Re: patch: power off
Tetsuya Isaki <[email protected]> Mon, 24 Mar 2014 23:21:12 +0900
| Newsgroups | gmane.os.netbsd.ports.x68k |
|---|---|
| Message-ID | <x77g7j8yp3.wl%[email protected]> |
At Mon, 24 Mar 2014 00:26:05 +0900, Izumi Tsutsui wrote: > > Current x68k kernel supports software power-off (by sysmon(4)), > > but in fact, the kernel does not turn off the power. Power off > > is happened in IPLROM after software reset. > > > > So, I wrote a patch that the kernel does power off itself. > > Any comments? > > Basically looks good, but I have some dumb comments. (see below) (snip) After this, tsutsui@ suggested a different method. Here is the patch. It's very simple than my previous one :-) It also works fine (on XM6i) of course. --- Tetsuya Isaki <[email protected] / [email protected]> Index: sys/arch/x68k/x68k/machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/x68k/x68k/machdep.c,v retrieving revision 1.188 diff -u -r1.188 machdep.c --- sys/arch/x68k/x68k/machdep.c 22 Mar 2014 21:49:18 -0000 1.188 +++ sys/arch/x68k/x68k/machdep.c 24 Mar 2014 14:00:55 -0000 @@ -517,16 +517,20 @@ * Power cannot be removed; simply halt the system (b) * Power switch state is checked in shutdown hook * a2: the power switch is off - * Remove the power; the simplest way is go back to ROM eg. reboot + * Remove the power * b) RB_HALT * call cngetc * c) otherwise * Reboot */ - if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off) - doboot(); - else if (/*((howto & RB_POWERDOWN) == RB_POWERDOWN) ||*/ - ((howto & RB_HALT) == RB_HALT)) { + if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off) { + /* power-off sequence */ + intio_set_sysport_powoff(0x00); + intio_set_sysport_powoff(0x0f); + intio_set_sysport_powoff(0x0f); + delay(1000000); + /* PASSTHROUGH even if came back */ + } else if ((howto & RB_HALT) == RB_HALT) { printf("System halted. Hit any key to reboot.\n\n"); (void)cngetc(); }