aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNate Lawson <njl@FreeBSD.org>2004-04-09 06:55:50 +0000
committerNate Lawson <njl@FreeBSD.org>2004-04-09 06:55:50 +0000
commitaa95c5b148cd2aaf59ce0bca9057b401071b8fcd (patch)
treee76f978793ddc11823c5adc2c8b545396bd2fae4 /sys
parent4a74bb97ed2e41a7fa0f19b102aff5f62a3440be (diff)
downloadsrc-aa95c5b148cd2aaf59ce0bca9057b401071b8fcd.tar.gz
src-aa95c5b148cd2aaf59ce0bca9057b401071b8fcd.zip
Replace more ad-hoc versions of acpi_GetReference(). Since the type of
Reference objects changed from ACPI_TYPE_ANY to ACPI_TYPE_LOCAL_REFERENCE in Oct. 2002, this may help systems where switching the cooler on failed. We support both types for now until this sorts out.
Notes
Notes: svn path=/head/; revision=128047
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpica/acpi_powerres.c26
-rw-r--r--sys/dev/acpica/acpi_thermal.c95
2 files changed, 31 insertions, 90 deletions
diff --git a/sys/dev/acpica/acpi_powerres.c b/sys/dev/acpica/acpi_powerres.c
index a0d8eb715d5f..7bbcc01dbaa7 100644
--- a/sys/dev/acpica/acpi_powerres.c
+++ b/sys/dev/acpica/acpi_powerres.c
@@ -488,30 +488,10 @@ acpi_pwr_reference_resource(ACPI_OBJECT *obj, void *arg)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
- /* check the object type */
- switch (obj->Type) {
- case ACPI_TYPE_ANY:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
- acpi_name(pc->ac_consumer),
- acpi_name(obj->Reference.Handle)));
- res = obj->Reference.Handle;
- break;
- case ACPI_TYPE_STRING:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
- acpi_name(pc->ac_consumer), obj->String.Pointer));
-
- /* Get the handle of the resource */
- status = AcpiGetHandle(NULL, obj->String.Pointer, &res);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
- "couldn't find power resource %s\n",
- obj->String.Pointer));
- return_VOID;
- }
- break;
- default:
+ res = acpi_GetReference(NULL, obj);
+ if (res == NULL) {
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
- "can't create a power reference for object type %d\n",
+ "can't create a power reference for object type %d\n",
obj->Type));
return_VOID;
}
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index c539a4e98482..2dfc43513432 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -550,38 +550,27 @@ acpi_tz_all_off(struct acpi_tz_softc *sc)
static void
acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg)
{
- ACPI_HANDLE cooler;
+ struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg;
+ ACPI_HANDLE cooler;
+ ACPI_STATUS status;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
ACPI_ASSERTLOCK;
- switch(obj->Type) {
- case ACPI_TYPE_ANY:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n",
- acpi_name(obj->Reference.Handle)));
+ cooler = acpi_GetReference(NULL, obj);
+ if (cooler == NULL) {
+ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get handle\n"));
+ return_VOID;
+ }
- acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D3);
- break;
- case ACPI_TYPE_STRING:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n",
- obj->String.Pointer));
-
- /*
- * Find the handle for the device and turn it off.
- * The String object here seems to contain a fully-qualified path, so we
- * don't have to search for it in our parents.
- *
- * XXX This may not always be the case.
- */
- if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler)))
- acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3);
- break;
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
- "called to handle unsupported object type %d\n",
- obj->Type));
- break;
+ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n",
+ acpi_name(cooler)));
+ status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3);
+ if (ACPI_FAILURE(status)) {
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "failed to deactivate %s - %s\n", acpi_name(cooler),
+ AcpiFormatException(status));
}
return_VOID;
@@ -591,7 +580,7 @@ acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg)
* Given an object, verify that it's a reference to a device of some sort,
* and try to switch it on.
*
- * XXX replication of off/on function code is bad, mmmkay?
+ * XXX replication of off/on function code is bad.
*/
static void
acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg)
@@ -604,47 +593,19 @@ acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg)
ACPI_ASSERTLOCK;
- switch(obj->Type) {
- case ACPI_TYPE_ANY:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n",
- acpi_name(obj->Reference.Handle)));
+ cooler = acpi_GetReference(NULL, obj);
+ if (cooler == NULL) {
+ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get handle\n"));
+ return_VOID;
+ }
- status = acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D0);
- if (ACPI_FAILURE(status)) {
- ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
- "failed to activate %s - %s\n",
- acpi_name(obj->Reference.Handle),
- AcpiFormatException(status));
- }
- break;
- case ACPI_TYPE_STRING:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n",
- obj->String.Pointer));
-
- /*
- * Find the handle for the device and turn it off.
- * The String object here seems to contain a fully-qualified path, so we
- * don't have to search for it in our parents.
- *
- * XXX This may not always be the case.
- */
- if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler))) {
- status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0);
- if (ACPI_FAILURE(status)) {
- ACPI_VPRINT(sc->tz_dev,
- acpi_device_get_parent_softc(sc->tz_dev),
- "failed to activate %s - %s\n",
- obj->String.Pointer, AcpiFormatException(status));
- }
- } else {
- ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
- "couldn't find %s\n", obj->String.Pointer);
- }
- break;
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "unsupported object type %d\n",
- obj->Type));
- break;
+ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n",
+ acpi_name(cooler)));
+ status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0);
+ if (ACPI_FAILURE(status)) {
+ ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+ "failed to activate %s - %s\n", acpi_name(cooler),
+ AcpiFormatException(status));
}
return_VOID;