diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/acpi_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/acpi_machdep.c | 4 | ||||
-rw-r--r-- | sys/dev/acpi/acpi.c | 32 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 3 |
5 files changed, 44 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index f061a7296d7..ab7d11fa168 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.9 2007/11/16 02:45:56 deraadt Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.10 2007/11/25 09:11:12 jsg Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -152,6 +152,8 @@ havebase: void acpi_attach_machdep(struct acpi_softc *sc) { + extern void (*cpuresetfn)(void); sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int, IST_LEVEL, IPL_TTY, acpi_interrupt, sc, sc->sc_dev.dv_xname); + cpuresetfn = acpi_reset; } diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 3c8e1028a75..2acbc3a9671 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.65 2007/11/03 22:23:35 mikeb Exp $ */ +/* $OpenBSD: machdep.c,v 1.66 2007/11/25 09:11:12 jsg Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -255,6 +255,7 @@ int cpu_dumpsize(void); u_long cpu_dump_mempagecnt(void); void dumpsys(void); void init_x86_64(paddr_t); +void (*cpuresetfn)(void); #ifdef KGDB #ifndef KGDB_DEVNAME @@ -1607,6 +1608,9 @@ cpu_reset(void) disable_intr(); + if (cpuresetfn) + (*cpuresetfn)(); + /* * The keyboard controller has 4 random output pins, one of which is * connected to the RESET pin on the CPU in many PCs. We tell the diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index ab8d9fc1083..058141b1bd3 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.8 2007/11/16 02:45:56 deraadt Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.9 2007/11/25 09:11:12 jsg Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -170,6 +170,8 @@ havebase: void acpi_attach_machdep(struct acpi_softc *sc) { + extern void (*cpuresetfn)(void); sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int, IST_LEVEL, IPL_TTY, acpi_interrupt, sc, sc->sc_dev.dv_xname); + cpuresetfn = acpi_reset; } diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index f6d7d40856c..a03a2fbe7bd 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.105 2007/11/19 19:17:30 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.106 2007/11/25 09:11:12 jsg Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -1152,6 +1152,36 @@ acpi_interrupt(void *arg) return (processed); } +void +acpi_reset(void) +{ + struct acpi_fadt *fadt; + u_int32_t reset_as, reset_len; + u_int32_t value; + + fadt = acpi_softc->sc_fadt; + + /* FADT_RESET_REG_SUP is not properly set in some implementations */ + if (acpi_softc->sc_revision <= 1 || fadt->reset_reg.address == 0) + return; + + value = fadt->reset_value; + + reset_as = fadt->reset_reg.register_bit_width / 8; + if (reset_as == 0) + reset_as = 1; + + reset_len = fadt->reset_reg.access_size; + if (reset_len == 0) + reset_len = reset_as; + + acpi_gasio(acpi_softc, ACPI_IOWRITE, + fadt->reset_reg.address_space_id, + fadt->reset_reg.address, reset_as, reset_len, &value); + + delay(100000); +} + /* move all stuff that doesn't go on the boot media in here */ #ifndef SMALL_KERNEL diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index f9d4d36097c..2dd1b6558e4 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.40 2007/11/19 19:09:42 deraadt Exp $ */ +/* $OpenBSD: acpivar.h,v 1.41 2007/11/25 09:11:12 jsg Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -248,6 +248,7 @@ int acpi_interrupt(void *); void acpi_enter_sleep_state(struct acpi_softc *, int); void acpi_powerdown(void); void acpi_resume(struct acpi_softc *); +void acpi_reset(void); #define ACPI_IOREAD 0 #define ACPI_IOWRITE 1 |