Page MenuHomeFreeBSD

D55360.id172207.diff
No OneTemporary

D55360.id172207.diff

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -2663,37 +2663,46 @@
return (status);
}
+/* Return from this function indicates failure. */
static void
-acpi_shutdown_final(void *arg, int howto)
+acpi_poweroff(device_t acpi_dev)
{
- struct acpi_softc *sc = (struct acpi_softc *)arg;
- register_t intr;
- ACPI_STATUS status;
+ register_t intr;
+ ACPI_STATUS status;
- /*
- * XXX Shutdown code should only run on the BSP (cpuid 0).
- * Some chipsets do not power off the system correctly if called from
- * an AP.
- */
- if ((howto & RB_POWEROFF) != 0) {
- status = acpi_EnterSleepStatePrep(sc->acpi_dev, ACPI_STATE_S5);
+ device_printf(acpi_dev, "Powering system off...\n");
+ status = acpi_EnterSleepStatePrep(acpi_dev, ACPI_STATE_S5);
if (ACPI_FAILURE(status)) {
- device_printf(sc->acpi_dev, "Power-off preparation failed! - %s\n",
- AcpiFormatException(status));
+ device_printf(acpi_dev, "Power-off preparation failed! - %s\n",
+ AcpiFormatException(status));
return;
}
- device_printf(sc->acpi_dev, "Powering system off\n");
intr = intr_disable();
status = AcpiEnterSleepState(ACPI_STATE_S5);
if (ACPI_FAILURE(status)) {
intr_restore(intr);
- device_printf(sc->acpi_dev, "power-off failed - %s\n",
+ device_printf(acpi_dev, "Power-off failed! - %s\n",
AcpiFormatException(status));
} else {
DELAY(1000000);
intr_restore(intr);
- device_printf(sc->acpi_dev, "power-off failed - timeout\n");
+ device_printf(acpi_dev, "Power-off failed! - timeout\n");
}
+}
+
+static void
+acpi_shutdown_final(void *arg, int howto)
+{
+ struct acpi_softc *sc = (struct acpi_softc *)arg;
+ ACPI_STATUS status;
+
+ /*
+ * XXX Shutdown code should only run on the BSP (cpuid 0).
+ * Some chipsets do not power off the system correctly if called from
+ * an AP.
+ */
+ if ((howto & RB_POWEROFF) != 0) {
+ acpi_poweroff(sc->acpi_dev);
} else if ((howto & RB_HALT) == 0 && sc->acpi_handle_reboot) {
/* Reboot using the reset register. */
status = AcpiReset();

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 7, 8:38 PM (15 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28894077
Default Alt Text
D55360.id172207.diff (2 KB)

Event Timeline