diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2013-04-19 05:49:53 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2013-04-19 05:49:53 +0000 | 
| commit | a95efc1a1522251892a7baebcb0569741ad7c6ca (patch) | |
| tree | 123ed5e9ad0bad1d892c0637e33953142b50843f /source/components/namespace | |
| parent | 9b7735bafd2eb5079bc7f216ba350dbf8f268683 (diff) | |
Notes
Diffstat (limited to 'source/components/namespace')
| -rw-r--r-- | source/components/namespace/nsarguments.c | 303 | ||||
| -rw-r--r-- | source/components/namespace/nseval.c | 240 | ||||
| -rw-r--r-- | source/components/namespace/nsinit.c | 6 | ||||
| -rw-r--r-- | source/components/namespace/nspredef.c | 208 | ||||
| -rw-r--r-- | source/components/namespace/nsprepkg.c | 75 | ||||
| -rw-r--r-- | source/components/namespace/nsrepair.c | 50 | ||||
| -rw-r--r-- | source/components/namespace/nsrepair2.c | 81 | ||||
| -rw-r--r-- | source/components/namespace/nsxfeval.c | 173 | 
8 files changed, 728 insertions, 408 deletions
diff --git a/source/components/namespace/nsarguments.c b/source/components/namespace/nsarguments.c new file mode 100644 index 000000000000..912813cf9c04 --- /dev/null +++ b/source/components/namespace/nsarguments.c @@ -0,0 +1,303 @@ +/****************************************************************************** + * + * Module Name: nsarguments - Validation of args for ACPI predefined methods + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2013, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acpredef.h" + + +#define _COMPONENT          ACPI_NAMESPACE +        ACPI_MODULE_NAME    ("nsarguments") + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsCheckArgumentTypes + * + * PARAMETERS:  Info            - Method execution information block + * + * RETURN:      None + * + * DESCRIPTION: Check the incoming argument count and all argument types + *              against the argument type list for a predefined name. + * + ******************************************************************************/ + +void +AcpiNsCheckArgumentTypes ( +    ACPI_EVALUATE_INFO          *Info) +{ +    UINT16                      ArgTypeList; +    UINT8                       ArgCount; +    UINT8                       ArgType; +    UINT8                       UserArgType; +    UINT32                      i; + + +    /* If not a predefined name, cannot typecheck args */ + +    if (!Info->Predefined) +    { +        return; +    } + +    ArgTypeList = Info->Predefined->Info.ArgumentList; +    ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); + +    /* Typecheck all arguments */ + +    for (i = 0; ((i < ArgCount) && (i < Info->ParamCount)); i++) +    { +        ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); +        UserArgType = Info->Parameters[i]->Common.Type; + +        if (UserArgType != ArgType) +        { +            ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, +                "Argument #%u type mismatch - " +                "Found [%s], ACPI requires [%s]", (i + 1), +                AcpiUtGetTypeName (UserArgType), +                AcpiUtGetTypeName (ArgType))); +        } +    } +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsCheckAcpiCompliance + * + * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs) + *              Node            - Namespace node for the method/object + *              Predefined      - Pointer to entry in predefined name table + * + * RETURN:      None + * + * DESCRIPTION: Check that the declared parameter count (in ASL/AML) for a + *              predefined name is what is expected (matches what is defined in + *              the ACPI specification for this predefined name.) + * + ******************************************************************************/ + +void +AcpiNsCheckAcpiCompliance ( +    char                        *Pathname, +    ACPI_NAMESPACE_NODE         *Node, +    const ACPI_PREDEFINED_INFO  *Predefined) +{ +    UINT32                      AmlParamCount; +    UINT32                      RequiredParamCount; + + +    if (!Predefined) +    { +        return; +    } + +    /* Get the ACPI-required arg count from the predefined info table */ + +    RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + +    /* +     * If this object is not a control method, we can check if the ACPI +     * spec requires that it be a method. +     */ +    if (Node->Type != ACPI_TYPE_METHOD) +    { +        if (RequiredParamCount > 0) +        { +            /* Object requires args, must be implemented as a method */ + +            ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +                "Object (%s) must be a control method with %u arguments", +                AcpiUtGetTypeName (Node->Type), RequiredParamCount)); +        } +        else if (!RequiredParamCount && !Predefined->Info.ExpectedBtypes) +        { +            /* Object requires no args and no return value, must be a method */ + +            ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +                "Object (%s) must be a control method " +                "with no arguments and no return value", +                AcpiUtGetTypeName (Node->Type))); +        } + +        return; +    } + +    /* +     * This is a control method. +     * Check that the ASL/AML-defined parameter count for this method +     * matches the ACPI-required parameter count +     * +     * Some methods are allowed to have a "minimum" number of args (_SCP) +     * because their definition in ACPI has changed over time. +     * +     * Note: These are BIOS errors in the declaration of the object +     */ +    AmlParamCount = Node->Object->Method.ParamCount; + +    if (AmlParamCount < RequiredParamCount) +    { +        ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +            "Insufficient arguments - " +            "ASL declared %u, ACPI requires %u", +            AmlParamCount, RequiredParamCount)); +    } +    else if ((AmlParamCount > RequiredParamCount) && +        !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) +    { +        ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +            "Excess arguments - " +            "ASL declared %u, ACPI requires %u", +            AmlParamCount, RequiredParamCount)); +    } +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsCheckArgumentCount + * + * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs) + *              Node            - Namespace node for the method/object + *              UserParamCount  - Number of args passed in by the caller + *              Predefined      - Pointer to entry in predefined name table + * + * RETURN:      None + * + * DESCRIPTION: Check that incoming argument count matches the declared + *              parameter count (in the ASL/AML) for an object. + * + ******************************************************************************/ + +void +AcpiNsCheckArgumentCount ( +    char                        *Pathname, +    ACPI_NAMESPACE_NODE         *Node, +    UINT32                      UserParamCount, +    const ACPI_PREDEFINED_INFO  *Predefined) +{ +    UINT32                      AmlParamCount; +    UINT32                      RequiredParamCount; + + +    if (!Predefined) +    { +        /* +         * Not a predefined name. Check the incoming user argument count +         * against the count that is specified in the method/object. +         */ +        if (Node->Type != ACPI_TYPE_METHOD) +        { +            if (UserParamCount) +            { +                ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +                    "%u arguments were passed to a non-method ACPI object (%s)", +                    UserParamCount, AcpiUtGetTypeName (Node->Type))); +            } + +            return; +        } + +        /* +         * This is a control method. Check the parameter count. +         * We can only check the incoming argument count against the +         * argument count declared for the method in the ASL/AML. +         * +         * Emit a message if too few or too many arguments have been passed +         * by the caller. +         * +         * Note: Too many arguments will not cause the method to +         * fail. However, the method will fail if there are too few +         * arguments and the method attempts to use one of the missing ones. +         */ +        AmlParamCount = Node->Object->Method.ParamCount; + +        if (UserParamCount < AmlParamCount) +        { +            ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +                "Insufficient arguments - " +                "Caller passed %u, method requires %u", +                UserParamCount, AmlParamCount)); +        } +        else if (UserParamCount > AmlParamCount) +        { +            ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +                "Excess arguments - " +                "Caller passed %u, method requires %u", +                UserParamCount, AmlParamCount)); +        } + +        return; +    } + +    /* +     * This is a predefined name. Validate the user-supplied parameter +     * count against the ACPI specification. We don't validate against +     * the method itself because what is important here is that the +     * caller is in conformance with the spec. (The arg count for the +     * method was checked against the ACPI spec earlier.) +     * +     * Some methods are allowed to have a "minimum" number of args (_SCP) +     * because their definition in ACPI has changed over time. +     */ +    RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + +    if (UserParamCount < RequiredParamCount) +    { +        ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +            "Insufficient arguments - " +            "Caller passed %u, ACPI requires %u", +            UserParamCount, RequiredParamCount)); +    } +    else if ((UserParamCount > RequiredParamCount) && +        !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) +    { +        ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +            "Excess arguments - " +            "Caller passed %u, ACPI requires %u", +            UserParamCount, RequiredParamCount)); +    } +} diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 1de341ce9024..c92e6e7ec9ee 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -67,7 +67,7 @@ AcpiNsExecModuleCode (   *   * PARAMETERS:  Info            - Evaluation info block, contains:   *                  PrefixNode      - Prefix or Method/Object Node to execute - *                  Pathname        - Name of method to execute, If NULL, the + *                  RelativePath    - Name of method to execute, If NULL, the   *                                    Node is the object to execute   *                  Parameters      - List of parameters to pass to the method,   *                                    terminated by NULL. Params itself may be @@ -93,7 +93,6 @@ AcpiNsEvaluate (      ACPI_EVALUATE_INFO      *Info)  {      ACPI_STATUS             Status; -    ACPI_NAMESPACE_NODE     *Node;      ACPI_FUNCTION_TRACE (NsEvaluate); @@ -104,23 +103,18 @@ AcpiNsEvaluate (          return_ACPI_STATUS (AE_BAD_PARAMETER);      } -    /* Initialize the return value to an invalid object */ - -    Info->ReturnObject = NULL; -    Info->ParamCount = 0; - -    if (!Info->ResolvedNode) +    if (!Info->Node)      {          /* -         * Get the actual namespace node for the target object if we need to. -         * Handles these cases: +         * Get the actual namespace node for the target object if we +         * need to. Handles these cases:           * -         * 1) Null node, Pathname (absolute path) -         * 2) Node, Pathname (path relative to Node) -         * 3) Node, Null Pathname +         * 1) Null node, valid pathname from root (absolute path) +         * 2) Node and valid pathname (path relative to Node) +         * 3) Node, Null pathname           */ -        Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname, -                    ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode); +        Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname, +            ACPI_NS_NO_UPSEARCH, &Info->Node);          if (ACPI_FAILURE (Status))          {              return_ACPI_STATUS (Status); @@ -128,60 +122,122 @@ AcpiNsEvaluate (      }      /* -     * For a method alias, we must grab the actual method node so that proper -     * scoping context will be established before execution. +     * For a method alias, we must grab the actual method node so that +     * proper scoping context will be established before execution.       */ -    if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS) +    if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) +    { +        Info->Node = ACPI_CAST_PTR ( +            ACPI_NAMESPACE_NODE, Info->Node->Object); +    } + +    /* Complete the info block initialization */ + +    Info->ReturnObject = NULL; +    Info->NodeFlags = Info->Node->Flags; +    Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node); + +    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", +        Info->RelativePathname, Info->Node, +        AcpiNsGetAttachedObject (Info->Node))); + +    /* Get info if we have a predefined name (_HID, etc.) */ + +    Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii); + +    /* Get the full pathname to the object, for use in warning messages */ + +    Info->FullPathname = AcpiNsGetExternalPathname (Info->Node); +    if (!Info->FullPathname)      { -        Info->ResolvedNode = -            ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->ResolvedNode->Object); +        return_ACPI_STATUS (AE_NO_MEMORY);      } -    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname, -        Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode))); +    /* Count the number of arguments being passed in */ -    Node = Info->ResolvedNode; +    Info->ParamCount = 0; +    if (Info->Parameters) +    { +        while (Info->Parameters[Info->ParamCount]) +        { +            Info->ParamCount++; +        } + +        /* Warn on impossible argument count */ + +        if (Info->ParamCount > ACPI_METHOD_NUM_ARGS) +        { +            ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, +                "Excess arguments (%u) - using only %u", +                Info->ParamCount, ACPI_METHOD_NUM_ARGS)); + +            Info->ParamCount = ACPI_METHOD_NUM_ARGS; +        } +    }      /* -     * Two major cases here: +     * For predefined names: Check that the declared argument count +     * matches the ACPI spec -- otherwise this is a BIOS error. +     */ +    AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node, +        Info->Predefined); + +    /* +     * For all names: Check that the incoming argument count for +     * this method/object matches the actual ASL/AML definition. +     */ +    AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node, +        Info->ParamCount, Info->Predefined); + +    /* For predefined names: Typecheck all incoming arguments */ + +    AcpiNsCheckArgumentTypes (Info); + +    /* +     * Three major evaluation cases:       * -     * 1) The object is a control method -- execute it -     * 2) The object is not a method -- just return it's current value +     * 1) Object types that cannot be evaluated by definition +     * 2) The object is a control method -- execute it +     * 3) The object is not a method -- just return it's current value       */ -    if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_METHOD) +    switch (AcpiNsGetType (Info->Node))      { +    case ACPI_TYPE_DEVICE: +    case ACPI_TYPE_EVENT: +    case ACPI_TYPE_MUTEX: +    case ACPI_TYPE_REGION: +    case ACPI_TYPE_THERMAL: +    case ACPI_TYPE_LOCAL_SCOPE:          /* -         * 1) Object is a control method - execute it +         * 1) Disallow evaluation of certain object types. For these, +         *    object evaluation is undefined and not supported.           */ +        ACPI_ERROR ((AE_INFO, +            "%s: Evaluation of object type [%s] is not supported", +            Info->FullPathname, +            AcpiUtGetTypeName (Info->Node->Type))); -        /* Verify that there is a method object associated with this node */ +        Status = AE_TYPE; +        goto Cleanup; -        Info->ObjDesc = AcpiNsGetAttachedObject (Info->ResolvedNode); -        if (!Info->ObjDesc) -        { -            ACPI_ERROR ((AE_INFO, "Control method has no attached sub-object")); -            return_ACPI_STATUS (AE_NULL_OBJECT); -        } +    case ACPI_TYPE_METHOD: +        /* +         * 2) Object is a control method - execute it +         */ -        /* Count the number of arguments being passed to the method */ +        /* Verify that there is a method object associated with this node */ -        if (Info->Parameters) +        if (!Info->ObjDesc)          { -            while (Info->Parameters[Info->ParamCount]) -            { -                if (Info->ParamCount > ACPI_METHOD_MAX_ARG) -                { -                    return_ACPI_STATUS (AE_LIMIT); -                } -                Info->ParamCount++; -            } +            ACPI_ERROR ((AE_INFO, "%s: Method has no attached sub-object", +                Info->FullPathname)); +            Status = AE_NULL_OBJECT; +            goto Cleanup;          } -        ACPI_DUMP_PATHNAME (Info->ResolvedNode, "ACPI: Execute Method", -            ACPI_LV_INFO, _COMPONENT); -          ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, -            "Method at AML address %p Length %X\n", +            "**** Execute method [%s] at AML address %p length %X\n", +            Info->FullPathname,              Info->ObjDesc->Method.AmlStart + 1,              Info->ObjDesc->Method.AmlLength - 1)); @@ -196,80 +252,58 @@ AcpiNsEvaluate (          AcpiExEnterInterpreter ();          Status = AcpiPsExecuteMethod (Info);          AcpiExExitInterpreter (); -    } -    else -    { +        break; + +    default:          /* -         * 2) Object is not a method, return its current value -         * -         * Disallow certain object types. For these, "evaluation" is undefined. +         * 3) All other non-method objects -- get the current object value           */ -        switch (Info->ResolvedNode->Type) -        { -        case ACPI_TYPE_DEVICE: -        case ACPI_TYPE_EVENT: -        case ACPI_TYPE_MUTEX: -        case ACPI_TYPE_REGION: -        case ACPI_TYPE_THERMAL: -        case ACPI_TYPE_LOCAL_SCOPE: - -            ACPI_ERROR ((AE_INFO, -                "[%4.4s] Evaluation of object type [%s] is not supported", -                Info->ResolvedNode->Name.Ascii, -                AcpiUtGetTypeName (Info->ResolvedNode->Type))); - -            return_ACPI_STATUS (AE_TYPE); - -        default: -            break; -        }          /* -         * Objects require additional resolution steps (e.g., the Node may be -         * a field that must be read, etc.) -- we can't just grab the object -         * out of the node. +         * Some objects require additional resolution steps (e.g., the Node +         * may be a field that must be read, etc.) -- we can't just grab +         * the object out of the node.           *           * Use ResolveNodeToValue() to get the associated value.           *           * NOTE: we can get away with passing in NULL for a walk state because -         * ResolvedNode is guaranteed to not be a reference to either a method +         * the Node is guaranteed to not be a reference to either a method           * local or a method argument (because this interface is never called           * from a running method.)           *           * Even though we do not directly invoke the interpreter for object -         * resolution, we must lock it because we could access an opregion. -         * The opregion access code assumes that the interpreter is locked. +         * resolution, we must lock it because we could access an OpRegion. +         * The OpRegion access code assumes that the interpreter is locked.           */          AcpiExEnterInterpreter (); -        /* Function has a strange interface */ +        /* TBD: ResolveNodeToValue has a strange interface, fix */ + +        Info->ReturnObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->Node); -        Status = AcpiExResolveNodeToValue (&Info->ResolvedNode, NULL); +        Status = AcpiExResolveNodeToValue (ACPI_CAST_INDIRECT_PTR ( +            ACPI_NAMESPACE_NODE, &Info->ReturnObject), NULL);          AcpiExExitInterpreter (); -        /* -         * If AcpiExResolveNodeToValue() succeeded, the return value was placed -         * in ResolvedNode. -         */ -        if (ACPI_SUCCESS (Status)) +        if (ACPI_FAILURE (Status))          { -            Status = AE_CTRL_RETURN_VALUE; -            Info->ReturnObject = -                ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->ResolvedNode); - -            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n", -                Info->ReturnObject, -                AcpiUtGetObjectTypeName (Info->ReturnObject))); +            goto Cleanup;          } + +        ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returned object %p [%s]\n", +            Info->ReturnObject, +            AcpiUtGetObjectTypeName (Info->ReturnObject))); + +        Status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */ +        break;      }      /* -     * Check input argument count against the ASL-defined count for a method. -     * Also check predefined names: argument count and return value against -     * the ACPI specification. Some incorrect return value types are repaired. +     * For predefined names, check the return value against the ACPI +     * specification. Some incorrect return value types are repaired.       */ -    (void) AcpiNsCheckPredefinedNames (Node, Info->ParamCount, -                Status, &Info->ReturnObject); +    (void) AcpiNsCheckReturnValue (Info->Node, Info, Info->ParamCount, +        Status, &Info->ReturnObject);      /* Check if there is a return value that must be dealt with */ @@ -289,12 +323,16 @@ AcpiNsEvaluate (      }      ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, -        "*** Completed evaluation of object %s ***\n", Info->Pathname)); +        "*** Completed evaluation of object %s ***\n", +        Info->RelativePathname)); +Cleanup:      /*       * Namespace was unlocked by the handling AcpiNs* function, so we -     * just return +     * just free the pathname and return       */ +    ACPI_FREE (Info->FullPathname); +    Info->FullPathname = NULL;      return_ACPI_STATUS (Status);  } diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 2fcee18bca8c..ee5dcdf2c7f9 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -198,7 +198,7 @@ AcpiNsInitializeDevices (       * part of the ACPI specification.       */      Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; -    Info.EvaluateInfo->Pathname = METHOD_NAME__INI; +    Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;      Info.EvaluateInfo->Parameters = NULL;      Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -610,7 +610,7 @@ AcpiNsInitOneDevice (          ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));      Info->PrefixNode = DeviceNode; -    Info->Pathname = METHOD_NAME__INI; +    Info->RelativePathname = METHOD_NAME__INI;      Info->Parameters = NULL;      Info->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -625,7 +625,7 @@ AcpiNsInitOneDevice (      {          /* Ignore error and move on to next device */ -        char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode); +        char *ScopeName = AcpiNsGetExternalPathname (Info->Node);          ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",              ScopeName)); diff --git a/source/components/namespace/nspredef.c b/source/components/namespace/nspredef.c index a9250e36207c..aff90d8f8a77 100644 --- a/source/components/namespace/nspredef.c +++ b/source/components/namespace/nspredef.c @@ -63,12 +63,12 @@   * There are several areas that are validated:   *   *  1) The number of input arguments as defined by the method/object in the - *      ASL is validated against the ACPI specification. + *     ASL is validated against the ACPI specification.   *  2) The type of the return object (if any) is validated against the ACPI - *      specification. + *     specification.   *  3) For returned package objects, the count of package elements is - *      validated, as well as the type of each package element. Nested - *      packages are supported. + *     validated, as well as the type of each package element. Nested + *     packages are supported.   *   * For any problems found, a warning message is issued.   * @@ -79,7 +79,7 @@  static ACPI_STATUS  AcpiNsCheckReference ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      ACPI_OPERAND_OBJECT         *ReturnObject);  static UINT32 @@ -89,9 +89,10 @@ AcpiNsGetBitmappedType (  /*******************************************************************************   * - * FUNCTION:    AcpiNsCheckPredefinedNames + * FUNCTION:    AcpiNsCheckReturnValue   *   * PARAMETERS:  Node            - Namespace node for the method/object + *              Info            - Method execution information block   *              UserParamCount  - Number of parameters actually passed   *              ReturnStatus    - Status from the object evaluation   *              ReturnObjectPtr - Pointer to the object returned from the @@ -99,56 +100,38 @@ AcpiNsGetBitmappedType (   *   * RETURN:      Status   * - * DESCRIPTION: Check an ACPI name for a match in the predefined name list. + * DESCRIPTION: Check the value returned from a predefined name.   *   ******************************************************************************/  ACPI_STATUS -AcpiNsCheckPredefinedNames ( +AcpiNsCheckReturnValue (      ACPI_NAMESPACE_NODE         *Node, +    ACPI_EVALUATE_INFO          *Info,      UINT32                      UserParamCount,      ACPI_STATUS                 ReturnStatus,      ACPI_OPERAND_OBJECT         **ReturnObjectPtr)  { -    ACPI_STATUS                 Status = AE_OK; +    ACPI_STATUS                 Status;      const ACPI_PREDEFINED_INFO  *Predefined; -    char                        *Pathname; -    ACPI_PREDEFINED_DATA        *Data; - - -    /* Match the name for this method/object against the predefined list */ - -    Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); -    /* Get the full pathname to the object, for use in warning messages */ - -    Pathname = AcpiNsGetExternalPathname (Node); -    if (!Pathname) -    { -        return (AE_OK); /* Could not get pathname, ignore */ -    } - -    /* -     * Check that the parameter count for this method matches the ASL -     * definition. For predefined names, ensure that both the caller and -     * the method itself are in accordance with the ACPI specification. -     */ -    AcpiNsCheckParameterCount (Pathname, Node, UserParamCount, Predefined);      /* If not a predefined name, we cannot validate the return object */ +    Predefined = Info->Predefined;      if (!Predefined)      { -        goto Cleanup; +        return (AE_OK);      }      /*       * If the method failed or did not actually return an object, we cannot       * validate the return object       */ -    if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) +    if ((ReturnStatus != AE_OK) && +        (ReturnStatus != AE_CTRL_RETURN_VALUE))      { -        goto Cleanup; +        return (AE_OK);      }      /* @@ -168,27 +151,15 @@ AcpiNsCheckPredefinedNames (          (!Predefined->Info.ExpectedBtypes) ||          (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL))      { -        goto Cleanup; -    } - -    /* Create the parameter data block for object validation */ - -    Data = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PREDEFINED_DATA)); -    if (!Data) -    { -        goto Cleanup; +        return (AE_OK);      } -    Data->Predefined = Predefined; -    Data->Node = Node; -    Data->NodeFlags = Node->Flags; -    Data->Pathname = Pathname;      /*       * Check that the type of the main return object is what is expected       * for this predefined name       */ -    Status = AcpiNsCheckObjectType (Data, ReturnObjectPtr, -                Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); +    Status = AcpiNsCheckObjectType (Info, ReturnObjectPtr, +        Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT);      if (ACPI_FAILURE (Status))      {          goto Exit; @@ -200,8 +171,8 @@ AcpiNsCheckPredefinedNames (       */      if ((*ReturnObjectPtr)->Common.Type == ACPI_TYPE_PACKAGE)      { -        Data->ParentPackage = *ReturnObjectPtr; -        Status = AcpiNsCheckPackage (Data, ReturnObjectPtr); +        Info->ParentPackage = *ReturnObjectPtr; +        Status = AcpiNsCheckPackage (Info, ReturnObjectPtr);          if (ACPI_FAILURE (Status))          {              goto Exit; @@ -216,7 +187,7 @@ AcpiNsCheckPredefinedNames (       * performed on a per-name basis, i.e., the code is specific to       * particular predefined names.       */ -    Status = AcpiNsComplexRepairs (Data, Node, Status, ReturnObjectPtr); +    Status = AcpiNsComplexRepairs (Info, Node, Status, ReturnObjectPtr);  Exit:      /* @@ -224,119 +195,21 @@ Exit:       * or more objects, mark the parent node to suppress further warning       * messages during the next evaluation of the same method/object.       */ -    if (ACPI_FAILURE (Status) || (Data->Flags & ACPI_OBJECT_REPAIRED)) +    if (ACPI_FAILURE (Status) || +       (Info->ReturnFlags & ACPI_OBJECT_REPAIRED))      {          Node->Flags |= ANOBJ_EVALUATED;      } -    ACPI_FREE (Data); -Cleanup: -    ACPI_FREE (Pathname);      return (Status);  }  /*******************************************************************************   * - * FUNCTION:    AcpiNsCheckParameterCount - * - * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs) - *              Node            - Namespace node for the method/object - *              UserParamCount  - Number of args passed in by the caller - *              Predefined      - Pointer to entry in predefined name table - * - * RETURN:      None - * - * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a - *              predefined name is what is expected (i.e., what is defined in - *              the ACPI specification for this predefined name.) - * - ******************************************************************************/ - -void -AcpiNsCheckParameterCount ( -    char                        *Pathname, -    ACPI_NAMESPACE_NODE         *Node, -    UINT32                      UserParamCount, -    const ACPI_PREDEFINED_INFO  *Predefined) -{ -    UINT32                      ParamCount; -    UINT32                      RequiredParamsCurrent; -    UINT32                      RequiredParamsOld; - - -    /* Methods have 0-7 parameters. All other types have zero. */ - -    ParamCount = 0; -    if (Node->Type == ACPI_TYPE_METHOD) -    { -        ParamCount = Node->Object->Method.ParamCount; -    } - -    if (!Predefined) -    { -        /* -         * Check the parameter count for non-predefined methods/objects. -         * -         * Warning if too few or too many arguments have been passed by the -         * caller. An incorrect number of arguments may not cause the method -         * to fail. However, the method will fail if there are too few -         * arguments and the method attempts to use one of the missing ones. -         */ -        if (UserParamCount < ParamCount) -        { -            ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, -                "Insufficient arguments - needs %u, found %u", -                ParamCount, UserParamCount)); -        } -        else if (UserParamCount > ParamCount) -        { -            ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, -                "Excess arguments - needs %u, found %u", -                ParamCount, UserParamCount)); -        } -        return; -    } - -    /* -     * Validate the user-supplied parameter count. -     * Allow two different legal argument counts (_SCP, etc.) -     */ -    RequiredParamsCurrent = Predefined->Info.ArgumentList & METHOD_ARG_MASK; -    RequiredParamsOld = Predefined->Info.ArgumentList >> METHOD_ARG_BIT_WIDTH; - -    if (UserParamCount != ACPI_UINT32_MAX) -    { -        if ((UserParamCount != RequiredParamsCurrent) && -            (UserParamCount != RequiredParamsOld)) -        { -            ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, -                "Parameter count mismatch - " -                "caller passed %u, ACPI requires %u", -                UserParamCount, RequiredParamsCurrent)); -        } -    } - -    /* -     * Check that the ASL-defined parameter count is what is expected for -     * this predefined name (parameter count as defined by the ACPI -     * specification) -     */ -    if ((ParamCount != RequiredParamsCurrent) && -        (ParamCount != RequiredParamsOld)) -    { -        ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, Node->Flags, -            "Parameter count mismatch - ASL declared %u, ACPI requires %u", -            ParamCount, RequiredParamsCurrent)); -    } -} - - -/******************************************************************************* - *   * FUNCTION:    AcpiNsCheckObjectType   * - * PARAMETERS:  Data            - Pointer to validation data structure + * PARAMETERS:  Info            - Method execution information block   *              ReturnObjectPtr - Pointer to the object returned from the   *                                evaluation of a method or object   *              ExpectedBtypes  - Bitmap of expected return type(s) @@ -353,7 +226,7 @@ AcpiNsCheckParameterCount (  ACPI_STATUS  AcpiNsCheckObjectType ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      ACPI_OPERAND_OBJECT         **ReturnObjectPtr,      UINT32                      ExpectedBtypes,      UINT32                      PackageIndex) @@ -368,7 +241,7 @@ AcpiNsCheckObjectType (      if (ReturnObject &&          ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED)      { -        ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,              "Invalid return type - Found a Namespace node [%4.4s] type %s",              ReturnObject->Node.Name.Ascii,              AcpiUtGetTypeName (ReturnObject->Node.Type))); @@ -383,8 +256,8 @@ AcpiNsCheckObjectType (       * from all of the predefined names (including elements of returned       * packages)       */ -    Data->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject); -    if (Data->ReturnBtype == ACPI_RTYPE_ANY) +    Info->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject); +    if (Info->ReturnBtype == ACPI_RTYPE_ANY)      {          /* Not one of the supported objects, must be incorrect */          goto TypeErrorExit; @@ -392,17 +265,20 @@ AcpiNsCheckObjectType (      /* For reference objects, check that the reference type is correct */ -    if ((Data->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE) +    if ((Info->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE)      { -        Status = AcpiNsCheckReference (Data, ReturnObject); +        Status = AcpiNsCheckReference (Info, ReturnObject);          return (Status);      }      /* Attempt simple repair of the returned object if necessary */ -    Status = AcpiNsSimpleRepair (Data, ExpectedBtypes, -                PackageIndex, ReturnObjectPtr); -    return (Status); +    Status = AcpiNsSimpleRepair (Info, ExpectedBtypes, +        PackageIndex, ReturnObjectPtr); +    if (ACPI_SUCCESS (Status)) +    { +        return (AE_OK); /* Successful repair */ +    }  TypeErrorExit: @@ -413,13 +289,13 @@ TypeErrorExit:      if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)      { -        ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,              "Return type mismatch - found %s, expected %s",              AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));      }      else      { -        ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,              "Return Package type mismatch at index %u - "              "found %s, expected %s", PackageIndex,              AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); @@ -433,7 +309,7 @@ TypeErrorExit:   *   * FUNCTION:    AcpiNsCheckReference   * - * PARAMETERS:  Data            - Pointer to validation data structure + * PARAMETERS:  Info            - Method execution information block   *              ReturnObject    - Object returned from the evaluation of a   *                                method or object   * @@ -447,7 +323,7 @@ TypeErrorExit:  static ACPI_STATUS  AcpiNsCheckReference ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      ACPI_OPERAND_OBJECT         *ReturnObject)  { @@ -461,7 +337,7 @@ AcpiNsCheckReference (          return (AE_OK);      } -    ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +    ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,          "Return type mismatch - unexpected reference object type [%s] %2.2X",          AcpiUtGetReferenceName (ReturnObject),          ReturnObject->Reference.Class)); diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index d18205c83fd7..5177c3dd6c06 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -55,14 +55,14 @@  static ACPI_STATUS  AcpiNsCheckPackageList ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      const ACPI_PREDEFINED_INFO  *Package,      ACPI_OPERAND_OBJECT         **Elements,      UINT32                      Count);  static ACPI_STATUS  AcpiNsCheckPackageElements ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      ACPI_OPERAND_OBJECT         **Elements,      UINT8                       Type1,      UINT32                      Count1, @@ -75,7 +75,7 @@ AcpiNsCheckPackageElements (   *   * FUNCTION:    AcpiNsCheckPackage   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObjectPtr     - Pointer to the object returned from the   *                                    evaluation of a method or object   * @@ -88,7 +88,7 @@ AcpiNsCheckPackageElements (  ACPI_STATUS  AcpiNsCheckPackage ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      ACPI_OPERAND_OBJECT         **ReturnObjectPtr)  {      ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr; @@ -105,17 +105,18 @@ AcpiNsCheckPackage (      /* The package info for this name is in the next table entry */ -    Package = Data->Predefined + 1; +    Package = Info->Predefined + 1;      ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,          "%s Validating return Package of Type %X, Count %X\n", -        Data->Pathname, Package->RetInfo.Type, ReturnObject->Package.Count)); +        Info->FullPathname, Package->RetInfo.Type, +        ReturnObject->Package.Count));      /*       * For variable-length Packages, we can safely remove all embedded       * and trailing NULL package elements       */ -    AcpiNsRemoveNullElements (Data, Package->RetInfo.Type, ReturnObject); +    AcpiNsRemoveNullElements (Info, Package->RetInfo.Type, ReturnObject);      /* Extract package count and elements array */ @@ -133,7 +134,7 @@ AcpiNsCheckPackage (              return (AE_OK);          } -        ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,              "Return Package has no elements (empty)"));          return (AE_AML_OPERAND_VALUE); @@ -165,12 +166,12 @@ AcpiNsCheckPackage (              ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,                  "%s: Return Package is larger than needed - "                  "found %u, expected %u\n", -                Data->Pathname, Count, ExpectedCount)); +                Info->FullPathname, Count, ExpectedCount));          }          /* Validate all elements of the returned package */ -        Status = AcpiNsCheckPackageElements (Data, Elements, +        Status = AcpiNsCheckPackageElements (Info, Elements,                      Package->RetInfo.ObjectType1, Package->RetInfo.Count1,                      Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0);          break; @@ -184,7 +185,7 @@ AcpiNsCheckPackage (           */          for (i = 0; i < Count; i++)          { -            Status = AcpiNsCheckObjectType (Data, Elements, +            Status = AcpiNsCheckObjectType (Info, Elements,                          Package->RetInfo.ObjectType1, i);              if (ACPI_FAILURE (Status))              { @@ -218,7 +219,7 @@ AcpiNsCheckPackage (              {                  /* These are the required package elements (0, 1, or 2) */ -                Status = AcpiNsCheckObjectType (Data, Elements, +                Status = AcpiNsCheckObjectType (Info, Elements,                              Package->RetInfo3.ObjectType[i], i);                  if (ACPI_FAILURE (Status))                  { @@ -229,7 +230,7 @@ AcpiNsCheckPackage (              {                  /* These are the optional package elements */ -                Status = AcpiNsCheckObjectType (Data, Elements, +                Status = AcpiNsCheckObjectType (Info, Elements,                              Package->RetInfo3.TailObjectType, i);                  if (ACPI_FAILURE (Status))                  { @@ -245,7 +246,7 @@ AcpiNsCheckPackage (          /* First element is the (Integer) revision */ -        Status = AcpiNsCheckObjectType (Data, Elements, +        Status = AcpiNsCheckObjectType (Info, Elements,                      ACPI_RTYPE_INTEGER, 0);          if (ACPI_FAILURE (Status))          { @@ -257,7 +258,7 @@ AcpiNsCheckPackage (          /* Examine the sub-packages */ -        Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); +        Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);          break; @@ -265,7 +266,7 @@ AcpiNsCheckPackage (          /* First element is the (Integer) count of sub-packages to follow */ -        Status = AcpiNsCheckObjectType (Data, Elements, +        Status = AcpiNsCheckObjectType (Info, Elements,                      ACPI_RTYPE_INTEGER, 0);          if (ACPI_FAILURE (Status))          { @@ -287,7 +288,7 @@ AcpiNsCheckPackage (          /* Examine the sub-packages */ -        Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); +        Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);          break; @@ -311,7 +312,7 @@ AcpiNsCheckPackage (          {              /* Create the new outer package and populate it */ -            Status = AcpiNsWrapWithPackage (Data, ReturnObject, ReturnObjectPtr); +            Status = AcpiNsWrapWithPackage (Info, ReturnObject, ReturnObjectPtr);              if (ACPI_FAILURE (Status))              {                  return (Status); @@ -326,7 +327,7 @@ AcpiNsCheckPackage (          /* Examine the sub-packages */ -        Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); +        Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);          break; @@ -334,7 +335,7 @@ AcpiNsCheckPackage (          /* Should not get here if predefined info table is correct */ -        ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,              "Invalid internal return type in table entry: %X",              Package->RetInfo.Type)); @@ -348,7 +349,7 @@ PackageTooSmall:      /* Error exit for the case with an incorrect package count */ -    ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +    ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,          "Return Package is too small - found %u elements, expected %u",          Count, ExpectedCount)); @@ -360,7 +361,7 @@ PackageTooSmall:   *   * FUNCTION:    AcpiNsCheckPackageList   * - * PARAMETERS:  Data            - Pointer to validation data structure + * PARAMETERS:  Info            - Method execution information block   *              Package         - Pointer to package-specific info for method   *              Elements        - Element list of parent package. All elements   *                                of this list should be of type Package. @@ -374,7 +375,7 @@ PackageTooSmall:  static ACPI_STATUS  AcpiNsCheckPackageList ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      const ACPI_PREDEFINED_INFO  *Package,      ACPI_OPERAND_OBJECT         **Elements,      UINT32                      Count) @@ -398,11 +399,11 @@ AcpiNsCheckPackageList (      {          SubPackage = *Elements;          SubElements = SubPackage->Package.Elements; -        Data->ParentPackage = SubPackage; +        Info->ParentPackage = SubPackage;          /* Each sub-object must be of type Package */ -        Status = AcpiNsCheckObjectType (Data, &SubPackage, +        Status = AcpiNsCheckObjectType (Info, &SubPackage,                      ACPI_RTYPE_PACKAGE, i);          if (ACPI_FAILURE (Status))          { @@ -411,7 +412,7 @@ AcpiNsCheckPackageList (          /* Examine the different types of expected sub-packages */ -        Data->ParentPackage = SubPackage; +        Info->ParentPackage = SubPackage;          switch (Package->RetInfo.Type)          {          case ACPI_PTYPE2: @@ -426,7 +427,7 @@ AcpiNsCheckPackageList (                  goto PackageTooSmall;              } -            Status = AcpiNsCheckPackageElements (Data, SubElements, +            Status = AcpiNsCheckPackageElements (Info, SubElements,                          Package->RetInfo.ObjectType1,                          Package->RetInfo.Count1,                          Package->RetInfo.ObjectType2, @@ -449,7 +450,7 @@ AcpiNsCheckPackageList (                  goto PackageTooSmall;              } -            Status = AcpiNsCheckPackageElements (Data, SubElements, +            Status = AcpiNsCheckPackageElements (Info, SubElements,                          Package->RetInfo.ObjectType1,                          Package->RetInfo.Count1,                          Package->RetInfo.ObjectType2, @@ -475,7 +476,7 @@ AcpiNsCheckPackageList (              for (j = 0; j < ExpectedCount; j++)              { -                Status = AcpiNsCheckObjectType (Data, &SubElements[j], +                Status = AcpiNsCheckObjectType (Info, &SubElements[j],                              Package->RetInfo2.ObjectType[j], j);                  if (ACPI_FAILURE (Status))                  { @@ -497,7 +498,7 @@ AcpiNsCheckPackageList (              /* Check the type of each sub-package element */ -            Status = AcpiNsCheckPackageElements (Data, SubElements, +            Status = AcpiNsCheckPackageElements (Info, SubElements,                          Package->RetInfo.ObjectType1,                          SubPackage->Package.Count, 0, 0, 0);              if (ACPI_FAILURE (Status)) @@ -513,7 +514,7 @@ AcpiNsCheckPackageList (               * First element is the (Integer) count of elements, including               * the count field (the ACPI name is NumElements)               */ -            Status = AcpiNsCheckObjectType (Data, SubElements, +            Status = AcpiNsCheckObjectType (Info, SubElements,                          ACPI_RTYPE_INTEGER, 0);              if (ACPI_FAILURE (Status))              { @@ -548,7 +549,7 @@ AcpiNsCheckPackageList (              /* Check the type of each sub-package element */ -            Status = AcpiNsCheckPackageElements (Data, (SubElements + 1), +            Status = AcpiNsCheckPackageElements (Info, (SubElements + 1),                          Package->RetInfo.ObjectType1,                          (ExpectedCount - 1), 0, 0, 1);              if (ACPI_FAILURE (Status)) @@ -573,7 +574,7 @@ PackageTooSmall:      /* The sub-package count was smaller than required */ -    ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +    ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,          "Return Sub-Package[%u] is too small - found %u elements, expected %u",          i, SubPackage->Package.Count, ExpectedCount)); @@ -585,7 +586,7 @@ PackageTooSmall:   *   * FUNCTION:    AcpiNsCheckPackageElements   * - * PARAMETERS:  Data            - Pointer to validation data structure + * PARAMETERS:  Info            - Method execution information block   *              Elements        - Pointer to the package elements array   *              Type1           - Object type for first group   *              Count1          - Count for first group @@ -602,7 +603,7 @@ PackageTooSmall:  static ACPI_STATUS  AcpiNsCheckPackageElements ( -    ACPI_PREDEFINED_DATA        *Data, +    ACPI_EVALUATE_INFO          *Info,      ACPI_OPERAND_OBJECT         **Elements,      UINT8                       Type1,      UINT32                      Count1, @@ -622,7 +623,7 @@ AcpiNsCheckPackageElements (       */      for (i = 0; i < Count1; i++)      { -        Status = AcpiNsCheckObjectType (Data, ThisElement, +        Status = AcpiNsCheckObjectType (Info, ThisElement,                      Type1, i + StartIndex);          if (ACPI_FAILURE (Status))          { @@ -633,7 +634,7 @@ AcpiNsCheckPackageElements (      for (i = 0; i < Count2; i++)      { -        Status = AcpiNsCheckObjectType (Data, ThisElement, +        Status = AcpiNsCheckObjectType (Info, ThisElement,                      Type2, (i + Count1 + StartIndex));          if (ACPI_FAILURE (Status))          { diff --git a/source/components/namespace/nsrepair.c b/source/components/namespace/nsrepair.c index e06502811d33..893ebe50fd0f 100644 --- a/source/components/namespace/nsrepair.c +++ b/source/components/namespace/nsrepair.c @@ -131,7 +131,7 @@ static const ACPI_SIMPLE_REPAIR_INFO    AcpiObjectRepairInfo[] =   *   * FUNCTION:    AcpiNsSimpleRepair   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ExpectedBtypes      - Object types expected   *              PackageIndex        - Index of object within parent package (if   *                                    applicable - ACPI_NOT_PACKAGE_ELEMENT @@ -148,7 +148,7 @@ static const ACPI_SIMPLE_REPAIR_INFO    AcpiObjectRepairInfo[] =  ACPI_STATUS  AcpiNsSimpleRepair ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      UINT32                  ExpectedBtypes,      UINT32                  PackageIndex,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr) @@ -166,13 +166,13 @@ AcpiNsSimpleRepair (       * Special repairs for certain names that are in the repair table.       * Check if this name is in the list of repairable names.       */ -    Predefined = AcpiNsMatchSimpleRepair (Data->Node, -        Data->ReturnBtype, PackageIndex); +    Predefined = AcpiNsMatchSimpleRepair (Info->Node, +        Info->ReturnBtype, PackageIndex);      if (Predefined)      {          if (!ReturnObject)          { -            ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, +            ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,                  ACPI_WARN_ALWAYS, "Missing expected return value"));          } @@ -195,7 +195,7 @@ AcpiNsSimpleRepair (       * Do not perform simple object repair unless the return type is not       * expected.       */ -    if (Data->ReturnBtype & ExpectedBtypes) +    if (Info->ReturnBtype & ExpectedBtypes)      {          return (AE_OK);      } @@ -218,7 +218,7 @@ AcpiNsSimpleRepair (      {          if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE)))          { -            ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, +            ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,                  ACPI_WARN_ALWAYS, "Missing expected return value"));              return (AE_AML_NO_RETURN_VALUE); @@ -259,7 +259,7 @@ AcpiNsSimpleRepair (           * object. Note: after the wrapping, the package will be validated           * for correct contents (expected object type or types).           */ -        Status = AcpiNsWrapWithPackage (Data, ReturnObject, &NewObject); +        Status = AcpiNsWrapWithPackage (Info, ReturnObject, &NewObject);          if (ACPI_SUCCESS (Status))          {              /* @@ -267,7 +267,7 @@ AcpiNsSimpleRepair (               * incremented for being inserted into the new package.               */              *ReturnObjectPtr = NewObject;       /* New Package object */ -            Data->Flags |= ACPI_OBJECT_REPAIRED; +            Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;              return (AE_OK);          }      } @@ -292,7 +292,7 @@ ObjectRepaired:           * package object as part of the repair, we don't need to           * change the reference count.           */ -        if (!(Data->Flags & ACPI_OBJECT_WRAPPED)) +        if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED))          {              NewObject->Common.ReferenceCount =                  ReturnObject->Common.ReferenceCount; @@ -305,14 +305,14 @@ ObjectRepaired:          ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,              "%s: Converted %s to expected %s at Package index %u\n", -            Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject), +            Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),              AcpiUtGetObjectTypeName (NewObject), PackageIndex));      }      else      {          ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,              "%s: Converted %s to expected %s\n", -            Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject), +            Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),              AcpiUtGetObjectTypeName (NewObject)));      } @@ -320,7 +320,7 @@ ObjectRepaired:      AcpiUtRemoveReference (ReturnObject);      *ReturnObjectPtr = NewObject; -    Data->Flags |= ACPI_OBJECT_REPAIRED; +    Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;      return (AE_OK);  } @@ -378,7 +378,7 @@ AcpiNsMatchSimpleRepair (   *   * FUNCTION:    AcpiNsRepairNullElement   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ExpectedBtypes      - Object types expected   *              PackageIndex        - Index of object within parent package (if   *                                    applicable - ACPI_NOT_PACKAGE_ELEMENT @@ -394,7 +394,7 @@ AcpiNsMatchSimpleRepair (  ACPI_STATUS  AcpiNsRepairNullElement ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      UINT32                  ExpectedBtypes,      UINT32                  PackageIndex,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr) @@ -451,14 +451,14 @@ AcpiNsRepairNullElement (      /* Set the reference count according to the parent Package object */ -    NewObject->Common.ReferenceCount = Data->ParentPackage->Common.ReferenceCount; +    NewObject->Common.ReferenceCount = Info->ParentPackage->Common.ReferenceCount;      ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,          "%s: Converted NULL package element to expected %s at index %u\n", -         Data->Pathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex)); +         Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex));      *ReturnObjectPtr = NewObject; -    Data->Flags |= ACPI_OBJECT_REPAIRED; +    Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;      return (AE_OK);  } @@ -467,7 +467,7 @@ AcpiNsRepairNullElement (   *   * FUNCTION:    AcpiNsRemoveNullElements   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              PackageType         - An AcpiReturnPackageTypes value   *              ObjDesc             - A Package object   * @@ -481,7 +481,7 @@ AcpiNsRepairNullElement (  void  AcpiNsRemoveNullElements ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      UINT8                   PackageType,      ACPI_OPERAND_OBJECT     *ObjDesc)  { @@ -546,7 +546,7 @@ AcpiNsRemoveNullElements (      {          ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,              "%s: Found and removed %u NULL elements\n", -            Data->Pathname, (Count - NewCount))); +            Info->FullPathname, (Count - NewCount)));          /* NULL terminate list and update the package count */ @@ -560,7 +560,7 @@ AcpiNsRemoveNullElements (   *   * FUNCTION:    AcpiNsWrapWithPackage   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              OriginalObject      - Pointer to the object to repair.   *              ObjDescPtr          - The new package object is returned here   * @@ -582,7 +582,7 @@ AcpiNsRemoveNullElements (  ACPI_STATUS  AcpiNsWrapWithPackage ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     *OriginalObject,      ACPI_OPERAND_OBJECT     **ObjDescPtr)  { @@ -606,11 +606,11 @@ AcpiNsWrapWithPackage (      ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,          "%s: Wrapped %s with expected Package object\n", -        Data->Pathname, AcpiUtGetObjectTypeName (OriginalObject))); +        Info->FullPathname, AcpiUtGetObjectTypeName (OriginalObject)));      /* Return the new object in the object pointer */      *ObjDescPtr = PkgObjDesc; -    Data->Flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED; +    Info->ReturnFlags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;      return (AE_OK);  } diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index b81c0dd0d52e..63fb36dd279a 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -58,7 +58,7 @@   */  typedef  ACPI_STATUS (*ACPI_REPAIR_FUNCTION) ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr);  typedef struct acpi_repair_info @@ -77,37 +77,37 @@ AcpiNsMatchComplexRepair (  static ACPI_STATUS  AcpiNsRepair_ALR ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr);  static ACPI_STATUS  AcpiNsRepair_CID ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr);  static ACPI_STATUS  AcpiNsRepair_FDE ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr);  static ACPI_STATUS  AcpiNsRepair_HID ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr);  static ACPI_STATUS  AcpiNsRepair_PSS ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr);  static ACPI_STATUS  AcpiNsRepair_TSS ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr);  static ACPI_STATUS  AcpiNsCheckSortedList ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     *ReturnObject,      UINT32                  ExpectedCount,      UINT32                  SortIndex, @@ -170,7 +170,7 @@ static const ACPI_REPAIR_INFO       AcpiNsRepairableNames[] =   *   * FUNCTION:    AcpiNsComplexRepairs   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              Node                - Namespace node for the method/object   *              ValidateStatus      - Original status of earlier validation   *              ReturnObjectPtr     - Pointer to the object returned from the @@ -186,7 +186,7 @@ static const ACPI_REPAIR_INFO       AcpiNsRepairableNames[] =  ACPI_STATUS  AcpiNsComplexRepairs ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_NAMESPACE_NODE     *Node,      ACPI_STATUS             ValidateStatus,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr) @@ -203,7 +203,7 @@ AcpiNsComplexRepairs (          return (ValidateStatus);      } -    Status = Predefined->RepairFunction (Data, ReturnObjectPtr); +    Status = Predefined->RepairFunction (Info, ReturnObjectPtr);      return (Status);  } @@ -247,7 +247,7 @@ AcpiNsMatchComplexRepair (   *   * FUNCTION:    AcpiNsRepair_ALR   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObjectPtr     - Pointer to the object returned from the   *                                    evaluation of a method or object   * @@ -260,14 +260,14 @@ AcpiNsMatchComplexRepair (  static ACPI_STATUS  AcpiNsRepair_ALR ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr)  {      ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr;      ACPI_STATUS             Status; -    Status = AcpiNsCheckSortedList (Data, ReturnObject, 2, 1, +    Status = AcpiNsCheckSortedList (Info, ReturnObject, 2, 1,                  ACPI_SORT_ASCENDING, "AmbientIlluminance");      return (Status); @@ -278,7 +278,7 @@ AcpiNsRepair_ALR (   *   * FUNCTION:    AcpiNsRepair_FDE   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObjectPtr     - Pointer to the object returned from the   *                                    evaluation of a method or object   * @@ -293,7 +293,7 @@ AcpiNsRepair_ALR (  static ACPI_STATUS  AcpiNsRepair_FDE ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr)  {      ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr; @@ -321,7 +321,7 @@ AcpiNsRepair_FDE (          if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE)          { -            ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +            ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,                  "Incorrect return buffer length %u, expected %u",                  ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE)); @@ -350,7 +350,7 @@ AcpiNsRepair_FDE (          ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,              "%s Expanded Byte Buffer to expected DWord Buffer\n", -            Data->Pathname)); +            Info->FullPathname));          break;      default: @@ -362,7 +362,7 @@ AcpiNsRepair_FDE (      AcpiUtRemoveReference (ReturnObject);      *ReturnObjectPtr = BufferObject; -    Data->Flags |= ACPI_OBJECT_REPAIRED; +    Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;      return (AE_OK);  } @@ -371,7 +371,7 @@ AcpiNsRepair_FDE (   *   * FUNCTION:    AcpiNsRepair_CID   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObjectPtr     - Pointer to the object returned from the   *                                    evaluation of a method or object   * @@ -385,7 +385,7 @@ AcpiNsRepair_FDE (  static ACPI_STATUS  AcpiNsRepair_CID ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr)  {      ACPI_STATUS             Status; @@ -400,7 +400,7 @@ AcpiNsRepair_CID (      if (ReturnObject->Common.Type == ACPI_TYPE_STRING)      { -        Status = AcpiNsRepair_HID (Data, ReturnObjectPtr); +        Status = AcpiNsRepair_HID (Info, ReturnObjectPtr);          return (Status);      } @@ -419,7 +419,7 @@ AcpiNsRepair_CID (          OriginalElement = *ElementPtr;          OriginalRefCount = OriginalElement->Common.ReferenceCount; -        Status = AcpiNsRepair_HID (Data, ElementPtr); +        Status = AcpiNsRepair_HID (Info, ElementPtr);          if (ACPI_FAILURE (Status))          {              return (Status); @@ -448,7 +448,7 @@ AcpiNsRepair_CID (   *   * FUNCTION:    AcpiNsRepair_HID   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObjectPtr     - Pointer to the object returned from the   *                                    evaluation of a method or object   * @@ -461,7 +461,7 @@ AcpiNsRepair_CID (  static ACPI_STATUS  AcpiNsRepair_HID ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr)  {      ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr; @@ -482,12 +482,12 @@ AcpiNsRepair_HID (      if (ReturnObject->String.Length == 0)      { -        ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,              "Invalid zero-length _HID or _CID string"));          /* Return AE_OK anyway, let driver handle it */ -        Data->Flags |= ACPI_OBJECT_REPAIRED; +        Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;          return (AE_OK);      } @@ -512,7 +512,7 @@ AcpiNsRepair_HID (          NewString->String.Length--;          ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, -            "%s: Removed invalid leading asterisk\n", Data->Pathname)); +            "%s: Removed invalid leading asterisk\n", Info->FullPathname));      }      /* @@ -538,7 +538,7 @@ AcpiNsRepair_HID (   *   * FUNCTION:    AcpiNsRepair_TSS   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObjectPtr     - Pointer to the object returned from the   *                                    evaluation of a method or object   * @@ -551,7 +551,7 @@ AcpiNsRepair_HID (  static ACPI_STATUS  AcpiNsRepair_TSS ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr)  {      ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr; @@ -567,13 +567,14 @@ AcpiNsRepair_TSS (       * In this case, it is best to just return the _TSS package as-is.       * (May, 2011)       */ -    Status = AcpiNsGetNode (Data->Node, "^_PSS", ACPI_NS_NO_UPSEARCH, &Node); +    Status = AcpiNsGetNode (Info->Node, "^_PSS", +        ACPI_NS_NO_UPSEARCH, &Node);      if (ACPI_SUCCESS (Status))      {          return (AE_OK);      } -    Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1, +    Status = AcpiNsCheckSortedList (Info, ReturnObject, 5, 1,                  ACPI_SORT_DESCENDING, "PowerDissipation");      return (Status); @@ -584,7 +585,7 @@ AcpiNsRepair_TSS (   *   * FUNCTION:    AcpiNsRepair_PSS   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObjectPtr     - Pointer to the object returned from the   *                                    evaluation of a method or object   * @@ -599,7 +600,7 @@ AcpiNsRepair_TSS (  static ACPI_STATUS  AcpiNsRepair_PSS ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr)  {      ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr; @@ -618,7 +619,7 @@ AcpiNsRepair_PSS (       * incorrectly sorted, sort it. We sort by CpuFrequency, since this       * should be proportional to the power.       */ -    Status =AcpiNsCheckSortedList (Data, ReturnObject, 6, 0, +    Status =AcpiNsCheckSortedList (Info, ReturnObject, 6, 0,                  ACPI_SORT_DESCENDING, "CpuFrequency");      if (ACPI_FAILURE (Status))      { @@ -640,7 +641,7 @@ AcpiNsRepair_PSS (          if ((UINT32) ObjDesc->Integer.Value > PreviousValue)          { -            ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, +            ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,                  "SubPackage[%u,%u] - suspicious power dissipation values",                  i-1, i));          } @@ -657,7 +658,7 @@ AcpiNsRepair_PSS (   *   * FUNCTION:    AcpiNsCheckSortedList   * - * PARAMETERS:  Data                - Pointer to validation data structure + * PARAMETERS:  Info                - Method execution information block   *              ReturnObject        - Pointer to the top-level returned object   *              ExpectedCount       - Minimum length of each sub-package   *              SortIndex           - Sub-package entry to sort on @@ -674,7 +675,7 @@ AcpiNsRepair_PSS (  static ACPI_STATUS  AcpiNsCheckSortedList ( -    ACPI_PREDEFINED_DATA    *Data, +    ACPI_EVALUATE_INFO      *Info,      ACPI_OPERAND_OBJECT     *ReturnObject,      UINT32                  ExpectedCount,      UINT32                  SortIndex, @@ -755,11 +756,11 @@ AcpiNsCheckSortedList (              AcpiNsSortList (ReturnObject->Package.Elements,                  OuterElementCount, SortIndex, SortDirection); -            Data->Flags |= ACPI_OBJECT_REPAIRED; +            Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;              ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,                  "%s: Repaired unsorted list - now sorted by %s\n", -                Data->Pathname, SortKeyName)); +                Info->FullPathname, SortKeyName));              return (AE_OK);          } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 6f13d6697e09..57cc0387797c 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -205,8 +205,6 @@ AcpiEvaluateObject (          return_ACPI_STATUS (AE_NO_MEMORY);      } -    Info->Pathname = Pathname; -      /* Convert and validate the device handle */      Info->PrefixNode = AcpiNsValidateHandle (Handle); @@ -217,17 +215,69 @@ AcpiEvaluateObject (      }      /* -     * If there are parameters to be passed to a control method, the external -     * objects must all be converted to internal objects +     * Get the actual namespace node for the target object. +     * Handles these cases: +     * +     * 1) Null node, valid pathname from root (absolute path) +     * 2) Node and valid pathname (path relative to Node) +     * 3) Node, Null pathname +     */ +    if ((Pathname) && +        (ACPI_IS_ROOT_PREFIX (Pathname[0]))) +    { +        /* The path is fully qualified, just evaluate by name */ + +        Info->PrefixNode = NULL; +    } +    else if (!Handle) +    { +        /* +         * A handle is optional iff a fully qualified pathname is specified. +         * Since we've already handled fully qualified names above, this is +         * an error. +         */ +        if (!Pathname) +        { +            ACPI_DEBUG_PRINT ((ACPI_DB_INFO, +                "Both Handle and Pathname are NULL")); +        } +        else +        { +            ACPI_DEBUG_PRINT ((ACPI_DB_INFO, +                "Null Handle with relative pathname [%s]", Pathname)); +        } + +        Status = AE_BAD_PARAMETER; +        goto Cleanup; +    } + +    Info->RelativePathname = Pathname; + +    /* +     * Convert all external objects passed as arguments to the +     * internal version(s).       */      if (ExternalParams && ExternalParams->Count)      { +        Info->ParamCount = (UINT16) ExternalParams->Count; + +        /* Warn on impossible argument count */ + +        if (Info->ParamCount > ACPI_METHOD_NUM_ARGS) +        { +            ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, +                "Excess arguments (%u) - using only %u", +                Info->ParamCount, ACPI_METHOD_NUM_ARGS)); + +            Info->ParamCount = ACPI_METHOD_NUM_ARGS; +        } +          /*           * Allocate a new parameter block for the internal objects           * Add 1 to count to allow for null terminated internal list           */          Info->Parameters = ACPI_ALLOCATE_ZEROED ( -            ((ACPI_SIZE) ExternalParams->Count + 1) * sizeof (void *)); +            ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *));          if (!Info->Parameters)          {              Status = AE_NO_MEMORY; @@ -236,58 +286,109 @@ AcpiEvaluateObject (          /* Convert each external object in the list to an internal object */ -        for (i = 0; i < ExternalParams->Count; i++) +        for (i = 0; i < Info->ParamCount; i++)          {              Status = AcpiUtCopyEobjectToIobject ( -                        &ExternalParams->Pointer[i], &Info->Parameters[i]); +                &ExternalParams->Pointer[i], &Info->Parameters[i]);              if (ACPI_FAILURE (Status))              {                  goto Cleanup;              }          } -        Info->Parameters[ExternalParams->Count] = NULL; + +        Info->Parameters[Info->ParamCount] = NULL;      } + +#if 0 +      /* -     * Three major cases: -     * 1) Fully qualified pathname -     * 2) No handle, not fully qualified pathname (error) -     * 3) Valid handle +     * Begin incoming argument count analysis. Check for too few args +     * and too many args.       */ -    if ((Pathname) && -        (ACPI_IS_ROOT_PREFIX (Pathname[0]))) -    { -        /* The path is fully qualified, just evaluate by name */ -        Info->PrefixNode = NULL; -        Status = AcpiNsEvaluate (Info); -    } -    else if (!Handle) +    switch (AcpiNsGetType (Info->Node))      { +    case ACPI_TYPE_METHOD: + +        /* Check incoming argument count against the method definition */ + +        if (Info->ObjDesc->Method.ParamCount > Info->ParamCount) +        { +            ACPI_ERROR ((AE_INFO, +                "Insufficient arguments (%u) - %u are required", +                Info->ParamCount, +                Info->ObjDesc->Method.ParamCount)); + +            Status = AE_MISSING_ARGUMENTS; +            goto Cleanup; +        } + +        else if (Info->ObjDesc->Method.ParamCount < Info->ParamCount) +        { +            ACPI_WARNING ((AE_INFO, +                "Excess arguments (%u) - only %u are required", +                Info->ParamCount, +                Info->ObjDesc->Method.ParamCount)); + +            /* Just pass the required number of arguments */ + +            Info->ParamCount = Info->ObjDesc->Method.ParamCount; +        } +          /* -         * A handle is optional iff a fully qualified pathname is specified. -         * Since we've already handled fully qualified names above, this is -         * an error +         * Any incoming external objects to be passed as arguments to the +         * method must be converted to internal objects           */ -        if (!Pathname) +        if (Info->ParamCount)          { -            ACPI_DEBUG_PRINT ((ACPI_DB_INFO, -                "Both Handle and Pathname are NULL")); +            /* +             * Allocate a new parameter block for the internal objects +             * Add 1 to count to allow for null terminated internal list +             */ +            Info->Parameters = ACPI_ALLOCATE_ZEROED ( +                ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *)); +            if (!Info->Parameters) +            { +                Status = AE_NO_MEMORY; +                goto Cleanup; +            } + +            /* Convert each external object in the list to an internal object */ + +            for (i = 0; i < Info->ParamCount; i++) +            { +                Status = AcpiUtCopyEobjectToIobject ( +                    &ExternalParams->Pointer[i], &Info->Parameters[i]); +                if (ACPI_FAILURE (Status)) +                { +                    goto Cleanup; +                } +            } + +            Info->Parameters[Info->ParamCount] = NULL;          } -        else +        break; + +    default: + +        /* Warn if arguments passed to an object that is not a method */ + +        if (Info->ParamCount)          { -            ACPI_DEBUG_PRINT ((ACPI_DB_INFO, -                "Null Handle with relative pathname [%s]", Pathname)); +            ACPI_WARNING ((AE_INFO, +                "%u arguments were passed to a non-method ACPI object", +                Info->ParamCount));          } - -        Status = AE_BAD_PARAMETER; +        break;      } -    else -    { -        /* We have a namespace a node and a possible relative path */ -        Status = AcpiNsEvaluate (Info); -    } +#endif + + +    /* Now we can evaluate the object */ + +    Status = AcpiNsEvaluate (Info);      /*       * If we are expecting a return value, and all went well above,  | 
