summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpi.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-11-25 09:11:13 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-11-25 09:11:13 +0000
commita265844618d4c900f0881d2d404cdf16aa6c0a34 (patch)
treeb69a123aa3915acdc4a863a309bea17b069c309b /sys/dev/acpi/acpi.c
parent7bf61c63bf10e4618037196968a64cba393bb44e (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/acpi/acpi.c')
-rw-r--r--sys/dev/acpi/acpi.c32
1 files changed, 31 insertions, 1 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