diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2001-01-10 18:01:51 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2001-01-10 18:01:51 +0000 |
commit | 4133f8a8b475e501baf5e6c110b0ef9a0d774252 (patch) | |
tree | 862582f716c5a13dbe8ebda2953f67f137b56805 /sys/dev/acpica | |
parent | 17fa7d09af853423bb0c8917ec26c6d206896dcf (diff) | |
download | FreeBSD-src-4133f8a8b475e501baf5e6c110b0ef9a0d774252.zip FreeBSD-src-4133f8a8b475e501baf5e6c110b0ef9a0d774252.tar.gz |
Enable fixed event at not only boot but also wakeup.
Reported and patch tested by: Peter Dufault <dufault@hda.hda.com>
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r-- | sys/dev/acpica/acpi.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 170024b..4eac94b 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -107,6 +107,8 @@ static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *cont static void acpi_shutdown_pre_sync(void *arg, int howto); static void acpi_shutdown_final(void *arg, int howto); +static void acpi_enable_fixed_events(struct acpi_softc *sc); + #ifdef ACPI_DEBUG static void acpi_set_debugging(void); #endif @@ -306,19 +308,7 @@ acpi_attach(device_t dev) sc->acpi_sleep_button_sx = ACPI_SLEEP_BUTTON_DEFAULT_SX; sc->acpi_lid_switch_sx = ACPI_LID_SWITCH_DEFAULT_SX; - /* Enable and clear fixed events and install handlers. */ - if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->PwrButton == 0) { - AcpiEnableEvent(ACPI_EVENT_POWER_BUTTON, ACPI_EVENT_FIXED); - AcpiClearEvent(ACPI_EVENT_POWER_BUTTON, ACPI_EVENT_FIXED); - AcpiInstallFixedEventHandler(ACPI_EVENT_POWER_BUTTON, acpi_eventhandler_power_button_for_sleep, sc); - device_printf(dev, "power button is handled as a fixed feature programming model.\n"); - } - if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->SleepButton == 0) { - AcpiEnableEvent(ACPI_EVENT_SLEEP_BUTTON, ACPI_EVENT_FIXED); - AcpiClearEvent(ACPI_EVENT_SLEEP_BUTTON, ACPI_EVENT_FIXED); - AcpiInstallFixedEventHandler(ACPI_EVENT_SLEEP_BUTTON, acpi_eventhandler_sleep_button_for_sleep, sc); - device_printf(dev, "sleep button is handled as a fixed feature programming model.\n"); - } + acpi_enable_fixed_events(sc); /* * Scan the namespace and attach/initialise children. @@ -668,6 +658,35 @@ acpi_shutdown_final(void *arg, int howto) } } +static void +acpi_enable_fixed_events(struct acpi_softc *sc) +{ + static int first_time = 1; +#define MSGFORMAT "%s button is handled as a fixed feature programming model.\n" + + /* Enable and clear fixed events and install handlers. */ + if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->PwrButton == 0) { + AcpiEnableEvent(ACPI_EVENT_POWER_BUTTON, ACPI_EVENT_FIXED); + AcpiClearEvent(ACPI_EVENT_POWER_BUTTON, ACPI_EVENT_FIXED); + AcpiInstallFixedEventHandler(ACPI_EVENT_POWER_BUTTON, + acpi_eventhandler_power_button_for_sleep, sc); + if (first_time) { + device_printf(sc->acpi_dev, MSGFORMAT, "power"); + } + } + if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->SleepButton == 0) { + AcpiEnableEvent(ACPI_EVENT_SLEEP_BUTTON, ACPI_EVENT_FIXED); + AcpiClearEvent(ACPI_EVENT_SLEEP_BUTTON, ACPI_EVENT_FIXED); + AcpiInstallFixedEventHandler(ACPI_EVENT_SLEEP_BUTTON, + acpi_eventhandler_sleep_button_for_sleep, sc); + if (first_time) { + device_printf(sc->acpi_dev, MSGFORMAT, "sleep"); + } + } + + first_time = 0; +} + /* * Match a HID string against a device */ @@ -765,6 +784,7 @@ acpi_SetSleepState(struct acpi_softc *sc, int state) } DEVICE_RESUME(root_bus); sc->acpi_sstate = ACPI_STATE_S0; + acpi_enable_fixed_events(sc); break; case ACPI_STATE_S5: |