Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k The system should halt if the powerdown fails.
details: https://anonhg.NetBSD.org/src/rev/2ba1d0d5ad3b
branches: trunk
changeset: 368495:2ba1d0d5ad3b
user: isaki <isaki%NetBSD.org@localhost>
date: Sat Jul 16 04:55:35 2022 +0000
description:
The system should halt if the powerdown fails.
On X680x0 hardware, front power button is an alternate switch.
If the power button is left on, the power will not turn off.
In addition, with this change, power_switch_is_off in powsw.c is
no longer necessary.
diffstat:
sys/arch/x68k/dev/powsw.c | 23 ++---------------------
sys/arch/x68k/x68k/machdep.c | 14 +++++---------
2 files changed, 7 insertions(+), 30 deletions(-)
diffs (121 lines):
diff -r 670cf23fa9a3 -r 2ba1d0d5ad3b sys/arch/x68k/dev/powsw.c
--- a/sys/arch/x68k/dev/powsw.c Sat Jul 16 04:49:07 2022 +0000
+++ b/sys/arch/x68k/dev/powsw.c Sat Jul 16 04:55:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: powsw.c,v 1.3 2022/07/16 04:49:07 isaki Exp $ */
+/* $NetBSD: powsw.c,v 1.4 2022/07/16 04:55:35 isaki Exp $ */
/*
* Copyright (c) 2011 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: powsw.c,v 1.3 2022/07/16 04:49:07 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powsw.c,v 1.4 2022/07/16 04:55:35 isaki Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,8 +50,6 @@
#include "ioconf.h"
-extern int power_switch_is_off; /* XXX should be in .h */
-
//#define POWSW_DEBUG
#if defined(POWSW_DEBUG)
@@ -96,7 +94,6 @@
static int powsw_intr(void *);
static void powsw_softintr(void *);
static void powsw_pswitch_event(void *);
-static void powsw_shutdown_check(void *);
static void powsw_reset_counter(struct powsw_softc *);
static void powsw_set_aer(struct powsw_softc *, int);
@@ -152,9 +149,6 @@
callout_init(&sc->sc_callout, 0);
callout_setfunc(&sc->sc_callout, powsw_softintr, sc);
- if (shutdownhook_establish(powsw_shutdown_check, sc) == NULL)
- panic("%s: can't establish shutdown hook", xname);
-
if (intio_intr_establish(desc->vector, xname, powsw_intr, sc) < 0)
panic("%s: can't establish interrupt", xname);
@@ -256,19 +250,6 @@
}
static void
-powsw_shutdown_check(void *arg)
-{
- struct powsw_softc *sc = arg;
- int poweroff;
-
- poweroff = sc->sc_prev;
- if (poweroff)
- power_switch_is_off = 1;
- DPRINTF("powsw_shutdown_check %s = %d\n",
- device_xname(sc->sc_dev), power_switch_is_off);
-}
-
-static void
powsw_reset_counter(struct powsw_softc *sc)
{
diff -r 670cf23fa9a3 -r 2ba1d0d5ad3b sys/arch/x68k/x68k/machdep.c
--- a/sys/arch/x68k/x68k/machdep.c Sat Jul 16 04:49:07 2022 +0000
+++ b/sys/arch/x68k/x68k/machdep.c Sat Jul 16 04:55:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.208 2022/06/25 08:19:01 isaki Exp $ */
+/* $NetBSD: machdep.c,v 1.209 2022/07/16 04:55:35 isaki Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.208 2022/06/25 08:19:01 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.209 2022/07/16 04:55:35 isaki Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -482,7 +482,6 @@
}
int waittime = -1;
-int power_switch_is_off = 0;
void
cpu_reboot(int howto, char *bootstr)
@@ -529,7 +528,6 @@
/* 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
* b) RB_HALT
@@ -537,7 +535,7 @@
* c) otherwise
* Reboot
*/
- if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off) {
+ if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
printf("powering off...\n");
delay(1000000);
@@ -548,10 +546,8 @@
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) {
+ }
+ if ((howto & RB_HALT) != 0) {
printf("System halted. Hit any key to reboot.\n\n");
cnpollc(1);
(void)cngetc();
Home |
Main Index |
Thread Index |
Old Index