From owner-freebsd-hackers Mon Mar 15 12: 2:11 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (Postfix) with ESMTP id 21D7615599 for ; Mon, 15 Mar 1999 12:02:09 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id MAA02187; Mon, 15 Mar 1999 12:01:44 -0800 (PST) (envelope-from dillon) Date: Mon, 15 Mar 1999 12:01:44 -0800 (PST) From: Matthew Dillon Message-Id: <199903152001.MAA02187@apollo.backplane.com> To: "Kenneth D. Merry" Cc: smp@csn.net, hackers@FreeBSD.ORG Subject: Re: power-off without halt References: <199903151941.MAA20523@panzer.plutotech.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG : :Matthew Dillon wrote... :> :Hi, :> : :> : We are looking at using FreeBSD as an "embedded OS" inside a line :> :of instruments we are building. I think I have a handle on all the :> :issues except how to cleanly handle shutdown where there is no :> :console, and thus no way to send a 'halt' command. The requirement :> :is that the user can merely turn off the power, nothing more required. :> : :> : I can modify the disk setup, kernel/util code as needed, I just need some :> :idea for a workable solution. Has anyone delt with this problem before? :> : :> :-- :> :Steve Passe | powered by :> :smp@csn.net | Symmetric MultiProcessor FreeBSD :> :> Well, physically speaking you can't power off a machine that may :> be writing to its disk. If it is in the middle of a write, you :> *will* lose sectors to hard errors. :> :> So, typically, the best way to deal with this sort of situation is :> to mount the disk read-only and never write to it. Or to not have a :> disk at all. Or to use a pcmcia type flash disk. : :SGI boxes have a neat feature (or at least they did when I did IRIX work a :few years ago). They have a "soft" power off switch. You hit the switch, :and it safely shuts down the machine. : :Don't ATX power supplies have some sort of soft power-off capability? :How about tying a "power" button on the front panel of this device to a :switch that would tell the machine to halt itself and then power off? : :>From looking at the ATX power supply specs: : :http://www.teleport.com/~atx/spec/atxps09.pdf : :It looks like there is a signal that tells the power supply to power itself :off. However, there's also a "standby" 5V power lead that is always active :when the power supply is plugged in. That's what allows things like wake :on LAN to work. : :It looks like the pieces are there. What you want, I suppose, is a :motherboard that can intercept the power switch signal, generate an :interrupt, and then wait for some feedback from the OS before sending the :signal on to shut down the power. : :Ken :-- :Kenneth Merry :ken@plutotech.com This sort of approach doesn't work well in practice. The problem you have to deal with is not so much the user hitting the power switch, but either the user unplugging the system from the wall or a real honest to god power failure occuring. After thinking about it a bit, the best way to solve this sort of problem is to put a monitor on the AC input and then use big honking capacitors on the diode bridge going into the switching power supply. This to hold the line voltage up long enough for the computer to finish writing to the disk when the plug is pulled. If you are trying to use off the shelf parts, you have to locate a switching power supply that has these features. You probably do not want to try to build such a beast yourself ( unless you *like* going through the UL approval process ), nor can you legally hack an existing but not-quite-right power supply. Depending on the current required by the system and the size of the caps, you should be able to get as much as 100mS of good power. e.g. IT=CV, T=CV/I. Assume 60W @ 110V yields half an amp. The caps on the diode bridge will probably level off at 50V or so and the switching regulator will be able to regulate down to, say, 20V. So, for example: T=CV/I T=(1000uF * 20V)/500mA = 40 mS of good power after AC failure. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message