summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi.c14
-rw-r--r--sys/dev/acpica/acpi_battery.c15
-rw-r--r--sys/dev/acpica/acpi_cpu.c2
-rw-r--r--sys/dev/acpica/acpi_dock.c8
-rw-r--r--sys/dev/acpica/acpi_thermal.c3
5 files changed, 26 insertions, 16 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 63f95d3..c3e4e52 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -675,8 +675,6 @@ acpi_suspend(device_t dev)
device_t child, *devlist;
int error, i, numdevs, pstate;
- GIANT_REQUIRED;
-
/* First give child devices a chance to suspend. */
error = bus_generic_suspend(dev);
if (error)
@@ -719,8 +717,6 @@ acpi_resume(device_t dev)
int i, numdevs, error;
device_t child, *devlist;
- GIANT_REQUIRED;
-
/*
* Put all devices in D0 before resuming them. Call _S0D on each one
* since some systems expect this.
@@ -745,8 +741,6 @@ static int
acpi_shutdown(device_t dev)
{
- GIANT_REQUIRED;
-
/* Allow children to shutdown first. */
bus_generic_shutdown(dev);
@@ -2534,11 +2528,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
thread_unlock(curthread);
#endif
- /*
- * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE
- * drivers need this.
- */
- mtx_lock(&Giant);
+ newbus_xlock();
slp_state = ACPI_SS_NONE;
@@ -2611,7 +2601,7 @@ backout:
if (slp_state >= ACPI_SS_SLEPT)
acpi_enable_fixed_events(sc);
- mtx_unlock(&Giant);
+ newbus_xunlock();
#ifdef SMP
thread_lock(curthread);
diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c
index dd2b3fa..1ec1413 100644
--- a/sys/dev/acpica/acpi_battery.c
+++ b/sys/dev/acpica/acpi_battery.c
@@ -329,6 +329,7 @@ acpi_battery_find_dev(u_int logical_unit)
dev = NULL;
found_unit = 0;
+ newbus_slock();
batt_dc = devclass_find("battery");
maxunit = devclass_get_maxunit(batt_dc);
for (i = 0; i < maxunit; i++) {
@@ -340,6 +341,7 @@ acpi_battery_find_dev(u_int logical_unit)
found_unit++;
dev = NULL;
}
+ newbus_sunlock();
return (dev);
}
@@ -369,13 +371,17 @@ acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg)
*/
switch (cmd) {
case ACPIIO_BATT_GET_UNITS:
+ newbus_slock();
*(int *)addr = acpi_battery_get_units();
+ newbus_sunlock();
error = 0;
break;
case ACPIIO_BATT_GET_BATTINFO:
if (dev != NULL || unit == ACPI_BATTERY_ALL_UNITS) {
bzero(&ioctl_arg->battinfo, sizeof(ioctl_arg->battinfo));
+ newbus_slock();
error = acpi_battery_get_battinfo(dev, &ioctl_arg->battinfo);
+ newbus_sunlock();
}
break;
case ACPIIO_BATT_GET_BIF:
@@ -416,6 +422,11 @@ acpi_battery_sysctl(SYSCTL_HANDLER_ARGS)
{
int val, error;
+ /*
+ * Tolerate a race here because newbus lock can't be acquired before
+ * acpi_battery_get_battinfo() as it can create a LOR with the sysctl
+ * lock.
+ */
acpi_battery_get_battinfo(NULL, &acpi_battery_battinfo);
val = *(u_int *)oidp->oid_arg1;
error = sysctl_handle_int(oidp, &val, 0, req);
@@ -427,6 +438,10 @@ acpi_battery_units_sysctl(SYSCTL_HANDLER_ARGS)
{
int count, error;
+ /*
+ * Tolerate a race here in order to avoid a LOR between sysctl lock
+ * and newbus lock.
+ */
count = acpi_battery_get_units();
error = sysctl_handle_int(oidp, &count, 0, req);
return (error);
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 5d8ad53..37134e2 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -732,7 +732,9 @@ acpi_cpu_startup(void *arg)
int i;
/* Get set of CPU devices */
+ newbus_slock();
devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices);
+ newbus_sunlock();
/*
* Setup any quirks that might necessary now that we have probed
diff --git a/sys/dev/acpica/acpi_dock.c b/sys/dev/acpica/acpi_dock.c
index b7d2e3e..95b9fae 100644
--- a/sys/dev/acpica/acpi_dock.c
+++ b/sys/dev/acpica/acpi_dock.c
@@ -188,12 +188,12 @@ acpi_dock_attach_later(void *context)
dev = (device_t)context;
+ newbus_xlock();
if (!device_is_enabled(dev))
device_enable(dev);
- mtx_lock(&Giant);
device_probe_and_attach(dev);
- mtx_unlock(&Giant);
+ newbus_xunlock();
}
static ACPI_STATUS
@@ -299,11 +299,11 @@ acpi_dock_eject_child(ACPI_HANDLE handle, UINT32 level, void *context,
"ejecting device for %s\n", acpi_name(handle));
dev = acpi_get_device(handle);
+ newbus_xlock();
if (dev != NULL && device_is_attached(dev)) {
- mtx_lock(&Giant);
device_detach(dev);
- mtx_unlock(&Giant);
}
+ newbus_xunlock();
acpi_SetInteger(handle, "_EJ0", 0);
out:
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index 962fdb7..1e58d52 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -936,6 +936,8 @@ acpi_tz_thread(void *arg)
sc = NULL;
for (;;) {
+ newbus_slock();
+
/* If the number of devices has changed, re-evaluate. */
if (devclass_get_count(acpi_tz_devclass) != devcount) {
if (devs != NULL) {
@@ -948,6 +950,7 @@ acpi_tz_thread(void *arg)
for (i = 0; i < devcount; i++)
sc[i] = device_get_softc(devs[i]);
}
+ newbus_sunlock();
/* Check for temperature events and act on them. */
for (i = 0; i < devcount; i++) {
OpenPOWER on IntegriCloud