RB_POWERDOWN is now supported.
Check if the power switch is open (off) in the shutdown_hook, and try removing the power in cpu_reboot. poffd default action is now shutdown -p.
This commit is contained in:
parent
f76fb48283
commit
233cd5d60b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pow.c,v 1.6 1997/10/12 14:44:12 oki Exp $ */
|
||||
/* $NetBSD: pow.c,v 1.7 1998/08/04 16:07:53 minoura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 MINOURA Makoto.
|
||||
|
@ -63,6 +63,8 @@ void powattach __P((int));
|
|||
void powintr __P((void));
|
||||
static int setalarm __P((struct x68k_alarminfo *));
|
||||
|
||||
static void pow_check_switch __P((void*));
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
powattach(num)
|
||||
|
@ -99,6 +101,8 @@ powattach(num)
|
|||
else
|
||||
printf ("???.\n");
|
||||
}
|
||||
|
||||
shutdownhook_establish(pow_check_switch, 0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
|
@ -292,3 +296,13 @@ powintr()
|
|||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
static void
|
||||
pow_check_switch(dummy)
|
||||
void *dummy;
|
||||
{
|
||||
extern int power_switch_is_off;
|
||||
|
||||
if ((~mfp.gpip & (POW_FRONTSW | POW_EXTERNALSW)) == 0)
|
||||
power_switch_is_off = 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pathnames.h,v 1.2 1998/01/05 20:52:35 perry Exp $ */
|
||||
/* $NetBSD: pathnames.h,v 1.3 1998/08/04 16:07:54 minoura Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 MINOURA Makoto.
|
||||
* All rights reserved.
|
||||
|
@ -34,7 +34,7 @@
|
|||
#include <paths.h>
|
||||
|
||||
#ifndef _PATH_DEFAULT_SHUTDOWN
|
||||
#define _PATH_DEFAULT_SHUTDOWN "/sbin/shutdown -r +1"
|
||||
#define _PATH_DEFAULT_SHUTDOWN "/sbin/shutdown -p +1"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_DEVPOW
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.38 1998/07/08 04:45:26 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.39 1998/08/04 16:07:54 minoura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -685,6 +685,7 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
|||
}
|
||||
|
||||
int waittime = -1;
|
||||
int power_switch_is_off = 0;
|
||||
|
||||
void
|
||||
cpu_reboot(howto, bootstr)
|
||||
|
@ -724,7 +725,21 @@ cpu_reboot(howto, bootstr)
|
|||
#endif
|
||||
|
||||
/* Finally, halt/reboot the system. */
|
||||
if (howto & RB_HALT) {
|
||||
/* a) RB_POWERDOWN
|
||||
* a1: the power switch is still on
|
||||
* 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
|
||||
* 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)) {
|
||||
printf("System halted. Hit any key to reboot.\n\n");
|
||||
(void)cngetc();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue