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).
This commit is contained in:
Jung-uk Kim 2010-10-13 00:21:53 +00:00
parent 4f6fbcd5db
commit ac731af567
2 changed files with 11 additions and 12 deletions

View file

@ -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

View file

@ -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