svn commit: r213755 - in head: share/man/man4 sys/dev/acpica

Jung-uk Kim jkim at FreeBSD.org
Wed Oct 13 00:21:54 UTC 2010


Author: jkim
Date: Wed Oct 13 00:21:53 2010
New Revision: 213755
URL: http://svn.freebsd.org/changeset/base/213755

Log:
  Use AcpiReset() from ACPICA instead of rolling our own, which is actually
  incomplete.  If FADT says the register is available, enable the capability
  by default.  Remove the previous default value from acpi(4).

Modified:
  head/share/man/man4/acpi.4
  head/sys/dev/acpica/acpi.c

Modified: head/share/man/man4/acpi.4
==============================================================================
--- head/share/man/man4/acpi.4	Tue Oct 12 22:11:31 2010	(r213754)
+++ head/share/man/man4/acpi.4	Wed Oct 13 00:21:53 2010	(r213755)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 2, 2010
+.Dd October 12, 2010
 .Dt ACPI 4
 .Os
 .Sh NAME
@@ -112,7 +112,6 @@ exiting to legacy mode first.
 Default is 0, leave ACPI enabled.
 .It Va hw.acpi.handle_reboot
 Use the ACPI Reset Register capability to reboot the system.
-Default is 0, use legacy reboot support.
 Some newer systems require use of this register, while some only work
 with legacy rebooting support.
 .It Va hw.acpi.lid_switch_state

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Tue Oct 12 22:11:31 2010	(r213754)
+++ head/sys/dev/acpica/acpi.c	Wed Oct 13 00:21:53 2010	(r213755)
@@ -587,6 +587,10 @@ acpi_attach(device_t dev)
 	freeenv(env);
     }
 
+    /* Only enable reboot by default if the FADT says it is available. */
+    if (AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER)
+	sc->acpi_handle_reboot = 1;
+
     /* Only enable S4BIOS by default if the FACS says it is available. */
     if (AcpiGbl_FACS->Flags & ACPI_FACS_S4_BIOS_PRESENT)
 	sc->acpi_s4bios = 1;
@@ -1819,19 +1823,15 @@ acpi_shutdown_final(void *arg, int howto
 	    DELAY(1000000);
 	    device_printf(sc->acpi_dev, "power-off failed - timeout\n");
 	}
-    } else if ((howto & RB_HALT) == 0 &&
-	(AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) &&
-	sc->acpi_handle_reboot) {
+    } else if ((howto & RB_HALT) == 0 && sc->acpi_handle_reboot) {
 	/* Reboot using the reset register. */
-	status = AcpiWrite(
-	    AcpiGbl_FADT.ResetValue, &AcpiGbl_FADT.ResetRegister);
-	if (ACPI_FAILURE(status))
-	    device_printf(sc->acpi_dev, "reset failed - %s\n",
-		AcpiFormatException(status));
-	else {
+	status = AcpiReset();
+	if (ACPI_SUCCESS(status)) {
 	    DELAY(1000000);
 	    device_printf(sc->acpi_dev, "reset failed - timeout\n");
-	}
+	} else if (status != AE_NOT_EXIST)
+	    device_printf(sc->acpi_dev, "reset failed - %s\n",
+		AcpiFormatException(status));
     } else if (sc->acpi_do_disable && panicstr == NULL) {
 	/*
 	 * Only disable ACPI if the user requested.  On some systems, writing


More information about the svn-src-head mailing list