Subject: Power Management & Servers : Auto Restart From Power Failure
To: None <port-macppc@NetBSD.org>
From: gerard grazzini <gerard@azurline.com>
List: port-macppc
Date: 02/04/2005 13:07:10
Repost of and old message :

I’m trying to convert an old PowerMac 7600/120 in a Fax 
Server. I chose to use NetBSD and Hylafax…

Reading carefully many post I install NetBSD 2.0 on the 
machine without to much trouble…

But my actual problems was to be sure that the machine 
stay up, more of the time and particulary to be sure that 
it auto restart after a power failure (a fonctions that 
comme with all macs).

I read about about the penny solution :
"hold down the power button on the keyboard, and then jam 
some pennies and dimes in there to keep it held down after 
you walk away. This is tested and works reliably on a m68k 
Quadra, so hopefully other ADB machines will also work."

It’s should works, and it’s a good workaround but may be 
they will be a more technical solution …
I make many google search without success on the *bsd 
side, but i found some interesting things on the apple and 
linux side :

• an Apple technical Note TN1079: Power Management & 
Servers : Auto Restart From Power Failure : 
http://developer.apple.com/technotes/tn/tn1079.html

• Somme's links about ” PmacPow” from Takashi Oe who send 
and Hex string to the Cuda ships to make him to 
automatically restart http://ppc.linux.or.jp/~toe/#pmacpow 
(and many others)

• An interesting post of the YDL list :

Here's what I do on my home router:
1. I created the 3-byte file /etc/powerup-boot containing 
exactly the following hex sequence (no terminating null or 
newline):
0x011301
The first 0x01 indicates this is a CUDA_PACKET (see 
<asm/adb.h> ) since the CUDA chip is responsible for power 
management among other things. The 0x13 indicates the 
specific CUDA parameter being accessed or modified, and 
isn't even documented in <asm/cuda.h>, but by digging 
around in MOL, I figured out that it was the 
CUDA_FILE_SERVER_FLAG parameter. The second 0x01 indicates 
that this system is a file server (really any machine that 
has to stay up all the time), and so if there is a power 
failure, when the power is restored, the CUDA chip allows 
the power to be passed through to the main processor 
initiating the boot sequence.
1/ also created the 3-byte file /etc/powerup-off 
containing the hex sequence:
0x011300
This file can be used to restore the system to the default 
powerup behavior following a power failure, namely to not 
automatically boot up, requiring the user to turn on the 
power to the main processor to initiate the boot process 
(this is the way I leave my primary home system set up 
since I'd rather not have it possibly damaged by multiple 
power fluctuations that might occur during a severe 
lightning storm for example - better to just leave it 
off).
2/ At the end of my /etc/rc.d/rc.local file, I added the 
following line:
cat /etc/powerup-boot >> /dev/adb
The ADB device is used to access and control the CUDA 
chip. This command may actually only have to be done once 
rather than during every boot, but I haven't tested that, 
and it seemed safer to just redo it every boot. I believe 
the power management settings are kept in the PRAM so they 
should in theory be saved across reboots.
3/ I set the Open Firmware variable boot-command to:
begin ['] boot catch 1000 ms cr again
This allows the disk time to spin up, and retries the boot 
command after a second (I got this tidbit from one of the 
installation manuals).

• and finally a nice program for linux to configure all 
(auto-restart, start-up time …) ” cudamgr” from Michel 
Lanners
http://lists.debian.org/debian-powe...9/msg00047.html
who seam’s to do exactly what I (and many others) need.

But the problems is that I can’t adapt it for the NetBSD 
platform… can may be a NetBSD Geeks help me to adapt it or 
may be have all ready do some think in these way ?

Tanks

Gerard Grazzini