summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpi_support
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-09-22 18:34:23 +0000
committerjhb <jhb@FreeBSD.org>2009-09-22 18:34:23 +0000
commitaefeeea8bffdb14d4d7264ae2b1eba029717eee8 (patch)
tree2823ddd74e7bc14e544c88a3cd568083accb60d9 /sys/dev/acpi_support
parentc8256e7fa48f727f051d7f2e5ac16afb0b919d72 (diff)
downloadFreeBSD-src-aefeeea8bffdb14d4d7264ae2b1eba029717eee8.zip
FreeBSD-src-aefeeea8bffdb14d4d7264ae2b1eba029717eee8.tar.gz
The elements in the component arrays may be direct Package objects rather
than references to objects. In that case, simply use the Package directly. I think a recent change to ACPI-CA is causing the interpreter to automatically expand these references. Reported by: Olivier Smedts olivier gid0 org MFC after: 3 days
Diffstat (limited to 'sys/dev/acpi_support')
-rw-r--r--sys/dev/acpi_support/acpi_aiboost.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/sys/dev/acpi_support/acpi_aiboost.c b/sys/dev/acpi_support/acpi_aiboost.c
index 8fff872..a8fe9cc 100644
--- a/sys/dev/acpi_support/acpi_aiboost.c
+++ b/sys/dev/acpi_support/acpi_aiboost.c
@@ -46,7 +46,6 @@ ACPI_MODULE_NAME("AIBOOST")
#define DESCSTRLEN 32
struct acpi_aiboost_element{
- ACPI_HANDLE h;
uint32_t id;
char desc[DESCSTRLEN];
};
@@ -127,22 +126,23 @@ static ACPI_STATUS acpi_aiboost_getcomponent(device_t dev, char *name, struct a
for(i = 1 ; i < o->Package.Count; i++){
elem = &o->Package.Elements[i];
- if(elem->Type != ACPI_TYPE_ANY){
- printf("NOREF\n");
- goto error;
- }
- c->elem[ i - 1].h = elem->Reference.Handle;
-
- buf2.Pointer = NULL;
- buf2.Length = ACPI_ALLOCATE_BUFFER;
-
- status = AcpiEvaluateObject(c->elem[i - 1].h, NULL, NULL,
- &buf2);
- if(ACPI_FAILURE(status)){
- printf("FETCH OBJECT\n");
+ if (elem->Type == ACPI_TYPE_ANY) {
+ buf2.Pointer = NULL;
+ buf2.Length = ACPI_ALLOCATE_BUFFER;
+
+ status = AcpiEvaluateObject(elem->Reference.Handle,
+ NULL, NULL, &buf2);
+ if (ACPI_FAILURE(status)){
+ printf("FETCH OBJECT\n");
+ goto error;
+ }
+ subobj = buf2.Pointer;
+ } else if (elem->Type == ACPI_TYPE_PACKAGE)
+ subobj = elem;
+ else {
+ printf("NO PACKAGE\n");
goto error;
}
- subobj = buf2.Pointer;
if(ACPI_FAILURE(acpi_PkgInt32(subobj,0, &c->elem[i -1].id))){
printf("ID FAILED\n");
goto error;
@@ -151,15 +151,17 @@ static ACPI_STATUS acpi_aiboost_getcomponent(device_t dev, char *name, struct a
sizeof(c->elem[i - 1].desc));
if(ACPI_FAILURE(status)){
if(status == E2BIG){
- c->elem[i-1].desc[DESCSTRLEN-1] = 0;
+ c->elem[i - 1].desc[DESCSTRLEN-1] = 0;
}else{
printf("DESC FAILED %d\n", i-1);
goto error;
}
}
- if(buf2.Pointer)
- AcpiOsFree(buf2.Pointer);
+ if (buf2.Pointer) {
+ AcpiOsFree(buf2.Pointer);
+ buf2.Pointer = NULL;
+ }
}
if(buf.Pointer)
OpenPOWER on IntegriCloud