Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k/x68k Implement the software power-off (correct...



details:   https://anonhg.NetBSD.org/src/rev/26cecff04188
branches:  trunk
changeset: 328105:26cecff04188
user:      isaki <isaki%NetBSD.org@localhost>
date:      Wed Mar 26 16:21:39 2014 +0000

description:
Implement the software power-off (correctly) when RB_POWERDOWN is
specified.  Before this, the kernel doesn't turn off the power in fact,
and thus the power off had happened in IPLROM after software reset.

Many thanks to tsutsui@ on port-x68k.

diffstat:

 sys/arch/x68k/x68k/machdep.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r 4900bbc11278 -r 26cecff04188 sys/arch/x68k/x68k/machdep.c
--- a/sys/arch/x68k/x68k/machdep.c      Wed Mar 26 16:16:06 2014 +0000
+++ b/sys/arch/x68k/x68k/machdep.c      Wed Mar 26 16:21:39 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.190 2014/03/26 08:17:59 christos Exp $   */
+/*     $NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.190 2014/03/26 08:17:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -513,16 +513,23 @@
         *      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) {
+               printf("powering off...\n");
+               delay(1000000);
+               intio_set_sysport_powoff(0x00);
+               intio_set_sysport_powoff(0x0f);
+               intio_set_sysport_powoff(0x0f);
+               delay(1000000);
+               printf("WARNING: powerdown failed\n");
+               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();
        }



Home | Main Index | Thread Index | Old Index