diff options
Diffstat (limited to 'sys/contrib/dev/acpica/components/namespace/nsxfeval.c')
-rw-r--r-- | sys/contrib/dev/acpica/components/namespace/nsxfeval.c | 138 |
1 files changed, 71 insertions, 67 deletions
diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c index 93226ef..6467d7e 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -305,13 +305,12 @@ AcpiEvaluateObject ( } -#if 0 +#ifdef _FUTURE_FEATURE /* * Begin incoming argument count analysis. Check for too few args * and too many args. */ - switch (AcpiNsGetType (Info->Node)) { case ACPI_TYPE_METHOD: @@ -399,69 +398,74 @@ AcpiEvaluateObject ( * If we are expecting a return value, and all went well above, * copy the return value to an external object. */ - if (ReturnBuffer) + if (!ReturnBuffer) + { + goto CleanupReturnObject; + } + + if (!Info->ReturnObject) + { + ReturnBuffer->Length = 0; + goto Cleanup; + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) == + ACPI_DESC_TYPE_NAMED) { - if (!Info->ReturnObject) + /* + * If we received a NS Node as a return object, this means that + * the object we are evaluating has nothing interesting to + * return (such as a mutex, etc.) We return an error because + * these types are essentially unsupported by this interface. + * We don't check up front because this makes it easier to add + * support for various types at a later date if necessary. + */ + Status = AE_TYPE; + Info->ReturnObject = NULL; /* No need to delete a NS Node */ + ReturnBuffer->Length = 0; + } + + if (ACPI_FAILURE (Status)) + { + goto CleanupReturnObject; + } + + /* Dereference Index and RefOf references */ + + AcpiNsResolveReferences (Info); + + /* Get the size of the returned object */ + + Status = AcpiUtGetObjectSize (Info->ReturnObject, + &BufferSpaceNeeded); + if (ACPI_SUCCESS (Status)) + { + /* Validate/Allocate/Clear caller buffer */ + + Status = AcpiUtInitializeBuffer (ReturnBuffer, + BufferSpaceNeeded); + if (ACPI_FAILURE (Status)) { - ReturnBuffer->Length = 0; + /* + * Caller's buffer is too small or a new one can't + * be allocated + */ + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Needed buffer size %X, %s\n", + (UINT32) BufferSpaceNeeded, + AcpiFormatException (Status))); } else { - if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) == - ACPI_DESC_TYPE_NAMED) - { - /* - * If we received a NS Node as a return object, this means that - * the object we are evaluating has nothing interesting to - * return (such as a mutex, etc.) We return an error because - * these types are essentially unsupported by this interface. - * We don't check up front because this makes it easier to add - * support for various types at a later date if necessary. - */ - Status = AE_TYPE; - Info->ReturnObject = NULL; /* No need to delete a NS Node */ - ReturnBuffer->Length = 0; - } + /* We have enough space for the object, build it */ - if (ACPI_SUCCESS (Status)) - { - /* Dereference Index and RefOf references */ - - AcpiNsResolveReferences (Info); - - /* Get the size of the returned object */ - - Status = AcpiUtGetObjectSize (Info->ReturnObject, - &BufferSpaceNeeded); - if (ACPI_SUCCESS (Status)) - { - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (ReturnBuffer, - BufferSpaceNeeded); - if (ACPI_FAILURE (Status)) - { - /* - * Caller's buffer is too small or a new one can't - * be allocated - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Needed buffer size %X, %s\n", - (UINT32) BufferSpaceNeeded, - AcpiFormatException (Status))); - } - else - { - /* We have enough space for the object, build it */ - - Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject, - ReturnBuffer); - } - } - } + Status = AcpiUtCopyIobjectToEobject ( + Info->ReturnObject, ReturnBuffer); } } +CleanupReturnObject: + if (Info->ReturnObject) { /* @@ -668,8 +672,8 @@ AcpiWalkNamespace ( } Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, - ACPI_NS_WALK_UNLOCK, DescendingCallback, - AscendingCallback, Context, ReturnValue); + ACPI_NS_WALK_UNLOCK, DescendingCallback, + AscendingCallback, Context, ReturnValue); UnlockAndExit2: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -758,7 +762,7 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - NoMatch = ACPI_STRCMP (Hid->String, Info->Hid); + NoMatch = strcmp (Hid->String, Info->Hid); ACPI_FREE (Hid); if (NoMatch) @@ -782,7 +786,7 @@ AcpiNsGetDeviceCallback ( Found = FALSE; for (i = 0; i < Cid->Count; i++) { - if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0) + if (strcmp (Cid->Ids[i].String, Info->Hid) == 0) { /* Found a matching CID */ @@ -820,8 +824,8 @@ AcpiNsGetDeviceCallback ( /* We have a valid device, invoke the user function */ - Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, - ReturnValue); + Status = Info->UserFunction (ObjHandle, NestingLevel, + Info->Context, ReturnValue); return (Status); } @@ -876,8 +880,8 @@ AcpiGetDevices ( * We're going to call their callback from OUR callback, so we need * to know what it is, and their context parameter. */ - Info.Hid = HID; - Info.Context = Context; + Info.Hid = HID; + Info.Context = Context; Info.UserFunction = UserFunction; /* @@ -893,8 +897,8 @@ AcpiGetDevices ( } Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); + ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, + AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); |