Date: Tue, 22 Sep 2009 18:34:23 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r197415 - head/sys/dev/acpi_support Message-ID: <200909221834.n8MIYNL0028101@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Sep 22 18:34:23 2009 New Revision: 197415 URL: http://svn.freebsd.org/changeset/base/197415 Log: 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 Modified: head/sys/dev/acpi_support/acpi_aiboost.c Modified: head/sys/dev/acpi_support/acpi_aiboost.c ============================================================================== --- head/sys/dev/acpi_support/acpi_aiboost.c Tue Sep 22 18:19:18 2009 (r197414) +++ head/sys/dev/acpi_support/acpi_aiboost.c Tue Sep 22 18:34:23 2009 (r197415) @@ -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_getcompo 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_getcompo 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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909221834.n8MIYNL0028101>