diff options
Diffstat (limited to 'source/components/utilities')
| -rw-r--r-- | source/components/utilities/utdelete.c | 66 | ||||
| -rw-r--r-- | source/components/utilities/utresrc.c | 70 | ||||
| -rw-r--r-- | source/components/utilities/utstate.c | 40 | ||||
| -rw-r--r-- | source/components/utilities/uttrack.c | 16 | 
4 files changed, 109 insertions, 83 deletions
diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 4ed629762768..d526e0d27891 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -368,7 +368,7 @@ AcpiUtDeleteInternalObjectList (      ACPI_OPERAND_OBJECT     **InternalObj; -    ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList); +    ACPI_FUNCTION_NAME (UtDeleteInternalObjectList);      /* Walk the null-terminated internal list */ @@ -381,7 +381,7 @@ AcpiUtDeleteInternalObjectList (      /* Free the combined parameter pointer list and object array */      ACPI_FREE (ObjList); -    return_VOID; +    return;  } @@ -528,7 +528,7 @@ AcpiUtUpdateObjectReference (      UINT32                  i; -    ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object); +    ACPI_FUNCTION_NAME (UtUpdateObjectReference);      while (Object) @@ -539,7 +539,7 @@ AcpiUtUpdateObjectReference (          {              ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,                  "Object %p is NS handle\n", Object)); -            return_ACPI_STATUS (AE_OK); +            return (AE_OK);          }          /* @@ -577,17 +577,43 @@ AcpiUtUpdateObjectReference (              for (i = 0; i < Object->Package.Count; i++)              {                  /* -                 * Push each element onto the stack for later processing. -                 * Note: There can be null elements within the package, -                 * these are simply ignored +                 * Null package elements are legal and can be simply +                 * ignored.                   */ -                Status = AcpiUtCreateUpdateStateAndPush ( -                            Object->Package.Elements[i], Action, &StateList); -                if (ACPI_FAILURE (Status)) +                NextObject = Object->Package.Elements[i]; +                if (!NextObject) +                { +                    continue; +                } + +                switch (NextObject->Common.Type)                  { -                    goto ErrorExit; +                case ACPI_TYPE_INTEGER: +                case ACPI_TYPE_STRING: +                case ACPI_TYPE_BUFFER: +                    /* +                     * For these very simple sub-objects, we can just +                     * update the reference count here and continue. +                     * Greatly increases performance of this operation. +                     */ +                    AcpiUtUpdateRefCount (NextObject, Action); +                    break; + +                default: +                    /* +                     * For complex sub-objects, push them onto the stack +                     * for later processing (this eliminates recursion.) +                     */ +                    Status = AcpiUtCreateUpdateStateAndPush ( +                                 NextObject, Action, &StateList); +                    if (ACPI_FAILURE (Status)) +                    { +                        goto ErrorExit; +                    } +                    break;                  }              } +            NextObject = NULL;              break;          case ACPI_TYPE_BUFFER_FIELD: @@ -663,7 +689,7 @@ AcpiUtUpdateObjectReference (          }      } -    return_ACPI_STATUS (AE_OK); +    return (AE_OK);  ErrorExit: @@ -679,7 +705,7 @@ ErrorExit:          AcpiUtDeleteGenericState (State);      } -    return_ACPI_STATUS (Status); +    return (Status);  } @@ -701,14 +727,14 @@ AcpiUtAddReference (      ACPI_OPERAND_OBJECT     *Object)  { -    ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object); +    ACPI_FUNCTION_NAME (UtAddReference);      /* Ensure that we have a valid object */      if (!AcpiUtValidInternalObject (Object))      { -        return_VOID; +        return;      }      ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, @@ -718,7 +744,7 @@ AcpiUtAddReference (      /* Increment the reference count */      (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); -    return_VOID; +    return;  } @@ -739,7 +765,7 @@ AcpiUtRemoveReference (      ACPI_OPERAND_OBJECT     *Object)  { -    ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object); +    ACPI_FUNCTION_NAME (UtRemoveReference);      /* @@ -751,14 +777,14 @@ AcpiUtRemoveReference (          (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))      { -        return_VOID; +        return;      }      /* Ensure that we have a valid object */      if (!AcpiUtValidInternalObject (Object))      { -        return_VOID; +        return;      }      ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, @@ -771,5 +797,5 @@ AcpiUtRemoveReference (       * of all subobjects!)       */      (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT); -    return_VOID; +    return;  } diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index a1a6c5bfbcc3..0caec2033d75 100644 --- a/source/components/utilities/utresrc.c +++ b/source/components/utilities/utresrc.c @@ -148,7 +148,9 @@ const char                      *AcpiGbl_RwDecode[] =  const char                      *AcpiGbl_ShrDecode[] =  {      "Exclusive", -    "Shared" +    "Shared", +    "ExclusiveAndWake",         /* ACPI 5.0 */ +    "SharedAndWake"             /* ACPI 5.0 */  };  const char                      *AcpiGbl_SizDecode[] = @@ -429,27 +431,17 @@ static const UINT8          AcpiGbl_ResourceTypes[] =      ACPI_VARIABLE_LENGTH            /* 0E *SerialBus */  }; -/* - * For the iASL compiler/disassembler, we don't want any error messages - * because the disassembler uses the resource validation code to determine - * if Buffer objects are actually Resource Templates. - */ -#ifdef ACPI_ASL_COMPILER -#define ACPI_RESOURCE_ERROR(plist) -#else -#define ACPI_RESOURCE_ERROR(plist)  ACPI_ERROR(plist) -#endif -  /*******************************************************************************   *   * FUNCTION:    AcpiUtWalkAmlResources   * - * PARAMETERS:  Aml             - Pointer to the raw AML resource template - *              AmlLength       - Length of the entire template - *              UserFunction    - Called once for each descriptor found. If - *                                NULL, a pointer to the EndTag is returned - *              Context         - Passed to UserFunction + * PARAMETERS:  WalkState           - Current walk info + * PARAMETERS:  Aml                 - Pointer to the raw AML resource template + *              AmlLength           - Length of the entire template + *              UserFunction        - Called once for each descriptor found. If + *                                    NULL, a pointer to the EndTag is returned + *              Context             - Passed to UserFunction   *   * RETURN:      Status   * @@ -460,6 +452,7 @@ static const UINT8          AcpiGbl_ResourceTypes[] =  ACPI_STATUS  AcpiUtWalkAmlResources ( +    ACPI_WALK_STATE         *WalkState,      UINT8                   *Aml,      ACPI_SIZE               AmlLength,      ACPI_WALK_AML_CALLBACK  UserFunction, @@ -493,7 +486,7 @@ AcpiUtWalkAmlResources (      {          /* Validate the Resource Type and Resource Length */ -        Status = AcpiUtValidateResource (Aml, &ResourceIndex); +        Status = AcpiUtValidateResource (WalkState, Aml, &ResourceIndex);          if (ACPI_FAILURE (Status))          {              /* @@ -553,7 +546,7 @@ AcpiUtWalkAmlResources (      {          /* Insert an EndTag anyway. AcpiRsGetListLength always leaves room */ -        (void) AcpiUtValidateResource (EndTag, &ResourceIndex); +        (void) AcpiUtValidateResource (WalkState, EndTag, &ResourceIndex);          Status = UserFunction (EndTag, 2, Offset, ResourceIndex, Context);          if (ACPI_FAILURE (Status))          { @@ -569,9 +562,10 @@ AcpiUtWalkAmlResources (   *   * FUNCTION:    AcpiUtValidateResource   * - * PARAMETERS:  Aml             - Pointer to the raw AML resource descriptor - *              ReturnIndex     - Where the resource index is returned. NULL - *                                if the index is not required. + * PARAMETERS:  WalkState           - Current walk info + *              Aml                 - Pointer to the raw AML resource descriptor + *              ReturnIndex         - Where the resource index is returned. NULL + *                                    if the index is not required.   *   * RETURN:      Status, and optionally the Index into the global resource tables   * @@ -583,6 +577,7 @@ AcpiUtWalkAmlResources (  ACPI_STATUS  AcpiUtValidateResource ( +    ACPI_WALK_STATE         *WalkState,      void                    *Aml,      UINT8                   *ReturnIndex)  { @@ -696,9 +691,12 @@ AcpiUtValidateResource (          if ((AmlResource->CommonSerialBus.Type == 0) ||              (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE))          { -            ACPI_RESOURCE_ERROR ((AE_INFO, -                "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", -                AmlResource->CommonSerialBus.Type)); +            if (WalkState) +            { +                ACPI_ERROR ((AE_INFO, +                    "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", +                    AmlResource->CommonSerialBus.Type)); +            }              return (AE_AML_INVALID_RESOURCE_TYPE);          }      } @@ -715,17 +713,23 @@ AcpiUtValidateResource (  InvalidResource: -    ACPI_RESOURCE_ERROR ((AE_INFO, -        "Invalid/unsupported resource descriptor: Type 0x%2.2X", -        ResourceType)); +    if (WalkState) +    { +        ACPI_ERROR ((AE_INFO, +            "Invalid/unsupported resource descriptor: Type 0x%2.2X", +            ResourceType)); +    }      return (AE_AML_INVALID_RESOURCE_TYPE);  BadResourceLength: -    ACPI_RESOURCE_ERROR ((AE_INFO, -        "Invalid resource descriptor length: Type " -        "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", -        ResourceType, ResourceLength, MinimumResourceLength)); +    if (WalkState) +    { +        ACPI_ERROR ((AE_INFO, +            "Invalid resource descriptor length: Type " +            "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", +            ResourceType, ResourceLength, MinimumResourceLength)); +    }      return (AE_AML_BAD_RESOURCE_LENGTH);  } @@ -914,7 +918,7 @@ AcpiUtGetResourceEndTag (      /* Validate the template and get a pointer to the EndTag */ -    Status = AcpiUtWalkAmlResources (ObjDesc->Buffer.Pointer, +    Status = AcpiUtWalkAmlResources (NULL, ObjDesc->Buffer.Pointer,                  ObjDesc->Buffer.Length, NULL, EndTag);      return_ACPI_STATUS (Status); diff --git a/source/components/utilities/utstate.c b/source/components/utilities/utstate.c index f144bca2fde4..7ce39e7c9b1a 100644 --- a/source/components/utilities/utstate.c +++ b/source/components/utilities/utstate.c @@ -107,15 +107,14 @@ AcpiUtPushGenericState (      ACPI_GENERIC_STATE      **ListHead,      ACPI_GENERIC_STATE      *State)  { -    ACPI_FUNCTION_TRACE (UtPushGenericState); +    ACPI_FUNCTION_ENTRY ();      /* Push the state object onto the front of the list (stack) */      State->Common.Next = *ListHead;      *ListHead = State; - -    return_VOID; +    return;  } @@ -138,7 +137,7 @@ AcpiUtPopGenericState (      ACPI_GENERIC_STATE      *State; -    ACPI_FUNCTION_TRACE (UtPopGenericState); +    ACPI_FUNCTION_ENTRY ();      /* Remove the state object at the head of the list (stack) */ @@ -151,7 +150,7 @@ AcpiUtPopGenericState (          *ListHead = State->Common.Next;      } -    return_PTR (State); +    return (State);  } @@ -209,7 +208,7 @@ AcpiUtCreateThreadState (      ACPI_GENERIC_STATE      *State; -    ACPI_FUNCTION_TRACE (UtCreateThreadState); +    ACPI_FUNCTION_ENTRY ();      /* Create the generic state object */ @@ -217,7 +216,7 @@ AcpiUtCreateThreadState (      State = AcpiUtCreateGenericState ();      if (!State)      { -        return_PTR (NULL); +        return (NULL);      }      /* Init fields specific to the update struct */ @@ -233,7 +232,7 @@ AcpiUtCreateThreadState (          State->Thread.ThreadId = (ACPI_THREAD_ID) 1;      } -    return_PTR ((ACPI_THREAD_STATE *) State); +    return ((ACPI_THREAD_STATE *) State);  } @@ -260,7 +259,7 @@ AcpiUtCreateUpdateState (      ACPI_GENERIC_STATE      *State; -    ACPI_FUNCTION_TRACE_PTR (UtCreateUpdateState, Object); +    ACPI_FUNCTION_ENTRY ();      /* Create the generic state object */ @@ -268,7 +267,7 @@ AcpiUtCreateUpdateState (      State = AcpiUtCreateGenericState ();      if (!State)      { -        return_PTR (NULL); +        return (NULL);      }      /* Init fields specific to the update struct */ @@ -276,8 +275,7 @@ AcpiUtCreateUpdateState (      State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_UPDATE;      State->Update.Object = Object;      State->Update.Value = Action; - -    return_PTR (State); +    return (State);  } @@ -303,7 +301,7 @@ AcpiUtCreatePkgState (      ACPI_GENERIC_STATE      *State; -    ACPI_FUNCTION_TRACE_PTR (UtCreatePkgState, InternalObject); +    ACPI_FUNCTION_ENTRY ();      /* Create the generic state object */ @@ -311,7 +309,7 @@ AcpiUtCreatePkgState (      State = AcpiUtCreateGenericState ();      if (!State)      { -        return_PTR (NULL); +        return (NULL);      }      /* Init fields specific to the update struct */ @@ -321,8 +319,7 @@ AcpiUtCreatePkgState (      State->Pkg.DestObject = ExternalObject;      State->Pkg.Index= Index;      State->Pkg.NumPackages = 1; - -    return_PTR (State); +    return (State);  } @@ -346,7 +343,7 @@ AcpiUtCreateControlState (      ACPI_GENERIC_STATE      *State; -    ACPI_FUNCTION_TRACE (UtCreateControlState); +    ACPI_FUNCTION_ENTRY ();      /* Create the generic state object */ @@ -354,15 +351,14 @@ AcpiUtCreateControlState (      State = AcpiUtCreateGenericState ();      if (!State)      { -        return_PTR (NULL); +        return (NULL);      }      /* Init fields specific to the control struct */      State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL;      State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; - -    return_PTR (State); +    return (State);  } @@ -383,7 +379,7 @@ void  AcpiUtDeleteGenericState (      ACPI_GENERIC_STATE      *State)  { -    ACPI_FUNCTION_TRACE (UtDeleteGenericState); +    ACPI_FUNCTION_ENTRY ();      /* Ignore null state */ @@ -392,5 +388,5 @@ AcpiUtDeleteGenericState (      {          (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);      } -    return_VOID; +    return;  } diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index 2e37aebba1e2..b995db4fe24e 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -490,12 +490,12 @@ AcpiUtRemoveAllocation (      ACPI_STATUS             Status; -    ACPI_FUNCTION_TRACE (UtRemoveAllocation); +    ACPI_FUNCTION_NAME (UtRemoveAllocation);      if (AcpiGbl_DisableMemTracking)      { -        return_ACPI_STATUS (AE_OK); +        return (AE_OK);      }      MemList = AcpiGbl_GlobalList; @@ -506,13 +506,13 @@ AcpiUtRemoveAllocation (          ACPI_ERROR ((Module, Line,              "Empty allocation list, nothing to free!")); -        return_ACPI_STATUS (AE_OK); +        return (AE_OK);      }      Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);      if (ACPI_FAILURE (Status))      { -        return_ACPI_STATUS (Status); +        return (Status);      }      /* Unlink */ @@ -531,15 +531,15 @@ AcpiUtRemoveAllocation (          (Allocation->Next)->Previous = Allocation->Previous;      } +    ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing %p, size 0%X\n", +        &Allocation->UserSpace, Allocation->Size)); +      /* Mark the segment as deleted */      ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); -    ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", -        Allocation->Size)); -      Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); -    return_ACPI_STATUS (Status); +    return (Status);  }  | 
