summaryrefslogtreecommitdiffstats
path: root/sys/amd64/acpica
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2012-02-16 22:28:17 +0000
committerjkim <jkim@FreeBSD.org>2012-02-16 22:28:17 +0000
commitfaa9b15d4e3462bd68f1545a0c2a633f6602b128 (patch)
tree064ff496550f516bcf2ffffee7af924bae1c051a /sys/amd64/acpica
parenta50c43eae7b499420b1a953487a5de0ad2e49464 (diff)
downloadFreeBSD-src-faa9b15d4e3462bd68f1545a0c2a633f6602b128.zip
FreeBSD-src-faa9b15d4e3462bd68f1545a0c2a633f6602b128.tar.gz
Refine r231791. Install the resume event handler unconditionally.
Diffstat (limited to 'sys/amd64/acpica')
-rw-r--r--sys/amd64/acpica/acpi_wakeup.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c
index c36f3bf..ec61ed9 100644
--- a/sys/amd64/acpica/acpi_wakeup.c
+++ b/sys/amd64/acpica/acpi_wakeup.c
@@ -98,7 +98,8 @@ static void
acpi_stop_beep(void *arg)
{
- timer_spkr_release();
+ if (acpi_resume_beep != 0)
+ timer_spkr_release();
}
#ifdef SMP
@@ -219,7 +220,6 @@ acpi_wakeup_cpus(struct acpi_softc *sc, const cpuset_t *wakeup_cpus)
int
acpi_sleep_machdep(struct acpi_softc *sc, int state)
{
- static eventhandler_tag stop_beep = NULL;
#ifdef SMP
cpuset_t wakeup_cpus;
#endif
@@ -236,21 +236,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
CPU_CLR(PCPU_GET(cpuid), &wakeup_cpus);
#endif
- if (acpi_resume_beep == 0) {
- if (stop_beep != NULL) {
- EVENTHANDLER_DEREGISTER(power_resume, stop_beep);
- stop_beep = NULL;
- }
- } else {
- if (stop_beep == NULL)
- stop_beep = EVENTHANDLER_REGISTER(power_resume,
- acpi_stop_beep, NULL, EVENTHANDLER_PRI_LAST);
- if (stop_beep == NULL)
- device_printf(sc->acpi_dev,
- "Failed to set up event handler\n");
- else
- timer_spkr_acquire();
- }
+ if (acpi_resume_beep != 0)
+ timer_spkr_acquire();
AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
@@ -267,7 +254,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
}
#endif
- WAKECODE_FIXUP(resume_beep, uint8_t, (stop_beep != NULL));
+ WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0));
WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0));
WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]);
@@ -343,6 +330,12 @@ acpi_alloc_wakeup_handler(void)
printf("%s: can't alloc wake memory\n", __func__);
return (NULL);
}
+ if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL,
+ EVENTHANDLER_PRI_LAST) == NULL) {
+ printf("%s: can't register event handler\n", __func__);
+ contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF);
+ return (NULL);
+ }
susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK);
suspfpusave = malloc(mp_ncpus * sizeof(void *), M_DEVBUF, M_WAITOK);
for (i = 0; i < mp_ncpus; i++) {
OpenPOWER on IntegriCloud