diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-11-25 09:11:13 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-11-25 09:11:13 +0000 |
commit | a265844618d4c900f0881d2d404cdf16aa6c0a34 (patch) | |
tree | b69a123aa3915acdc4a863a309bea17b069c309b /sys/dev | |
parent | 7bf61c63bf10e4618037196968a64cba393bb44e (diff) |
When available and ACPI is enabled use the ACPI reset method
to reboot. This is required for some quirky sis machines
and likely others to reboot.
Tested by many. 'commit early commit often' deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpi/acpi.c | 32 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 3 |
2 files changed, 33 insertions, 2 deletions
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 |