Subject: Re: Intel 82371 power management controller
To: None <netbsd-users@netbsd.org>
From: Wolfgang Rupprecht <wolfgang+gnus20020925T172808@wsrcc.com>
List: netbsd-users
Date: 09/25/2002 17:47:29
> But I'm planning on hooking it to a UPS, and I'd like
> to be able to power down the machine completely if necessary.)
Most desktop machines revert to the last power-on-off state when
wall-power returns. If you yank the plug the thing will try to reboot
when you stick the plug in if and only if it was on when the plug was
pulled.
If you want to do an automatic reboot when power is re-applied, you'll
need to leave the computer on, but obviously sync-ed and preferably
waiting at the 'hit any key to reboot' prompt when the power goes
away.
What I do here, and it obviously has timing issues, is to watch the
UPS battery capacity during a power failure. If the battery dips to
some low value the daemon tells the UPS to turn off the power in 60
seconds. The daemon then quickly does what is essentially a "halt".
If things go well the shutdown happens with pleny of time to spare and
the computer just sits at the prompt. This system got a good workout
when Enron and PG&E were playing their power games here in California.
Now there are 2 obvious failure modes. 1) the power could come back
on after the UPS was commanded to shut down in 120 seconds and after
the UPS daemon started nuking things. 2) the halt could hang cause
things didn't die quickly enough. #1 just can't be fixed without
tighter integration between the UPS and the motherboard. If the power
doesn't go away the computer will just continue sitting at the 'hit
any key' prompt till someone either hits a key or the power does
cycle. #2 was solved by hacking out all the pussy-footing code from
halt/reboot, that gives everything an overly generous amount of time
to die before escalating to a more virulent version of kill. I think
I gave everything a second to voluntarily die and then upped the
strength of the kill by 1 more notch.
How I wish that folks would make some ATX power supplies with
battery/backup and full APM control built in (just like laptops).
-wolfgang
--
Wolfgang Rupprecht <wolfgang+gnus@dailyplanet.wsrcc.com>
http://www.wsrcc.com/wolfgang/
Hackers don't spread viruses. Microsoft spreads viruses.