Home | History | Annotate | Line # | Download | only in compiler
asllookup.c revision 1.1.1.2.2.2
      1  1.1.1.2.2.2  bouyer /******************************************************************************
      2  1.1.1.2.2.2  bouyer  *
      3  1.1.1.2.2.2  bouyer  * Module Name: asllookup- Namespace lookup
      4  1.1.1.2.2.2  bouyer  *
      5  1.1.1.2.2.2  bouyer  *****************************************************************************/
      6  1.1.1.2.2.2  bouyer 
      7  1.1.1.2.2.2  bouyer /*
      8  1.1.1.2.2.2  bouyer  * Copyright (C) 2000 - 2011, Intel Corp.
      9  1.1.1.2.2.2  bouyer  * All rights reserved.
     10  1.1.1.2.2.2  bouyer  *
     11  1.1.1.2.2.2  bouyer  * Redistribution and use in source and binary forms, with or without
     12  1.1.1.2.2.2  bouyer  * modification, are permitted provided that the following conditions
     13  1.1.1.2.2.2  bouyer  * are met:
     14  1.1.1.2.2.2  bouyer  * 1. Redistributions of source code must retain the above copyright
     15  1.1.1.2.2.2  bouyer  *    notice, this list of conditions, and the following disclaimer,
     16  1.1.1.2.2.2  bouyer  *    without modification.
     17  1.1.1.2.2.2  bouyer  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1.1.2.2.2  bouyer  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1.1.2.2.2  bouyer  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1.1.2.2.2  bouyer  *    including a substantially similar Disclaimer requirement for further
     21  1.1.1.2.2.2  bouyer  *    binary redistribution.
     22  1.1.1.2.2.2  bouyer  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1.1.2.2.2  bouyer  *    of any contributors may be used to endorse or promote products derived
     24  1.1.1.2.2.2  bouyer  *    from this software without specific prior written permission.
     25  1.1.1.2.2.2  bouyer  *
     26  1.1.1.2.2.2  bouyer  * Alternatively, this software may be distributed under the terms of the
     27  1.1.1.2.2.2  bouyer  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1.1.2.2.2  bouyer  * Software Foundation.
     29  1.1.1.2.2.2  bouyer  *
     30  1.1.1.2.2.2  bouyer  * NO WARRANTY
     31  1.1.1.2.2.2  bouyer  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1.1.2.2.2  bouyer  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.2.2.2  bouyer  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.1.1.2.2.2  bouyer  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1.1.2.2.2  bouyer  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1.1.2.2.2  bouyer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1.1.2.2.2  bouyer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1.1.2.2.2  bouyer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1.1.2.2.2  bouyer  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1.1.2.2.2  bouyer  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1.1.2.2.2  bouyer  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1.1.2.2.2  bouyer  */
     43  1.1.1.2.2.2  bouyer 
     44  1.1.1.2.2.2  bouyer 
     45  1.1.1.2.2.2  bouyer #include "aslcompiler.h"
     46  1.1.1.2.2.2  bouyer #include "aslcompiler.y.h"
     47  1.1.1.2.2.2  bouyer 
     48  1.1.1.2.2.2  bouyer #include "acparser.h"
     49  1.1.1.2.2.2  bouyer #include "amlcode.h"
     50  1.1.1.2.2.2  bouyer #include "acnamesp.h"
     51  1.1.1.2.2.2  bouyer #include "acdispat.h"
     52  1.1.1.2.2.2  bouyer 
     53  1.1.1.2.2.2  bouyer 
     54  1.1.1.2.2.2  bouyer #define _COMPONENT          ACPI_COMPILER
     55  1.1.1.2.2.2  bouyer         ACPI_MODULE_NAME    ("asllookup")
     56  1.1.1.2.2.2  bouyer 
     57  1.1.1.2.2.2  bouyer /* Local prototypes */
     58  1.1.1.2.2.2  bouyer 
     59  1.1.1.2.2.2  bouyer static ACPI_STATUS
     60  1.1.1.2.2.2  bouyer LsCompareOneNamespaceObject (
     61  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
     62  1.1.1.2.2.2  bouyer     UINT32                  Level,
     63  1.1.1.2.2.2  bouyer     void                    *Context,
     64  1.1.1.2.2.2  bouyer     void                    **ReturnValue);
     65  1.1.1.2.2.2  bouyer 
     66  1.1.1.2.2.2  bouyer static ACPI_STATUS
     67  1.1.1.2.2.2  bouyer LsDoOneNamespaceObject (
     68  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
     69  1.1.1.2.2.2  bouyer     UINT32                  Level,
     70  1.1.1.2.2.2  bouyer     void                    *Context,
     71  1.1.1.2.2.2  bouyer     void                    **ReturnValue);
     72  1.1.1.2.2.2  bouyer 
     73  1.1.1.2.2.2  bouyer static BOOLEAN
     74  1.1.1.2.2.2  bouyer LkObjectExists (
     75  1.1.1.2.2.2  bouyer     char                    *Name);
     76  1.1.1.2.2.2  bouyer 
     77  1.1.1.2.2.2  bouyer static void
     78  1.1.1.2.2.2  bouyer LkCheckFieldRange (
     79  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op,
     80  1.1.1.2.2.2  bouyer     UINT32                  RegionBitLength,
     81  1.1.1.2.2.2  bouyer     UINT32                  FieldBitOffset,
     82  1.1.1.2.2.2  bouyer     UINT32                  FieldBitLength,
     83  1.1.1.2.2.2  bouyer     UINT32                  AccessBitWidth);
     84  1.1.1.2.2.2  bouyer 
     85  1.1.1.2.2.2  bouyer static ACPI_STATUS
     86  1.1.1.2.2.2  bouyer LkNamespaceLocateBegin (
     87  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op,
     88  1.1.1.2.2.2  bouyer     UINT32                  Level,
     89  1.1.1.2.2.2  bouyer     void                    *Context);
     90  1.1.1.2.2.2  bouyer 
     91  1.1.1.2.2.2  bouyer static ACPI_STATUS
     92  1.1.1.2.2.2  bouyer LkNamespaceLocateEnd (
     93  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op,
     94  1.1.1.2.2.2  bouyer     UINT32                  Level,
     95  1.1.1.2.2.2  bouyer     void                    *Context);
     96  1.1.1.2.2.2  bouyer 
     97  1.1.1.2.2.2  bouyer static ACPI_STATUS
     98  1.1.1.2.2.2  bouyer LkIsObjectUsed (
     99  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
    100  1.1.1.2.2.2  bouyer     UINT32                  Level,
    101  1.1.1.2.2.2  bouyer     void                    *Context,
    102  1.1.1.2.2.2  bouyer     void                    **ReturnValue);
    103  1.1.1.2.2.2  bouyer 
    104  1.1.1.2.2.2  bouyer static ACPI_STATUS
    105  1.1.1.2.2.2  bouyer LsDoOnePathname (
    106  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
    107  1.1.1.2.2.2  bouyer     UINT32                  Level,
    108  1.1.1.2.2.2  bouyer     void                    *Context,
    109  1.1.1.2.2.2  bouyer     void                    **ReturnValue);
    110  1.1.1.2.2.2  bouyer 
    111  1.1.1.2.2.2  bouyer static ACPI_PARSE_OBJECT *
    112  1.1.1.2.2.2  bouyer LkGetNameOp (
    113  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op);
    114  1.1.1.2.2.2  bouyer 
    115  1.1.1.2.2.2  bouyer 
    116  1.1.1.2.2.2  bouyer /*******************************************************************************
    117  1.1.1.2.2.2  bouyer  *
    118  1.1.1.2.2.2  bouyer  * FUNCTION:    LsDoOneNamespaceObject
    119  1.1.1.2.2.2  bouyer  *
    120  1.1.1.2.2.2  bouyer  * PARAMETERS:  ACPI_WALK_CALLBACK
    121  1.1.1.2.2.2  bouyer  *
    122  1.1.1.2.2.2  bouyer  * RETURN:      Status
    123  1.1.1.2.2.2  bouyer  *
    124  1.1.1.2.2.2  bouyer  * DESCRIPTION: Dump a namespace object to the namespace output file.
    125  1.1.1.2.2.2  bouyer  *              Called during the walk of the namespace to dump all objects.
    126  1.1.1.2.2.2  bouyer  *
    127  1.1.1.2.2.2  bouyer  ******************************************************************************/
    128  1.1.1.2.2.2  bouyer 
    129  1.1.1.2.2.2  bouyer static ACPI_STATUS
    130  1.1.1.2.2.2  bouyer LsDoOneNamespaceObject (
    131  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
    132  1.1.1.2.2.2  bouyer     UINT32                  Level,
    133  1.1.1.2.2.2  bouyer     void                    *Context,
    134  1.1.1.2.2.2  bouyer     void                    **ReturnValue)
    135  1.1.1.2.2.2  bouyer {
    136  1.1.1.2.2.2  bouyer     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
    137  1.1.1.2.2.2  bouyer     ACPI_OPERAND_OBJECT     *ObjDesc;
    138  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op;
    139  1.1.1.2.2.2  bouyer 
    140  1.1.1.2.2.2  bouyer 
    141  1.1.1.2.2.2  bouyer     Gbl_NumNamespaceObjects++;
    142  1.1.1.2.2.2  bouyer 
    143  1.1.1.2.2.2  bouyer     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u  [%u]  %*s %4.4s - %s",
    144  1.1.1.2.2.2  bouyer         Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
    145  1.1.1.2.2.2  bouyer         &Node->Name,
    146  1.1.1.2.2.2  bouyer         AcpiUtGetTypeName (Node->Type));
    147  1.1.1.2.2.2  bouyer 
    148  1.1.1.2.2.2  bouyer     Op = Node->Op;
    149  1.1.1.2.2.2  bouyer     ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
    150  1.1.1.2.2.2  bouyer 
    151  1.1.1.2.2.2  bouyer     if (!Op)
    152  1.1.1.2.2.2  bouyer     {
    153  1.1.1.2.2.2  bouyer         FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
    154  1.1.1.2.2.2  bouyer         return (AE_OK);
    155  1.1.1.2.2.2  bouyer     }
    156  1.1.1.2.2.2  bouyer 
    157  1.1.1.2.2.2  bouyer 
    158  1.1.1.2.2.2  bouyer     if ((ObjDesc) &&
    159  1.1.1.2.2.2  bouyer         (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND))
    160  1.1.1.2.2.2  bouyer     {
    161  1.1.1.2.2.2  bouyer         switch (Node->Type)
    162  1.1.1.2.2.2  bouyer         {
    163  1.1.1.2.2.2  bouyer         case ACPI_TYPE_INTEGER:
    164  1.1.1.2.2.2  bouyer 
    165  1.1.1.2.2.2  bouyer             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    166  1.1.1.2.2.2  bouyer                 "       [Initial Value   0x%8.8X%8.8X]",
    167  1.1.1.2.2.2  bouyer                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
    168  1.1.1.2.2.2  bouyer             break;
    169  1.1.1.2.2.2  bouyer 
    170  1.1.1.2.2.2  bouyer 
    171  1.1.1.2.2.2  bouyer         case ACPI_TYPE_STRING:
    172  1.1.1.2.2.2  bouyer 
    173  1.1.1.2.2.2  bouyer             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    174  1.1.1.2.2.2  bouyer                 "        [Initial Value   \"%s\"]",
    175  1.1.1.2.2.2  bouyer                 ObjDesc->String.Pointer);
    176  1.1.1.2.2.2  bouyer             break;
    177  1.1.1.2.2.2  bouyer 
    178  1.1.1.2.2.2  bouyer         default:
    179  1.1.1.2.2.2  bouyer             /* Nothing to do for other types */
    180  1.1.1.2.2.2  bouyer             break;
    181  1.1.1.2.2.2  bouyer         }
    182  1.1.1.2.2.2  bouyer 
    183  1.1.1.2.2.2  bouyer     }
    184  1.1.1.2.2.2  bouyer     else
    185  1.1.1.2.2.2  bouyer     {
    186  1.1.1.2.2.2  bouyer         switch (Node->Type)
    187  1.1.1.2.2.2  bouyer         {
    188  1.1.1.2.2.2  bouyer         case ACPI_TYPE_INTEGER:
    189  1.1.1.2.2.2  bouyer 
    190  1.1.1.2.2.2  bouyer             if (Op->Asl.ParseOpcode == PARSEOP_NAME)
    191  1.1.1.2.2.2  bouyer             {
    192  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Child;
    193  1.1.1.2.2.2  bouyer             }
    194  1.1.1.2.2.2  bouyer             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
    195  1.1.1.2.2.2  bouyer                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
    196  1.1.1.2.2.2  bouyer             {
    197  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Next;
    198  1.1.1.2.2.2  bouyer             }
    199  1.1.1.2.2.2  bouyer             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    200  1.1.1.2.2.2  bouyer                 "       [Initial Value   0x%8.8X%8.8X]",
    201  1.1.1.2.2.2  bouyer                 ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
    202  1.1.1.2.2.2  bouyer             break;
    203  1.1.1.2.2.2  bouyer 
    204  1.1.1.2.2.2  bouyer 
    205  1.1.1.2.2.2  bouyer         case ACPI_TYPE_STRING:
    206  1.1.1.2.2.2  bouyer 
    207  1.1.1.2.2.2  bouyer             if (Op->Asl.ParseOpcode == PARSEOP_NAME)
    208  1.1.1.2.2.2  bouyer             {
    209  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Child;
    210  1.1.1.2.2.2  bouyer             }
    211  1.1.1.2.2.2  bouyer             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
    212  1.1.1.2.2.2  bouyer                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
    213  1.1.1.2.2.2  bouyer             {
    214  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Next;
    215  1.1.1.2.2.2  bouyer             }
    216  1.1.1.2.2.2  bouyer             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    217  1.1.1.2.2.2  bouyer                 "        [Initial Value   \"%s\"]",
    218  1.1.1.2.2.2  bouyer                 Op->Asl.Value.String);
    219  1.1.1.2.2.2  bouyer             break;
    220  1.1.1.2.2.2  bouyer 
    221  1.1.1.2.2.2  bouyer 
    222  1.1.1.2.2.2  bouyer         case ACPI_TYPE_LOCAL_REGION_FIELD:
    223  1.1.1.2.2.2  bouyer 
    224  1.1.1.2.2.2  bouyer             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
    225  1.1.1.2.2.2  bouyer                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
    226  1.1.1.2.2.2  bouyer             {
    227  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Child;
    228  1.1.1.2.2.2  bouyer             }
    229  1.1.1.2.2.2  bouyer             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    230  1.1.1.2.2.2  bouyer                 "   [Offset 0x%04X   Length 0x%04X bits]",
    231  1.1.1.2.2.2  bouyer                 Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
    232  1.1.1.2.2.2  bouyer             break;
    233  1.1.1.2.2.2  bouyer 
    234  1.1.1.2.2.2  bouyer 
    235  1.1.1.2.2.2  bouyer         case ACPI_TYPE_BUFFER_FIELD:
    236  1.1.1.2.2.2  bouyer 
    237  1.1.1.2.2.2  bouyer             switch (Op->Asl.ParseOpcode)
    238  1.1.1.2.2.2  bouyer             {
    239  1.1.1.2.2.2  bouyer             case PARSEOP_CREATEBYTEFIELD:
    240  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "   [BYTE  ( 8 bit)]");
    241  1.1.1.2.2.2  bouyer                 break;
    242  1.1.1.2.2.2  bouyer 
    243  1.1.1.2.2.2  bouyer             case PARSEOP_CREATEDWORDFIELD:
    244  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "   [DWORD (32 bit)]");
    245  1.1.1.2.2.2  bouyer                 break;
    246  1.1.1.2.2.2  bouyer 
    247  1.1.1.2.2.2  bouyer             case PARSEOP_CREATEQWORDFIELD:
    248  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "   [QWORD (64 bit)]");
    249  1.1.1.2.2.2  bouyer                 break;
    250  1.1.1.2.2.2  bouyer 
    251  1.1.1.2.2.2  bouyer             case PARSEOP_CREATEWORDFIELD:
    252  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "   [WORD  (16 bit)]");
    253  1.1.1.2.2.2  bouyer                 break;
    254  1.1.1.2.2.2  bouyer 
    255  1.1.1.2.2.2  bouyer             case PARSEOP_CREATEBITFIELD:
    256  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "   [BIT   ( 1 bit)]");
    257  1.1.1.2.2.2  bouyer                 break;
    258  1.1.1.2.2.2  bouyer 
    259  1.1.1.2.2.2  bouyer             case PARSEOP_CREATEFIELD:
    260  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "   [Arbitrary Bit Field]");
    261  1.1.1.2.2.2  bouyer                 break;
    262  1.1.1.2.2.2  bouyer 
    263  1.1.1.2.2.2  bouyer             default:
    264  1.1.1.2.2.2  bouyer                 break;
    265  1.1.1.2.2.2  bouyer 
    266  1.1.1.2.2.2  bouyer             }
    267  1.1.1.2.2.2  bouyer             break;
    268  1.1.1.2.2.2  bouyer 
    269  1.1.1.2.2.2  bouyer 
    270  1.1.1.2.2.2  bouyer         case ACPI_TYPE_PACKAGE:
    271  1.1.1.2.2.2  bouyer 
    272  1.1.1.2.2.2  bouyer             if (Op->Asl.ParseOpcode == PARSEOP_NAME)
    273  1.1.1.2.2.2  bouyer             {
    274  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Child;
    275  1.1.1.2.2.2  bouyer             }
    276  1.1.1.2.2.2  bouyer             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
    277  1.1.1.2.2.2  bouyer                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
    278  1.1.1.2.2.2  bouyer             {
    279  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Next;
    280  1.1.1.2.2.2  bouyer             }
    281  1.1.1.2.2.2  bouyer             Op = Op->Asl.Child;
    282  1.1.1.2.2.2  bouyer 
    283  1.1.1.2.2.2  bouyer             if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
    284  1.1.1.2.2.2  bouyer                 (Op->Asl.ParseOpcode == PARSEOP_RAW_DATA))
    285  1.1.1.2.2.2  bouyer             {
    286  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    287  1.1.1.2.2.2  bouyer                     "       [Initial Length  0x%.2X elements]",
    288  1.1.1.2.2.2  bouyer                     Op->Asl.Value.Integer);
    289  1.1.1.2.2.2  bouyer             }
    290  1.1.1.2.2.2  bouyer             break;
    291  1.1.1.2.2.2  bouyer 
    292  1.1.1.2.2.2  bouyer 
    293  1.1.1.2.2.2  bouyer         case ACPI_TYPE_BUFFER:
    294  1.1.1.2.2.2  bouyer 
    295  1.1.1.2.2.2  bouyer             if (Op->Asl.ParseOpcode == PARSEOP_NAME)
    296  1.1.1.2.2.2  bouyer             {
    297  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Child;
    298  1.1.1.2.2.2  bouyer             }
    299  1.1.1.2.2.2  bouyer             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
    300  1.1.1.2.2.2  bouyer                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
    301  1.1.1.2.2.2  bouyer             {
    302  1.1.1.2.2.2  bouyer                 Op = Op->Asl.Next;
    303  1.1.1.2.2.2  bouyer             }
    304  1.1.1.2.2.2  bouyer             Op = Op->Asl.Child;
    305  1.1.1.2.2.2  bouyer 
    306  1.1.1.2.2.2  bouyer             if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER))
    307  1.1.1.2.2.2  bouyer             {
    308  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    309  1.1.1.2.2.2  bouyer                     "        [Initial Length  0x%.2X bytes]",
    310  1.1.1.2.2.2  bouyer                     Op->Asl.Value.Integer);
    311  1.1.1.2.2.2  bouyer             }
    312  1.1.1.2.2.2  bouyer             break;
    313  1.1.1.2.2.2  bouyer 
    314  1.1.1.2.2.2  bouyer 
    315  1.1.1.2.2.2  bouyer         case ACPI_TYPE_METHOD:
    316  1.1.1.2.2.2  bouyer 
    317  1.1.1.2.2.2  bouyer             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    318  1.1.1.2.2.2  bouyer                 "        [Code Length     0x%.4X bytes]",
    319  1.1.1.2.2.2  bouyer                 Op->Asl.AmlSubtreeLength);
    320  1.1.1.2.2.2  bouyer             break;
    321  1.1.1.2.2.2  bouyer 
    322  1.1.1.2.2.2  bouyer 
    323  1.1.1.2.2.2  bouyer         case ACPI_TYPE_LOCAL_RESOURCE:
    324  1.1.1.2.2.2  bouyer 
    325  1.1.1.2.2.2  bouyer             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    326  1.1.1.2.2.2  bouyer                 "  [Desc Offset     0x%.4X Bytes]", Node->Value);
    327  1.1.1.2.2.2  bouyer             break;
    328  1.1.1.2.2.2  bouyer 
    329  1.1.1.2.2.2  bouyer 
    330  1.1.1.2.2.2  bouyer         case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
    331  1.1.1.2.2.2  bouyer 
    332  1.1.1.2.2.2  bouyer             if (Node->Flags & 0x80)
    333  1.1.1.2.2.2  bouyer             {
    334  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    335  1.1.1.2.2.2  bouyer                     "   [Field Offset    0x%.4X Bits 0x%.4X Bytes]",
    336  1.1.1.2.2.2  bouyer                     Node->Value, Node->Value / 8);
    337  1.1.1.2.2.2  bouyer             }
    338  1.1.1.2.2.2  bouyer             else
    339  1.1.1.2.2.2  bouyer             {
    340  1.1.1.2.2.2  bouyer                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
    341  1.1.1.2.2.2  bouyer                     "   [Field Offset    0x%.4X Bytes]", Node->Value);
    342  1.1.1.2.2.2  bouyer             }
    343  1.1.1.2.2.2  bouyer             break;
    344  1.1.1.2.2.2  bouyer 
    345  1.1.1.2.2.2  bouyer 
    346  1.1.1.2.2.2  bouyer         default:
    347  1.1.1.2.2.2  bouyer             /* Nothing to do for other types */
    348  1.1.1.2.2.2  bouyer             break;
    349  1.1.1.2.2.2  bouyer         }
    350  1.1.1.2.2.2  bouyer     }
    351  1.1.1.2.2.2  bouyer 
    352  1.1.1.2.2.2  bouyer     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
    353  1.1.1.2.2.2  bouyer     return (AE_OK);
    354  1.1.1.2.2.2  bouyer }
    355  1.1.1.2.2.2  bouyer 
    356  1.1.1.2.2.2  bouyer 
    357  1.1.1.2.2.2  bouyer /*******************************************************************************
    358  1.1.1.2.2.2  bouyer  *
    359  1.1.1.2.2.2  bouyer  * FUNCTION:    LsSetupNsList
    360  1.1.1.2.2.2  bouyer  *
    361  1.1.1.2.2.2  bouyer  * PARAMETERS:  Handle          - local file handle
    362  1.1.1.2.2.2  bouyer  *
    363  1.1.1.2.2.2  bouyer  * RETURN:      None
    364  1.1.1.2.2.2  bouyer  *
    365  1.1.1.2.2.2  bouyer  * DESCRIPTION: Set the namespace output file to the input handle
    366  1.1.1.2.2.2  bouyer  *
    367  1.1.1.2.2.2  bouyer  ******************************************************************************/
    368  1.1.1.2.2.2  bouyer 
    369  1.1.1.2.2.2  bouyer void
    370  1.1.1.2.2.2  bouyer LsSetupNsList (
    371  1.1.1.2.2.2  bouyer     void                    *Handle)
    372  1.1.1.2.2.2  bouyer {
    373  1.1.1.2.2.2  bouyer 
    374  1.1.1.2.2.2  bouyer     Gbl_NsOutputFlag = TRUE;
    375  1.1.1.2.2.2  bouyer     Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle;
    376  1.1.1.2.2.2  bouyer }
    377  1.1.1.2.2.2  bouyer 
    378  1.1.1.2.2.2  bouyer 
    379  1.1.1.2.2.2  bouyer /*******************************************************************************
    380  1.1.1.2.2.2  bouyer  *
    381  1.1.1.2.2.2  bouyer  * FUNCTION:    LsDoOnePathname
    382  1.1.1.2.2.2  bouyer  *
    383  1.1.1.2.2.2  bouyer  * PARAMETERS:  ACPI_WALK_CALLBACK
    384  1.1.1.2.2.2  bouyer  *
    385  1.1.1.2.2.2  bouyer  * RETURN:      Status
    386  1.1.1.2.2.2  bouyer  *
    387  1.1.1.2.2.2  bouyer  * DESCRIPTION: Print the full pathname for a namespace node.
    388  1.1.1.2.2.2  bouyer  *
    389  1.1.1.2.2.2  bouyer  ******************************************************************************/
    390  1.1.1.2.2.2  bouyer 
    391  1.1.1.2.2.2  bouyer static ACPI_STATUS
    392  1.1.1.2.2.2  bouyer LsDoOnePathname (
    393  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
    394  1.1.1.2.2.2  bouyer     UINT32                  Level,
    395  1.1.1.2.2.2  bouyer     void                    *Context,
    396  1.1.1.2.2.2  bouyer     void                    **ReturnValue)
    397  1.1.1.2.2.2  bouyer {
    398  1.1.1.2.2.2  bouyer     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
    399  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    400  1.1.1.2.2.2  bouyer     ACPI_BUFFER             TargetPath;
    401  1.1.1.2.2.2  bouyer 
    402  1.1.1.2.2.2  bouyer 
    403  1.1.1.2.2.2  bouyer     TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
    404  1.1.1.2.2.2  bouyer     Status = AcpiNsHandleToPathname (Node, &TargetPath);
    405  1.1.1.2.2.2  bouyer     if (ACPI_FAILURE (Status))
    406  1.1.1.2.2.2  bouyer     {
    407  1.1.1.2.2.2  bouyer         return (Status);
    408  1.1.1.2.2.2  bouyer     }
    409  1.1.1.2.2.2  bouyer 
    410  1.1.1.2.2.2  bouyer     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer);
    411  1.1.1.2.2.2  bouyer     ACPI_FREE (TargetPath.Pointer);
    412  1.1.1.2.2.2  bouyer 
    413  1.1.1.2.2.2  bouyer     return (AE_OK);
    414  1.1.1.2.2.2  bouyer }
    415  1.1.1.2.2.2  bouyer 
    416  1.1.1.2.2.2  bouyer 
    417  1.1.1.2.2.2  bouyer /*******************************************************************************
    418  1.1.1.2.2.2  bouyer  *
    419  1.1.1.2.2.2  bouyer  * FUNCTION:    LsDisplayNamespace
    420  1.1.1.2.2.2  bouyer  *
    421  1.1.1.2.2.2  bouyer  * PARAMETERS:  None
    422  1.1.1.2.2.2  bouyer  *
    423  1.1.1.2.2.2  bouyer  * RETURN:      Status
    424  1.1.1.2.2.2  bouyer  *
    425  1.1.1.2.2.2  bouyer  * DESCRIPTION: Walk the namespace an display information about each node
    426  1.1.1.2.2.2  bouyer  *              in the tree.  Information is written to the optional
    427  1.1.1.2.2.2  bouyer  *              namespace output file.
    428  1.1.1.2.2.2  bouyer  *
    429  1.1.1.2.2.2  bouyer  ******************************************************************************/
    430  1.1.1.2.2.2  bouyer 
    431  1.1.1.2.2.2  bouyer ACPI_STATUS
    432  1.1.1.2.2.2  bouyer LsDisplayNamespace (
    433  1.1.1.2.2.2  bouyer     void)
    434  1.1.1.2.2.2  bouyer {
    435  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    436  1.1.1.2.2.2  bouyer 
    437  1.1.1.2.2.2  bouyer 
    438  1.1.1.2.2.2  bouyer     if (!Gbl_NsOutputFlag)
    439  1.1.1.2.2.2  bouyer     {
    440  1.1.1.2.2.2  bouyer         return (AE_OK);
    441  1.1.1.2.2.2  bouyer     }
    442  1.1.1.2.2.2  bouyer 
    443  1.1.1.2.2.2  bouyer     Gbl_NumNamespaceObjects = 0;
    444  1.1.1.2.2.2  bouyer 
    445  1.1.1.2.2.2  bouyer     /* File header */
    446  1.1.1.2.2.2  bouyer 
    447  1.1.1.2.2.2  bouyer     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n");
    448  1.1.1.2.2.2  bouyer     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count  Depth    Name - Type\n\n");
    449  1.1.1.2.2.2  bouyer 
    450  1.1.1.2.2.2  bouyer     /* Walk entire namespace from the root */
    451  1.1.1.2.2.2  bouyer 
    452  1.1.1.2.2.2  bouyer     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
    453  1.1.1.2.2.2  bouyer                 ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL,
    454  1.1.1.2.2.2  bouyer                 NULL, NULL);
    455  1.1.1.2.2.2  bouyer 
    456  1.1.1.2.2.2  bouyer     /* Print the full pathname for each namespace node */
    457  1.1.1.2.2.2  bouyer 
    458  1.1.1.2.2.2  bouyer     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n");
    459  1.1.1.2.2.2  bouyer 
    460  1.1.1.2.2.2  bouyer     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
    461  1.1.1.2.2.2  bouyer                 ACPI_UINT32_MAX, FALSE, LsDoOnePathname, NULL,
    462  1.1.1.2.2.2  bouyer                 NULL, NULL);
    463  1.1.1.2.2.2  bouyer 
    464  1.1.1.2.2.2  bouyer     return (Status);
    465  1.1.1.2.2.2  bouyer }
    466  1.1.1.2.2.2  bouyer 
    467  1.1.1.2.2.2  bouyer 
    468  1.1.1.2.2.2  bouyer /*******************************************************************************
    469  1.1.1.2.2.2  bouyer  *
    470  1.1.1.2.2.2  bouyer  * FUNCTION:    LsCompareOneNamespaceObject
    471  1.1.1.2.2.2  bouyer  *
    472  1.1.1.2.2.2  bouyer  * PARAMETERS:  ACPI_WALK_CALLBACK
    473  1.1.1.2.2.2  bouyer  *
    474  1.1.1.2.2.2  bouyer  * RETURN:      Status
    475  1.1.1.2.2.2  bouyer  *
    476  1.1.1.2.2.2  bouyer  * DESCRIPTION: Compare name of one object.
    477  1.1.1.2.2.2  bouyer  *
    478  1.1.1.2.2.2  bouyer  ******************************************************************************/
    479  1.1.1.2.2.2  bouyer 
    480  1.1.1.2.2.2  bouyer static ACPI_STATUS
    481  1.1.1.2.2.2  bouyer LsCompareOneNamespaceObject (
    482  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
    483  1.1.1.2.2.2  bouyer     UINT32                  Level,
    484  1.1.1.2.2.2  bouyer     void                    *Context,
    485  1.1.1.2.2.2  bouyer     void                    **ReturnValue)
    486  1.1.1.2.2.2  bouyer {
    487  1.1.1.2.2.2  bouyer     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
    488  1.1.1.2.2.2  bouyer 
    489  1.1.1.2.2.2  bouyer 
    490  1.1.1.2.2.2  bouyer     /* Simply check the name */
    491  1.1.1.2.2.2  bouyer 
    492  1.1.1.2.2.2  bouyer     if (*((UINT32 *) (Context)) == Node->Name.Integer)
    493  1.1.1.2.2.2  bouyer     {
    494  1.1.1.2.2.2  bouyer         /* Abort walk if we found one instance */
    495  1.1.1.2.2.2  bouyer 
    496  1.1.1.2.2.2  bouyer         return (AE_CTRL_TRUE);
    497  1.1.1.2.2.2  bouyer     }
    498  1.1.1.2.2.2  bouyer 
    499  1.1.1.2.2.2  bouyer     return (AE_OK);
    500  1.1.1.2.2.2  bouyer }
    501  1.1.1.2.2.2  bouyer 
    502  1.1.1.2.2.2  bouyer 
    503  1.1.1.2.2.2  bouyer /*******************************************************************************
    504  1.1.1.2.2.2  bouyer  *
    505  1.1.1.2.2.2  bouyer  * FUNCTION:    LkObjectExists
    506  1.1.1.2.2.2  bouyer  *
    507  1.1.1.2.2.2  bouyer  * PARAMETERS:  Name            - 4 char ACPI name
    508  1.1.1.2.2.2  bouyer  *
    509  1.1.1.2.2.2  bouyer  * RETURN:      TRUE if name exists in namespace
    510  1.1.1.2.2.2  bouyer  *
    511  1.1.1.2.2.2  bouyer  * DESCRIPTION: Walk the namespace to find an object
    512  1.1.1.2.2.2  bouyer  *
    513  1.1.1.2.2.2  bouyer  ******************************************************************************/
    514  1.1.1.2.2.2  bouyer 
    515  1.1.1.2.2.2  bouyer static BOOLEAN
    516  1.1.1.2.2.2  bouyer LkObjectExists (
    517  1.1.1.2.2.2  bouyer     char                    *Name)
    518  1.1.1.2.2.2  bouyer {
    519  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    520  1.1.1.2.2.2  bouyer 
    521  1.1.1.2.2.2  bouyer 
    522  1.1.1.2.2.2  bouyer     /* Walk entire namespace from the supplied root */
    523  1.1.1.2.2.2  bouyer 
    524  1.1.1.2.2.2  bouyer     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
    525  1.1.1.2.2.2  bouyer                 ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL,
    526  1.1.1.2.2.2  bouyer                 Name, NULL);
    527  1.1.1.2.2.2  bouyer     if (Status == AE_CTRL_TRUE)
    528  1.1.1.2.2.2  bouyer     {
    529  1.1.1.2.2.2  bouyer         /* At least one instance of the name was found */
    530  1.1.1.2.2.2  bouyer 
    531  1.1.1.2.2.2  bouyer         return (TRUE);
    532  1.1.1.2.2.2  bouyer     }
    533  1.1.1.2.2.2  bouyer 
    534  1.1.1.2.2.2  bouyer     return (FALSE);
    535  1.1.1.2.2.2  bouyer }
    536  1.1.1.2.2.2  bouyer 
    537  1.1.1.2.2.2  bouyer 
    538  1.1.1.2.2.2  bouyer /*******************************************************************************
    539  1.1.1.2.2.2  bouyer  *
    540  1.1.1.2.2.2  bouyer  * FUNCTION:    LkGetNameOp
    541  1.1.1.2.2.2  bouyer  *
    542  1.1.1.2.2.2  bouyer  * PARAMETERS:  Op              - Current Op
    543  1.1.1.2.2.2  bouyer  *
    544  1.1.1.2.2.2  bouyer  * RETURN:      NameOp associated with the input op
    545  1.1.1.2.2.2  bouyer  *
    546  1.1.1.2.2.2  bouyer  * DESCRIPTION: Find the name declaration op associated with the operator
    547  1.1.1.2.2.2  bouyer  *
    548  1.1.1.2.2.2  bouyer  ******************************************************************************/
    549  1.1.1.2.2.2  bouyer 
    550  1.1.1.2.2.2  bouyer static ACPI_PARSE_OBJECT *
    551  1.1.1.2.2.2  bouyer LkGetNameOp (
    552  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op)
    553  1.1.1.2.2.2  bouyer {
    554  1.1.1.2.2.2  bouyer     const ACPI_OPCODE_INFO  *OpInfo;
    555  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *NameOp = Op;
    556  1.1.1.2.2.2  bouyer 
    557  1.1.1.2.2.2  bouyer 
    558  1.1.1.2.2.2  bouyer     OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
    559  1.1.1.2.2.2  bouyer 
    560  1.1.1.2.2.2  bouyer 
    561  1.1.1.2.2.2  bouyer     /* Get the NamePath from the appropriate place */
    562  1.1.1.2.2.2  bouyer 
    563  1.1.1.2.2.2  bouyer     if (OpInfo->Flags & AML_NAMED)
    564  1.1.1.2.2.2  bouyer     {
    565  1.1.1.2.2.2  bouyer         /* For nearly all NAMED operators, the name reference is the first child */
    566  1.1.1.2.2.2  bouyer 
    567  1.1.1.2.2.2  bouyer         NameOp = Op->Asl.Child;
    568  1.1.1.2.2.2  bouyer         if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
    569  1.1.1.2.2.2  bouyer         {
    570  1.1.1.2.2.2  bouyer             /*
    571  1.1.1.2.2.2  bouyer              * ALIAS is the only oddball opcode, the name declaration
    572  1.1.1.2.2.2  bouyer              * (alias name) is the second operand
    573  1.1.1.2.2.2  bouyer              */
    574  1.1.1.2.2.2  bouyer             NameOp = Op->Asl.Child->Asl.Next;
    575  1.1.1.2.2.2  bouyer         }
    576  1.1.1.2.2.2  bouyer     }
    577  1.1.1.2.2.2  bouyer     else if (OpInfo->Flags & AML_CREATE)
    578  1.1.1.2.2.2  bouyer     {
    579  1.1.1.2.2.2  bouyer         /* Name must appear as the last parameter */
    580  1.1.1.2.2.2  bouyer 
    581  1.1.1.2.2.2  bouyer         NameOp = Op->Asl.Child;
    582  1.1.1.2.2.2  bouyer         while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
    583  1.1.1.2.2.2  bouyer         {
    584  1.1.1.2.2.2  bouyer             NameOp = NameOp->Asl.Next;
    585  1.1.1.2.2.2  bouyer         }
    586  1.1.1.2.2.2  bouyer     }
    587  1.1.1.2.2.2  bouyer 
    588  1.1.1.2.2.2  bouyer     return (NameOp);
    589  1.1.1.2.2.2  bouyer }
    590  1.1.1.2.2.2  bouyer 
    591  1.1.1.2.2.2  bouyer 
    592  1.1.1.2.2.2  bouyer /*******************************************************************************
    593  1.1.1.2.2.2  bouyer  *
    594  1.1.1.2.2.2  bouyer  * FUNCTION:    LkIsObjectUsed
    595  1.1.1.2.2.2  bouyer  *
    596  1.1.1.2.2.2  bouyer  * PARAMETERS:  ACPI_WALK_CALLBACK
    597  1.1.1.2.2.2  bouyer  *
    598  1.1.1.2.2.2  bouyer  * RETURN:      Status
    599  1.1.1.2.2.2  bouyer  *
    600  1.1.1.2.2.2  bouyer  * DESCRIPTION: Check for an unreferenced namespace object and emit a warning.
    601  1.1.1.2.2.2  bouyer  *              We have to be careful, because some types and names are
    602  1.1.1.2.2.2  bouyer  *              typically or always unreferenced, we don't want to issue
    603  1.1.1.2.2.2  bouyer  *              excessive warnings.
    604  1.1.1.2.2.2  bouyer  *
    605  1.1.1.2.2.2  bouyer  ******************************************************************************/
    606  1.1.1.2.2.2  bouyer 
    607  1.1.1.2.2.2  bouyer static ACPI_STATUS
    608  1.1.1.2.2.2  bouyer LkIsObjectUsed (
    609  1.1.1.2.2.2  bouyer     ACPI_HANDLE             ObjHandle,
    610  1.1.1.2.2.2  bouyer     UINT32                  Level,
    611  1.1.1.2.2.2  bouyer     void                    *Context,
    612  1.1.1.2.2.2  bouyer     void                    **ReturnValue)
    613  1.1.1.2.2.2  bouyer {
    614  1.1.1.2.2.2  bouyer     ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
    615  1.1.1.2.2.2  bouyer 
    616  1.1.1.2.2.2  bouyer 
    617  1.1.1.2.2.2  bouyer     /* Referenced flag is set during the namespace xref */
    618  1.1.1.2.2.2  bouyer 
    619  1.1.1.2.2.2  bouyer     if (Node->Flags & ANOBJ_IS_REFERENCED)
    620  1.1.1.2.2.2  bouyer     {
    621  1.1.1.2.2.2  bouyer         return (AE_OK);
    622  1.1.1.2.2.2  bouyer     }
    623  1.1.1.2.2.2  bouyer 
    624  1.1.1.2.2.2  bouyer     /*
    625  1.1.1.2.2.2  bouyer      * Ignore names that start with an underscore,
    626  1.1.1.2.2.2  bouyer      * these are the reserved ACPI names and are typically not referenced,
    627  1.1.1.2.2.2  bouyer      * they are called by the host OS.
    628  1.1.1.2.2.2  bouyer      */
    629  1.1.1.2.2.2  bouyer     if (Node->Name.Ascii[0] == '_')
    630  1.1.1.2.2.2  bouyer     {
    631  1.1.1.2.2.2  bouyer         return (AE_OK);
    632  1.1.1.2.2.2  bouyer     }
    633  1.1.1.2.2.2  bouyer 
    634  1.1.1.2.2.2  bouyer     /* There are some types that are typically not referenced, ignore them */
    635  1.1.1.2.2.2  bouyer 
    636  1.1.1.2.2.2  bouyer     switch (Node->Type)
    637  1.1.1.2.2.2  bouyer     {
    638  1.1.1.2.2.2  bouyer     case ACPI_TYPE_DEVICE:
    639  1.1.1.2.2.2  bouyer     case ACPI_TYPE_PROCESSOR:
    640  1.1.1.2.2.2  bouyer     case ACPI_TYPE_POWER:
    641  1.1.1.2.2.2  bouyer     case ACPI_TYPE_LOCAL_RESOURCE:
    642  1.1.1.2.2.2  bouyer         return (AE_OK);
    643  1.1.1.2.2.2  bouyer 
    644  1.1.1.2.2.2  bouyer     default:
    645  1.1.1.2.2.2  bouyer         break;
    646  1.1.1.2.2.2  bouyer     }
    647  1.1.1.2.2.2  bouyer 
    648  1.1.1.2.2.2  bouyer     /* All others are valid unreferenced namespace objects */
    649  1.1.1.2.2.2  bouyer 
    650  1.1.1.2.2.2  bouyer     if (Node->Op)
    651  1.1.1.2.2.2  bouyer     {
    652  1.1.1.2.2.2  bouyer         AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL);
    653  1.1.1.2.2.2  bouyer     }
    654  1.1.1.2.2.2  bouyer     return (AE_OK);
    655  1.1.1.2.2.2  bouyer }
    656  1.1.1.2.2.2  bouyer 
    657  1.1.1.2.2.2  bouyer 
    658  1.1.1.2.2.2  bouyer /*******************************************************************************
    659  1.1.1.2.2.2  bouyer  *
    660  1.1.1.2.2.2  bouyer  * FUNCTION:    LkFindUnreferencedObjects
    661  1.1.1.2.2.2  bouyer  *
    662  1.1.1.2.2.2  bouyer  * PARAMETERS:  None
    663  1.1.1.2.2.2  bouyer  *
    664  1.1.1.2.2.2  bouyer  * RETURN:      None
    665  1.1.1.2.2.2  bouyer  *
    666  1.1.1.2.2.2  bouyer  * DESCRIPTION: Namespace walk to find objects that are not referenced in any
    667  1.1.1.2.2.2  bouyer  *              way. Must be called after the namespace has been cross
    668  1.1.1.2.2.2  bouyer  *              referenced.
    669  1.1.1.2.2.2  bouyer  *
    670  1.1.1.2.2.2  bouyer  ******************************************************************************/
    671  1.1.1.2.2.2  bouyer 
    672  1.1.1.2.2.2  bouyer void
    673  1.1.1.2.2.2  bouyer LkFindUnreferencedObjects (
    674  1.1.1.2.2.2  bouyer     void)
    675  1.1.1.2.2.2  bouyer {
    676  1.1.1.2.2.2  bouyer 
    677  1.1.1.2.2.2  bouyer     /* Walk entire namespace from the supplied root */
    678  1.1.1.2.2.2  bouyer 
    679  1.1.1.2.2.2  bouyer     (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
    680  1.1.1.2.2.2  bouyer                 ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL,
    681  1.1.1.2.2.2  bouyer                 NULL, NULL);
    682  1.1.1.2.2.2  bouyer }
    683  1.1.1.2.2.2  bouyer 
    684  1.1.1.2.2.2  bouyer 
    685  1.1.1.2.2.2  bouyer /*******************************************************************************
    686  1.1.1.2.2.2  bouyer  *
    687  1.1.1.2.2.2  bouyer  * FUNCTION:    LkCrossReferenceNamespace
    688  1.1.1.2.2.2  bouyer  *
    689  1.1.1.2.2.2  bouyer  * PARAMETERS:  None
    690  1.1.1.2.2.2  bouyer  *
    691  1.1.1.2.2.2  bouyer  * RETURN:      Status
    692  1.1.1.2.2.2  bouyer  *
    693  1.1.1.2.2.2  bouyer  * DESCRIPTION: Perform a cross reference check of the parse tree against the
    694  1.1.1.2.2.2  bouyer  *              namespace.  Every named referenced within the parse tree
    695  1.1.1.2.2.2  bouyer  *              should be get resolved with a namespace lookup.  If not, the
    696  1.1.1.2.2.2  bouyer  *              original reference in the ASL code is invalid -- i.e., refers
    697  1.1.1.2.2.2  bouyer  *              to a non-existent object.
    698  1.1.1.2.2.2  bouyer  *
    699  1.1.1.2.2.2  bouyer  * NOTE:  The ASL "External" operator causes the name to be inserted into the
    700  1.1.1.2.2.2  bouyer  *        namespace so that references to the external name will be resolved
    701  1.1.1.2.2.2  bouyer  *        correctly here.
    702  1.1.1.2.2.2  bouyer  *
    703  1.1.1.2.2.2  bouyer  ******************************************************************************/
    704  1.1.1.2.2.2  bouyer 
    705  1.1.1.2.2.2  bouyer ACPI_STATUS
    706  1.1.1.2.2.2  bouyer LkCrossReferenceNamespace (
    707  1.1.1.2.2.2  bouyer     void)
    708  1.1.1.2.2.2  bouyer {
    709  1.1.1.2.2.2  bouyer     ACPI_WALK_STATE         *WalkState;
    710  1.1.1.2.2.2  bouyer 
    711  1.1.1.2.2.2  bouyer 
    712  1.1.1.2.2.2  bouyer     DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n");
    713  1.1.1.2.2.2  bouyer 
    714  1.1.1.2.2.2  bouyer     /*
    715  1.1.1.2.2.2  bouyer      * Create a new walk state for use when looking up names
    716  1.1.1.2.2.2  bouyer      * within the namespace (Passed as context to the callbacks)
    717  1.1.1.2.2.2  bouyer      */
    718  1.1.1.2.2.2  bouyer     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
    719  1.1.1.2.2.2  bouyer     if (!WalkState)
    720  1.1.1.2.2.2  bouyer     {
    721  1.1.1.2.2.2  bouyer         return AE_NO_MEMORY;
    722  1.1.1.2.2.2  bouyer     }
    723  1.1.1.2.2.2  bouyer 
    724  1.1.1.2.2.2  bouyer     /* Walk the entire parse tree */
    725  1.1.1.2.2.2  bouyer 
    726  1.1.1.2.2.2  bouyer     TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin,
    727  1.1.1.2.2.2  bouyer                         LkNamespaceLocateEnd, WalkState);
    728  1.1.1.2.2.2  bouyer     return AE_OK;
    729  1.1.1.2.2.2  bouyer }
    730  1.1.1.2.2.2  bouyer 
    731  1.1.1.2.2.2  bouyer 
    732  1.1.1.2.2.2  bouyer /*******************************************************************************
    733  1.1.1.2.2.2  bouyer  *
    734  1.1.1.2.2.2  bouyer  * FUNCTION:    LkCheckFieldRange
    735  1.1.1.2.2.2  bouyer  *
    736  1.1.1.2.2.2  bouyer  * PARAMETERS:  RegionBitLength     - Length of entire parent region
    737  1.1.1.2.2.2  bouyer  *              FieldBitOffset      - Start of the field unit (within region)
    738  1.1.1.2.2.2  bouyer  *              FieldBitLength      - Entire length of field unit
    739  1.1.1.2.2.2  bouyer  *              AccessBitWidth      - Access width of the field unit
    740  1.1.1.2.2.2  bouyer  *
    741  1.1.1.2.2.2  bouyer  * RETURN:      None
    742  1.1.1.2.2.2  bouyer  *
    743  1.1.1.2.2.2  bouyer  * DESCRIPTION: Check one field unit to make sure it fits in the parent
    744  1.1.1.2.2.2  bouyer  *              op region.
    745  1.1.1.2.2.2  bouyer  *
    746  1.1.1.2.2.2  bouyer  * Note: AccessBitWidth must be either 8,16,32, or 64
    747  1.1.1.2.2.2  bouyer  *
    748  1.1.1.2.2.2  bouyer  ******************************************************************************/
    749  1.1.1.2.2.2  bouyer 
    750  1.1.1.2.2.2  bouyer static void
    751  1.1.1.2.2.2  bouyer LkCheckFieldRange (
    752  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op,
    753  1.1.1.2.2.2  bouyer     UINT32                  RegionBitLength,
    754  1.1.1.2.2.2  bouyer     UINT32                  FieldBitOffset,
    755  1.1.1.2.2.2  bouyer     UINT32                  FieldBitLength,
    756  1.1.1.2.2.2  bouyer     UINT32                  AccessBitWidth)
    757  1.1.1.2.2.2  bouyer {
    758  1.1.1.2.2.2  bouyer     UINT32                  FieldEndBitOffset;
    759  1.1.1.2.2.2  bouyer 
    760  1.1.1.2.2.2  bouyer 
    761  1.1.1.2.2.2  bouyer     /*
    762  1.1.1.2.2.2  bouyer      * Check each field unit against the region size.  The entire
    763  1.1.1.2.2.2  bouyer      * field unit (start offset plus length) must fit within the
    764  1.1.1.2.2.2  bouyer      * region.
    765  1.1.1.2.2.2  bouyer      */
    766  1.1.1.2.2.2  bouyer     FieldEndBitOffset = FieldBitOffset + FieldBitLength;
    767  1.1.1.2.2.2  bouyer 
    768  1.1.1.2.2.2  bouyer     if (FieldEndBitOffset > RegionBitLength)
    769  1.1.1.2.2.2  bouyer     {
    770  1.1.1.2.2.2  bouyer         /* Field definition itself is beyond the end-of-region */
    771  1.1.1.2.2.2  bouyer 
    772  1.1.1.2.2.2  bouyer         AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL);
    773  1.1.1.2.2.2  bouyer         return;
    774  1.1.1.2.2.2  bouyer     }
    775  1.1.1.2.2.2  bouyer 
    776  1.1.1.2.2.2  bouyer     /*
    777  1.1.1.2.2.2  bouyer      * Now check that the field plus AccessWidth doesn't go beyond
    778  1.1.1.2.2.2  bouyer      * the end-of-region.  Assumes AccessBitWidth is a power of 2
    779  1.1.1.2.2.2  bouyer      */
    780  1.1.1.2.2.2  bouyer     FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth);
    781  1.1.1.2.2.2  bouyer 
    782  1.1.1.2.2.2  bouyer     if (FieldEndBitOffset > RegionBitLength)
    783  1.1.1.2.2.2  bouyer     {
    784  1.1.1.2.2.2  bouyer         /* Field definition combined with the access is beyond EOR */
    785  1.1.1.2.2.2  bouyer 
    786  1.1.1.2.2.2  bouyer         AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL);
    787  1.1.1.2.2.2  bouyer     }
    788  1.1.1.2.2.2  bouyer }
    789  1.1.1.2.2.2  bouyer 
    790  1.1.1.2.2.2  bouyer /*******************************************************************************
    791  1.1.1.2.2.2  bouyer  *
    792  1.1.1.2.2.2  bouyer  * FUNCTION:    LkNamespaceLocateBegin
    793  1.1.1.2.2.2  bouyer  *
    794  1.1.1.2.2.2  bouyer  * PARAMETERS:  ASL_WALK_CALLBACK
    795  1.1.1.2.2.2  bouyer  *
    796  1.1.1.2.2.2  bouyer  * RETURN:      Status
    797  1.1.1.2.2.2  bouyer  *
    798  1.1.1.2.2.2  bouyer  * DESCRIPTION: Descending callback used during cross-reference.  For named
    799  1.1.1.2.2.2  bouyer  *              object references, attempt to locate the name in the
    800  1.1.1.2.2.2  bouyer  *              namespace.
    801  1.1.1.2.2.2  bouyer  *
    802  1.1.1.2.2.2  bouyer  * NOTE: ASL references to named fields within resource descriptors are
    803  1.1.1.2.2.2  bouyer  *       resolved to integer values here.  Therefore, this step is an
    804  1.1.1.2.2.2  bouyer  *       important part of the code generation.  We don't know that the
    805  1.1.1.2.2.2  bouyer  *       name refers to a resource descriptor until now.
    806  1.1.1.2.2.2  bouyer  *
    807  1.1.1.2.2.2  bouyer  ******************************************************************************/
    808  1.1.1.2.2.2  bouyer 
    809  1.1.1.2.2.2  bouyer static ACPI_STATUS
    810  1.1.1.2.2.2  bouyer LkNamespaceLocateBegin (
    811  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op,
    812  1.1.1.2.2.2  bouyer     UINT32                  Level,
    813  1.1.1.2.2.2  bouyer     void                    *Context)
    814  1.1.1.2.2.2  bouyer {
    815  1.1.1.2.2.2  bouyer     ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;
    816  1.1.1.2.2.2  bouyer     ACPI_NAMESPACE_NODE     *Node;
    817  1.1.1.2.2.2  bouyer     ACPI_STATUS             Status;
    818  1.1.1.2.2.2  bouyer     ACPI_OBJECT_TYPE        ObjectType;
    819  1.1.1.2.2.2  bouyer     char                    *Path;
    820  1.1.1.2.2.2  bouyer     UINT8                   PassedArgs;
    821  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *NextOp;
    822  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *OwningOp;
    823  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *SpaceIdOp;
    824  1.1.1.2.2.2  bouyer     UINT32                  MinimumLength;
    825  1.1.1.2.2.2  bouyer     UINT32                  Temp;
    826  1.1.1.2.2.2  bouyer     const ACPI_OPCODE_INFO  *OpInfo;
    827  1.1.1.2.2.2  bouyer     UINT32                  Flags;
    828  1.1.1.2.2.2  bouyer 
    829  1.1.1.2.2.2  bouyer 
    830  1.1.1.2.2.2  bouyer     ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op);
    831  1.1.1.2.2.2  bouyer 
    832  1.1.1.2.2.2  bouyer     /*
    833  1.1.1.2.2.2  bouyer      * If this node is the actual declaration of a name
    834  1.1.1.2.2.2  bouyer      * [such as the XXXX name in "Method (XXXX)"],
    835  1.1.1.2.2.2  bouyer      * we are not interested in it here.  We only care about names that are
    836  1.1.1.2.2.2  bouyer      * references to other objects within the namespace and the parent objects
    837  1.1.1.2.2.2  bouyer      * of name declarations
    838  1.1.1.2.2.2  bouyer      */
    839  1.1.1.2.2.2  bouyer     if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
    840  1.1.1.2.2.2  bouyer     {
    841  1.1.1.2.2.2  bouyer         return (AE_OK);
    842  1.1.1.2.2.2  bouyer     }
    843  1.1.1.2.2.2  bouyer 
    844  1.1.1.2.2.2  bouyer     /* We are only interested in opcodes that have an associated name */
    845  1.1.1.2.2.2  bouyer 
    846  1.1.1.2.2.2  bouyer     OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
    847  1.1.1.2.2.2  bouyer 
    848  1.1.1.2.2.2  bouyer     if ((!(OpInfo->Flags & AML_NAMED)) &&
    849  1.1.1.2.2.2  bouyer         (!(OpInfo->Flags & AML_CREATE)) &&
    850  1.1.1.2.2.2  bouyer         (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
    851  1.1.1.2.2.2  bouyer         (Op->Asl.ParseOpcode != PARSEOP_NAMESEG)    &&
    852  1.1.1.2.2.2  bouyer         (Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
    853  1.1.1.2.2.2  bouyer     {
    854  1.1.1.2.2.2  bouyer         return (AE_OK);
    855  1.1.1.2.2.2  bouyer     }
    856  1.1.1.2.2.2  bouyer 
    857  1.1.1.2.2.2  bouyer     /*
    858  1.1.1.2.2.2  bouyer      * One special case: CondRefOf operator - we don't care if the name exists
    859  1.1.1.2.2.2  bouyer      * or not at this point, just ignore it, the point of the operator is to
    860  1.1.1.2.2.2  bouyer      * determine if the name exists at runtime.
    861  1.1.1.2.2.2  bouyer      */
    862  1.1.1.2.2.2  bouyer     if ((Op->Asl.Parent) &&
    863  1.1.1.2.2.2  bouyer         (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
    864  1.1.1.2.2.2  bouyer     {
    865  1.1.1.2.2.2  bouyer         return (AE_OK);
    866  1.1.1.2.2.2  bouyer     }
    867  1.1.1.2.2.2  bouyer 
    868  1.1.1.2.2.2  bouyer     /*
    869  1.1.1.2.2.2  bouyer      * We must enable the "search-to-root" for single NameSegs, but
    870  1.1.1.2.2.2  bouyer      * we have to be very careful about opening up scopes
    871  1.1.1.2.2.2  bouyer      */
    872  1.1.1.2.2.2  bouyer     Flags = ACPI_NS_SEARCH_PARENT;
    873  1.1.1.2.2.2  bouyer     if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
    874  1.1.1.2.2.2  bouyer         (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)    ||
    875  1.1.1.2.2.2  bouyer         (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
    876  1.1.1.2.2.2  bouyer     {
    877  1.1.1.2.2.2  bouyer         /*
    878  1.1.1.2.2.2  bouyer          * These are name references, do not push the scope stack
    879  1.1.1.2.2.2  bouyer          * for them.
    880  1.1.1.2.2.2  bouyer          */
    881  1.1.1.2.2.2  bouyer         Flags |= ACPI_NS_DONT_OPEN_SCOPE;
    882  1.1.1.2.2.2  bouyer     }
    883  1.1.1.2.2.2  bouyer 
    884  1.1.1.2.2.2  bouyer     /* Get the NamePath from the appropriate place */
    885  1.1.1.2.2.2  bouyer 
    886  1.1.1.2.2.2  bouyer     if (OpInfo->Flags & AML_NAMED)
    887  1.1.1.2.2.2  bouyer     {
    888  1.1.1.2.2.2  bouyer         /* For nearly all NAMED operators, the name reference is the first child */
    889  1.1.1.2.2.2  bouyer 
    890  1.1.1.2.2.2  bouyer         Path = Op->Asl.Child->Asl.Value.String;
    891  1.1.1.2.2.2  bouyer         if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
    892  1.1.1.2.2.2  bouyer         {
    893  1.1.1.2.2.2  bouyer             /*
    894  1.1.1.2.2.2  bouyer              * ALIAS is the only oddball opcode, the name declaration
    895  1.1.1.2.2.2  bouyer              * (alias name) is the second operand
    896  1.1.1.2.2.2  bouyer              */
    897  1.1.1.2.2.2  bouyer             Path = Op->Asl.Child->Asl.Next->Asl.Value.String;
    898  1.1.1.2.2.2  bouyer         }
    899  1.1.1.2.2.2  bouyer     }
    900  1.1.1.2.2.2  bouyer     else if (OpInfo->Flags & AML_CREATE)
    901  1.1.1.2.2.2  bouyer     {
    902  1.1.1.2.2.2  bouyer         /* Name must appear as the last parameter */
    903  1.1.1.2.2.2  bouyer 
    904  1.1.1.2.2.2  bouyer         NextOp = Op->Asl.Child;
    905  1.1.1.2.2.2  bouyer         while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
    906  1.1.1.2.2.2  bouyer         {
    907  1.1.1.2.2.2  bouyer             NextOp = NextOp->Asl.Next;
    908  1.1.1.2.2.2  bouyer         }
    909  1.1.1.2.2.2  bouyer         Path = NextOp->Asl.Value.String;
    910  1.1.1.2.2.2  bouyer     }
    911  1.1.1.2.2.2  bouyer     else
    912  1.1.1.2.2.2  bouyer     {
    913  1.1.1.2.2.2  bouyer         Path = Op->Asl.Value.String;
    914  1.1.1.2.2.2  bouyer     }
    915  1.1.1.2.2.2  bouyer 
    916  1.1.1.2.2.2  bouyer     ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
    917  1.1.1.2.2.2  bouyer     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    918  1.1.1.2.2.2  bouyer         "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
    919  1.1.1.2.2.2  bouyer 
    920  1.1.1.2.2.2  bouyer     /*
    921  1.1.1.2.2.2  bouyer      * Lookup the name in the namespace.  Name must exist at this point, or it
    922  1.1.1.2.2.2  bouyer      * is an invalid reference.
    923  1.1.1.2.2.2  bouyer      *
    924  1.1.1.2.2.2  bouyer      * The namespace is also used as a lookup table for references to resource
    925  1.1.1.2.2.2  bouyer      * descriptors and the fields within them.
    926  1.1.1.2.2.2  bouyer      */
    927  1.1.1.2.2.2  bouyer     Gbl_NsLookupCount++;
    928  1.1.1.2.2.2  bouyer 
    929  1.1.1.2.2.2  bouyer     Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
    930  1.1.1.2.2.2  bouyer                 ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
    931  1.1.1.2.2.2  bouyer     if (ACPI_FAILURE (Status))
    932  1.1.1.2.2.2  bouyer     {
    933  1.1.1.2.2.2  bouyer         if (Status == AE_NOT_FOUND)
    934  1.1.1.2.2.2  bouyer         {
    935  1.1.1.2.2.2  bouyer             /*
    936  1.1.1.2.2.2  bouyer              * We didn't find the name reference by path -- we can qualify this
    937  1.1.1.2.2.2  bouyer              * a little better before we print an error message
    938  1.1.1.2.2.2  bouyer              */
    939  1.1.1.2.2.2  bouyer             if (strlen (Path) == ACPI_NAME_SIZE)
    940  1.1.1.2.2.2  bouyer             {
    941  1.1.1.2.2.2  bouyer                 /* A simple, one-segment ACPI name */
    942  1.1.1.2.2.2  bouyer 
    943  1.1.1.2.2.2  bouyer                 if (LkObjectExists (Path))
    944  1.1.1.2.2.2  bouyer                 {
    945  1.1.1.2.2.2  bouyer                     /*
    946  1.1.1.2.2.2  bouyer                      * There exists such a name, but we couldn't get to it
    947  1.1.1.2.2.2  bouyer                      * from this scope
    948  1.1.1.2.2.2  bouyer                      */
    949  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op,
    950  1.1.1.2.2.2  bouyer                         Op->Asl.ExternalName);
    951  1.1.1.2.2.2  bouyer                 }
    952  1.1.1.2.2.2  bouyer                 else
    953  1.1.1.2.2.2  bouyer                 {
    954  1.1.1.2.2.2  bouyer                     /* The name doesn't exist, period */
    955  1.1.1.2.2.2  bouyer 
    956  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_NOT_EXIST,
    957  1.1.1.2.2.2  bouyer                         Op, Op->Asl.ExternalName);
    958  1.1.1.2.2.2  bouyer                 }
    959  1.1.1.2.2.2  bouyer             }
    960  1.1.1.2.2.2  bouyer             else
    961  1.1.1.2.2.2  bouyer             {
    962  1.1.1.2.2.2  bouyer                 /* Check for a fully qualified path */
    963  1.1.1.2.2.2  bouyer 
    964  1.1.1.2.2.2  bouyer                 if (Path[0] == AML_ROOT_PREFIX)
    965  1.1.1.2.2.2  bouyer                 {
    966  1.1.1.2.2.2  bouyer                     /* Gave full path, the object does not exist */
    967  1.1.1.2.2.2  bouyer 
    968  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
    969  1.1.1.2.2.2  bouyer                         Op->Asl.ExternalName);
    970  1.1.1.2.2.2  bouyer                 }
    971  1.1.1.2.2.2  bouyer                 else
    972  1.1.1.2.2.2  bouyer                 {
    973  1.1.1.2.2.2  bouyer                     /*
    974  1.1.1.2.2.2  bouyer                      * We can't tell whether it doesn't exist or just
    975  1.1.1.2.2.2  bouyer                      * can't be reached.
    976  1.1.1.2.2.2  bouyer                      */
    977  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
    978  1.1.1.2.2.2  bouyer                         Op->Asl.ExternalName);
    979  1.1.1.2.2.2  bouyer                 }
    980  1.1.1.2.2.2  bouyer             }
    981  1.1.1.2.2.2  bouyer 
    982  1.1.1.2.2.2  bouyer             Status = AE_OK;
    983  1.1.1.2.2.2  bouyer         }
    984  1.1.1.2.2.2  bouyer         return (Status);
    985  1.1.1.2.2.2  bouyer     }
    986  1.1.1.2.2.2  bouyer 
    987  1.1.1.2.2.2  bouyer     /* Check for a reference vs. name declaration */
    988  1.1.1.2.2.2  bouyer 
    989  1.1.1.2.2.2  bouyer     if (!(OpInfo->Flags & AML_NAMED) &&
    990  1.1.1.2.2.2  bouyer         !(OpInfo->Flags & AML_CREATE))
    991  1.1.1.2.2.2  bouyer     {
    992  1.1.1.2.2.2  bouyer         /* This node has been referenced, mark it for reference check */
    993  1.1.1.2.2.2  bouyer 
    994  1.1.1.2.2.2  bouyer         Node->Flags |= ANOBJ_IS_REFERENCED;
    995  1.1.1.2.2.2  bouyer     }
    996  1.1.1.2.2.2  bouyer 
    997  1.1.1.2.2.2  bouyer     /* Attempt to optimize the NamePath */
    998  1.1.1.2.2.2  bouyer 
    999  1.1.1.2.2.2  bouyer     OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
   1000  1.1.1.2.2.2  bouyer 
   1001  1.1.1.2.2.2  bouyer     /*
   1002  1.1.1.2.2.2  bouyer      * 1) Dereference an alias (A name reference that is an alias)
   1003  1.1.1.2.2.2  bouyer      *    Aliases are not nested, the alias always points to the final object
   1004  1.1.1.2.2.2  bouyer      */
   1005  1.1.1.2.2.2  bouyer     if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) &&
   1006  1.1.1.2.2.2  bouyer         (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
   1007  1.1.1.2.2.2  bouyer     {
   1008  1.1.1.2.2.2  bouyer         /* This node points back to the original PARSEOP_ALIAS */
   1009  1.1.1.2.2.2  bouyer 
   1010  1.1.1.2.2.2  bouyer         NextOp = Node->Op;
   1011  1.1.1.2.2.2  bouyer 
   1012  1.1.1.2.2.2  bouyer         /* The first child is the alias target op */
   1013  1.1.1.2.2.2  bouyer 
   1014  1.1.1.2.2.2  bouyer         NextOp = NextOp->Asl.Child;
   1015  1.1.1.2.2.2  bouyer 
   1016  1.1.1.2.2.2  bouyer         /* That in turn points back to original target alias node */
   1017  1.1.1.2.2.2  bouyer 
   1018  1.1.1.2.2.2  bouyer         if (NextOp->Asl.Node)
   1019  1.1.1.2.2.2  bouyer         {
   1020  1.1.1.2.2.2  bouyer             Node = NextOp->Asl.Node;
   1021  1.1.1.2.2.2  bouyer         }
   1022  1.1.1.2.2.2  bouyer 
   1023  1.1.1.2.2.2  bouyer         /* Else - forward reference to alias, will be resolved later */
   1024  1.1.1.2.2.2  bouyer     }
   1025  1.1.1.2.2.2  bouyer 
   1026  1.1.1.2.2.2  bouyer     /* 2) Check for a reference to a resource descriptor */
   1027  1.1.1.2.2.2  bouyer 
   1028  1.1.1.2.2.2  bouyer     if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
   1029  1.1.1.2.2.2  bouyer              (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
   1030  1.1.1.2.2.2  bouyer     {
   1031  1.1.1.2.2.2  bouyer         /*
   1032  1.1.1.2.2.2  bouyer          * This was a reference to a field within a resource descriptor.  Extract
   1033  1.1.1.2.2.2  bouyer          * the associated field offset (either a bit or byte offset depending on
   1034  1.1.1.2.2.2  bouyer          * the field type) and change the named reference into an integer for
   1035  1.1.1.2.2.2  bouyer          * AML code generation
   1036  1.1.1.2.2.2  bouyer          */
   1037  1.1.1.2.2.2  bouyer         Temp = Node->Value;
   1038  1.1.1.2.2.2  bouyer         if (Node->Flags & ANOBJ_IS_BIT_OFFSET)
   1039  1.1.1.2.2.2  bouyer         {
   1040  1.1.1.2.2.2  bouyer             Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET;
   1041  1.1.1.2.2.2  bouyer         }
   1042  1.1.1.2.2.2  bouyer 
   1043  1.1.1.2.2.2  bouyer         /* Perform BitOffset <--> ByteOffset conversion if necessary */
   1044  1.1.1.2.2.2  bouyer 
   1045  1.1.1.2.2.2  bouyer         switch (Op->Asl.Parent->Asl.AmlOpcode)
   1046  1.1.1.2.2.2  bouyer         {
   1047  1.1.1.2.2.2  bouyer         case AML_CREATE_FIELD_OP:
   1048  1.1.1.2.2.2  bouyer 
   1049  1.1.1.2.2.2  bouyer             /* We allow a Byte offset to Bit Offset conversion for this op */
   1050  1.1.1.2.2.2  bouyer 
   1051  1.1.1.2.2.2  bouyer             if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
   1052  1.1.1.2.2.2  bouyer             {
   1053  1.1.1.2.2.2  bouyer                 /* Simply multiply byte offset times 8 to get bit offset */
   1054  1.1.1.2.2.2  bouyer 
   1055  1.1.1.2.2.2  bouyer                 Temp = ACPI_MUL_8 (Temp);
   1056  1.1.1.2.2.2  bouyer             }
   1057  1.1.1.2.2.2  bouyer             break;
   1058  1.1.1.2.2.2  bouyer 
   1059  1.1.1.2.2.2  bouyer 
   1060  1.1.1.2.2.2  bouyer         case AML_CREATE_BIT_FIELD_OP:
   1061  1.1.1.2.2.2  bouyer 
   1062  1.1.1.2.2.2  bouyer             /* This op requires a Bit Offset */
   1063  1.1.1.2.2.2  bouyer 
   1064  1.1.1.2.2.2  bouyer             if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
   1065  1.1.1.2.2.2  bouyer             {
   1066  1.1.1.2.2.2  bouyer                 AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL);
   1067  1.1.1.2.2.2  bouyer             }
   1068  1.1.1.2.2.2  bouyer             break;
   1069  1.1.1.2.2.2  bouyer 
   1070  1.1.1.2.2.2  bouyer 
   1071  1.1.1.2.2.2  bouyer         case AML_CREATE_BYTE_FIELD_OP:
   1072  1.1.1.2.2.2  bouyer         case AML_CREATE_WORD_FIELD_OP:
   1073  1.1.1.2.2.2  bouyer         case AML_CREATE_DWORD_FIELD_OP:
   1074  1.1.1.2.2.2  bouyer         case AML_CREATE_QWORD_FIELD_OP:
   1075  1.1.1.2.2.2  bouyer         case AML_INDEX_OP:
   1076  1.1.1.2.2.2  bouyer 
   1077  1.1.1.2.2.2  bouyer             /* These Ops require Byte offsets */
   1078  1.1.1.2.2.2  bouyer 
   1079  1.1.1.2.2.2  bouyer             if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
   1080  1.1.1.2.2.2  bouyer             {
   1081  1.1.1.2.2.2  bouyer                 AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL);
   1082  1.1.1.2.2.2  bouyer             }
   1083  1.1.1.2.2.2  bouyer             break;
   1084  1.1.1.2.2.2  bouyer 
   1085  1.1.1.2.2.2  bouyer 
   1086  1.1.1.2.2.2  bouyer         default:
   1087  1.1.1.2.2.2  bouyer             /* Nothing to do for other opcodes */
   1088  1.1.1.2.2.2  bouyer             break;
   1089  1.1.1.2.2.2  bouyer         }
   1090  1.1.1.2.2.2  bouyer 
   1091  1.1.1.2.2.2  bouyer         /* Now convert this node to an integer whose value is the field offset */
   1092  1.1.1.2.2.2  bouyer 
   1093  1.1.1.2.2.2  bouyer         Op->Asl.AmlLength       = 0;
   1094  1.1.1.2.2.2  bouyer         Op->Asl.ParseOpcode     = PARSEOP_INTEGER;
   1095  1.1.1.2.2.2  bouyer         Op->Asl.Value.Integer   = (UINT64) Temp;
   1096  1.1.1.2.2.2  bouyer         Op->Asl.CompileFlags   |= NODE_IS_RESOURCE_FIELD;
   1097  1.1.1.2.2.2  bouyer 
   1098  1.1.1.2.2.2  bouyer         OpcGenerateAmlOpcode (Op);
   1099  1.1.1.2.2.2  bouyer     }
   1100  1.1.1.2.2.2  bouyer 
   1101  1.1.1.2.2.2  bouyer     /* 3) Check for a method invocation */
   1102  1.1.1.2.2.2  bouyer 
   1103  1.1.1.2.2.2  bouyer     else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
   1104  1.1.1.2.2.2  bouyer                 (Node->Type == ACPI_TYPE_METHOD) &&
   1105  1.1.1.2.2.2  bouyer                 (Op->Asl.Parent) &&
   1106  1.1.1.2.2.2  bouyer                 (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD))   ||
   1107  1.1.1.2.2.2  bouyer 
   1108  1.1.1.2.2.2  bouyer                 (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
   1109  1.1.1.2.2.2  bouyer     {
   1110  1.1.1.2.2.2  bouyer 
   1111  1.1.1.2.2.2  bouyer         /*
   1112  1.1.1.2.2.2  bouyer          * A reference to a method within one of these opcodes is not an
   1113  1.1.1.2.2.2  bouyer          * invocation of the method, it is simply a reference to the method.
   1114  1.1.1.2.2.2  bouyer          */
   1115  1.1.1.2.2.2  bouyer         if ((Op->Asl.Parent) &&
   1116  1.1.1.2.2.2  bouyer            ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF)      ||
   1117  1.1.1.2.2.2  bouyer             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF)    ||
   1118  1.1.1.2.2.2  bouyer             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
   1119  1.1.1.2.2.2  bouyer         {
   1120  1.1.1.2.2.2  bouyer             return (AE_OK);
   1121  1.1.1.2.2.2  bouyer         }
   1122  1.1.1.2.2.2  bouyer         /*
   1123  1.1.1.2.2.2  bouyer          * There are two types of method invocation:
   1124  1.1.1.2.2.2  bouyer          * 1) Invocation with arguments -- the parser recognizes this
   1125  1.1.1.2.2.2  bouyer          *    as a METHODCALL.
   1126  1.1.1.2.2.2  bouyer          * 2) Invocation with no arguments --the parser cannot determine that
   1127  1.1.1.2.2.2  bouyer          *    this is a method invocation, therefore we have to figure it out
   1128  1.1.1.2.2.2  bouyer          *    here.
   1129  1.1.1.2.2.2  bouyer          */
   1130  1.1.1.2.2.2  bouyer         if (Node->Type != ACPI_TYPE_METHOD)
   1131  1.1.1.2.2.2  bouyer         {
   1132  1.1.1.2.2.2  bouyer             sprintf (MsgBuffer, "%s is a %s",
   1133  1.1.1.2.2.2  bouyer                     Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
   1134  1.1.1.2.2.2  bouyer 
   1135  1.1.1.2.2.2  bouyer             AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
   1136  1.1.1.2.2.2  bouyer             return (AE_OK);
   1137  1.1.1.2.2.2  bouyer         }
   1138  1.1.1.2.2.2  bouyer 
   1139  1.1.1.2.2.2  bouyer         /* Save the method node in the caller's op */
   1140  1.1.1.2.2.2  bouyer 
   1141  1.1.1.2.2.2  bouyer         Op->Asl.Node = Node;
   1142  1.1.1.2.2.2  bouyer         if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)
   1143  1.1.1.2.2.2  bouyer         {
   1144  1.1.1.2.2.2  bouyer             return (AE_OK);
   1145  1.1.1.2.2.2  bouyer         }
   1146  1.1.1.2.2.2  bouyer 
   1147  1.1.1.2.2.2  bouyer         /*
   1148  1.1.1.2.2.2  bouyer          * This is a method invocation, with or without arguments.
   1149  1.1.1.2.2.2  bouyer          * Count the number of arguments, each appears as a child
   1150  1.1.1.2.2.2  bouyer          * under the parent node
   1151  1.1.1.2.2.2  bouyer          */
   1152  1.1.1.2.2.2  bouyer         Op->Asl.ParseOpcode = PARSEOP_METHODCALL;
   1153  1.1.1.2.2.2  bouyer         UtSetParseOpName (Op);
   1154  1.1.1.2.2.2  bouyer 
   1155  1.1.1.2.2.2  bouyer         PassedArgs = 0;
   1156  1.1.1.2.2.2  bouyer         NextOp     = Op->Asl.Child;
   1157  1.1.1.2.2.2  bouyer 
   1158  1.1.1.2.2.2  bouyer         while (NextOp)
   1159  1.1.1.2.2.2  bouyer         {
   1160  1.1.1.2.2.2  bouyer             PassedArgs++;
   1161  1.1.1.2.2.2  bouyer             NextOp = NextOp->Asl.Next;
   1162  1.1.1.2.2.2  bouyer         }
   1163  1.1.1.2.2.2  bouyer 
   1164  1.1.1.2.2.2  bouyer         if (Node->Value != ASL_EXTERNAL_METHOD)
   1165  1.1.1.2.2.2  bouyer         {
   1166  1.1.1.2.2.2  bouyer             /*
   1167  1.1.1.2.2.2  bouyer              * Check the parsed arguments with the number expected by the
   1168  1.1.1.2.2.2  bouyer              * method declaration itself
   1169  1.1.1.2.2.2  bouyer              */
   1170  1.1.1.2.2.2  bouyer             if (PassedArgs != Node->Value)
   1171  1.1.1.2.2.2  bouyer             {
   1172  1.1.1.2.2.2  bouyer                 sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
   1173  1.1.1.2.2.2  bouyer                             Node->Value);
   1174  1.1.1.2.2.2  bouyer 
   1175  1.1.1.2.2.2  bouyer                 if (PassedArgs < Node->Value)
   1176  1.1.1.2.2.2  bouyer                 {
   1177  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
   1178  1.1.1.2.2.2  bouyer                 }
   1179  1.1.1.2.2.2  bouyer                 else
   1180  1.1.1.2.2.2  bouyer                 {
   1181  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer);
   1182  1.1.1.2.2.2  bouyer                 }
   1183  1.1.1.2.2.2  bouyer             }
   1184  1.1.1.2.2.2  bouyer         }
   1185  1.1.1.2.2.2  bouyer     }
   1186  1.1.1.2.2.2  bouyer 
   1187  1.1.1.2.2.2  bouyer     /* 4) Check for an ASL Field definition */
   1188  1.1.1.2.2.2  bouyer 
   1189  1.1.1.2.2.2  bouyer     else if ((Op->Asl.Parent) &&
   1190  1.1.1.2.2.2  bouyer             ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD)     ||
   1191  1.1.1.2.2.2  bouyer              (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
   1192  1.1.1.2.2.2  bouyer     {
   1193  1.1.1.2.2.2  bouyer         /*
   1194  1.1.1.2.2.2  bouyer          * Offset checking for fields.  If the parent operation region has a
   1195  1.1.1.2.2.2  bouyer          * constant length (known at compile time), we can check fields
   1196  1.1.1.2.2.2  bouyer          * defined in that region against the region length.  This will catch
   1197  1.1.1.2.2.2  bouyer          * fields and field units that cannot possibly fit within the region.
   1198  1.1.1.2.2.2  bouyer          *
   1199  1.1.1.2.2.2  bouyer          * Note: Index fields do not directly reference an operation region,
   1200  1.1.1.2.2.2  bouyer          * thus they are not included in this check.
   1201  1.1.1.2.2.2  bouyer          */
   1202  1.1.1.2.2.2  bouyer         if (Op == Op->Asl.Parent->Asl.Child)
   1203  1.1.1.2.2.2  bouyer         {
   1204  1.1.1.2.2.2  bouyer             /*
   1205  1.1.1.2.2.2  bouyer              * This is the first child of the field node, which is
   1206  1.1.1.2.2.2  bouyer              * the name of the region.  Get the parse node for the
   1207  1.1.1.2.2.2  bouyer              * region -- which contains the length of the region.
   1208  1.1.1.2.2.2  bouyer              */
   1209  1.1.1.2.2.2  bouyer             OwningOp = Node->Op;
   1210  1.1.1.2.2.2  bouyer             Op->Asl.Parent->Asl.ExtraValue =
   1211  1.1.1.2.2.2  bouyer                 ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer);
   1212  1.1.1.2.2.2  bouyer 
   1213  1.1.1.2.2.2  bouyer             /* Examine the field access width */
   1214  1.1.1.2.2.2  bouyer 
   1215  1.1.1.2.2.2  bouyer             switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer)
   1216  1.1.1.2.2.2  bouyer             {
   1217  1.1.1.2.2.2  bouyer             case AML_FIELD_ACCESS_ANY:
   1218  1.1.1.2.2.2  bouyer             case AML_FIELD_ACCESS_BYTE:
   1219  1.1.1.2.2.2  bouyer             case AML_FIELD_ACCESS_BUFFER:
   1220  1.1.1.2.2.2  bouyer             default:
   1221  1.1.1.2.2.2  bouyer                 MinimumLength = 1;
   1222  1.1.1.2.2.2  bouyer                 break;
   1223  1.1.1.2.2.2  bouyer 
   1224  1.1.1.2.2.2  bouyer             case AML_FIELD_ACCESS_WORD:
   1225  1.1.1.2.2.2  bouyer                 MinimumLength = 2;
   1226  1.1.1.2.2.2  bouyer                 break;
   1227  1.1.1.2.2.2  bouyer 
   1228  1.1.1.2.2.2  bouyer             case AML_FIELD_ACCESS_DWORD:
   1229  1.1.1.2.2.2  bouyer                 MinimumLength = 4;
   1230  1.1.1.2.2.2  bouyer                 break;
   1231  1.1.1.2.2.2  bouyer 
   1232  1.1.1.2.2.2  bouyer             case AML_FIELD_ACCESS_QWORD:
   1233  1.1.1.2.2.2  bouyer                 MinimumLength = 8;
   1234  1.1.1.2.2.2  bouyer                 break;
   1235  1.1.1.2.2.2  bouyer             }
   1236  1.1.1.2.2.2  bouyer 
   1237  1.1.1.2.2.2  bouyer             /*
   1238  1.1.1.2.2.2  bouyer              * Is the region at least as big as the access width?
   1239  1.1.1.2.2.2  bouyer              * Note: DataTableRegions have 0 length
   1240  1.1.1.2.2.2  bouyer              */
   1241  1.1.1.2.2.2  bouyer             if (((UINT32) OwningOp->Asl.Value.Integer) &&
   1242  1.1.1.2.2.2  bouyer                 ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength))
   1243  1.1.1.2.2.2  bouyer             {
   1244  1.1.1.2.2.2  bouyer                 AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL);
   1245  1.1.1.2.2.2  bouyer             }
   1246  1.1.1.2.2.2  bouyer 
   1247  1.1.1.2.2.2  bouyer             /*
   1248  1.1.1.2.2.2  bouyer              * Check EC/CMOS/SMBUS fields to make sure that the correct
   1249  1.1.1.2.2.2  bouyer              * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS)
   1250  1.1.1.2.2.2  bouyer              */
   1251  1.1.1.2.2.2  bouyer             SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
   1252  1.1.1.2.2.2  bouyer             switch ((UINT32) SpaceIdOp->Asl.Value.Integer)
   1253  1.1.1.2.2.2  bouyer             {
   1254  1.1.1.2.2.2  bouyer             case REGION_EC:
   1255  1.1.1.2.2.2  bouyer             case REGION_CMOS:
   1256  1.1.1.2.2.2  bouyer 
   1257  1.1.1.2.2.2  bouyer                 if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
   1258  1.1.1.2.2.2  bouyer                 {
   1259  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
   1260  1.1.1.2.2.2  bouyer                 }
   1261  1.1.1.2.2.2  bouyer                 break;
   1262  1.1.1.2.2.2  bouyer 
   1263  1.1.1.2.2.2  bouyer             case REGION_SMBUS:
   1264  1.1.1.2.2.2  bouyer             case REGION_IPMI:
   1265  1.1.1.2.2.2  bouyer 
   1266  1.1.1.2.2.2  bouyer                 if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
   1267  1.1.1.2.2.2  bouyer                 {
   1268  1.1.1.2.2.2  bouyer                     AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL);
   1269  1.1.1.2.2.2  bouyer                 }
   1270  1.1.1.2.2.2  bouyer                 break;
   1271  1.1.1.2.2.2  bouyer 
   1272  1.1.1.2.2.2  bouyer             default:
   1273  1.1.1.2.2.2  bouyer 
   1274  1.1.1.2.2.2  bouyer                 /* Nothing to do for other address spaces */
   1275  1.1.1.2.2.2  bouyer                 break;
   1276  1.1.1.2.2.2  bouyer             }
   1277  1.1.1.2.2.2  bouyer         }
   1278  1.1.1.2.2.2  bouyer         else
   1279  1.1.1.2.2.2  bouyer         {
   1280  1.1.1.2.2.2  bouyer             /*
   1281  1.1.1.2.2.2  bouyer              * This is one element of the field list.  Check to make sure
   1282  1.1.1.2.2.2  bouyer              * that it does not go beyond the end of the parent operation region.
   1283  1.1.1.2.2.2  bouyer              *
   1284  1.1.1.2.2.2  bouyer              * In the code below:
   1285  1.1.1.2.2.2  bouyer              *    Op->Asl.Parent->Asl.ExtraValue      - Region Length (bits)
   1286  1.1.1.2.2.2  bouyer              *    Op->Asl.ExtraValue                  - Field start offset (bits)
   1287  1.1.1.2.2.2  bouyer              *    Op->Asl.Child->Asl.Value.Integer32  - Field length (bits)
   1288  1.1.1.2.2.2  bouyer              *    Op->Asl.Child->Asl.ExtraValue       - Field access width (bits)
   1289  1.1.1.2.2.2  bouyer              */
   1290  1.1.1.2.2.2  bouyer             if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child)
   1291  1.1.1.2.2.2  bouyer             {
   1292  1.1.1.2.2.2  bouyer                 LkCheckFieldRange (Op,
   1293  1.1.1.2.2.2  bouyer                             Op->Asl.Parent->Asl.ExtraValue,
   1294  1.1.1.2.2.2  bouyer                             Op->Asl.ExtraValue,
   1295  1.1.1.2.2.2  bouyer                             (UINT32) Op->Asl.Child->Asl.Value.Integer,
   1296  1.1.1.2.2.2  bouyer                             Op->Asl.Child->Asl.ExtraValue);
   1297  1.1.1.2.2.2  bouyer             }
   1298  1.1.1.2.2.2  bouyer         }
   1299  1.1.1.2.2.2  bouyer     }
   1300  1.1.1.2.2.2  bouyer 
   1301  1.1.1.2.2.2  bouyer     Op->Asl.Node = Node;
   1302  1.1.1.2.2.2  bouyer     return (Status);
   1303  1.1.1.2.2.2  bouyer }
   1304  1.1.1.2.2.2  bouyer 
   1305  1.1.1.2.2.2  bouyer 
   1306  1.1.1.2.2.2  bouyer /*******************************************************************************
   1307  1.1.1.2.2.2  bouyer  *
   1308  1.1.1.2.2.2  bouyer  * FUNCTION:    LkNamespaceLocateEnd
   1309  1.1.1.2.2.2  bouyer  *
   1310  1.1.1.2.2.2  bouyer  * PARAMETERS:  ASL_WALK_CALLBACK
   1311  1.1.1.2.2.2  bouyer  *
   1312  1.1.1.2.2.2  bouyer  * RETURN:      Status
   1313  1.1.1.2.2.2  bouyer  *
   1314  1.1.1.2.2.2  bouyer  * DESCRIPTION: Ascending callback used during cross reference.  We only
   1315  1.1.1.2.2.2  bouyer  *              need to worry about scope management here.
   1316  1.1.1.2.2.2  bouyer  *
   1317  1.1.1.2.2.2  bouyer  ******************************************************************************/
   1318  1.1.1.2.2.2  bouyer 
   1319  1.1.1.2.2.2  bouyer static ACPI_STATUS
   1320  1.1.1.2.2.2  bouyer LkNamespaceLocateEnd (
   1321  1.1.1.2.2.2  bouyer     ACPI_PARSE_OBJECT       *Op,
   1322  1.1.1.2.2.2  bouyer     UINT32                  Level,
   1323  1.1.1.2.2.2  bouyer     void                    *Context)
   1324  1.1.1.2.2.2  bouyer {
   1325  1.1.1.2.2.2  bouyer     ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;
   1326  1.1.1.2.2.2  bouyer     const ACPI_OPCODE_INFO  *OpInfo;
   1327  1.1.1.2.2.2  bouyer 
   1328  1.1.1.2.2.2  bouyer 
   1329  1.1.1.2.2.2  bouyer     ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd);
   1330  1.1.1.2.2.2  bouyer 
   1331  1.1.1.2.2.2  bouyer 
   1332  1.1.1.2.2.2  bouyer     /* We are only interested in opcodes that have an associated name */
   1333  1.1.1.2.2.2  bouyer 
   1334  1.1.1.2.2.2  bouyer     OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
   1335  1.1.1.2.2.2  bouyer     if (!(OpInfo->Flags & AML_NAMED))
   1336  1.1.1.2.2.2  bouyer     {
   1337  1.1.1.2.2.2  bouyer         return (AE_OK);
   1338  1.1.1.2.2.2  bouyer     }
   1339  1.1.1.2.2.2  bouyer 
   1340  1.1.1.2.2.2  bouyer     /* Not interested in name references, we did not open a scope for them */
   1341  1.1.1.2.2.2  bouyer 
   1342  1.1.1.2.2.2  bouyer     if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
   1343  1.1.1.2.2.2  bouyer         (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)    ||
   1344  1.1.1.2.2.2  bouyer         (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
   1345  1.1.1.2.2.2  bouyer     {
   1346  1.1.1.2.2.2  bouyer         return (AE_OK);
   1347  1.1.1.2.2.2  bouyer     }
   1348  1.1.1.2.2.2  bouyer 
   1349  1.1.1.2.2.2  bouyer     /* Pop the scope stack if necessary */
   1350  1.1.1.2.2.2  bouyer 
   1351  1.1.1.2.2.2  bouyer     if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode)))
   1352  1.1.1.2.2.2  bouyer     {
   1353  1.1.1.2.2.2  bouyer 
   1354  1.1.1.2.2.2  bouyer         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
   1355  1.1.1.2.2.2  bouyer             "%s: Popping scope for Op %p\n",
   1356  1.1.1.2.2.2  bouyer             AcpiUtGetTypeName (OpInfo->ObjectType), Op));
   1357  1.1.1.2.2.2  bouyer 
   1358  1.1.1.2.2.2  bouyer         (void) AcpiDsScopeStackPop (WalkState);
   1359  1.1.1.2.2.2  bouyer     }
   1360  1.1.1.2.2.2  bouyer 
   1361  1.1.1.2.2.2  bouyer     return (AE_OK);
   1362  1.1.1.2.2.2  bouyer }
   1363  1.1.1.2.2.2  bouyer 
   1364  1.1.1.2.2.2  bouyer 
   1365