diff options
author | msmith <msmith@FreeBSD.org> | 1998-10-30 05:41:15 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-10-30 05:41:15 +0000 |
commit | e79dcdb69f35b4c9a8524672d1c364e750730b38 (patch) | |
tree | c2d16e98b9b0fc0b55a9e67cbcf5b278c400f11f /sys/i386 | |
parent | 0fcabcf90e9664f8f2c243b394255dda6012386f (diff) | |
download | FreeBSD-src-e79dcdb69f35b4c9a8524672d1c364e750730b38.zip FreeBSD-src-e79dcdb69f35b4c9a8524672d1c364e750730b38.tar.gz |
Add the ability to specify where on the at_shutdown queue a handler is
installed.
Remove cpu_power_down, and replace it with an entry at the end of the
SHUTDOWN_FINAL queue in the only place it's used (APM).
Submitted by: Some ideas from Bruce Walter <walter@fortean.com>
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/apm/apm.c | 13 | ||||
-rw-r--r-- | sys/i386/bios/apm.c | 13 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 16 | ||||
-rw-r--r-- | sys/i386/include/apm_bios.h | 3 | ||||
-rw-r--r-- | sys/i386/include/md_var.h | 3 |
5 files changed, 21 insertions, 27 deletions
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index c871151..ffe4b0a 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.73 1998/07/06 06:29:03 imp Exp $ + * $Id: apm.c,v 1.74 1998/09/28 03:41:12 jlemon Exp $ */ #include "opt_devfs.h" @@ -29,6 +29,7 @@ #endif /*DEVFS*/ #include <sys/systm.h> #include <sys/time.h> +#include <sys/reboot.h> #include <i386/isa/isa_device.h> #include <machine/apm_bios.h> #include <machine/segments.h> @@ -245,12 +246,13 @@ apm_display(int newstate) /* * Turn off the entire system. */ -void -apm_power_off(void) +static void +apm_power_off(int howto, void *junk) { u_long eax, ebx, ecx, edx; - if (!apm_softc.active) + /* Not halting, or not active */ + if (!(howto & RB_HALT) || !apm_softc.active) return; eax = (APM_BIOS << 8) | APM_SETPWSTATE; ebx = PMDV_ALLDEV; @@ -903,6 +905,9 @@ apmattach(struct isa_device *dvp) apm_event_enable(); + /* Power the system off using APM */ + at_shutdown_pri(apm_power_off, NULL, SHUTDOWN_FINAL, SHUTDOWN_PRI_LAST); + sc->initialized = 1; #ifdef DEVFS diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index c871151..ffe4b0a 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.73 1998/07/06 06:29:03 imp Exp $ + * $Id: apm.c,v 1.74 1998/09/28 03:41:12 jlemon Exp $ */ #include "opt_devfs.h" @@ -29,6 +29,7 @@ #endif /*DEVFS*/ #include <sys/systm.h> #include <sys/time.h> +#include <sys/reboot.h> #include <i386/isa/isa_device.h> #include <machine/apm_bios.h> #include <machine/segments.h> @@ -245,12 +246,13 @@ apm_display(int newstate) /* * Turn off the entire system. */ -void -apm_power_off(void) +static void +apm_power_off(int howto, void *junk) { u_long eax, ebx, ecx, edx; - if (!apm_softc.active) + /* Not halting, or not active */ + if (!(howto & RB_HALT) || !apm_softc.active) return; eax = (APM_BIOS << 8) | APM_SETPWSTATE; ebx = PMDV_ALLDEV; @@ -903,6 +905,9 @@ apmattach(struct isa_device *dvp) apm_event_enable(); + /* Power the system off using APM */ + at_shutdown_pri(apm_power_off, NULL, SHUTDOWN_FINAL, SHUTDOWN_PRI_LAST); + sc->initialized = 1; #ifdef DEVFS diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 06db070..fd58e5a 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.312 1998/10/09 00:31:06 msmith Exp $ + * $Id: machdep.c,v 1.313 1998/10/09 23:36:26 peter Exp $ */ #include "apm.h" @@ -109,9 +109,6 @@ #include <net/netisr.h> #endif -#if NAPM > 0 -#include <machine/apm_bios.h> -#endif #include <machine/cpu.h> #include <machine/reg.h> #include <machine/clock.h> @@ -794,17 +791,6 @@ cpu_halt(void) } /* - * Turn the power off. - */ -void -cpu_power_down(void) -{ -#if NAPM > 0 - apm_power_off(); -#endif -} - -/* * Clear registers on exec */ void diff --git a/sys/i386/include/apm_bios.h b/sys/i386/include/apm_bios.h index 616e36a..43028b3 100644 --- a/sys/i386/include/apm_bios.h +++ b/sys/i386/include/apm_bios.h @@ -12,7 +12,7 @@ * * Aug, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm_bios.h,v 1.19 1997/11/12 04:12:51 jdp Exp $ + * $Id: apm_bios.h,v 1.20 1998/07/06 06:29:05 imp Exp $ */ #ifndef _MACHINE_APM_BIOS_H_ @@ -160,7 +160,6 @@ struct apmhook *apm_hook_establish (int apmh, struct apmhook *); void apm_hook_disestablish (int apmh, struct apmhook *); void apm_cpu_idle(void); void apm_cpu_busy(void); -void apm_power_off(void); #endif /* KERNEL */ diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index a565266..82a4334 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: md_var.h,v 1.25 1998/09/14 22:43:40 jdp Exp $ + * $Id: md_var.h,v 1.26 1998/09/25 17:34:49 peter Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -62,7 +62,6 @@ struct fpreg; void bcopyb __P((const void *from, void *to, size_t len)); void busdma_swi __P((void)); void cpu_halt __P((void)); -void cpu_power_down __P((void)); void cpu_reset __P((void)); void cpu_switch_load_fs __P((void)) __asm(__STRING(cpu_switch_load_fs)); void cpu_switch_load_gs __P((void)) __asm(__STRING(cpu_switch_load_gs)); |