From fc0ea94a7d9ca062e42a162e2d344ba4218f4169 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 16 Oct 2002 17:28:53 +0000 Subject: [PATCH] Catch up to changes in acpivar.h to add support for using ACPI on 4-stable systems. Sponsored by: The Weather Channel --- sys/dev/acpica/Osd/OsdInterrupt.c | 2 ++ sys/dev/acpica/acpi.c | 12 ++++++++++-- sys/dev/acpica/acpi_battery.c | 2 -- sys/dev/acpica/acpi_cpu.c | 2 ++ sys/dev/acpica/acpi_ec.c | 2 -- sys/dev/acpica/acpi_lid.c | 2 -- sys/dev/acpica/acpi_powerres.c | 2 -- sys/dev/acpica/acpi_thermal.c | 11 +++++++++-- 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/sys/dev/acpica/Osd/OsdInterrupt.c b/sys/dev/acpica/Osd/OsdInterrupt.c index 927d8d9de6e..d848145b120 100644 --- a/sys/dev/acpica/Osd/OsdInterrupt.c +++ b/sys/dev/acpica/Osd/OsdInterrupt.c @@ -129,6 +129,8 @@ AcpiOsRemoveInterruptHandler (UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine static void InterruptWrapper(void *arg) { + ACPI_LOCK_DECL; + ACPI_LOCK; InterruptHandler(arg); ACPI_UNLOCK; diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 29c17db23a1..f8699f9ca00 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -33,9 +33,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -96,7 +94,9 @@ static const char* sleep_state_names[] = { /* this has to be static, as the softc is gone when we need it */ static int acpi_off_state = ACPI_STATE_S5; +#if __FreeBSD_version >= 500000 struct mtx acpi_mutex; +#endif static int acpi_modevent(struct module *mod, int event, void *junk); static void acpi_identify(driver_t *driver, device_t parent); @@ -230,8 +230,10 @@ acpi_identify(driver_t *driver, device_t parent) if (device_find_child(parent, "acpi", 0) != NULL) return_VOID; +#if __FreeBSD_version >= 500000 /* initialise the ACPI mutex */ mtx_init(&acpi_mutex, "ACPI global lock", NULL, MTX_DEF); +#endif /* * Start up the ACPI CA subsystem. @@ -281,6 +283,7 @@ acpi_probe(device_t dev) char buf[20]; ACPI_STATUS status; int error; + ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -315,6 +318,7 @@ acpi_attach(device_t dev) #ifdef ACPI_DEBUGGER char *debugpoint; #endif + ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); ACPI_LOCK; @@ -692,6 +696,7 @@ acpi_isa_get_logicalid(device_t dev) ACPI_DEVICE_INFO devinfo; ACPI_STATUS error; u_int32_t pnpid; + ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -1439,6 +1444,7 @@ acpi_Disable(struct acpi_softc *sc) static void acpi_system_eventhandler_sleep(void *arg, int state) { + ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state); ACPI_LOCK; @@ -1451,6 +1457,7 @@ acpi_system_eventhandler_sleep(void *arg, int state) static void acpi_system_eventhandler_wakeup(void *arg, int state) { + ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state); /* Well, what to do? :-) */ @@ -1803,6 +1810,7 @@ acpiioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) struct acpi_softc *sc; struct acpi_ioctl_hook *hp; int error, xerror, state; + ACPI_LOCK_DECL; ACPI_LOCK; diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c index f245c8f04eb..329d64a7d71 100644 --- a/sys/dev/acpica/acpi_battery.c +++ b/sys/dev/acpica/acpi_battery.c @@ -30,9 +30,7 @@ #include #include #include -#include #include -#include #include #include #include diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index d37ccfde993..30c1cfe54d9 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -259,6 +259,7 @@ static void acpi_cpu_init_throttling(void *arg) { int cpu_temp_speed; + ACPI_LOCK_DECL; ACPI_LOCK; @@ -352,6 +353,7 @@ acpi_cpu_power_profile(void *arg) { int state; u_int32_t new; + ACPI_LOCK_DECL; state = power_profile_get_state(); if (state != POWER_PROFILE_PERFORMANCE && diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index cfb2239ec0d..96da6d351d4 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -618,9 +618,7 @@ EcWaitEventIntr(struct acpi_ec_softc *sc, EC_EVENT Event) ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Event); /* XXX this should test whether interrupts are available some other way */ -#ifdef ACPI_EC_EVENT_DRIVEN if(cold) -#endif return_ACPI_STATUS(EcWaitEvent(sc, Event)); if (!EcIsLocked(sc)) diff --git a/sys/dev/acpica/acpi_lid.c b/sys/dev/acpica/acpi_lid.c index f83b2de2404..5a4b8cc0bf7 100644 --- a/sys/dev/acpica/acpi_lid.c +++ b/sys/dev/acpica/acpi_lid.c @@ -33,8 +33,6 @@ #include #include #include -#include -#include #include #include "acpi.h" diff --git a/sys/dev/acpica/acpi_powerres.c b/sys/dev/acpica/acpi_powerres.c index 1526a933372..fc42695fa88 100644 --- a/sys/dev/acpica/acpi_powerres.c +++ b/sys/dev/acpica/acpi_powerres.c @@ -30,9 +30,7 @@ #include #include #include -#include #include -#include #include #include #include diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c index 74fc9624be9..78061809ded 100644 --- a/sys/dev/acpica/acpi_thermal.c +++ b/sys/dev/acpica/acpi_thermal.c @@ -31,8 +31,6 @@ #include #include #include -#include -#include #include #include #include @@ -145,6 +143,7 @@ static int acpi_tz_probe(device_t dev) { int result; + ACPI_LOCK_DECL; ACPI_LOCK; @@ -171,6 +170,7 @@ acpi_tz_attach(device_t dev) struct acpi_softc *acpi_sc; int error; char oidname[8]; + ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -665,6 +665,7 @@ acpi_tz_active_sysctl(SYSCTL_HANDLER_ARGS) struct acpi_tz_softc *sc; int active; int error; + ACPI_LOCK_DECL; ACPI_LOCK; @@ -757,6 +758,7 @@ acpi_tz_power_profile(void *arg) ACPI_STATUS status; struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg; int state; + ACPI_LOCK_DECL; state = power_profile_get_state(); if (state != POWER_PROFILE_PERFORMANCE && @@ -796,6 +798,7 @@ acpi_tz_thread(void *arg) { device_t *devs; int devcount, i; + ACPI_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -806,7 +809,9 @@ acpi_tz_thread(void *arg) for (;;) { tsleep(&acpi_tz_proc, PZERO, "nothing", hz * acpi_tz_polling_rate); +#if __FreeBSD_version >= 500000 mtx_lock(&Giant); +#endif if (devcount == 0) devclass_get_devices(acpi_tz_devclass, &devs, &devcount); @@ -816,6 +821,8 @@ acpi_tz_thread(void *arg) acpi_tz_timeout(device_get_softc(devs[i])); ACPI_UNLOCK; +#if __FreeBSD_version >= 500000 mtx_unlock(&Giant); +#endif } } -- 2.45.2