From 29cba08d4c89cdc3caea4dd03cc150e6c0d272ec Mon Sep 17 00:00:00 2001 From: Jason Downs Date: Mon, 28 Sep 1998 05:13:14 +0000 Subject: Avoid a really stupid APM-related panic. Someone who knows about this crap should figure out why calling apm_set_powstate() after it's already failed once causes a vm_fault() crash. --- sys/arch/i386/i386/machdep.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sys') diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 36adbde349f..ce0ca0ecc72 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.93 1998/08/30 07:30:13 downsj Exp $ */ +/* $OpenBSD: machdep.c,v 1.94 1998/09/28 05:13:13 downsj Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -1230,11 +1230,17 @@ haltsys: * Turn off, if we can. But try to turn disk off and * wait a bit first--some disk drives are slow to * clean up and users have reported disk corruption. + * + * If apm_set_powstate() fails the first time, don't + * try to turn the system off. */ delay(500000); - apm_set_powstate(APM_DEV_DISK(0xff), APM_SYS_OFF); - delay(500000); - apm_set_powstate(APM_DEV_ALLDEVS, APM_SYS_OFF); + if (apm_set_powstate(APM_DEV_DISK(0xff), + APM_SYS_OFF) == 0) { + delay(500000); + (void) apm_set_powstate(APM_DEV_ALLDEVS, + APM_SYS_OFF); + } } #endif printf("\n"); -- cgit v1.2.3