Home | History | Annotate | Line # | Download | only in compiler
aslpredef.c revision 1.18
      1   1.1    jruoho /******************************************************************************
      2   1.1    jruoho  *
      3   1.1    jruoho  * Module Name: aslpredef - support for ACPI predefined names
      4   1.1    jruoho  *
      5   1.1    jruoho  *****************************************************************************/
      6   1.1    jruoho 
      7  1.18  christos /******************************************************************************
      8  1.18  christos  *
      9  1.18  christos  * 1. Copyright Notice
     10  1.18  christos  *
     11  1.18  christos  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
     12   1.1    jruoho  * All rights reserved.
     13   1.1    jruoho  *
     14  1.18  christos  * 2. License
     15  1.18  christos  *
     16  1.18  christos  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.18  christos  * rights. You may have additional license terms from the party that provided
     18  1.18  christos  * you this software, covering your right to use that party's intellectual
     19  1.18  christos  * property rights.
     20  1.18  christos  *
     21  1.18  christos  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.18  christos  * copy of the source code appearing in this file ("Covered Code") an
     23  1.18  christos  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.18  christos  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.18  christos  * make derivatives, distribute, use and display any portion of the Covered
     26  1.18  christos  * Code in any form, with the right to sublicense such rights; and
     27  1.18  christos  *
     28  1.18  christos  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  1.18  christos  * license (with the right to sublicense), under only those claims of Intel
     30  1.18  christos  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  1.18  christos  * offer to sell, and import the Covered Code and derivative works thereof
     32  1.18  christos  * solely to the minimum extent necessary to exercise the above copyright
     33  1.18  christos  * license, and in no event shall the patent license extend to any additions
     34  1.18  christos  * to or modifications of the Original Intel Code. No other license or right
     35  1.18  christos  * is granted directly or by implication, estoppel or otherwise;
     36  1.18  christos  *
     37  1.18  christos  * The above copyright and patent license is granted only if the following
     38  1.18  christos  * conditions are met:
     39  1.18  christos  *
     40  1.18  christos  * 3. Conditions
     41  1.18  christos  *
     42  1.18  christos  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  1.18  christos  * Redistribution of source code of any substantial portion of the Covered
     44  1.18  christos  * Code or modification with rights to further distribute source must include
     45  1.18  christos  * the above Copyright Notice, the above License, this list of Conditions,
     46  1.18  christos  * and the following Disclaimer and Export Compliance provision. In addition,
     47  1.18  christos  * Licensee must cause all Covered Code to which Licensee contributes to
     48  1.18  christos  * contain a file documenting the changes Licensee made to create that Covered
     49  1.18  christos  * Code and the date of any change. Licensee must include in that file the
     50  1.18  christos  * documentation of any changes made by any predecessor Licensee. Licensee
     51  1.18  christos  * must include a prominent statement that the modification is derived,
     52  1.18  christos  * directly or indirectly, from Original Intel Code.
     53  1.18  christos  *
     54  1.18  christos  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  1.18  christos  * Redistribution of source code of any substantial portion of the Covered
     56  1.18  christos  * Code or modification without rights to further distribute source must
     57  1.18  christos  * include the following Disclaimer and Export Compliance provision in the
     58  1.18  christos  * documentation and/or other materials provided with distribution. In
     59  1.18  christos  * addition, Licensee may not authorize further sublicense of source of any
     60  1.18  christos  * portion of the Covered Code, and must include terms to the effect that the
     61  1.18  christos  * license from Licensee to its licensee is limited to the intellectual
     62  1.18  christos  * property embodied in the software Licensee provides to its licensee, and
     63  1.18  christos  * not to intellectual property embodied in modifications its licensee may
     64  1.18  christos  * make.
     65  1.18  christos  *
     66  1.18  christos  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  1.18  christos  * substantial portion of the Covered Code or modification must reproduce the
     68  1.18  christos  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  1.18  christos  * provision in the documentation and/or other materials provided with the
     70  1.18  christos  * distribution.
     71  1.18  christos  *
     72  1.18  christos  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  1.18  christos  * Intel Code.
     74  1.18  christos  *
     75  1.18  christos  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  1.18  christos  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  1.18  christos  * other dealings in products derived from or relating to the Covered Code
     78  1.18  christos  * without prior written authorization from Intel.
     79  1.18  christos  *
     80  1.18  christos  * 4. Disclaimer and Export Compliance
     81  1.18  christos  *
     82  1.18  christos  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  1.18  christos  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  1.18  christos  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     85  1.18  christos  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     86  1.18  christos  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     87  1.18  christos  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  1.18  christos  * PARTICULAR PURPOSE.
     89  1.18  christos  *
     90  1.18  christos  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  1.18  christos  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  1.18  christos  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  1.18  christos  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  1.18  christos  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  1.18  christos  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     96  1.18  christos  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  1.18  christos  * LIMITED REMEDY.
     98  1.18  christos  *
     99  1.18  christos  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  1.18  christos  * software or system incorporating such software without first obtaining any
    101  1.18  christos  * required license or other approval from the U. S. Department of Commerce or
    102  1.18  christos  * any other agency or department of the United States Government. In the
    103  1.18  christos  * event Licensee exports any such software from the United States or
    104  1.18  christos  * re-exports any such software from a foreign destination, Licensee shall
    105  1.18  christos  * ensure that the distribution and export/re-export of the software is in
    106  1.18  christos  * compliance with all laws, regulations, orders, or other restrictions of the
    107  1.18  christos  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  1.18  christos  * any of its subsidiaries will export/re-export any technical data, process,
    109  1.18  christos  * software, or service, directly or indirectly, to any country for which the
    110  1.18  christos  * United States government or any agency thereof requires an export license,
    111  1.18  christos  * other governmental approval, or letter of assurance, without first obtaining
    112  1.18  christos  * such license, approval or letter.
    113  1.18  christos  *
    114  1.18  christos  *****************************************************************************
    115  1.18  christos  *
    116  1.18  christos  * Alternatively, you may choose to be licensed under the terms of the
    117  1.18  christos  * following license:
    118  1.18  christos  *
    119   1.2  christos  * Redistribution and use in source and binary forms, with or without
    120   1.2  christos  * modification, are permitted provided that the following conditions
    121   1.2  christos  * are met:
    122   1.2  christos  * 1. Redistributions of source code must retain the above copyright
    123   1.2  christos  *    notice, this list of conditions, and the following disclaimer,
    124   1.2  christos  *    without modification.
    125   1.2  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    126   1.2  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
    127   1.2  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
    128   1.2  christos  *    including a substantially similar Disclaimer requirement for further
    129   1.2  christos  *    binary redistribution.
    130   1.2  christos  * 3. Neither the names of the above-listed copyright holders nor the names
    131   1.2  christos  *    of any contributors may be used to endorse or promote products derived
    132   1.2  christos  *    from this software without specific prior written permission.
    133   1.2  christos  *
    134   1.2  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    135   1.2  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    136  1.14  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    137   1.2  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    138  1.18  christos  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    139  1.18  christos  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    140  1.18  christos  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    141  1.18  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    142  1.18  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    143  1.18  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    144  1.18  christos  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    145  1.18  christos  *
    146  1.18  christos  * Alternatively, you may choose to be licensed under the terms of the
    147  1.18  christos  * GNU General Public License ("GPL") version 2 as published by the Free
    148  1.18  christos  * Software Foundation.
    149  1.18  christos  *
    150  1.18  christos  *****************************************************************************/
    151   1.1    jruoho 
    152   1.1    jruoho #define ACPI_CREATE_PREDEFINED_TABLE
    153   1.2  christos #define ACPI_CREATE_RESOURCE_TABLE
    154   1.1    jruoho 
    155   1.1    jruoho #include "aslcompiler.h"
    156   1.1    jruoho #include "aslcompiler.y.h"
    157   1.1    jruoho #include "acpredef.h"
    158   1.2  christos #include "acnamesp.h"
    159   1.1    jruoho 
    160   1.1    jruoho 
    161   1.1    jruoho #define _COMPONENT          ACPI_COMPILER
    162   1.1    jruoho         ACPI_MODULE_NAME    ("aslpredef")
    163   1.1    jruoho 
    164   1.1    jruoho 
    165   1.1    jruoho /* Local prototypes */
    166   1.1    jruoho 
    167   1.2  christos static void
    168   1.2  christos ApCheckForUnexpectedReturnValue (
    169   1.2  christos     ACPI_PARSE_OBJECT       *Op,
    170   1.2  christos     ASL_METHOD_INFO         *MethodInfo);
    171   1.2  christos 
    172   1.1    jruoho static UINT32
    173   1.1    jruoho ApCheckForSpecialName (
    174   1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    175   1.1    jruoho     char                    *Name);
    176   1.1    jruoho 
    177   1.1    jruoho 
    178   1.1    jruoho /*******************************************************************************
    179   1.1    jruoho  *
    180   1.1    jruoho  * FUNCTION:    ApCheckForPredefinedMethod
    181   1.1    jruoho  *
    182   1.1    jruoho  * PARAMETERS:  Op              - A parse node of type "METHOD".
    183   1.1    jruoho  *              MethodInfo      - Saved info about this method
    184   1.1    jruoho  *
    185   1.1    jruoho  * RETURN:      None
    186   1.1    jruoho  *
    187   1.1    jruoho  * DESCRIPTION: If method is a predefined name, check that the number of
    188   1.1    jruoho  *              arguments and the return type (returns a value or not)
    189   1.1    jruoho  *              is correct.
    190   1.1    jruoho  *
    191   1.1    jruoho  ******************************************************************************/
    192   1.1    jruoho 
    193   1.2  christos BOOLEAN
    194   1.1    jruoho ApCheckForPredefinedMethod (
    195   1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    196   1.1    jruoho     ASL_METHOD_INFO         *MethodInfo)
    197   1.1    jruoho {
    198   1.2  christos     UINT32                      Index;
    199   1.2  christos     UINT32                      RequiredArgCount;
    200   1.2  christos     const ACPI_PREDEFINED_INFO  *ThisName;
    201   1.1    jruoho 
    202   1.1    jruoho 
    203   1.1    jruoho     /* Check for a match against the predefined name list */
    204   1.1    jruoho 
    205   1.1    jruoho     Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
    206   1.1    jruoho 
    207   1.1    jruoho     switch (Index)
    208   1.1    jruoho     {
    209   1.1    jruoho     case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
    210   1.1    jruoho     case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
    211   1.1    jruoho     case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
    212   1.1    jruoho 
    213   1.1    jruoho         /* Just return, nothing to do */
    214   1.2  christos         return (FALSE);
    215   1.1    jruoho 
    216   1.1    jruoho 
    217   1.1    jruoho     case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
    218   1.1    jruoho 
    219  1.10  christos         AslGbl_ReservedMethods++;
    220   1.1    jruoho 
    221   1.1    jruoho         /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */
    222   1.1    jruoho 
    223   1.1    jruoho         if (MethodInfo->NumArguments != 0)
    224   1.1    jruoho         {
    225  1.10  christos             snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer), "%s requires %u", Op->Asl.ExternalName, 0);
    226   1.1    jruoho 
    227   1.1    jruoho             AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
    228  1.10  christos                 AslGbl_MsgBuffer);
    229   1.1    jruoho         }
    230   1.1    jruoho         break;
    231   1.1    jruoho 
    232   1.1    jruoho 
    233   1.1    jruoho     default:
    234   1.1    jruoho         /*
    235   1.2  christos          * Matched a predefined method name - validate the ASL-defined
    236   1.2  christos          * argument count against the ACPI specification.
    237   1.1    jruoho          *
    238   1.2  christos          * Some methods are allowed to have a "minimum" number of args
    239   1.2  christos          * (_SCP) because their definition in ACPI has changed over time.
    240   1.1    jruoho          */
    241  1.10  christos         AslGbl_ReservedMethods++;
    242   1.2  christos         ThisName = &AcpiGbl_PredefinedMethods[Index];
    243   1.2  christos         RequiredArgCount = METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList);
    244   1.1    jruoho 
    245   1.2  christos         if (MethodInfo->NumArguments != RequiredArgCount)
    246   1.1    jruoho         {
    247  1.10  christos             snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer), "%4.4s requires %u",
    248   1.2  christos                 ThisName->Info.Name, RequiredArgCount);
    249   1.1    jruoho 
    250   1.2  christos             if (MethodInfo->NumArguments < RequiredArgCount)
    251   1.1    jruoho             {
    252   1.2  christos                 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op,
    253  1.10  christos                     AslGbl_MsgBuffer);
    254   1.1    jruoho             }
    255   1.2  christos             else if ((MethodInfo->NumArguments > RequiredArgCount) &&
    256   1.2  christos                 !(ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM))
    257   1.1    jruoho             {
    258   1.2  christos                 AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
    259  1.10  christos                     AslGbl_MsgBuffer);
    260   1.1    jruoho             }
    261   1.1    jruoho         }
    262   1.1    jruoho 
    263   1.1    jruoho         /*
    264   1.1    jruoho          * Check if method returns no value, but the predefined name is
    265   1.1    jruoho          * required to return a value
    266   1.1    jruoho          */
    267   1.1    jruoho         if (MethodInfo->NumReturnNoValue &&
    268   1.2  christos             ThisName->Info.ExpectedBtypes)
    269   1.1    jruoho         {
    270  1.10  christos             AcpiUtGetExpectedReturnTypes (AslGbl_StringBuffer,
    271   1.2  christos                 ThisName->Info.ExpectedBtypes);
    272   1.1    jruoho 
    273  1.10  christos             snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer), "%s required for %4.4s",
    274  1.10  christos                 AslGbl_StringBuffer, ThisName->Info.Name);
    275   1.1    jruoho 
    276   1.1    jruoho             AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
    277  1.10  christos                 AslGbl_MsgBuffer);
    278   1.1    jruoho         }
    279   1.1    jruoho         break;
    280   1.1    jruoho     }
    281   1.2  christos 
    282   1.2  christos     return (TRUE);
    283   1.2  christos }
    284   1.2  christos 
    285   1.2  christos 
    286   1.2  christos /*******************************************************************************
    287   1.2  christos  *
    288   1.2  christos  * FUNCTION:    ApCheckForUnexpectedReturnValue
    289   1.2  christos  *
    290   1.2  christos  * PARAMETERS:  Op              - A parse node of type "RETURN".
    291   1.2  christos  *              MethodInfo      - Saved info about this method
    292   1.2  christos  *
    293   1.2  christos  * RETURN:      None
    294   1.2  christos  *
    295   1.2  christos  * DESCRIPTION: Check for an unexpected return value from a predefined method.
    296   1.2  christos  *              Invoked for predefined methods that are defined to not return
    297   1.2  christos  *              any value. If there is a return value, issue a remark, since
    298   1.2  christos  *              the ASL writer may be confused as to the method definition
    299   1.2  christos  *              and/or functionality.
    300   1.2  christos  *
    301   1.2  christos  * Note: We ignore all return values of "Zero", since this is what a standalone
    302   1.2  christos  *       Return() statement will always generate -- so we ignore it here --
    303   1.2  christos  *       i.e., there is no difference between Return() and Return(Zero).
    304   1.2  christos  *       Also, a null Return() will be disassembled to return(Zero) -- so, we
    305   1.2  christos  *       don't want to generate extraneous remarks/warnings for a disassembled
    306   1.2  christos  *       ASL file.
    307   1.2  christos  *
    308   1.2  christos  ******************************************************************************/
    309   1.2  christos 
    310   1.2  christos static void
    311   1.2  christos ApCheckForUnexpectedReturnValue (
    312   1.2  christos     ACPI_PARSE_OBJECT       *Op,
    313   1.2  christos     ASL_METHOD_INFO         *MethodInfo)
    314   1.2  christos {
    315   1.2  christos     ACPI_PARSE_OBJECT       *ReturnValueOp;
    316   1.2  christos 
    317   1.2  christos 
    318   1.2  christos     /* Ignore Return() and Return(Zero) (they are the same) */
    319   1.2  christos 
    320   1.2  christos     ReturnValueOp = Op->Asl.Child;
    321   1.2  christos     if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO)
    322   1.2  christos     {
    323   1.2  christos         return;
    324   1.2  christos     }
    325   1.2  christos 
    326   1.2  christos     /* We have a valid return value, but the reserved name did not expect it */
    327   1.2  christos 
    328   1.2  christos     AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL,
    329   1.2  christos         Op, MethodInfo->Op->Asl.ExternalName);
    330   1.1    jruoho }
    331   1.1    jruoho 
    332   1.1    jruoho 
    333   1.1    jruoho /*******************************************************************************
    334   1.1    jruoho  *
    335   1.1    jruoho  * FUNCTION:    ApCheckPredefinedReturnValue
    336   1.1    jruoho  *
    337   1.1    jruoho  * PARAMETERS:  Op              - A parse node of type "RETURN".
    338   1.1    jruoho  *              MethodInfo      - Saved info about this method
    339   1.1    jruoho  *
    340   1.1    jruoho  * RETURN:      None
    341   1.1    jruoho  *
    342   1.1    jruoho  * DESCRIPTION: If method is a predefined name, attempt to validate the return
    343   1.1    jruoho  *              value. Only "static" types can be validated - a simple return
    344   1.1    jruoho  *              of an integer/string/buffer/package or a named reference to
    345   1.1    jruoho  *              a static object. Values such as a Localx or Argx or a control
    346   1.2  christos  *              method invocation are not checked. Issue a warning if there is
    347   1.2  christos  *              a valid return value, but the reserved method defines no
    348   1.2  christos  *              return value.
    349   1.1    jruoho  *
    350   1.1    jruoho  ******************************************************************************/
    351   1.1    jruoho 
    352   1.1    jruoho void
    353   1.1    jruoho ApCheckPredefinedReturnValue (
    354   1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    355   1.1    jruoho     ASL_METHOD_INFO         *MethodInfo)
    356   1.1    jruoho {
    357   1.2  christos     UINT32                      Index;
    358   1.2  christos     ACPI_PARSE_OBJECT           *ReturnValueOp;
    359   1.2  christos     const ACPI_PREDEFINED_INFO  *ThisName;
    360   1.1    jruoho 
    361   1.1    jruoho 
    362   1.3  christos     /*
    363   1.3  christos      * Check parent method for a match against the predefined name list.
    364   1.3  christos      *
    365   1.3  christos      * Note: Disable compiler errors/warnings because any errors will be
    366   1.3  christos      * caught when analyzing the parent method. Eliminates duplicate errors.
    367   1.3  christos      */
    368  1.10  christos     AslGbl_AllExceptionsDisabled = TRUE;
    369   1.1    jruoho     Index = ApCheckForPredefinedName (MethodInfo->Op,
    370   1.5  christos         MethodInfo->Op->Asl.NameSeg);
    371  1.10  christos     AslGbl_AllExceptionsDisabled = FALSE;
    372   1.1    jruoho 
    373   1.1    jruoho     switch (Index)
    374   1.1    jruoho     {
    375   1.2  christos     case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
    376   1.2  christos 
    377   1.2  christos         /* No return value expected, warn if there is one */
    378   1.2  christos 
    379   1.2  christos         ApCheckForUnexpectedReturnValue (Op, MethodInfo);
    380   1.2  christos         return;
    381   1.2  christos 
    382   1.1    jruoho     case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
    383   1.1    jruoho     case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
    384   1.1    jruoho     case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
    385   1.1    jruoho 
    386   1.1    jruoho         /* Just return, nothing to do */
    387   1.1    jruoho         return;
    388   1.1    jruoho 
    389   1.1    jruoho     default: /* A standard predefined ACPI name */
    390   1.1    jruoho 
    391   1.2  christos         ThisName = &AcpiGbl_PredefinedMethods[Index];
    392   1.2  christos         if (!ThisName->Info.ExpectedBtypes)
    393   1.2  christos         {
    394   1.2  christos             /* No return value expected, warn if there is one */
    395   1.1    jruoho 
    396   1.2  christos             ApCheckForUnexpectedReturnValue (Op, MethodInfo);
    397   1.1    jruoho             return;
    398   1.1    jruoho         }
    399   1.1    jruoho 
    400   1.1    jruoho         /* Get the object returned, it is the next argument */
    401   1.1    jruoho 
    402   1.1    jruoho         ReturnValueOp = Op->Asl.Child;
    403   1.1    jruoho         switch (ReturnValueOp->Asl.ParseOpcode)
    404   1.1    jruoho         {
    405   1.1    jruoho         case PARSEOP_ZERO:
    406   1.1    jruoho         case PARSEOP_ONE:
    407   1.1    jruoho         case PARSEOP_ONES:
    408   1.1    jruoho         case PARSEOP_INTEGER:
    409   1.1    jruoho         case PARSEOP_STRING_LITERAL:
    410   1.1    jruoho         case PARSEOP_BUFFER:
    411   1.1    jruoho         case PARSEOP_PACKAGE:
    412   1.1    jruoho 
    413   1.1    jruoho             /* Static data return object - check against expected type */
    414   1.1    jruoho 
    415   1.2  christos             ApCheckObjectType (ThisName->Info.Name, ReturnValueOp,
    416   1.2  christos                 ThisName->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT);
    417   1.2  christos 
    418   1.2  christos             /* For packages, check the individual package elements */
    419   1.2  christos 
    420   1.2  christos             if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_PACKAGE)
    421   1.2  christos             {
    422   1.2  christos                 ApCheckPackage (ReturnValueOp, ThisName);
    423   1.2  christos             }
    424   1.1    jruoho             break;
    425   1.1    jruoho 
    426   1.1    jruoho         default:
    427   1.1    jruoho             /*
    428   1.1    jruoho              * All other ops are very difficult or impossible to typecheck at
    429   1.1    jruoho              * compile time. These include all Localx, Argx, and method
    430   1.1    jruoho              * invocations. Also, NAMESEG and NAMESTRING because the type of
    431   1.1    jruoho              * any named object can be changed at runtime (for example,
    432   1.1    jruoho              * CopyObject will change the type of the target object.)
    433   1.1    jruoho              */
    434   1.1    jruoho             break;
    435   1.1    jruoho         }
    436   1.1    jruoho     }
    437   1.1    jruoho }
    438   1.1    jruoho 
    439   1.1    jruoho 
    440   1.1    jruoho /*******************************************************************************
    441   1.1    jruoho  *
    442   1.1    jruoho  * FUNCTION:    ApCheckForPredefinedObject
    443   1.1    jruoho  *
    444   1.1    jruoho  * PARAMETERS:  Op              - A parse node
    445   1.1    jruoho  *              Name            - The ACPI name to be checked
    446   1.1    jruoho  *
    447   1.1    jruoho  * RETURN:      None
    448   1.1    jruoho  *
    449   1.1    jruoho  * DESCRIPTION: Check for a predefined name for a static object (created via
    450   1.1    jruoho  *              the ASL Name operator). If it is a predefined ACPI name, ensure
    451   1.1    jruoho  *              that the name does not require any arguments (which would
    452  1.11  christos  *              require a control method implementation of the name), and that
    453   1.1    jruoho  *              the type of the object is one of the expected types for the
    454   1.1    jruoho  *              predefined name.
    455   1.1    jruoho  *
    456   1.1    jruoho  ******************************************************************************/
    457   1.1    jruoho 
    458   1.1    jruoho void
    459   1.1    jruoho ApCheckForPredefinedObject (
    460   1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    461   1.1    jruoho     char                    *Name)
    462   1.1    jruoho {
    463   1.2  christos     UINT32                      Index;
    464   1.2  christos     ACPI_PARSE_OBJECT           *ObjectOp;
    465   1.2  christos     const ACPI_PREDEFINED_INFO  *ThisName;
    466   1.1    jruoho 
    467   1.1    jruoho 
    468   1.1    jruoho     /*
    469   1.1    jruoho      * Check for a real predefined name -- not a resource descriptor name
    470   1.1    jruoho      * or a predefined scope name
    471   1.1    jruoho      */
    472   1.1    jruoho     Index = ApCheckForPredefinedName (Op, Name);
    473   1.1    jruoho 
    474   1.1    jruoho     switch (Index)
    475   1.1    jruoho     {
    476   1.1    jruoho     case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
    477   1.1    jruoho     case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
    478   1.1    jruoho     case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
    479   1.1    jruoho 
    480   1.1    jruoho         /* Nothing to do */
    481   1.1    jruoho         return;
    482   1.1    jruoho 
    483   1.1    jruoho     case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
    484   1.1    jruoho 
    485   1.1    jruoho         /*
    486   1.1    jruoho          * These names must be control methods, by definition in ACPI spec.
    487   1.1    jruoho          * Also because they are defined to return no value. None of them
    488   1.1    jruoho          * require any arguments.
    489   1.1    jruoho          */
    490   1.1    jruoho         AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
    491   1.1    jruoho             "with zero arguments");
    492   1.1    jruoho         return;
    493   1.1    jruoho 
    494   1.2  christos     default:
    495   1.1    jruoho 
    496   1.2  christos         break;
    497   1.2  christos     }
    498   1.1    jruoho 
    499   1.2  christos     /* A standard predefined ACPI name */
    500   1.1    jruoho 
    501   1.2  christos     /*
    502   1.2  christos      * If this predefined name requires input arguments, then
    503   1.2  christos      * it must be implemented as a control method
    504   1.2  christos      */
    505   1.2  christos     ThisName = &AcpiGbl_PredefinedMethods[Index];
    506   1.2  christos     if (METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList) > 0)
    507   1.2  christos     {
    508   1.2  christos         AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
    509   1.2  christos             "with arguments");
    510   1.2  christos         return;
    511   1.2  christos     }
    512   1.1    jruoho 
    513   1.2  christos     /*
    514   1.2  christos      * If no return value is expected from this predefined name, then
    515   1.2  christos      * it follows that it must be implemented as a control method
    516   1.2  christos      * (with zero args, because the args > 0 case was handled above)
    517   1.2  christos      * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
    518   1.2  christos      */
    519   1.2  christos     if (!ThisName->Info.ExpectedBtypes)
    520   1.2  christos     {
    521   1.2  christos         AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
    522   1.2  christos             "with zero arguments");
    523   1.1    jruoho         return;
    524   1.1    jruoho     }
    525   1.2  christos 
    526   1.2  christos     /* Typecheck the actual object, it is the next argument */
    527   1.2  christos 
    528   1.2  christos     ObjectOp = Op->Asl.Child->Asl.Next;
    529   1.2  christos     ApCheckObjectType (ThisName->Info.Name, Op->Asl.Child->Asl.Next,
    530   1.2  christos         ThisName->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT);
    531   1.2  christos 
    532   1.2  christos     /* For packages, check the individual package elements */
    533   1.2  christos 
    534   1.2  christos     if (ObjectOp->Asl.ParseOpcode == PARSEOP_PACKAGE)
    535   1.2  christos     {
    536   1.2  christos         ApCheckPackage (ObjectOp, ThisName);
    537   1.2  christos     }
    538   1.1    jruoho }
    539   1.1    jruoho 
    540   1.1    jruoho 
    541   1.1    jruoho /*******************************************************************************
    542   1.1    jruoho  *
    543   1.1    jruoho  * FUNCTION:    ApCheckForPredefinedName
    544   1.1    jruoho  *
    545   1.1    jruoho  * PARAMETERS:  Op              - A parse node
    546   1.1    jruoho  *              Name            - NameSeg to check
    547   1.1    jruoho  *
    548   1.1    jruoho  * RETURN:      None
    549   1.1    jruoho  *
    550   1.1    jruoho  * DESCRIPTION: Check a NameSeg against the reserved list.
    551   1.1    jruoho  *
    552   1.1    jruoho  ******************************************************************************/
    553   1.1    jruoho 
    554   1.1    jruoho UINT32
    555   1.1    jruoho ApCheckForPredefinedName (
    556   1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    557   1.1    jruoho     char                    *Name)
    558   1.1    jruoho {
    559   1.2  christos     UINT32                      i;
    560   1.2  christos     const ACPI_PREDEFINED_INFO  *ThisName;
    561   1.1    jruoho 
    562   1.1    jruoho 
    563   1.1    jruoho     if (Name[0] == 0)
    564   1.1    jruoho     {
    565   1.6  christos         AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
    566  1.16  christos             "Zero length name found");
    567   1.1    jruoho     }
    568   1.1    jruoho 
    569   1.1    jruoho     /* All reserved names are prefixed with a single underscore */
    570   1.1    jruoho 
    571   1.1    jruoho     if (Name[0] != '_')
    572   1.1    jruoho     {
    573   1.1    jruoho         return (ACPI_NOT_RESERVED_NAME);
    574   1.1    jruoho     }
    575   1.1    jruoho 
    576   1.1    jruoho     /* Check for a standard predefined method name */
    577   1.1    jruoho 
    578   1.2  christos     ThisName = AcpiGbl_PredefinedMethods;
    579   1.2  christos     for (i = 0; ThisName->Info.Name[0]; i++)
    580   1.1    jruoho     {
    581  1.11  christos         if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
    582   1.1    jruoho         {
    583   1.1    jruoho             /* Return index into predefined array */
    584   1.1    jruoho             return (i);
    585   1.1    jruoho         }
    586   1.2  christos 
    587   1.2  christos         ThisName++; /* Does not account for extra package data, but is OK */
    588   1.1    jruoho     }
    589   1.1    jruoho 
    590   1.1    jruoho     /* Check for resource names and predefined scope names */
    591   1.1    jruoho 
    592   1.2  christos     ThisName = AcpiGbl_ResourceNames;
    593   1.2  christos     while (ThisName->Info.Name[0])
    594   1.1    jruoho     {
    595  1.11  christos         if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
    596   1.1    jruoho         {
    597   1.1    jruoho             return (ACPI_PREDEFINED_NAME);
    598   1.1    jruoho         }
    599   1.2  christos 
    600   1.2  christos         ThisName++;
    601   1.1    jruoho     }
    602   1.1    jruoho 
    603   1.2  christos     ThisName = AcpiGbl_ScopeNames;
    604   1.2  christos     while (ThisName->Info.Name[0])
    605   1.1    jruoho     {
    606  1.11  christos         if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
    607   1.1    jruoho         {
    608   1.1    jruoho             return (ACPI_PREDEFINED_NAME);
    609   1.1    jruoho         }
    610   1.2  christos 
    611   1.2  christos         ThisName++;
    612   1.1    jruoho     }
    613   1.1    jruoho 
    614   1.1    jruoho     /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */
    615   1.1    jruoho 
    616   1.1    jruoho     return (ApCheckForSpecialName (Op, Name));
    617   1.1    jruoho }
    618   1.1    jruoho 
    619   1.1    jruoho 
    620   1.1    jruoho /*******************************************************************************
    621   1.1    jruoho  *
    622   1.1    jruoho  * FUNCTION:    ApCheckForSpecialName
    623   1.1    jruoho  *
    624   1.1    jruoho  * PARAMETERS:  Op              - A parse node
    625   1.1    jruoho  *              Name            - NameSeg to check
    626   1.1    jruoho  *
    627   1.1    jruoho  * RETURN:      None
    628   1.1    jruoho  *
    629   1.1    jruoho  * DESCRIPTION: Check for the "special" predefined names -
    630   1.1    jruoho  *              _Lxx, _Exx, _Qxx, _Wxx, and _T_x
    631   1.1    jruoho  *
    632   1.1    jruoho  ******************************************************************************/
    633   1.1    jruoho 
    634   1.1    jruoho static UINT32
    635   1.1    jruoho ApCheckForSpecialName (
    636   1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    637   1.1    jruoho     char                    *Name)
    638   1.1    jruoho {
    639   1.1    jruoho 
    640   1.1    jruoho     /*
    641   1.1    jruoho      * Check for the "special" predefined names. We already know that the
    642   1.1    jruoho      * first character is an underscore.
    643   1.1    jruoho      *   GPE:  _Lxx
    644   1.1    jruoho      *   GPE:  _Exx
    645   1.1    jruoho      *   GPE:  _Wxx
    646   1.1    jruoho      *   EC:   _Qxx
    647   1.1    jruoho      */
    648   1.1    jruoho     if ((Name[1] == 'L') ||
    649   1.1    jruoho         (Name[1] == 'E') ||
    650   1.1    jruoho         (Name[1] == 'W') ||
    651   1.1    jruoho         (Name[1] == 'Q'))
    652   1.1    jruoho     {
    653   1.1    jruoho         /* The next two characters must be hex digits */
    654   1.1    jruoho 
    655   1.1    jruoho         if ((isxdigit ((int) Name[2])) &&
    656   1.1    jruoho             (isxdigit ((int) Name[3])))
    657   1.1    jruoho         {
    658   1.1    jruoho             return (ACPI_EVENT_RESERVED_NAME);
    659   1.1    jruoho         }
    660   1.1    jruoho     }
    661   1.1    jruoho 
    662   1.1    jruoho     /* Check for the names reserved for the compiler itself: _T_x */
    663   1.1    jruoho 
    664   1.1    jruoho     else if ((Op->Asl.ExternalName[1] == 'T') &&
    665   1.1    jruoho              (Op->Asl.ExternalName[2] == '_'))
    666   1.1    jruoho     {
    667   1.1    jruoho         /* Ignore if actually emitted by the compiler */
    668   1.1    jruoho 
    669   1.8  christos         if (Op->Asl.CompileFlags & OP_COMPILER_EMITTED)
    670   1.1    jruoho         {
    671   1.1    jruoho             return (ACPI_NOT_RESERVED_NAME);
    672   1.1    jruoho         }
    673   1.1    jruoho 
    674   1.1    jruoho         /*
    675   1.1    jruoho          * Was not actually emitted by the compiler. This is a special case,
    676   1.1    jruoho          * however. If the ASL code being compiled was the result of a
    677  1.13  christos          * disassembly, it may possibly contain valid compiler-emitted names
    678   1.1    jruoho          * of the form "_T_x". We don't want to issue an error or even a
    679   1.1    jruoho          * warning and force the user to manually change the names. So, we
    680   1.1    jruoho          * will issue a remark instead.
    681   1.1    jruoho          */
    682   1.5  christos         AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED,
    683   1.5  christos             Op, Op->Asl.ExternalName);
    684   1.1    jruoho         return (ACPI_COMPILER_RESERVED_NAME);
    685   1.1    jruoho     }
    686   1.1    jruoho 
    687   1.1    jruoho     /*
    688   1.1    jruoho      * The name didn't match any of the known predefined names. Flag it as a
    689   1.1    jruoho      * warning, since the entire namespace starting with an underscore is
    690   1.1    jruoho      * reserved by the ACPI spec.
    691   1.1    jruoho      */
    692   1.5  christos     AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME,
    693   1.5  christos         Op, Op->Asl.ExternalName);
    694   1.1    jruoho 
    695   1.1    jruoho     return (ACPI_NOT_RESERVED_NAME);
    696   1.1    jruoho }
    697   1.1    jruoho 
    698   1.1    jruoho 
    699   1.1    jruoho /*******************************************************************************
    700   1.1    jruoho  *
    701   1.1    jruoho  * FUNCTION:    ApCheckObjectType
    702   1.1    jruoho  *
    703   1.2  christos  * PARAMETERS:  PredefinedName  - Name of the predefined object we are checking
    704   1.2  christos  *              Op              - Current parse node
    705   1.1    jruoho  *              ExpectedBtypes  - Bitmap of expected return type(s)
    706   1.2  christos  *              PackageIndex    - Index of object within parent package (if
    707   1.2  christos  *                                applicable - ACPI_NOT_PACKAGE_ELEMENT
    708   1.2  christos  *                                otherwise)
    709   1.1    jruoho  *
    710   1.1    jruoho  * RETURN:      None
    711   1.1    jruoho  *
    712   1.1    jruoho  * DESCRIPTION: Check if the object type is one of the types that is expected
    713   1.1    jruoho  *              by the predefined name. Only a limited number of object types
    714   1.1    jruoho  *              can be returned by the predefined names.
    715   1.1    jruoho  *
    716   1.1    jruoho  ******************************************************************************/
    717   1.1    jruoho 
    718   1.2  christos ACPI_STATUS
    719   1.1    jruoho ApCheckObjectType (
    720   1.2  christos     const char              *PredefinedName,
    721   1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    722   1.2  christos     UINT32                  ExpectedBtypes,
    723   1.2  christos     UINT32                  PackageIndex)
    724   1.1    jruoho {
    725   1.1    jruoho     UINT32                  ReturnBtype;
    726   1.2  christos     char                    *TypeName;
    727   1.2  christos 
    728   1.2  christos 
    729   1.2  christos     if (!Op)
    730   1.2  christos     {
    731   1.2  christos         return (AE_TYPE);
    732   1.2  christos     }
    733   1.1    jruoho 
    734   1.2  christos     /* Map the parse opcode to a bitmapped return type (RTYPE) */
    735   1.1    jruoho 
    736   1.1    jruoho     switch (Op->Asl.ParseOpcode)
    737   1.1    jruoho     {
    738   1.1    jruoho     case PARSEOP_ZERO:
    739   1.1    jruoho     case PARSEOP_ONE:
    740   1.1    jruoho     case PARSEOP_ONES:
    741   1.1    jruoho     case PARSEOP_INTEGER:
    742   1.2  christos 
    743   1.1    jruoho         ReturnBtype = ACPI_RTYPE_INTEGER;
    744   1.2  christos         TypeName = "Integer";
    745   1.2  christos         break;
    746   1.2  christos 
    747   1.2  christos     case PARSEOP_STRING_LITERAL:
    748   1.2  christos 
    749   1.2  christos         ReturnBtype = ACPI_RTYPE_STRING;
    750   1.2  christos         TypeName = "String";
    751   1.1    jruoho         break;
    752   1.1    jruoho 
    753   1.1    jruoho     case PARSEOP_BUFFER:
    754   1.2  christos 
    755   1.1    jruoho         ReturnBtype = ACPI_RTYPE_BUFFER;
    756   1.2  christos         TypeName = "Buffer";
    757   1.1    jruoho         break;
    758   1.1    jruoho 
    759   1.2  christos     case PARSEOP_PACKAGE:
    760   1.2  christos     case PARSEOP_VAR_PACKAGE:
    761   1.2  christos 
    762   1.2  christos         ReturnBtype = ACPI_RTYPE_PACKAGE;
    763   1.2  christos         TypeName = "Package";
    764   1.1    jruoho         break;
    765   1.1    jruoho 
    766   1.2  christos     case PARSEOP_NAMESEG:
    767   1.2  christos     case PARSEOP_NAMESTRING:
    768   1.2  christos         /*
    769   1.2  christos          * Ignore any named references within a package object.
    770   1.2  christos          *
    771   1.2  christos          * For Package objects, references are allowed instead of any of the
    772   1.2  christos          * standard data types (Integer/String/Buffer/Package). These
    773   1.2  christos          * references are resolved at runtime. NAMESEG and NAMESTRING are
    774   1.2  christos          * impossible to typecheck at compile time because the type of
    775   1.2  christos          * any named object can be changed at runtime (for example,
    776   1.2  christos          * CopyObject will change the type of the target object).
    777   1.2  christos          */
    778   1.2  christos         if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
    779   1.2  christos         {
    780   1.2  christos             return (AE_OK);
    781   1.2  christos         }
    782   1.2  christos 
    783   1.2  christos         ReturnBtype = ACPI_RTYPE_REFERENCE;
    784   1.2  christos         TypeName = "Reference";
    785   1.1    jruoho         break;
    786   1.1    jruoho 
    787   1.1    jruoho     default:
    788   1.2  christos 
    789   1.1    jruoho         /* Not one of the supported object types */
    790   1.1    jruoho 
    791   1.2  christos         TypeName = UtGetOpName (Op->Asl.ParseOpcode);
    792   1.1    jruoho         goto TypeErrorExit;
    793   1.1    jruoho     }
    794   1.1    jruoho 
    795   1.1    jruoho     /* Exit if the object is one of the expected types */
    796   1.1    jruoho 
    797   1.1    jruoho     if (ReturnBtype & ExpectedBtypes)
    798   1.1    jruoho     {
    799   1.2  christos         return (AE_OK);
    800   1.1    jruoho     }
    801   1.1    jruoho 
    802   1.1    jruoho 
    803   1.1    jruoho TypeErrorExit:
    804   1.1    jruoho 
    805   1.1    jruoho     /* Format the expected types and emit an error message */
    806   1.1    jruoho 
    807  1.10  christos     AcpiUtGetExpectedReturnTypes (AslGbl_StringBuffer, ExpectedBtypes);
    808   1.1    jruoho 
    809   1.2  christos     if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT)
    810   1.2  christos     {
    811  1.10  christos         snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer), "%4.4s: found %s, %s required",
    812  1.10  christos             PredefinedName, TypeName, AslGbl_StringBuffer);
    813   1.2  christos     }
    814   1.2  christos     else
    815   1.2  christos     {
    816  1.10  christos         snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer), "%4.4s: found %s at index %u, %s required",
    817  1.10  christos             PredefinedName, TypeName, PackageIndex, AslGbl_StringBuffer);
    818   1.2  christos     }
    819   1.1    jruoho 
    820  1.10  christos     AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, AslGbl_MsgBuffer);
    821   1.2  christos     return (AE_TYPE);
    822   1.1    jruoho }
    823   1.1    jruoho 
    824   1.1    jruoho 
    825   1.1    jruoho /*******************************************************************************
    826   1.1    jruoho  *
    827   1.1    jruoho  * FUNCTION:    ApDisplayReservedNames
    828   1.1    jruoho  *
    829   1.1    jruoho  * PARAMETERS:  None
    830   1.1    jruoho  *
    831   1.1    jruoho  * RETURN:      None
    832   1.1    jruoho  *
    833   1.1    jruoho  * DESCRIPTION: Dump information about the ACPI predefined names and predefined
    834   1.1    jruoho  *              resource descriptor names.
    835   1.1    jruoho  *
    836   1.1    jruoho  ******************************************************************************/
    837   1.1    jruoho 
    838   1.1    jruoho void
    839   1.1    jruoho ApDisplayReservedNames (
    840   1.1    jruoho     void)
    841   1.1    jruoho {
    842   1.1    jruoho     const ACPI_PREDEFINED_INFO  *ThisName;
    843   1.1    jruoho     UINT32                      Count;
    844   1.2  christos     UINT32                      NumTypes;
    845   1.1    jruoho 
    846   1.1    jruoho 
    847   1.1    jruoho     /*
    848   1.1    jruoho      * Predefined names/methods
    849   1.1    jruoho      */
    850   1.1    jruoho     printf ("\nPredefined Name Information\n\n");
    851   1.1    jruoho 
    852   1.1    jruoho     Count = 0;
    853   1.2  christos     ThisName = AcpiGbl_PredefinedMethods;
    854   1.1    jruoho     while (ThisName->Info.Name[0])
    855   1.1    jruoho     {
    856  1.10  christos         AcpiUtDisplayPredefinedMethod (AslGbl_MsgBuffer, ThisName, FALSE);
    857   1.1    jruoho         Count++;
    858   1.2  christos         ThisName = AcpiUtGetNextPredefinedMethod (ThisName);
    859   1.1    jruoho     }
    860   1.1    jruoho 
    861   1.1    jruoho     printf ("%u Predefined Names are recognized\n", Count);
    862   1.1    jruoho 
    863   1.1    jruoho     /*
    864   1.1    jruoho      * Resource Descriptor names
    865   1.1    jruoho      */
    866   1.2  christos     printf ("\nPredefined Names for Resource Descriptor Fields\n\n");
    867   1.1    jruoho 
    868   1.1    jruoho     Count = 0;
    869   1.2  christos     ThisName = AcpiGbl_ResourceNames;
    870   1.1    jruoho     while (ThisName->Info.Name[0])
    871   1.1    jruoho     {
    872  1.10  christos         NumTypes = AcpiUtGetResourceBitWidth (AslGbl_MsgBuffer,
    873   1.2  christos             ThisName->Info.ArgumentList);
    874   1.2  christos 
    875   1.2  christos         printf ("%4.4s    Field is %s bits wide%s\n",
    876  1.10  christos             ThisName->Info.Name, AslGbl_MsgBuffer,
    877   1.2  christos             (NumTypes > 1) ? " (depending on descriptor type)" : "");
    878   1.2  christos 
    879   1.1    jruoho         Count++;
    880   1.1    jruoho         ThisName++;
    881   1.1    jruoho     }
    882   1.1    jruoho 
    883   1.2  christos     printf ("%u Resource Descriptor Field Names are recognized\n", Count);
    884   1.1    jruoho 
    885   1.1    jruoho     /*
    886   1.1    jruoho      * Predefined scope names
    887   1.1    jruoho      */
    888   1.2  christos     printf ("\nPredefined Scope/Device Names (automatically created at root)\n\n");
    889   1.1    jruoho 
    890   1.2  christos     ThisName = AcpiGbl_ScopeNames;
    891   1.1    jruoho     while (ThisName->Info.Name[0])
    892   1.1    jruoho     {
    893   1.2  christos         printf ("%4.4s    Scope/Device\n", ThisName->Info.Name);
    894   1.1    jruoho         ThisName++;
    895   1.1    jruoho     }
    896   1.1    jruoho }
    897