Home | History | Annotate | Line # | Download | only in compiler
aslxref.c revision 1.2.10.2
      1  1.2.10.2  tls /******************************************************************************
      2  1.2.10.2  tls  *
      3  1.2.10.2  tls  * Module Name: aslxref - Namespace cross-reference
      4  1.2.10.2  tls  *
      5  1.2.10.2  tls  *****************************************************************************/
      6  1.2.10.2  tls 
      7  1.2.10.2  tls /*
      8  1.2.10.2  tls  * Copyright (C) 2000 - 2013, Intel Corp.
      9  1.2.10.2  tls  * All rights reserved.
     10  1.2.10.2  tls  *
     11  1.2.10.2  tls  * Redistribution and use in source and binary forms, with or without
     12  1.2.10.2  tls  * modification, are permitted provided that the following conditions
     13  1.2.10.2  tls  * are met:
     14  1.2.10.2  tls  * 1. Redistributions of source code must retain the above copyright
     15  1.2.10.2  tls  *    notice, this list of conditions, and the following disclaimer,
     16  1.2.10.2  tls  *    without modification.
     17  1.2.10.2  tls  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.2.10.2  tls  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.2.10.2  tls  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.2.10.2  tls  *    including a substantially similar Disclaimer requirement for further
     21  1.2.10.2  tls  *    binary redistribution.
     22  1.2.10.2  tls  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.2.10.2  tls  *    of any contributors may be used to endorse or promote products derived
     24  1.2.10.2  tls  *    from this software without specific prior written permission.
     25  1.2.10.2  tls  *
     26  1.2.10.2  tls  * Alternatively, this software may be distributed under the terms of the
     27  1.2.10.2  tls  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.2.10.2  tls  * Software Foundation.
     29  1.2.10.2  tls  *
     30  1.2.10.2  tls  * NO WARRANTY
     31  1.2.10.2  tls  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.2.10.2  tls  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.2.10.2  tls  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.2.10.2  tls  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.2.10.2  tls  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.2.10.2  tls  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.2.10.2  tls  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.2.10.2  tls  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.2.10.2  tls  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.2.10.2  tls  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.2.10.2  tls  * POSSIBILITY OF SUCH DAMAGES.
     42  1.2.10.2  tls  */
     43  1.2.10.2  tls 
     44  1.2.10.2  tls 
     45  1.2.10.2  tls #include "aslcompiler.h"
     46  1.2.10.2  tls #include "aslcompiler.y.h"
     47  1.2.10.2  tls #include "acparser.h"
     48  1.2.10.2  tls #include "amlcode.h"
     49  1.2.10.2  tls #include "acnamesp.h"
     50  1.2.10.2  tls #include "acdispat.h"
     51  1.2.10.2  tls 
     52  1.2.10.2  tls 
     53  1.2.10.2  tls #define _COMPONENT          ACPI_COMPILER
     54  1.2.10.2  tls         ACPI_MODULE_NAME    ("aslxref")
     55  1.2.10.2  tls 
     56  1.2.10.2  tls /* Local prototypes */
     57  1.2.10.2  tls 
     58  1.2.10.2  tls static ACPI_STATUS
     59  1.2.10.2  tls XfNamespaceLocateBegin (
     60  1.2.10.2  tls     ACPI_PARSE_OBJECT       *Op,
     61  1.2.10.2  tls     UINT32                  Level,
     62  1.2.10.2  tls     void                    *Context);
     63  1.2.10.2  tls 
     64  1.2.10.2  tls static ACPI_STATUS
     65  1.2.10.2  tls XfNamespaceLocateEnd (
     66  1.2.10.2  tls     ACPI_PARSE_OBJECT       *Op,
     67  1.2.10.2  tls     UINT32                  Level,
     68  1.2.10.2  tls     void                    *Context);
     69  1.2.10.2  tls 
     70  1.2.10.2  tls static BOOLEAN
     71  1.2.10.2  tls XfObjectExists (
     72  1.2.10.2  tls     char                    *Name);
     73  1.2.10.2  tls 
     74  1.2.10.2  tls static ACPI_STATUS
     75  1.2.10.2  tls XfCompareOneNamespaceObject (
     76  1.2.10.2  tls     ACPI_HANDLE             ObjHandle,
     77  1.2.10.2  tls     UINT32                  Level,
     78  1.2.10.2  tls     void                    *Context,
     79  1.2.10.2  tls     void                    **ReturnValue);
     80  1.2.10.2  tls 
     81  1.2.10.2  tls static void
     82  1.2.10.2  tls XfCheckFieldRange (
     83  1.2.10.2  tls     ACPI_PARSE_OBJECT       *Op,
     84  1.2.10.2  tls     UINT32                  RegionBitLength,
     85  1.2.10.2  tls     UINT32                  FieldBitOffset,
     86  1.2.10.2  tls     UINT32                  FieldBitLength,
     87  1.2.10.2  tls     UINT32                  AccessBitWidth);
     88  1.2.10.2  tls 
     89  1.2.10.2  tls 
     90  1.2.10.2  tls /*******************************************************************************
     91  1.2.10.2  tls  *
     92  1.2.10.2  tls  * FUNCTION:    XfCrossReferenceNamespace
     93  1.2.10.2  tls  *
     94  1.2.10.2  tls  * PARAMETERS:  None
     95  1.2.10.2  tls  *
     96  1.2.10.2  tls  * RETURN:      Status
     97  1.2.10.2  tls  *
     98  1.2.10.2  tls  * DESCRIPTION: Perform a cross reference check of the parse tree against the
     99  1.2.10.2  tls  *              namespace. Every named referenced within the parse tree
    100  1.2.10.2  tls  *              should be get resolved with a namespace lookup. If not, the
    101  1.2.10.2  tls  *              original reference in the ASL code is invalid -- i.e., refers
    102  1.2.10.2  tls  *              to a non-existent object.
    103  1.2.10.2  tls  *
    104  1.2.10.2  tls  * NOTE:  The ASL "External" operator causes the name to be inserted into the
    105  1.2.10.2  tls  *        namespace so that references to the external name will be resolved
    106  1.2.10.2  tls  *        correctly here.
    107  1.2.10.2  tls  *
    108  1.2.10.2  tls  ******************************************************************************/
    109  1.2.10.2  tls 
    110  1.2.10.2  tls ACPI_STATUS
    111  1.2.10.2  tls XfCrossReferenceNamespace (
    112  1.2.10.2  tls     void)
    113  1.2.10.2  tls {
    114  1.2.10.2  tls     ACPI_WALK_STATE         *WalkState;
    115  1.2.10.2  tls 
    116  1.2.10.2  tls 
    117  1.2.10.2  tls     DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n");
    118  1.2.10.2  tls 
    119  1.2.10.2  tls     /*
    120  1.2.10.2  tls      * Create a new walk state for use when looking up names
    121  1.2.10.2  tls      * within the namespace (Passed as context to the callbacks)
    122  1.2.10.2  tls      */
    123  1.2.10.2  tls     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
    124  1.2.10.2  tls     if (!WalkState)
    125  1.2.10.2  tls     {
    126  1.2.10.2  tls         return (AE_NO_MEMORY);
    127  1.2.10.2  tls     }
    128  1.2.10.2  tls 
    129  1.2.10.2  tls     /* Walk the entire parse tree */
    130  1.2.10.2  tls 
    131  1.2.10.2  tls     TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin,
    132  1.2.10.2  tls                         XfNamespaceLocateEnd, WalkState);
    133  1.2.10.2  tls     return (AE_OK);
    134  1.2.10.2  tls }
    135  1.2.10.2  tls 
    136  1.2.10.2  tls 
    137  1.2.10.2  tls /*******************************************************************************
    138  1.2.10.2  tls  *
    139  1.2.10.2  tls  * FUNCTION:    XfObjectExists
    140  1.2.10.2  tls  *
    141  1.2.10.2  tls  * PARAMETERS:  Name            - 4 char ACPI name
    142  1.2.10.2  tls  *
    143  1.2.10.2  tls  * RETURN:      TRUE if name exists in namespace
    144  1.2.10.2  tls  *
    145  1.2.10.2  tls  * DESCRIPTION: Walk the namespace to find an object
    146  1.2.10.2  tls  *
    147  1.2.10.2  tls  ******************************************************************************/
    148  1.2.10.2  tls 
    149  1.2.10.2  tls static BOOLEAN
    150  1.2.10.2  tls XfObjectExists (
    151  1.2.10.2  tls     char                    *Name)
    152  1.2.10.2  tls {
    153  1.2.10.2  tls     ACPI_STATUS             Status;
    154  1.2.10.2  tls 
    155  1.2.10.2  tls 
    156  1.2.10.2  tls     /* Walk entire namespace from the supplied root */
    157  1.2.10.2  tls 
    158  1.2.10.2  tls     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
    159  1.2.10.2  tls                 ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL,
    160  1.2.10.2  tls                 Name, NULL);
    161  1.2.10.2  tls     if (Status == AE_CTRL_TRUE)
    162  1.2.10.2  tls     {
    163  1.2.10.2  tls         /* At least one instance of the name was found */
    164  1.2.10.2  tls 
    165  1.2.10.2  tls         return (TRUE);
    166  1.2.10.2  tls     }
    167  1.2.10.2  tls 
    168  1.2.10.2  tls     return (FALSE);
    169  1.2.10.2  tls }
    170  1.2.10.2  tls 
    171  1.2.10.2  tls 
    172  1.2.10.2  tls /*******************************************************************************
    173  1.2.10.2  tls  *
    174  1.2.10.2  tls  * FUNCTION:    XfCompareOneNamespaceObject
    175  1.2.10.2  tls  *
    176  1.2.10.2  tls  * PARAMETERS:  ACPI_WALK_CALLBACK
    177  1.2.10.2  tls  *
    178  1.2.10.2  tls  * RETURN:      Status
    179  1.2.10.2  tls  *
    180  1.2.10.2  tls  * DESCRIPTION: Compare name of one object.
    181  1.2.10.2  tls  *
    182  1.2.10.2  tls  ******************************************************************************/
    183  1.2.10.2  tls 
    184  1.2.10.2  tls static ACPI_STATUS
    185  1.2.10.2  tls XfCompareOneNamespaceObject (
    186  1.2.10.2  tls     ACPI_HANDLE             ObjHandle,
    187  1.2.10.2  tls     UINT32                  Level,
    188  1.2.10.2  tls     void                    *Context,
    189  1.2.10.2  tls     void                    **ReturnValue)
    190  1.2.10.2  tls {
    191  1.2.10.2  tls     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
    192  1.2.10.2  tls 
    193  1.2.10.2  tls 
    194  1.2.10.2  tls     /* Simply check the name */
    195  1.2.10.2  tls 
    196  1.2.10.2  tls     if (*((UINT32 *) (Context)) == Node->Name.Integer)
    197  1.2.10.2  tls     {
    198  1.2.10.2  tls         /* Abort walk if we found one instance */
    199  1.2.10.2  tls 
    200  1.2.10.2  tls         return (AE_CTRL_TRUE);
    201  1.2.10.2  tls     }
    202  1.2.10.2  tls 
    203  1.2.10.2  tls     return (AE_OK);
    204  1.2.10.2  tls }
    205  1.2.10.2  tls 
    206  1.2.10.2  tls 
    207  1.2.10.2  tls /*******************************************************************************
    208  1.2.10.2  tls  *
    209  1.2.10.2  tls  * FUNCTION:    XfCheckFieldRange
    210  1.2.10.2  tls  *
    211  1.2.10.2  tls  * PARAMETERS:  RegionBitLength     - Length of entire parent region
    212  1.2.10.2  tls  *              FieldBitOffset      - Start of the field unit (within region)
    213  1.2.10.2  tls  *              FieldBitLength      - Entire length of field unit
    214  1.2.10.2  tls  *              AccessBitWidth      - Access width of the field unit
    215  1.2.10.2  tls  *
    216  1.2.10.2  tls  * RETURN:      None
    217  1.2.10.2  tls  *
    218  1.2.10.2  tls  * DESCRIPTION: Check one field unit to make sure it fits in the parent
    219  1.2.10.2  tls  *              op region.
    220  1.2.10.2  tls  *
    221  1.2.10.2  tls  * Note: AccessBitWidth must be either 8,16,32, or 64
    222  1.2.10.2  tls  *
    223  1.2.10.2  tls  ******************************************************************************/
    224  1.2.10.2  tls 
    225  1.2.10.2  tls static void
    226  1.2.10.2  tls XfCheckFieldRange (
    227  1.2.10.2  tls     ACPI_PARSE_OBJECT       *Op,
    228  1.2.10.2  tls     UINT32                  RegionBitLength,
    229  1.2.10.2  tls     UINT32                  FieldBitOffset,
    230  1.2.10.2  tls     UINT32                  FieldBitLength,
    231  1.2.10.2  tls     UINT32                  AccessBitWidth)
    232  1.2.10.2  tls {
    233  1.2.10.2  tls     UINT32                  FieldEndBitOffset;
    234  1.2.10.2  tls 
    235  1.2.10.2  tls 
    236  1.2.10.2  tls     /*
    237  1.2.10.2  tls      * Check each field unit against the region size. The entire
    238  1.2.10.2  tls      * field unit (start offset plus length) must fit within the
    239  1.2.10.2  tls      * region.
    240  1.2.10.2  tls      */
    241  1.2.10.2  tls     FieldEndBitOffset = FieldBitOffset + FieldBitLength;
    242  1.2.10.2  tls 
    243  1.2.10.2  tls     if (FieldEndBitOffset > RegionBitLength)
    244  1.2.10.2  tls     {
    245  1.2.10.2  tls         /* Field definition itself is beyond the end-of-region */
    246  1.2.10.2  tls 
    247  1.2.10.2  tls         AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL);
    248  1.2.10.2  tls         return;
    249  1.2.10.2  tls     }
    250  1.2.10.2  tls 
    251  1.2.10.2  tls     /*
    252  1.2.10.2  tls      * Now check that the field plus AccessWidth doesn't go beyond
    253  1.2.10.2  tls      * the end-of-region. Assumes AccessBitWidth is a power of 2
    254  1.2.10.2  tls      */
    255  1.2.10.2  tls     FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth);
    256  1.2.10.2  tls 
    257  1.2.10.2  tls     if (FieldEndBitOffset > RegionBitLength)
    258  1.2.10.2  tls     {
    259  1.2.10.2  tls         /* Field definition combined with the access is beyond EOR */
    260  1.2.10.2  tls 
    261  1.2.10.2  tls         AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL);
    262  1.2.10.2  tls     }
    263  1.2.10.2  tls }
    264  1.2.10.2  tls 
    265  1.2.10.2  tls /*******************************************************************************
    266  1.2.10.2  tls  *
    267  1.2.10.2  tls  * FUNCTION:    XfNamespaceLocateBegin
    268  1.2.10.2  tls  *
    269  1.2.10.2  tls  * PARAMETERS:  ASL_WALK_CALLBACK
    270  1.2.10.2  tls  *
    271  1.2.10.2  tls  * RETURN:      Status
    272  1.2.10.2  tls  *
    273  1.2.10.2  tls  * DESCRIPTION: Descending callback used during cross-reference. For named
    274  1.2.10.2  tls  *              object references, attempt to locate the name in the
    275  1.2.10.2  tls  *              namespace.
    276  1.2.10.2  tls  *
    277  1.2.10.2  tls  * NOTE: ASL references to named fields within resource descriptors are
    278  1.2.10.2  tls  *       resolved to integer values here. Therefore, this step is an
    279  1.2.10.2  tls  *       important part of the code generation. We don't know that the
    280  1.2.10.2  tls  *       name refers to a resource descriptor until now.
    281  1.2.10.2  tls  *
    282  1.2.10.2  tls  ******************************************************************************/
    283  1.2.10.2  tls 
    284  1.2.10.2  tls static ACPI_STATUS
    285  1.2.10.2  tls XfNamespaceLocateBegin (
    286  1.2.10.2  tls     ACPI_PARSE_OBJECT       *Op,
    287  1.2.10.2  tls     UINT32                  Level,
    288  1.2.10.2  tls     void                    *Context)
    289  1.2.10.2  tls {
    290  1.2.10.2  tls     ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;
    291  1.2.10.2  tls     ACPI_NAMESPACE_NODE     *Node;
    292  1.2.10.2  tls     ACPI_STATUS             Status;
    293  1.2.10.2  tls     ACPI_OBJECT_TYPE        ObjectType;
    294  1.2.10.2  tls     char                    *Path;
    295  1.2.10.2  tls     UINT8                   PassedArgs;
    296  1.2.10.2  tls     ACPI_PARSE_OBJECT       *NextOp;
    297  1.2.10.2  tls     ACPI_PARSE_OBJECT       *OwningOp;
    298  1.2.10.2  tls     ACPI_PARSE_OBJECT       *SpaceIdOp;
    299  1.2.10.2  tls     UINT32                  MinimumLength;
    300  1.2.10.2  tls     UINT32                  Offset;
    301  1.2.10.2  tls     UINT32                  FieldBitLength;
    302  1.2.10.2  tls     UINT32                  TagBitLength;
    303  1.2.10.2  tls     UINT8                   Message = 0;
    304  1.2.10.2  tls     const ACPI_OPCODE_INFO  *OpInfo;
    305  1.2.10.2  tls     UINT32                  Flags;
    306  1.2.10.2  tls 
    307  1.2.10.2  tls 
    308  1.2.10.2  tls     ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op);
    309  1.2.10.2  tls 
    310  1.2.10.2  tls     /*
    311  1.2.10.2  tls      * If this node is the actual declaration of a name
    312  1.2.10.2  tls      * [such as the XXXX name in "Method (XXXX)"],
    313  1.2.10.2  tls      * we are not interested in it here. We only care about names that are
    314  1.2.10.2  tls      * references to other objects within the namespace and the parent objects
    315  1.2.10.2  tls      * of name declarations
    316  1.2.10.2  tls      */
    317  1.2.10.2  tls     if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
    318  1.2.10.2  tls     {
    319  1.2.10.2  tls         return_ACPI_STATUS (AE_OK);
    320  1.2.10.2  tls     }
    321  1.2.10.2  tls 
    322  1.2.10.2  tls     /* We are only interested in opcodes that have an associated name */
    323  1.2.10.2  tls 
    324  1.2.10.2  tls     OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
    325  1.2.10.2  tls 
    326  1.2.10.2  tls     if ((!(OpInfo->Flags & AML_NAMED)) &&
    327  1.2.10.2  tls         (!(OpInfo->Flags & AML_CREATE)) &&
    328  1.2.10.2  tls         (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
    329  1.2.10.2  tls         (Op->Asl.ParseOpcode != PARSEOP_NAMESEG)    &&
    330  1.2.10.2  tls         (Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
    331  1.2.10.2  tls     {
    332  1.2.10.2  tls         return_ACPI_STATUS (AE_OK);
    333  1.2.10.2  tls     }
    334  1.2.10.2  tls 
    335  1.2.10.2  tls     /*
    336  1.2.10.2  tls      * One special case: CondRefOf operator - we don't care if the name exists
    337  1.2.10.2  tls      * or not at this point, just ignore it, the point of the operator is to
    338  1.2.10.2  tls      * determine if the name exists at runtime.
    339  1.2.10.2  tls      */
    340  1.2.10.2  tls     if ((Op->Asl.Parent) &&
    341  1.2.10.2  tls         (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
    342  1.2.10.2  tls     {
    343  1.2.10.2  tls         return_ACPI_STATUS (AE_OK);
    344  1.2.10.2  tls     }
    345  1.2.10.2  tls 
    346  1.2.10.2  tls     /*
    347  1.2.10.2  tls      * We must enable the "search-to-root" for single NameSegs, but
    348  1.2.10.2  tls      * we have to be very careful about opening up scopes
    349  1.2.10.2  tls      */
    350  1.2.10.2  tls     Flags = ACPI_NS_SEARCH_PARENT;
    351  1.2.10.2  tls     if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
    352  1.2.10.2  tls         (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)    ||
    353  1.2.10.2  tls         (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
    354  1.2.10.2  tls     {
    355  1.2.10.2  tls         /*
    356  1.2.10.2  tls          * These are name references, do not push the scope stack
    357  1.2.10.2  tls          * for them.
    358  1.2.10.2  tls          */
    359  1.2.10.2  tls         Flags |= ACPI_NS_DONT_OPEN_SCOPE;
    360  1.2.10.2  tls     }
    361  1.2.10.2  tls 
    362  1.2.10.2  tls     /* Get the NamePath from the appropriate place */
    363  1.2.10.2  tls 
    364  1.2.10.2  tls     if (OpInfo->Flags & AML_NAMED)
    365  1.2.10.2  tls     {
    366  1.2.10.2  tls         /* For nearly all NAMED operators, the name reference is the first child */
    367  1.2.10.2  tls 
    368  1.2.10.2  tls         Path = Op->Asl.Child->Asl.Value.String;
    369  1.2.10.2  tls         if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
    370  1.2.10.2  tls         {
    371  1.2.10.2  tls             /*
    372  1.2.10.2  tls              * ALIAS is the only oddball opcode, the name declaration
    373  1.2.10.2  tls              * (alias name) is the second operand
    374  1.2.10.2  tls              */
    375  1.2.10.2  tls             Path = Op->Asl.Child->Asl.Next->Asl.Value.String;
    376  1.2.10.2  tls         }
    377  1.2.10.2  tls     }
    378  1.2.10.2  tls     else if (OpInfo->Flags & AML_CREATE)
    379  1.2.10.2  tls     {
    380  1.2.10.2  tls         /* Name must appear as the last parameter */
    381  1.2.10.2  tls 
    382  1.2.10.2  tls         NextOp = Op->Asl.Child;
    383  1.2.10.2  tls         while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
    384  1.2.10.2  tls         {
    385  1.2.10.2  tls             NextOp = NextOp->Asl.Next;
    386  1.2.10.2  tls         }
    387  1.2.10.2  tls         Path = NextOp->Asl.Value.String;
    388  1.2.10.2  tls     }
    389  1.2.10.2  tls     else
    390  1.2.10.2  tls     {
    391  1.2.10.2  tls         Path = Op->Asl.Value.String;
    392  1.2.10.2  tls     }
    393  1.2.10.2  tls 
    394  1.2.10.2  tls     ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
    395  1.2.10.2  tls     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    396  1.2.10.2  tls         "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
    397  1.2.10.2  tls 
    398  1.2.10.2  tls     /*
    399  1.2.10.2  tls      * Lookup the name in the namespace. Name must exist at this point, or it
    400  1.2.10.2  tls      * is an invalid reference.
    401  1.2.10.2  tls      *
    402  1.2.10.2  tls      * The namespace is also used as a lookup table for references to resource
    403  1.2.10.2  tls      * descriptors and the fields within them.
    404  1.2.10.2  tls      */
    405  1.2.10.2  tls     Gbl_NsLookupCount++;
    406  1.2.10.2  tls 
    407  1.2.10.2  tls     Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
    408  1.2.10.2  tls                 ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
    409  1.2.10.2  tls     if (ACPI_FAILURE (Status))
    410  1.2.10.2  tls     {
    411  1.2.10.2  tls         if (Status == AE_NOT_FOUND)
    412  1.2.10.2  tls         {
    413  1.2.10.2  tls             /*
    414  1.2.10.2  tls              * We didn't find the name reference by path -- we can qualify this
    415  1.2.10.2  tls              * a little better before we print an error message
    416  1.2.10.2  tls              */
    417  1.2.10.2  tls             if (strlen (Path) == ACPI_NAME_SIZE)
    418  1.2.10.2  tls             {
    419  1.2.10.2  tls                 /* A simple, one-segment ACPI name */
    420  1.2.10.2  tls 
    421  1.2.10.2  tls                 if (XfObjectExists (Path))
    422  1.2.10.2  tls                 {
    423  1.2.10.2  tls                     /*
    424  1.2.10.2  tls                      * There exists such a name, but we couldn't get to it
    425  1.2.10.2  tls                      * from this scope
    426  1.2.10.2  tls                      */
    427  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op,
    428  1.2.10.2  tls                         Op->Asl.ExternalName);
    429  1.2.10.2  tls                 }
    430  1.2.10.2  tls                 else
    431  1.2.10.2  tls                 {
    432  1.2.10.2  tls                     /* The name doesn't exist, period */
    433  1.2.10.2  tls 
    434  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_NOT_EXIST,
    435  1.2.10.2  tls                         Op, Op->Asl.ExternalName);
    436  1.2.10.2  tls                 }
    437  1.2.10.2  tls             }
    438  1.2.10.2  tls             else
    439  1.2.10.2  tls             {
    440  1.2.10.2  tls                 /* Check for a fully qualified path */
    441  1.2.10.2  tls 
    442  1.2.10.2  tls                 if (Path[0] == AML_ROOT_PREFIX)
    443  1.2.10.2  tls                 {
    444  1.2.10.2  tls                     /* Gave full path, the object does not exist */
    445  1.2.10.2  tls 
    446  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
    447  1.2.10.2  tls                         Op->Asl.ExternalName);
    448  1.2.10.2  tls                 }
    449  1.2.10.2  tls                 else
    450  1.2.10.2  tls                 {
    451  1.2.10.2  tls                     /*
    452  1.2.10.2  tls                      * We can't tell whether it doesn't exist or just
    453  1.2.10.2  tls                      * can't be reached.
    454  1.2.10.2  tls                      */
    455  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
    456  1.2.10.2  tls                         Op->Asl.ExternalName);
    457  1.2.10.2  tls                 }
    458  1.2.10.2  tls             }
    459  1.2.10.2  tls 
    460  1.2.10.2  tls             Status = AE_OK;
    461  1.2.10.2  tls         }
    462  1.2.10.2  tls 
    463  1.2.10.2  tls         return_ACPI_STATUS (Status);
    464  1.2.10.2  tls     }
    465  1.2.10.2  tls 
    466  1.2.10.2  tls     /* Check for a reference vs. name declaration */
    467  1.2.10.2  tls 
    468  1.2.10.2  tls     if (!(OpInfo->Flags & AML_NAMED) &&
    469  1.2.10.2  tls         !(OpInfo->Flags & AML_CREATE))
    470  1.2.10.2  tls     {
    471  1.2.10.2  tls         /* This node has been referenced, mark it for reference check */
    472  1.2.10.2  tls 
    473  1.2.10.2  tls         Node->Flags |= ANOBJ_IS_REFERENCED;
    474  1.2.10.2  tls     }
    475  1.2.10.2  tls 
    476  1.2.10.2  tls     /* Attempt to optimize the NamePath */
    477  1.2.10.2  tls 
    478  1.2.10.2  tls     OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
    479  1.2.10.2  tls 
    480  1.2.10.2  tls     /*
    481  1.2.10.2  tls      * 1) Dereference an alias (A name reference that is an alias)
    482  1.2.10.2  tls      *    Aliases are not nested, the alias always points to the final object
    483  1.2.10.2  tls      */
    484  1.2.10.2  tls     if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) &&
    485  1.2.10.2  tls         (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
    486  1.2.10.2  tls     {
    487  1.2.10.2  tls         /* This node points back to the original PARSEOP_ALIAS */
    488  1.2.10.2  tls 
    489  1.2.10.2  tls         NextOp = Node->Op;
    490  1.2.10.2  tls 
    491  1.2.10.2  tls         /* The first child is the alias target op */
    492  1.2.10.2  tls 
    493  1.2.10.2  tls         NextOp = NextOp->Asl.Child;
    494  1.2.10.2  tls 
    495  1.2.10.2  tls         /* That in turn points back to original target alias node */
    496  1.2.10.2  tls 
    497  1.2.10.2  tls         if (NextOp->Asl.Node)
    498  1.2.10.2  tls         {
    499  1.2.10.2  tls             Node = NextOp->Asl.Node;
    500  1.2.10.2  tls         }
    501  1.2.10.2  tls 
    502  1.2.10.2  tls         /* Else - forward reference to alias, will be resolved later */
    503  1.2.10.2  tls     }
    504  1.2.10.2  tls 
    505  1.2.10.2  tls     /* 2) Check for a reference to a resource descriptor */
    506  1.2.10.2  tls 
    507  1.2.10.2  tls     if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
    508  1.2.10.2  tls         (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
    509  1.2.10.2  tls     {
    510  1.2.10.2  tls         /*
    511  1.2.10.2  tls          * This was a reference to a field within a resource descriptor.
    512  1.2.10.2  tls          * Extract the associated field offset (either a bit or byte
    513  1.2.10.2  tls          * offset depending on the field type) and change the named
    514  1.2.10.2  tls          * reference into an integer for AML code generation
    515  1.2.10.2  tls          */
    516  1.2.10.2  tls         Offset = Node->Value;
    517  1.2.10.2  tls         TagBitLength = Node->Length;
    518  1.2.10.2  tls 
    519  1.2.10.2  tls         /*
    520  1.2.10.2  tls          * If a field is being created, generate the length (in bits) of
    521  1.2.10.2  tls          * the field. Note: Opcodes other than CreateXxxField and Index
    522  1.2.10.2  tls          * can come through here. For other opcodes, we just need to
    523  1.2.10.2  tls          * convert the resource tag reference to an integer offset.
    524  1.2.10.2  tls          */
    525  1.2.10.2  tls         switch (Op->Asl.Parent->Asl.AmlOpcode)
    526  1.2.10.2  tls         {
    527  1.2.10.2  tls         case AML_CREATE_FIELD_OP: /* Variable "Length" field, in bits */
    528  1.2.10.2  tls             /*
    529  1.2.10.2  tls              * We know the length operand is an integer constant because
    530  1.2.10.2  tls              * we know that it contains a reference to a resource
    531  1.2.10.2  tls              * descriptor tag.
    532  1.2.10.2  tls              */
    533  1.2.10.2  tls             FieldBitLength = (UINT32) Op->Asl.Next->Asl.Value.Integer;
    534  1.2.10.2  tls             break;
    535  1.2.10.2  tls 
    536  1.2.10.2  tls         case AML_CREATE_BIT_FIELD_OP:
    537  1.2.10.2  tls 
    538  1.2.10.2  tls             FieldBitLength = 1;
    539  1.2.10.2  tls             break;
    540  1.2.10.2  tls 
    541  1.2.10.2  tls         case AML_CREATE_BYTE_FIELD_OP:
    542  1.2.10.2  tls         case AML_INDEX_OP:
    543  1.2.10.2  tls 
    544  1.2.10.2  tls             FieldBitLength = 8;
    545  1.2.10.2  tls             break;
    546  1.2.10.2  tls 
    547  1.2.10.2  tls         case AML_CREATE_WORD_FIELD_OP:
    548  1.2.10.2  tls 
    549  1.2.10.2  tls             FieldBitLength = 16;
    550  1.2.10.2  tls             break;
    551  1.2.10.2  tls 
    552  1.2.10.2  tls         case AML_CREATE_DWORD_FIELD_OP:
    553  1.2.10.2  tls 
    554  1.2.10.2  tls             FieldBitLength = 32;
    555  1.2.10.2  tls             break;
    556  1.2.10.2  tls 
    557  1.2.10.2  tls         case AML_CREATE_QWORD_FIELD_OP:
    558  1.2.10.2  tls 
    559  1.2.10.2  tls             FieldBitLength = 64;
    560  1.2.10.2  tls             break;
    561  1.2.10.2  tls 
    562  1.2.10.2  tls         default:
    563  1.2.10.2  tls 
    564  1.2.10.2  tls             FieldBitLength = 0;
    565  1.2.10.2  tls             break;
    566  1.2.10.2  tls         }
    567  1.2.10.2  tls 
    568  1.2.10.2  tls         /* Check the field length against the length of the resource tag */
    569  1.2.10.2  tls 
    570  1.2.10.2  tls         if (FieldBitLength)
    571  1.2.10.2  tls         {
    572  1.2.10.2  tls             if (TagBitLength < FieldBitLength)
    573  1.2.10.2  tls             {
    574  1.2.10.2  tls                 Message = ASL_MSG_TAG_SMALLER;
    575  1.2.10.2  tls             }
    576  1.2.10.2  tls             else if (TagBitLength > FieldBitLength)
    577  1.2.10.2  tls             {
    578  1.2.10.2  tls                 Message = ASL_MSG_TAG_LARGER;
    579  1.2.10.2  tls             }
    580  1.2.10.2  tls 
    581  1.2.10.2  tls             if (Message)
    582  1.2.10.2  tls             {
    583  1.2.10.2  tls                 snprintf (MsgBuffer, sizeof(MsgBuffer), "Size mismatch, Tag: %u bit%s, Field: %u bit%s",
    584  1.2.10.2  tls                     TagBitLength, (TagBitLength > 1) ? "s" : "",
    585  1.2.10.2  tls                     FieldBitLength, (FieldBitLength > 1) ? "s" : "");
    586  1.2.10.2  tls 
    587  1.2.10.2  tls                 AslError (ASL_WARNING, Message, Op, MsgBuffer);
    588  1.2.10.2  tls             }
    589  1.2.10.2  tls         }
    590  1.2.10.2  tls 
    591  1.2.10.2  tls         /* Convert the BitOffset to a ByteOffset for certain opcodes */
    592  1.2.10.2  tls 
    593  1.2.10.2  tls         switch (Op->Asl.Parent->Asl.AmlOpcode)
    594  1.2.10.2  tls         {
    595  1.2.10.2  tls         case AML_CREATE_BYTE_FIELD_OP:
    596  1.2.10.2  tls         case AML_CREATE_WORD_FIELD_OP:
    597  1.2.10.2  tls         case AML_CREATE_DWORD_FIELD_OP:
    598  1.2.10.2  tls         case AML_CREATE_QWORD_FIELD_OP:
    599  1.2.10.2  tls         case AML_INDEX_OP:
    600  1.2.10.2  tls 
    601  1.2.10.2  tls             Offset = ACPI_DIV_8 (Offset);
    602  1.2.10.2  tls             break;
    603  1.2.10.2  tls 
    604  1.2.10.2  tls         default:
    605  1.2.10.2  tls 
    606  1.2.10.2  tls             break;
    607  1.2.10.2  tls         }
    608  1.2.10.2  tls 
    609  1.2.10.2  tls         /* Now convert this node to an integer whose value is the field offset */
    610  1.2.10.2  tls 
    611  1.2.10.2  tls         Op->Asl.AmlLength = 0;
    612  1.2.10.2  tls         Op->Asl.ParseOpcode = PARSEOP_INTEGER;
    613  1.2.10.2  tls         Op->Asl.Value.Integer = (UINT64) Offset;
    614  1.2.10.2  tls         Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
    615  1.2.10.2  tls 
    616  1.2.10.2  tls         OpcGenerateAmlOpcode (Op);
    617  1.2.10.2  tls     }
    618  1.2.10.2  tls 
    619  1.2.10.2  tls     /* 3) Check for a method invocation */
    620  1.2.10.2  tls 
    621  1.2.10.2  tls     else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
    622  1.2.10.2  tls                 (Node->Type == ACPI_TYPE_METHOD) &&
    623  1.2.10.2  tls                 (Op->Asl.Parent) &&
    624  1.2.10.2  tls                 (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD))   ||
    625  1.2.10.2  tls 
    626  1.2.10.2  tls                 (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
    627  1.2.10.2  tls     {
    628  1.2.10.2  tls         /*
    629  1.2.10.2  tls          * A reference to a method within one of these opcodes is not an
    630  1.2.10.2  tls          * invocation of the method, it is simply a reference to the method.
    631  1.2.10.2  tls          */
    632  1.2.10.2  tls         if ((Op->Asl.Parent) &&
    633  1.2.10.2  tls            ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF)      ||
    634  1.2.10.2  tls             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF)    ||
    635  1.2.10.2  tls             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
    636  1.2.10.2  tls         {
    637  1.2.10.2  tls             return_ACPI_STATUS (AE_OK);
    638  1.2.10.2  tls         }
    639  1.2.10.2  tls         /*
    640  1.2.10.2  tls          * There are two types of method invocation:
    641  1.2.10.2  tls          * 1) Invocation with arguments -- the parser recognizes this
    642  1.2.10.2  tls          *    as a METHODCALL.
    643  1.2.10.2  tls          * 2) Invocation with no arguments --the parser cannot determine that
    644  1.2.10.2  tls          *    this is a method invocation, therefore we have to figure it out
    645  1.2.10.2  tls          *    here.
    646  1.2.10.2  tls          */
    647  1.2.10.2  tls         if (Node->Type != ACPI_TYPE_METHOD)
    648  1.2.10.2  tls         {
    649  1.2.10.2  tls             snprintf (MsgBuffer, sizeof(MsgBuffer), "%s is a %s",
    650  1.2.10.2  tls                     Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
    651  1.2.10.2  tls 
    652  1.2.10.2  tls             AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
    653  1.2.10.2  tls             return_ACPI_STATUS (AE_OK);
    654  1.2.10.2  tls         }
    655  1.2.10.2  tls 
    656  1.2.10.2  tls         /* Save the method node in the caller's op */
    657  1.2.10.2  tls 
    658  1.2.10.2  tls         Op->Asl.Node = Node;
    659  1.2.10.2  tls         if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)
    660  1.2.10.2  tls         {
    661  1.2.10.2  tls             return_ACPI_STATUS (AE_OK);
    662  1.2.10.2  tls         }
    663  1.2.10.2  tls 
    664  1.2.10.2  tls         /*
    665  1.2.10.2  tls          * This is a method invocation, with or without arguments.
    666  1.2.10.2  tls          * Count the number of arguments, each appears as a child
    667  1.2.10.2  tls          * under the parent node
    668  1.2.10.2  tls          */
    669  1.2.10.2  tls         Op->Asl.ParseOpcode = PARSEOP_METHODCALL;
    670  1.2.10.2  tls         UtSetParseOpName (Op);
    671  1.2.10.2  tls 
    672  1.2.10.2  tls         PassedArgs = 0;
    673  1.2.10.2  tls         NextOp     = Op->Asl.Child;
    674  1.2.10.2  tls 
    675  1.2.10.2  tls         while (NextOp)
    676  1.2.10.2  tls         {
    677  1.2.10.2  tls             PassedArgs++;
    678  1.2.10.2  tls             NextOp = NextOp->Asl.Next;
    679  1.2.10.2  tls         }
    680  1.2.10.2  tls 
    681  1.2.10.2  tls         if (Node->Value != ASL_EXTERNAL_METHOD)
    682  1.2.10.2  tls         {
    683  1.2.10.2  tls             /*
    684  1.2.10.2  tls              * Check the parsed arguments with the number expected by the
    685  1.2.10.2  tls              * method declaration itself
    686  1.2.10.2  tls              */
    687  1.2.10.2  tls             if (PassedArgs != Node->Value)
    688  1.2.10.2  tls             {
    689  1.2.10.2  tls                 snprintf (MsgBuffer, sizeof(MsgBuffer), "%s requires %u", Op->Asl.ExternalName,
    690  1.2.10.2  tls                             Node->Value);
    691  1.2.10.2  tls 
    692  1.2.10.2  tls                 if (PassedArgs < Node->Value)
    693  1.2.10.2  tls                 {
    694  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
    695  1.2.10.2  tls                 }
    696  1.2.10.2  tls                 else
    697  1.2.10.2  tls                 {
    698  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer);
    699  1.2.10.2  tls                 }
    700  1.2.10.2  tls             }
    701  1.2.10.2  tls         }
    702  1.2.10.2  tls     }
    703  1.2.10.2  tls 
    704  1.2.10.2  tls     /* 4) Check for an ASL Field definition */
    705  1.2.10.2  tls 
    706  1.2.10.2  tls     else if ((Op->Asl.Parent) &&
    707  1.2.10.2  tls             ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD)     ||
    708  1.2.10.2  tls              (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
    709  1.2.10.2  tls     {
    710  1.2.10.2  tls         /*
    711  1.2.10.2  tls          * Offset checking for fields. If the parent operation region has a
    712  1.2.10.2  tls          * constant length (known at compile time), we can check fields
    713  1.2.10.2  tls          * defined in that region against the region length. This will catch
    714  1.2.10.2  tls          * fields and field units that cannot possibly fit within the region.
    715  1.2.10.2  tls          *
    716  1.2.10.2  tls          * Note: Index fields do not directly reference an operation region,
    717  1.2.10.2  tls          * thus they are not included in this check.
    718  1.2.10.2  tls          */
    719  1.2.10.2  tls         if (Op == Op->Asl.Parent->Asl.Child)
    720  1.2.10.2  tls         {
    721  1.2.10.2  tls             /*
    722  1.2.10.2  tls              * This is the first child of the field node, which is
    723  1.2.10.2  tls              * the name of the region. Get the parse node for the
    724  1.2.10.2  tls              * region -- which contains the length of the region.
    725  1.2.10.2  tls              */
    726  1.2.10.2  tls             OwningOp = Node->Op;
    727  1.2.10.2  tls             Op->Asl.Parent->Asl.ExtraValue =
    728  1.2.10.2  tls                 ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer);
    729  1.2.10.2  tls 
    730  1.2.10.2  tls             /* Examine the field access width */
    731  1.2.10.2  tls 
    732  1.2.10.2  tls             switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer)
    733  1.2.10.2  tls             {
    734  1.2.10.2  tls             case AML_FIELD_ACCESS_ANY:
    735  1.2.10.2  tls             case AML_FIELD_ACCESS_BYTE:
    736  1.2.10.2  tls             case AML_FIELD_ACCESS_BUFFER:
    737  1.2.10.2  tls             default:
    738  1.2.10.2  tls 
    739  1.2.10.2  tls                 MinimumLength = 1;
    740  1.2.10.2  tls                 break;
    741  1.2.10.2  tls 
    742  1.2.10.2  tls             case AML_FIELD_ACCESS_WORD:
    743  1.2.10.2  tls 
    744  1.2.10.2  tls                 MinimumLength = 2;
    745  1.2.10.2  tls                 break;
    746  1.2.10.2  tls 
    747  1.2.10.2  tls             case AML_FIELD_ACCESS_DWORD:
    748  1.2.10.2  tls 
    749  1.2.10.2  tls                 MinimumLength = 4;
    750  1.2.10.2  tls                 break;
    751  1.2.10.2  tls 
    752  1.2.10.2  tls             case AML_FIELD_ACCESS_QWORD:
    753  1.2.10.2  tls 
    754  1.2.10.2  tls                 MinimumLength = 8;
    755  1.2.10.2  tls                 break;
    756  1.2.10.2  tls             }
    757  1.2.10.2  tls 
    758  1.2.10.2  tls             /*
    759  1.2.10.2  tls              * Is the region at least as big as the access width?
    760  1.2.10.2  tls              * Note: DataTableRegions have 0 length
    761  1.2.10.2  tls              */
    762  1.2.10.2  tls             if (((UINT32) OwningOp->Asl.Value.Integer) &&
    763  1.2.10.2  tls                 ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength))
    764  1.2.10.2  tls             {
    765  1.2.10.2  tls                 AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL);
    766  1.2.10.2  tls             }
    767  1.2.10.2  tls 
    768  1.2.10.2  tls             /*
    769  1.2.10.2  tls              * Check EC/CMOS/SMBUS fields to make sure that the correct
    770  1.2.10.2  tls              * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS)
    771  1.2.10.2  tls              */
    772  1.2.10.2  tls             SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
    773  1.2.10.2  tls             switch ((UINT32) SpaceIdOp->Asl.Value.Integer)
    774  1.2.10.2  tls             {
    775  1.2.10.2  tls             case ACPI_ADR_SPACE_EC:
    776  1.2.10.2  tls             case ACPI_ADR_SPACE_CMOS:
    777  1.2.10.2  tls             case ACPI_ADR_SPACE_GPIO:
    778  1.2.10.2  tls 
    779  1.2.10.2  tls                 if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
    780  1.2.10.2  tls                 {
    781  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
    782  1.2.10.2  tls                 }
    783  1.2.10.2  tls                 break;
    784  1.2.10.2  tls 
    785  1.2.10.2  tls             case ACPI_ADR_SPACE_SMBUS:
    786  1.2.10.2  tls             case ACPI_ADR_SPACE_IPMI:
    787  1.2.10.2  tls             case ACPI_ADR_SPACE_GSBUS:
    788  1.2.10.2  tls 
    789  1.2.10.2  tls                 if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
    790  1.2.10.2  tls                 {
    791  1.2.10.2  tls                     AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL);
    792  1.2.10.2  tls                 }
    793  1.2.10.2  tls                 break;
    794  1.2.10.2  tls 
    795  1.2.10.2  tls             default:
    796  1.2.10.2  tls 
    797  1.2.10.2  tls                 /* Nothing to do for other address spaces */
    798  1.2.10.2  tls 
    799  1.2.10.2  tls                 break;
    800  1.2.10.2  tls             }
    801  1.2.10.2  tls         }
    802  1.2.10.2  tls         else
    803  1.2.10.2  tls         {
    804  1.2.10.2  tls             /*
    805  1.2.10.2  tls              * This is one element of the field list. Check to make sure
    806  1.2.10.2  tls              * that it does not go beyond the end of the parent operation region.
    807  1.2.10.2  tls              *
    808  1.2.10.2  tls              * In the code below:
    809  1.2.10.2  tls              *    Op->Asl.Parent->Asl.ExtraValue      - Region Length (bits)
    810  1.2.10.2  tls              *    Op->Asl.ExtraValue                  - Field start offset (bits)
    811  1.2.10.2  tls              *    Op->Asl.Child->Asl.Value.Integer32  - Field length (bits)
    812  1.2.10.2  tls              *    Op->Asl.Child->Asl.ExtraValue       - Field access width (bits)
    813  1.2.10.2  tls              */
    814  1.2.10.2  tls             if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child)
    815  1.2.10.2  tls             {
    816  1.2.10.2  tls                 XfCheckFieldRange (Op,
    817  1.2.10.2  tls                             Op->Asl.Parent->Asl.ExtraValue,
    818  1.2.10.2  tls                             Op->Asl.ExtraValue,
    819  1.2.10.2  tls                             (UINT32) Op->Asl.Child->Asl.Value.Integer,
    820  1.2.10.2  tls                             Op->Asl.Child->Asl.ExtraValue);
    821  1.2.10.2  tls             }
    822  1.2.10.2  tls         }
    823  1.2.10.2  tls     }
    824  1.2.10.2  tls 
    825  1.2.10.2  tls     Op->Asl.Node = Node;
    826  1.2.10.2  tls     return_ACPI_STATUS (Status);
    827  1.2.10.2  tls }
    828  1.2.10.2  tls 
    829  1.2.10.2  tls 
    830  1.2.10.2  tls /*******************************************************************************
    831  1.2.10.2  tls  *
    832  1.2.10.2  tls  * FUNCTION:    XfNamespaceLocateEnd
    833  1.2.10.2  tls  *
    834  1.2.10.2  tls  * PARAMETERS:  ASL_WALK_CALLBACK
    835  1.2.10.2  tls  *
    836  1.2.10.2  tls  * RETURN:      Status
    837  1.2.10.2  tls  *
    838  1.2.10.2  tls  * DESCRIPTION: Ascending callback used during cross reference. We only
    839  1.2.10.2  tls  *              need to worry about scope management here.
    840  1.2.10.2  tls  *
    841  1.2.10.2  tls  ******************************************************************************/
    842  1.2.10.2  tls 
    843  1.2.10.2  tls static ACPI_STATUS
    844  1.2.10.2  tls XfNamespaceLocateEnd (
    845  1.2.10.2  tls     ACPI_PARSE_OBJECT       *Op,
    846  1.2.10.2  tls     UINT32                  Level,
    847  1.2.10.2  tls     void                    *Context)
    848  1.2.10.2  tls {
    849  1.2.10.2  tls     ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;
    850  1.2.10.2  tls     const ACPI_OPCODE_INFO  *OpInfo;
    851  1.2.10.2  tls 
    852  1.2.10.2  tls 
    853  1.2.10.2  tls     ACPI_FUNCTION_TRACE (XfNamespaceLocateEnd);
    854  1.2.10.2  tls 
    855  1.2.10.2  tls 
    856  1.2.10.2  tls     /* We are only interested in opcodes that have an associated name */
    857  1.2.10.2  tls 
    858  1.2.10.2  tls     OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
    859  1.2.10.2  tls     if (!(OpInfo->Flags & AML_NAMED))
    860  1.2.10.2  tls     {
    861  1.2.10.2  tls         return_ACPI_STATUS (AE_OK);
    862  1.2.10.2  tls     }
    863  1.2.10.2  tls 
    864  1.2.10.2  tls     /* Not interested in name references, we did not open a scope for them */
    865  1.2.10.2  tls 
    866  1.2.10.2  tls     if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
    867  1.2.10.2  tls         (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)    ||
    868  1.2.10.2  tls         (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
    869  1.2.10.2  tls     {
    870  1.2.10.2  tls         return_ACPI_STATUS (AE_OK);
    871  1.2.10.2  tls     }
    872  1.2.10.2  tls 
    873  1.2.10.2  tls     /* Pop the scope stack if necessary */
    874  1.2.10.2  tls 
    875  1.2.10.2  tls     if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode)))
    876  1.2.10.2  tls     {
    877  1.2.10.2  tls 
    878  1.2.10.2  tls         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    879  1.2.10.2  tls             "%s: Popping scope for Op %p\n",
    880  1.2.10.2  tls             AcpiUtGetTypeName (OpInfo->ObjectType), Op));
    881  1.2.10.2  tls 
    882  1.2.10.2  tls         (void) AcpiDsScopeStackPop (WalkState);
    883  1.2.10.2  tls     }
    884  1.2.10.2  tls 
    885  1.2.10.2  tls     return_ACPI_STATUS (AE_OK);
    886  1.2.10.2  tls }
    887