Home | History | Annotate | Line # | Download | only in compiler
aslopcodes.c revision 1.1.1.4.2.2
      1          1.1    jruoho /******************************************************************************
      2          1.1    jruoho  *
      3          1.1    jruoho  * Module Name: aslopcode - AML opcode generation
      4          1.1    jruoho  *
      5          1.1    jruoho  *****************************************************************************/
      6          1.1    jruoho 
      7      1.1.1.2    jruoho /*
      8  1.1.1.4.2.1     skrll  * Copyright (C) 2000 - 2015, Intel Corp.
      9          1.1    jruoho  * All rights reserved.
     10          1.1    jruoho  *
     11      1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12      1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13      1.1.1.2    jruoho  * are met:
     14      1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15      1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16      1.1.1.2    jruoho  *    without modification.
     17      1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18      1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19      1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20      1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21      1.1.1.2    jruoho  *    binary redistribution.
     22      1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23      1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24      1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25      1.1.1.2    jruoho  *
     26      1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27      1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28      1.1.1.2    jruoho  * Software Foundation.
     29      1.1.1.2    jruoho  *
     30      1.1.1.2    jruoho  * NO WARRANTY
     31      1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32      1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33      1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34      1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35      1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36      1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37      1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38      1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39      1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40      1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41      1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42      1.1.1.2    jruoho  */
     43          1.1    jruoho 
     44          1.1    jruoho #include "aslcompiler.h"
     45          1.1    jruoho #include "aslcompiler.y.h"
     46          1.1    jruoho #include "amlcode.h"
     47          1.1    jruoho 
     48          1.1    jruoho #define _COMPONENT          ACPI_COMPILER
     49          1.1    jruoho         ACPI_MODULE_NAME    ("aslopcodes")
     50          1.1    jruoho 
     51          1.1    jruoho 
     52          1.1    jruoho /* Local prototypes */
     53          1.1    jruoho 
     54          1.1    jruoho static void
     55          1.1    jruoho OpcDoAccessAs (
     56          1.1    jruoho     ACPI_PARSE_OBJECT       *Op);
     57          1.1    jruoho 
     58          1.1    jruoho static void
     59      1.1.1.3  christos OpcDoConnection (
     60      1.1.1.3  christos     ACPI_PARSE_OBJECT       *Op);
     61      1.1.1.3  christos 
     62      1.1.1.3  christos static void
     63          1.1    jruoho OpcDoUnicode (
     64          1.1    jruoho     ACPI_PARSE_OBJECT       *Op);
     65          1.1    jruoho 
     66          1.1    jruoho static void
     67          1.1    jruoho OpcDoEisaId (
     68          1.1    jruoho     ACPI_PARSE_OBJECT       *Op);
     69          1.1    jruoho 
     70          1.1    jruoho static void
     71  1.1.1.4.2.1     skrll OpcDoPld (
     72  1.1.1.4.2.1     skrll     ACPI_PARSE_OBJECT       *Op);
     73  1.1.1.4.2.1     skrll 
     74  1.1.1.4.2.1     skrll static void
     75          1.1    jruoho OpcDoUuId (
     76          1.1    jruoho     ACPI_PARSE_OBJECT       *Op);
     77          1.1    jruoho 
     78  1.1.1.4.2.1     skrll static UINT8 *
     79  1.1.1.4.2.1     skrll OpcEncodePldBuffer (
     80  1.1.1.4.2.1     skrll     ACPI_PLD_INFO           *PldInfo);
     81  1.1.1.4.2.1     skrll 
     82  1.1.1.4.2.1     skrll 
     83  1.1.1.4.2.1     skrll /* ToPld strings */
     84  1.1.1.4.2.1     skrll 
     85  1.1.1.4.2.1     skrll static char *AslPldPanelList[] =
     86  1.1.1.4.2.1     skrll {
     87  1.1.1.4.2.1     skrll     "TOP",
     88  1.1.1.4.2.1     skrll     "BOTTOM",
     89  1.1.1.4.2.1     skrll     "LEFT",
     90  1.1.1.4.2.1     skrll     "RIGHT",
     91  1.1.1.4.2.1     skrll     "FRONT",
     92  1.1.1.4.2.1     skrll     "BACK",
     93  1.1.1.4.2.1     skrll     "UNKNOWN",
     94  1.1.1.4.2.1     skrll     NULL
     95  1.1.1.4.2.1     skrll };
     96  1.1.1.4.2.1     skrll 
     97  1.1.1.4.2.1     skrll static char *AslPldVerticalPositionList[] =
     98  1.1.1.4.2.1     skrll {
     99  1.1.1.4.2.1     skrll     "UPPER",
    100  1.1.1.4.2.1     skrll     "CENTER",
    101  1.1.1.4.2.1     skrll     "LOWER",
    102  1.1.1.4.2.1     skrll     NULL
    103  1.1.1.4.2.1     skrll };
    104  1.1.1.4.2.1     skrll 
    105  1.1.1.4.2.1     skrll static char *AslPldHorizontalPositionList[] =
    106  1.1.1.4.2.1     skrll {
    107  1.1.1.4.2.1     skrll     "LEFT",
    108  1.1.1.4.2.1     skrll     "CENTER",
    109  1.1.1.4.2.1     skrll     "RIGHT",
    110  1.1.1.4.2.1     skrll     NULL
    111  1.1.1.4.2.1     skrll };
    112  1.1.1.4.2.1     skrll 
    113  1.1.1.4.2.1     skrll static char *AslPldShapeList[] =
    114  1.1.1.4.2.1     skrll {
    115  1.1.1.4.2.1     skrll     "ROUND",
    116  1.1.1.4.2.1     skrll     "OVAL",
    117  1.1.1.4.2.1     skrll     "SQUARE",
    118  1.1.1.4.2.1     skrll     "VERTICALRECTANGLE",
    119  1.1.1.4.2.1     skrll     "HORIZONTALRECTANGLE",
    120  1.1.1.4.2.1     skrll     "VERTICALTRAPEZOID",
    121  1.1.1.4.2.1     skrll     "HORIZONTALTRAPEZOID",
    122  1.1.1.4.2.1     skrll     "UNKNOWN",
    123  1.1.1.4.2.1     skrll     "CHAMFERED",
    124  1.1.1.4.2.1     skrll     NULL
    125  1.1.1.4.2.1     skrll };
    126  1.1.1.4.2.1     skrll 
    127          1.1    jruoho 
    128          1.1    jruoho /*******************************************************************************
    129          1.1    jruoho  *
    130          1.1    jruoho  * FUNCTION:    OpcAmlOpcodeUpdateWalk
    131          1.1    jruoho  *
    132          1.1    jruoho  * PARAMETERS:  ASL_WALK_CALLBACK
    133          1.1    jruoho  *
    134          1.1    jruoho  * RETURN:      Status
    135          1.1    jruoho  *
    136          1.1    jruoho  * DESCRIPTION: Opcode update walk, ascending callback
    137          1.1    jruoho  *
    138          1.1    jruoho  ******************************************************************************/
    139          1.1    jruoho 
    140          1.1    jruoho ACPI_STATUS
    141          1.1    jruoho OpcAmlOpcodeUpdateWalk (
    142          1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    143          1.1    jruoho     UINT32                  Level,
    144          1.1    jruoho     void                    *Context)
    145          1.1    jruoho {
    146          1.1    jruoho 
    147          1.1    jruoho     /*
    148          1.1    jruoho      * Handle the Package() case where the actual opcode cannot be determined
    149          1.1    jruoho      * until the PackageLength operand has been folded and minimized.
    150          1.1    jruoho      * (PackageOp versus VarPackageOp)
    151          1.1    jruoho      *
    152          1.1    jruoho      * This is (as of ACPI 3.0) the only case where the AML opcode can change
    153          1.1    jruoho      * based upon the value of a parameter.
    154          1.1    jruoho      *
    155          1.1    jruoho      * The parser always inserts a VarPackage opcode, which can possibly be
    156          1.1    jruoho      * optimized to a Package opcode.
    157          1.1    jruoho      */
    158          1.1    jruoho     if (Op->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)
    159          1.1    jruoho     {
    160          1.1    jruoho         OpnDoPackage (Op);
    161          1.1    jruoho     }
    162          1.1    jruoho 
    163          1.1    jruoho     return (AE_OK);
    164          1.1    jruoho }
    165          1.1    jruoho 
    166          1.1    jruoho 
    167          1.1    jruoho /*******************************************************************************
    168          1.1    jruoho  *
    169          1.1    jruoho  * FUNCTION:    OpcAmlOpcodeWalk
    170          1.1    jruoho  *
    171          1.1    jruoho  * PARAMETERS:  ASL_WALK_CALLBACK
    172          1.1    jruoho  *
    173          1.1    jruoho  * RETURN:      Status
    174          1.1    jruoho  *
    175          1.1    jruoho  * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML
    176          1.1    jruoho  *              operands.
    177          1.1    jruoho  *
    178          1.1    jruoho  ******************************************************************************/
    179          1.1    jruoho 
    180          1.1    jruoho ACPI_STATUS
    181          1.1    jruoho OpcAmlOpcodeWalk (
    182          1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    183          1.1    jruoho     UINT32                  Level,
    184          1.1    jruoho     void                    *Context)
    185          1.1    jruoho {
    186          1.1    jruoho 
    187          1.1    jruoho     TotalParseNodes++;
    188          1.1    jruoho 
    189          1.1    jruoho     OpcGenerateAmlOpcode (Op);
    190          1.1    jruoho     OpnGenerateAmlOperands (Op);
    191          1.1    jruoho     return (AE_OK);
    192          1.1    jruoho }
    193          1.1    jruoho 
    194          1.1    jruoho 
    195          1.1    jruoho /*******************************************************************************
    196          1.1    jruoho  *
    197          1.1    jruoho  * FUNCTION:    OpcGetIntegerWidth
    198          1.1    jruoho  *
    199          1.1    jruoho  * PARAMETERS:  Op          - DEFINITION BLOCK op
    200          1.1    jruoho  *
    201          1.1    jruoho  * RETURN:      none
    202          1.1    jruoho  *
    203          1.1    jruoho  * DESCRIPTION: Extract integer width from the table revision
    204          1.1    jruoho  *
    205          1.1    jruoho  ******************************************************************************/
    206          1.1    jruoho 
    207          1.1    jruoho void
    208          1.1    jruoho OpcGetIntegerWidth (
    209          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    210          1.1    jruoho {
    211          1.1    jruoho     ACPI_PARSE_OBJECT       *Child;
    212          1.1    jruoho 
    213          1.1    jruoho 
    214          1.1    jruoho     if (!Op)
    215          1.1    jruoho     {
    216          1.1    jruoho         return;
    217          1.1    jruoho     }
    218          1.1    jruoho 
    219          1.1    jruoho     if (Gbl_RevisionOverride)
    220          1.1    jruoho     {
    221          1.1    jruoho         AcpiUtSetIntegerWidth (Gbl_RevisionOverride);
    222          1.1    jruoho     }
    223          1.1    jruoho     else
    224          1.1    jruoho     {
    225          1.1    jruoho         Child = Op->Asl.Child;
    226          1.1    jruoho         Child = Child->Asl.Next;
    227          1.1    jruoho         Child = Child->Asl.Next;
    228          1.1    jruoho 
    229          1.1    jruoho         /* Use the revision to set the integer width */
    230          1.1    jruoho 
    231          1.1    jruoho         AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
    232          1.1    jruoho     }
    233          1.1    jruoho }
    234          1.1    jruoho 
    235          1.1    jruoho 
    236          1.1    jruoho /*******************************************************************************
    237          1.1    jruoho  *
    238          1.1    jruoho  * FUNCTION:    OpcSetOptimalIntegerSize
    239          1.1    jruoho  *
    240          1.1    jruoho  * PARAMETERS:  Op        - A parse tree node
    241          1.1    jruoho  *
    242      1.1.1.3  christos  * RETURN:      Integer width, in bytes. Also sets the node AML opcode to the
    243          1.1    jruoho  *              optimal integer AML prefix opcode.
    244          1.1    jruoho  *
    245      1.1.1.3  christos  * DESCRIPTION: Determine the optimal AML encoding of an integer. All leading
    246          1.1    jruoho  *              zeros can be truncated to squeeze the integer into the
    247          1.1    jruoho  *              minimal number of AML bytes.
    248          1.1    jruoho  *
    249          1.1    jruoho  ******************************************************************************/
    250          1.1    jruoho 
    251          1.1    jruoho UINT32
    252          1.1    jruoho OpcSetOptimalIntegerSize (
    253          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    254          1.1    jruoho {
    255          1.1    jruoho 
    256          1.1    jruoho #if 0
    257          1.1    jruoho     /*
    258          1.1    jruoho      * TBD: - we don't want to optimize integers in the block header, but the
    259          1.1    jruoho      * code below does not work correctly.
    260          1.1    jruoho      */
    261          1.1    jruoho     if (Op->Asl.Parent &&
    262          1.1    jruoho         Op->Asl.Parent->Asl.Parent &&
    263          1.1    jruoho        (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))
    264          1.1    jruoho     {
    265      1.1.1.3  christos         return (0);
    266          1.1    jruoho     }
    267          1.1    jruoho #endif
    268          1.1    jruoho 
    269          1.1    jruoho     /*
    270          1.1    jruoho      * Check for the special AML integers first - Zero, One, Ones.
    271          1.1    jruoho      * These are single-byte opcodes that are the smallest possible
    272          1.1    jruoho      * representation of an integer.
    273          1.1    jruoho      *
    274          1.1    jruoho      * This optimization is optional.
    275          1.1    jruoho      */
    276          1.1    jruoho     if (Gbl_IntegerOptimizationFlag)
    277          1.1    jruoho     {
    278          1.1    jruoho         switch (Op->Asl.Value.Integer)
    279          1.1    jruoho         {
    280          1.1    jruoho         case 0:
    281          1.1    jruoho 
    282          1.1    jruoho             Op->Asl.AmlOpcode = AML_ZERO_OP;
    283          1.1    jruoho             AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
    284          1.1    jruoho                 Op, "Zero");
    285      1.1.1.3  christos             return (1);
    286          1.1    jruoho 
    287          1.1    jruoho         case 1:
    288          1.1    jruoho 
    289          1.1    jruoho             Op->Asl.AmlOpcode = AML_ONE_OP;
    290          1.1    jruoho             AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
    291          1.1    jruoho                 Op, "One");
    292      1.1.1.3  christos             return (1);
    293          1.1    jruoho 
    294          1.1    jruoho         case ACPI_UINT32_MAX:
    295          1.1    jruoho 
    296          1.1    jruoho             /* Check for table integer width (32 or 64) */
    297          1.1    jruoho 
    298          1.1    jruoho             if (AcpiGbl_IntegerByteWidth == 4)
    299          1.1    jruoho             {
    300          1.1    jruoho                 Op->Asl.AmlOpcode = AML_ONES_OP;
    301          1.1    jruoho                 AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
    302          1.1    jruoho                     Op, "Ones");
    303      1.1.1.3  christos                 return (1);
    304          1.1    jruoho             }
    305          1.1    jruoho             break;
    306          1.1    jruoho 
    307          1.1    jruoho         case ACPI_UINT64_MAX:
    308          1.1    jruoho 
    309          1.1    jruoho             /* Check for table integer width (32 or 64) */
    310          1.1    jruoho 
    311          1.1    jruoho             if (AcpiGbl_IntegerByteWidth == 8)
    312          1.1    jruoho             {
    313          1.1    jruoho                 Op->Asl.AmlOpcode = AML_ONES_OP;
    314          1.1    jruoho                 AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
    315          1.1    jruoho                     Op, "Ones");
    316      1.1.1.3  christos                 return (1);
    317          1.1    jruoho             }
    318          1.1    jruoho             break;
    319          1.1    jruoho 
    320          1.1    jruoho         default:
    321      1.1.1.3  christos 
    322          1.1    jruoho             break;
    323          1.1    jruoho         }
    324          1.1    jruoho     }
    325          1.1    jruoho 
    326          1.1    jruoho     /* Find the best fit using the various AML integer prefixes */
    327          1.1    jruoho 
    328          1.1    jruoho     if (Op->Asl.Value.Integer <= ACPI_UINT8_MAX)
    329          1.1    jruoho     {
    330          1.1    jruoho         Op->Asl.AmlOpcode = AML_BYTE_OP;
    331      1.1.1.3  christos         return (1);
    332          1.1    jruoho     }
    333          1.1    jruoho     if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX)
    334          1.1    jruoho     {
    335          1.1    jruoho         Op->Asl.AmlOpcode = AML_WORD_OP;
    336      1.1.1.3  christos         return (2);
    337          1.1    jruoho     }
    338          1.1    jruoho     if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX)
    339          1.1    jruoho     {
    340          1.1    jruoho         Op->Asl.AmlOpcode = AML_DWORD_OP;
    341      1.1.1.3  christos         return (4);
    342          1.1    jruoho     }
    343          1.1    jruoho     else
    344          1.1    jruoho     {
    345          1.1    jruoho         if (AcpiGbl_IntegerByteWidth == 4)
    346          1.1    jruoho         {
    347          1.1    jruoho             AslError (ASL_WARNING, ASL_MSG_INTEGER_LENGTH,
    348          1.1    jruoho                 Op, NULL);
    349          1.1    jruoho 
    350          1.1    jruoho             if (!Gbl_IgnoreErrors)
    351          1.1    jruoho             {
    352          1.1    jruoho                 /* Truncate the integer to 32-bit */
    353          1.1    jruoho                 Op->Asl.AmlOpcode = AML_DWORD_OP;
    354      1.1.1.3  christos                 return (4);
    355          1.1    jruoho             }
    356          1.1    jruoho         }
    357          1.1    jruoho 
    358          1.1    jruoho         Op->Asl.AmlOpcode = AML_QWORD_OP;
    359      1.1.1.3  christos         return (8);
    360          1.1    jruoho     }
    361          1.1    jruoho }
    362          1.1    jruoho 
    363          1.1    jruoho 
    364          1.1    jruoho /*******************************************************************************
    365          1.1    jruoho  *
    366          1.1    jruoho  * FUNCTION:    OpcDoAccessAs
    367          1.1    jruoho  *
    368          1.1    jruoho  * PARAMETERS:  Op        - Parse node
    369          1.1    jruoho  *
    370          1.1    jruoho  * RETURN:      None
    371          1.1    jruoho  *
    372          1.1    jruoho  * DESCRIPTION: Implement the ACCESS_AS ASL keyword.
    373          1.1    jruoho  *
    374          1.1    jruoho  ******************************************************************************/
    375          1.1    jruoho 
    376          1.1    jruoho static void
    377          1.1    jruoho OpcDoAccessAs (
    378          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    379          1.1    jruoho {
    380      1.1.1.3  christos     ACPI_PARSE_OBJECT       *TypeOp;
    381      1.1.1.3  christos     ACPI_PARSE_OBJECT       *AttribOp;
    382      1.1.1.3  christos     ACPI_PARSE_OBJECT       *LengthOp;
    383      1.1.1.3  christos     UINT8                   Attribute;
    384          1.1    jruoho 
    385          1.1    jruoho 
    386          1.1    jruoho     Op->Asl.AmlOpcodeLength = 1;
    387      1.1.1.3  christos     TypeOp = Op->Asl.Child;
    388          1.1    jruoho 
    389          1.1    jruoho     /* First child is the access type */
    390          1.1    jruoho 
    391      1.1.1.3  christos     TypeOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
    392      1.1.1.3  christos     TypeOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
    393          1.1    jruoho 
    394          1.1    jruoho     /* Second child is the optional access attribute */
    395          1.1    jruoho 
    396      1.1.1.3  christos     AttribOp = TypeOp->Asl.Next;
    397      1.1.1.3  christos     if (AttribOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
    398      1.1.1.3  christos     {
    399      1.1.1.3  christos         AttribOp->Asl.Value.Integer = 0;
    400      1.1.1.3  christos     }
    401      1.1.1.3  christos     AttribOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
    402      1.1.1.3  christos     AttribOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
    403      1.1.1.3  christos 
    404      1.1.1.3  christos     /* Only a few AccessAttributes support AccessLength */
    405      1.1.1.3  christos 
    406      1.1.1.3  christos     Attribute = (UINT8) AttribOp->Asl.Value.Integer;
    407      1.1.1.3  christos     if ((Attribute != AML_FIELD_ATTRIB_MULTIBYTE) &&
    408      1.1.1.3  christos         (Attribute != AML_FIELD_ATTRIB_RAW_BYTES) &&
    409      1.1.1.3  christos         (Attribute != AML_FIELD_ATTRIB_RAW_PROCESS))
    410      1.1.1.3  christos     {
    411      1.1.1.3  christos         return;
    412      1.1.1.3  christos     }
    413      1.1.1.3  christos 
    414      1.1.1.3  christos     Op->Asl.AmlOpcode = AML_FIELD_EXT_ACCESS_OP;
    415      1.1.1.3  christos 
    416      1.1.1.3  christos     /*
    417      1.1.1.3  christos      * Child of Attributes is the AccessLength (required for Multibyte,
    418      1.1.1.3  christos      * RawBytes, RawProcess.)
    419      1.1.1.3  christos      */
    420      1.1.1.3  christos     LengthOp = AttribOp->Asl.Child;
    421      1.1.1.3  christos     if (!LengthOp)
    422      1.1.1.3  christos     {
    423      1.1.1.3  christos         return;
    424      1.1.1.3  christos     }
    425      1.1.1.3  christos 
    426      1.1.1.3  christos     /* TBD: probably can remove */
    427      1.1.1.3  christos 
    428      1.1.1.3  christos     if (LengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
    429      1.1.1.3  christos     {
    430      1.1.1.3  christos         LengthOp->Asl.Value.Integer = 16;
    431      1.1.1.3  christos     }
    432      1.1.1.3  christos 
    433      1.1.1.3  christos     LengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
    434      1.1.1.3  christos     LengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
    435      1.1.1.3  christos }
    436      1.1.1.3  christos 
    437      1.1.1.3  christos 
    438      1.1.1.3  christos /*******************************************************************************
    439      1.1.1.3  christos  *
    440      1.1.1.3  christos  * FUNCTION:    OpcDoConnection
    441      1.1.1.3  christos  *
    442      1.1.1.3  christos  * PARAMETERS:  Op        - Parse node
    443      1.1.1.3  christos  *
    444      1.1.1.3  christos  * RETURN:      None
    445      1.1.1.3  christos  *
    446      1.1.1.3  christos  * DESCRIPTION: Implement the Connection ASL keyword.
    447      1.1.1.3  christos  *
    448      1.1.1.3  christos  ******************************************************************************/
    449      1.1.1.3  christos 
    450      1.1.1.3  christos static void
    451      1.1.1.3  christos OpcDoConnection (
    452      1.1.1.3  christos     ACPI_PARSE_OBJECT       *Op)
    453      1.1.1.3  christos {
    454      1.1.1.3  christos     ASL_RESOURCE_NODE       *Rnode;
    455      1.1.1.3  christos     ACPI_PARSE_OBJECT       *BufferOp;
    456      1.1.1.3  christos     ACPI_PARSE_OBJECT       *BufferLengthOp;
    457      1.1.1.3  christos     ACPI_PARSE_OBJECT       *BufferDataOp;
    458      1.1.1.4  christos     ASL_RESOURCE_INFO       Info;
    459      1.1.1.3  christos     UINT8                   State;
    460      1.1.1.3  christos 
    461      1.1.1.3  christos 
    462      1.1.1.3  christos     Op->Asl.AmlOpcodeLength = 1;
    463      1.1.1.3  christos 
    464      1.1.1.3  christos     if (Op->Asl.Child->Asl.AmlOpcode == AML_INT_NAMEPATH_OP)
    465      1.1.1.3  christos     {
    466      1.1.1.3  christos         return;
    467      1.1.1.3  christos     }
    468      1.1.1.3  christos 
    469      1.1.1.3  christos     BufferOp = Op->Asl.Child;
    470      1.1.1.3  christos     BufferLengthOp = BufferOp->Asl.Child;
    471      1.1.1.3  christos     BufferDataOp = BufferLengthOp->Asl.Next;
    472      1.1.1.3  christos 
    473      1.1.1.4  christos     Info.DescriptorTypeOp = BufferDataOp->Asl.Next;
    474      1.1.1.4  christos     Info.CurrentByteOffset = 0;
    475      1.1.1.3  christos     State = ACPI_RSTATE_NORMAL;
    476      1.1.1.4  christos     Rnode = RsDoOneResourceDescriptor (&Info, &State);
    477      1.1.1.3  christos     if (!Rnode)
    478          1.1    jruoho     {
    479      1.1.1.3  christos         return; /* error */
    480          1.1    jruoho     }
    481      1.1.1.3  christos 
    482      1.1.1.3  christos     /*
    483      1.1.1.3  christos      * Transform the nodes into the following
    484      1.1.1.3  christos      *
    485      1.1.1.3  christos      * Op           -> AML_BUFFER_OP
    486      1.1.1.3  christos      * First Child  -> BufferLength
    487      1.1.1.3  christos      * Second Child -> Descriptor Buffer (raw byte data)
    488      1.1.1.3  christos      */
    489      1.1.1.3  christos     BufferOp->Asl.ParseOpcode         = PARSEOP_BUFFER;
    490      1.1.1.3  christos     BufferOp->Asl.AmlOpcode           = AML_BUFFER_OP;
    491      1.1.1.3  christos     BufferOp->Asl.CompileFlags        = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC;
    492      1.1.1.3  christos     UtSetParseOpName (BufferOp);
    493      1.1.1.3  christos 
    494      1.1.1.3  christos     BufferLengthOp->Asl.ParseOpcode   = PARSEOP_INTEGER;
    495      1.1.1.3  christos     BufferLengthOp->Asl.Value.Integer = Rnode->BufferLength;
    496      1.1.1.3  christos     (void) OpcSetOptimalIntegerSize (BufferLengthOp);
    497      1.1.1.3  christos     UtSetParseOpName (BufferLengthOp);
    498      1.1.1.3  christos 
    499      1.1.1.3  christos     BufferDataOp->Asl.ParseOpcode         = PARSEOP_RAW_DATA;
    500      1.1.1.3  christos     BufferDataOp->Asl.AmlOpcode           = AML_RAW_DATA_CHAIN;
    501      1.1.1.3  christos     BufferDataOp->Asl.AmlOpcodeLength     = 0;
    502      1.1.1.3  christos     BufferDataOp->Asl.AmlLength           = Rnode->BufferLength;
    503      1.1.1.3  christos     BufferDataOp->Asl.Value.Buffer        = (UINT8 *) Rnode;
    504      1.1.1.3  christos     UtSetParseOpName (BufferDataOp);
    505          1.1    jruoho }
    506          1.1    jruoho 
    507          1.1    jruoho 
    508          1.1    jruoho /*******************************************************************************
    509          1.1    jruoho  *
    510          1.1    jruoho  * FUNCTION:    OpcDoUnicode
    511          1.1    jruoho  *
    512          1.1    jruoho  * PARAMETERS:  Op        - Parse node
    513          1.1    jruoho  *
    514          1.1    jruoho  * RETURN:      None
    515          1.1    jruoho  *
    516          1.1    jruoho  * DESCRIPTION: Implement the UNICODE ASL "macro".  Convert the input string
    517      1.1.1.3  christos  *              to a unicode buffer. There is no Unicode AML opcode.
    518          1.1    jruoho  *
    519          1.1    jruoho  * Note:  The Unicode string is 16 bits per character, no leading signature,
    520          1.1    jruoho  *        with a 16-bit terminating NULL.
    521          1.1    jruoho  *
    522          1.1    jruoho  ******************************************************************************/
    523          1.1    jruoho 
    524          1.1    jruoho static void
    525          1.1    jruoho OpcDoUnicode (
    526          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    527          1.1    jruoho {
    528          1.1    jruoho     ACPI_PARSE_OBJECT       *InitializerOp;
    529          1.1    jruoho     UINT32                  Length;
    530          1.1    jruoho     UINT32                  Count;
    531          1.1    jruoho     UINT32                  i;
    532          1.1    jruoho     UINT8                   *AsciiString;
    533          1.1    jruoho     UINT16                  *UnicodeString;
    534          1.1    jruoho     ACPI_PARSE_OBJECT       *BufferLengthOp;
    535          1.1    jruoho 
    536          1.1    jruoho 
    537          1.1    jruoho     /* Change op into a buffer object */
    538          1.1    jruoho 
    539          1.1    jruoho     Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
    540          1.1    jruoho     Op->Asl.ParseOpcode = PARSEOP_BUFFER;
    541          1.1    jruoho     UtSetParseOpName (Op);
    542          1.1    jruoho 
    543          1.1    jruoho     /* Buffer Length is first, followed by the string */
    544          1.1    jruoho 
    545          1.1    jruoho     BufferLengthOp = Op->Asl.Child;
    546          1.1    jruoho     InitializerOp = BufferLengthOp->Asl.Next;
    547          1.1    jruoho 
    548          1.1    jruoho     AsciiString = (UINT8 *) InitializerOp->Asl.Value.String;
    549          1.1    jruoho 
    550          1.1    jruoho     /* Create a new buffer for the Unicode string */
    551          1.1    jruoho 
    552          1.1    jruoho     Count = strlen (InitializerOp->Asl.Value.String) + 1;
    553          1.1    jruoho     Length = Count * sizeof (UINT16);
    554          1.1    jruoho     UnicodeString = UtLocalCalloc (Length);
    555          1.1    jruoho 
    556          1.1    jruoho     /* Convert to Unicode string (including null terminator) */
    557          1.1    jruoho 
    558          1.1    jruoho     for (i = 0; i < Count; i++)
    559          1.1    jruoho     {
    560          1.1    jruoho         UnicodeString[i] = (UINT16) AsciiString[i];
    561          1.1    jruoho     }
    562          1.1    jruoho 
    563          1.1    jruoho     /*
    564          1.1    jruoho      * Just set the buffer size node to be the buffer length, regardless
    565          1.1    jruoho      * of whether it was previously an integer or a default_arg placeholder
    566          1.1    jruoho      */
    567          1.1    jruoho     BufferLengthOp->Asl.ParseOpcode   = PARSEOP_INTEGER;
    568          1.1    jruoho     BufferLengthOp->Asl.AmlOpcode     = AML_DWORD_OP;
    569          1.1    jruoho     BufferLengthOp->Asl.Value.Integer = Length;
    570          1.1    jruoho     UtSetParseOpName (BufferLengthOp);
    571          1.1    jruoho 
    572          1.1    jruoho     (void) OpcSetOptimalIntegerSize (BufferLengthOp);
    573          1.1    jruoho 
    574          1.1    jruoho     /* The Unicode string is a raw data buffer */
    575          1.1    jruoho 
    576          1.1    jruoho     InitializerOp->Asl.Value.Buffer   = (UINT8 *) UnicodeString;
    577          1.1    jruoho     InitializerOp->Asl.AmlOpcode      = AML_RAW_DATA_BUFFER;
    578          1.1    jruoho     InitializerOp->Asl.AmlLength      = Length;
    579          1.1    jruoho     InitializerOp->Asl.ParseOpcode    = PARSEOP_RAW_DATA;
    580          1.1    jruoho     InitializerOp->Asl.Child          = NULL;
    581          1.1    jruoho     UtSetParseOpName (InitializerOp);
    582          1.1    jruoho }
    583          1.1    jruoho 
    584          1.1    jruoho 
    585          1.1    jruoho /*******************************************************************************
    586          1.1    jruoho  *
    587          1.1    jruoho  * FUNCTION:    OpcDoEisaId
    588          1.1    jruoho  *
    589          1.1    jruoho  * PARAMETERS:  Op        - Parse node
    590          1.1    jruoho  *
    591          1.1    jruoho  * RETURN:      None
    592          1.1    jruoho  *
    593      1.1.1.3  christos  * DESCRIPTION: Convert a string EISA ID to numeric representation. See the
    594      1.1.1.3  christos  *              Pnp BIOS Specification for details. Here is an excerpt:
    595          1.1    jruoho  *
    596          1.1    jruoho  *              A seven character ASCII representation of the product
    597      1.1.1.3  christos  *              identifier compressed into a 32-bit identifier. The seven
    598          1.1    jruoho  *              character ID consists of a three character manufacturer code,
    599          1.1    jruoho  *              a three character hexadecimal product identifier, and a one
    600      1.1.1.3  christos  *              character hexadecimal revision number. The manufacturer code
    601          1.1    jruoho  *              is a 3 uppercase character code that is compressed into 3 5-bit
    602          1.1    jruoho  *              values as follows:
    603          1.1    jruoho  *                  1) Find hex ASCII value for each letter
    604          1.1    jruoho  *                  2) Subtract 40h from each ASCII value
    605      1.1.1.3  christos  *                  3) Retain 5 least significant bits for each letter by
    606          1.1    jruoho  *                     discarding upper 3 bits because they are always 0.
    607          1.1    jruoho  *                  4) Compressed code = concatenate 0 and the 3 5-bit values
    608          1.1    jruoho  *
    609          1.1    jruoho  *              The format of the compressed product identifier is as follows:
    610          1.1    jruoho  *              Byte 0: Bit 7       - Reserved (0)
    611          1.1    jruoho  *                      Bits 6-2:   - 1st character of compressed mfg code
    612          1.1    jruoho  *                      Bits 1-0    - Upper 2 bits of 2nd character of mfg code
    613          1.1    jruoho  *              Byte 1: Bits 7-5    - Lower 3 bits of 2nd character of mfg code
    614          1.1    jruoho  *                      Bits 4-0    - 3rd character of mfg code
    615          1.1    jruoho  *              Byte 2: Bits 7-4    - 1st hex digit of product number
    616          1.1    jruoho  *                      Bits 3-0    - 2nd hex digit of product number
    617          1.1    jruoho  *              Byte 3: Bits 7-4    - 3st hex digit of product number
    618          1.1    jruoho  *                      Bits 3-0    - Hex digit of the revision number
    619          1.1    jruoho  *
    620          1.1    jruoho  ******************************************************************************/
    621          1.1    jruoho 
    622          1.1    jruoho static void
    623          1.1    jruoho OpcDoEisaId (
    624          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    625          1.1    jruoho {
    626          1.1    jruoho     UINT32                  EisaId = 0;
    627          1.1    jruoho     UINT32                  BigEndianId;
    628          1.1    jruoho     char                    *InString;
    629          1.1    jruoho     ACPI_STATUS             Status = AE_OK;
    630          1.1    jruoho     UINT32                  i;
    631          1.1    jruoho 
    632          1.1    jruoho 
    633          1.1    jruoho     InString = (char *) Op->Asl.Value.String;
    634          1.1    jruoho 
    635          1.1    jruoho     /*
    636          1.1    jruoho      * The EISAID string must be exactly 7 characters and of the form
    637          1.1    jruoho      * "UUUXXXX" -- 3 uppercase letters and 4 hex digits (e.g., "PNP0001")
    638          1.1    jruoho      */
    639  1.1.1.4.2.2     skrll     if (strlen (InString) != 7)
    640          1.1    jruoho     {
    641          1.1    jruoho         Status = AE_BAD_PARAMETER;
    642          1.1    jruoho     }
    643          1.1    jruoho     else
    644          1.1    jruoho     {
    645          1.1    jruoho         /* Check all 7 characters for correct format */
    646          1.1    jruoho 
    647          1.1    jruoho         for (i = 0; i < 7; i++)
    648          1.1    jruoho         {
    649          1.1    jruoho             /* First 3 characters must be uppercase letters */
    650          1.1    jruoho 
    651          1.1    jruoho             if (i < 3)
    652          1.1    jruoho             {
    653          1.1    jruoho                 if (!isupper ((int) InString[i]))
    654          1.1    jruoho                 {
    655          1.1    jruoho                     Status = AE_BAD_PARAMETER;
    656          1.1    jruoho                 }
    657          1.1    jruoho             }
    658          1.1    jruoho 
    659          1.1    jruoho             /* Last 4 characters must be hex digits */
    660          1.1    jruoho 
    661          1.1    jruoho             else if (!isxdigit ((int) InString[i]))
    662          1.1    jruoho             {
    663          1.1    jruoho                 Status = AE_BAD_PARAMETER;
    664          1.1    jruoho             }
    665          1.1    jruoho         }
    666          1.1    jruoho     }
    667          1.1    jruoho 
    668          1.1    jruoho     if (ACPI_FAILURE (Status))
    669          1.1    jruoho     {
    670          1.1    jruoho         AslError (ASL_ERROR, ASL_MSG_INVALID_EISAID, Op, Op->Asl.Value.String);
    671          1.1    jruoho     }
    672          1.1    jruoho     else
    673          1.1    jruoho     {
    674          1.1    jruoho         /* Create ID big-endian first (bits are contiguous) */
    675          1.1    jruoho 
    676          1.1    jruoho         BigEndianId =
    677      1.1.1.2    jruoho             (UINT32) ((UINT8) (InString[0] - 0x40)) << 26 |
    678      1.1.1.2    jruoho             (UINT32) ((UINT8) (InString[1] - 0x40)) << 21 |
    679      1.1.1.2    jruoho             (UINT32) ((UINT8) (InString[2] - 0x40)) << 16 |
    680          1.1    jruoho 
    681      1.1.1.4  christos             (AcpiUtAsciiCharToHex (InString[3])) << 12 |
    682      1.1.1.4  christos             (AcpiUtAsciiCharToHex (InString[4])) << 8  |
    683      1.1.1.4  christos             (AcpiUtAsciiCharToHex (InString[5])) << 4  |
    684      1.1.1.4  christos              AcpiUtAsciiCharToHex (InString[6]);
    685          1.1    jruoho 
    686          1.1    jruoho         /* Swap to little-endian to get final ID (see function header) */
    687          1.1    jruoho 
    688          1.1    jruoho         EisaId = AcpiUtDwordByteSwap (BigEndianId);
    689          1.1    jruoho     }
    690          1.1    jruoho 
    691          1.1    jruoho     /*
    692          1.1    jruoho      * Morph the Op into an integer, regardless of whether there
    693          1.1    jruoho      * was an error in the EISAID string
    694          1.1    jruoho      */
    695          1.1    jruoho     Op->Asl.Value.Integer = EisaId;
    696          1.1    jruoho 
    697          1.1    jruoho     Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
    698          1.1    jruoho     Op->Asl.ParseOpcode = PARSEOP_INTEGER;
    699          1.1    jruoho     (void) OpcSetOptimalIntegerSize (Op);
    700          1.1    jruoho 
    701          1.1    jruoho     /* Op is now an integer */
    702          1.1    jruoho 
    703          1.1    jruoho     UtSetParseOpName (Op);
    704          1.1    jruoho }
    705          1.1    jruoho 
    706          1.1    jruoho 
    707          1.1    jruoho /*******************************************************************************
    708          1.1    jruoho  *
    709  1.1.1.4.2.1     skrll  * FUNCTION:    OpcEncodePldBuffer
    710  1.1.1.4.2.1     skrll  *
    711  1.1.1.4.2.1     skrll  * PARAMETERS:  PldInfo             - _PLD buffer struct (Using local struct)
    712  1.1.1.4.2.1     skrll  *
    713  1.1.1.4.2.1     skrll  * RETURN:      Encode _PLD buffer suitable for return value from _PLD
    714  1.1.1.4.2.1     skrll  *
    715  1.1.1.4.2.1     skrll  * DESCRIPTION: Bit-packs a _PLD buffer struct.
    716  1.1.1.4.2.1     skrll  *
    717  1.1.1.4.2.1     skrll  ******************************************************************************/
    718  1.1.1.4.2.1     skrll 
    719  1.1.1.4.2.1     skrll static UINT8 *
    720  1.1.1.4.2.1     skrll OpcEncodePldBuffer (
    721  1.1.1.4.2.1     skrll     ACPI_PLD_INFO           *PldInfo)
    722  1.1.1.4.2.1     skrll {
    723  1.1.1.4.2.1     skrll     UINT32                  *Buffer;
    724  1.1.1.4.2.1     skrll     UINT32                  Dword;
    725  1.1.1.4.2.1     skrll 
    726  1.1.1.4.2.1     skrll 
    727  1.1.1.4.2.1     skrll     Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
    728  1.1.1.4.2.1     skrll     if (!Buffer)
    729  1.1.1.4.2.1     skrll     {
    730  1.1.1.4.2.1     skrll         return (NULL);
    731  1.1.1.4.2.1     skrll     }
    732  1.1.1.4.2.1     skrll 
    733  1.1.1.4.2.1     skrll     /* First 32 bits */
    734  1.1.1.4.2.1     skrll 
    735  1.1.1.4.2.1     skrll     Dword = 0;
    736  1.1.1.4.2.1     skrll     ACPI_PLD_SET_REVISION       (&Dword, PldInfo->Revision);
    737  1.1.1.4.2.1     skrll     ACPI_PLD_SET_IGNORE_COLOR   (&Dword, PldInfo->IgnoreColor);
    738  1.1.1.4.2.1     skrll     ACPI_PLD_SET_RED            (&Dword, PldInfo->Red);
    739  1.1.1.4.2.1     skrll     ACPI_PLD_SET_GREEN          (&Dword, PldInfo->Green);
    740  1.1.1.4.2.1     skrll     ACPI_PLD_SET_BLUE           (&Dword, PldInfo->Blue);
    741  1.1.1.4.2.1     skrll     ACPI_MOVE_32_TO_32          (&Buffer[0], &Dword);
    742  1.1.1.4.2.1     skrll 
    743  1.1.1.4.2.1     skrll     /* Second 32 bits */
    744  1.1.1.4.2.1     skrll 
    745  1.1.1.4.2.1     skrll     Dword = 0;
    746  1.1.1.4.2.1     skrll     ACPI_PLD_SET_WIDTH          (&Dword, PldInfo->Width);
    747  1.1.1.4.2.1     skrll     ACPI_PLD_SET_HEIGHT         (&Dword, PldInfo->Height);
    748  1.1.1.4.2.1     skrll     ACPI_MOVE_32_TO_32          (&Buffer[1], &Dword);
    749  1.1.1.4.2.1     skrll 
    750  1.1.1.4.2.1     skrll     /* Third 32 bits */
    751  1.1.1.4.2.1     skrll 
    752  1.1.1.4.2.1     skrll     Dword = 0;
    753  1.1.1.4.2.1     skrll     ACPI_PLD_SET_USER_VISIBLE   (&Dword, PldInfo->UserVisible);
    754  1.1.1.4.2.1     skrll     ACPI_PLD_SET_DOCK           (&Dword, PldInfo->Dock);
    755  1.1.1.4.2.1     skrll     ACPI_PLD_SET_LID            (&Dword, PldInfo->Lid);
    756  1.1.1.4.2.1     skrll     ACPI_PLD_SET_PANEL          (&Dword, PldInfo->Panel);
    757  1.1.1.4.2.1     skrll     ACPI_PLD_SET_VERTICAL       (&Dword, PldInfo->VerticalPosition);
    758  1.1.1.4.2.1     skrll     ACPI_PLD_SET_HORIZONTAL     (&Dword, PldInfo->HorizontalPosition);
    759  1.1.1.4.2.1     skrll     ACPI_PLD_SET_SHAPE          (&Dword, PldInfo->Shape);
    760  1.1.1.4.2.1     skrll     ACPI_PLD_SET_ORIENTATION    (&Dword, PldInfo->GroupOrientation);
    761  1.1.1.4.2.1     skrll     ACPI_PLD_SET_TOKEN          (&Dword, PldInfo->GroupToken);
    762  1.1.1.4.2.1     skrll     ACPI_PLD_SET_POSITION       (&Dword, PldInfo->GroupPosition);
    763  1.1.1.4.2.1     skrll     ACPI_PLD_SET_BAY            (&Dword, PldInfo->Bay);
    764  1.1.1.4.2.1     skrll     ACPI_MOVE_32_TO_32          (&Buffer[2], &Dword);
    765  1.1.1.4.2.1     skrll 
    766  1.1.1.4.2.1     skrll     /* Fourth 32 bits */
    767  1.1.1.4.2.1     skrll 
    768  1.1.1.4.2.1     skrll     Dword = 0;
    769  1.1.1.4.2.1     skrll     ACPI_PLD_SET_EJECTABLE      (&Dword, PldInfo->Ejectable);
    770  1.1.1.4.2.1     skrll     ACPI_PLD_SET_OSPM_EJECT     (&Dword, PldInfo->OspmEjectRequired);
    771  1.1.1.4.2.1     skrll     ACPI_PLD_SET_CABINET        (&Dword, PldInfo->CabinetNumber);
    772  1.1.1.4.2.1     skrll     ACPI_PLD_SET_CARD_CAGE      (&Dword, PldInfo->CardCageNumber);
    773  1.1.1.4.2.1     skrll     ACPI_PLD_SET_REFERENCE      (&Dword, PldInfo->Reference);
    774  1.1.1.4.2.1     skrll     ACPI_PLD_SET_ROTATION       (&Dword, PldInfo->Rotation);
    775  1.1.1.4.2.1     skrll     ACPI_PLD_SET_ORDER          (&Dword, PldInfo->Order);
    776  1.1.1.4.2.1     skrll     ACPI_MOVE_32_TO_32          (&Buffer[3], &Dword);
    777  1.1.1.4.2.1     skrll 
    778  1.1.1.4.2.1     skrll     if (PldInfo->Revision >= 2)
    779  1.1.1.4.2.1     skrll     {
    780  1.1.1.4.2.1     skrll         /* Fifth 32 bits */
    781  1.1.1.4.2.1     skrll 
    782  1.1.1.4.2.1     skrll         Dword = 0;
    783  1.1.1.4.2.1     skrll         ACPI_PLD_SET_VERT_OFFSET    (&Dword, PldInfo->VerticalOffset);
    784  1.1.1.4.2.1     skrll         ACPI_PLD_SET_HORIZ_OFFSET   (&Dword, PldInfo->HorizontalOffset);
    785  1.1.1.4.2.1     skrll         ACPI_MOVE_32_TO_32          (&Buffer[4], &Dword);
    786  1.1.1.4.2.1     skrll     }
    787  1.1.1.4.2.1     skrll 
    788  1.1.1.4.2.1     skrll     return (ACPI_CAST_PTR (UINT8, Buffer));
    789  1.1.1.4.2.1     skrll }
    790  1.1.1.4.2.1     skrll 
    791  1.1.1.4.2.1     skrll 
    792  1.1.1.4.2.1     skrll /*******************************************************************************
    793  1.1.1.4.2.1     skrll  *
    794  1.1.1.4.2.1     skrll  * FUNCTION:    OpcFindName
    795  1.1.1.4.2.1     skrll  *
    796  1.1.1.4.2.1     skrll  * PARAMETERS:  List                - Array of char strings to be searched
    797  1.1.1.4.2.1     skrll  *              Name                - Char string to string for
    798  1.1.1.4.2.1     skrll  *              Index               - Index value to set if found
    799  1.1.1.4.2.1     skrll  *
    800  1.1.1.4.2.1     skrll  * RETURN:      TRUE if any names matched, FALSE otherwise
    801  1.1.1.4.2.1     skrll  *
    802  1.1.1.4.2.1     skrll  * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to
    803  1.1.1.4.2.1     skrll  *              equivalent parameter value.
    804  1.1.1.4.2.1     skrll  *
    805  1.1.1.4.2.1     skrll  ******************************************************************************/
    806  1.1.1.4.2.1     skrll 
    807  1.1.1.4.2.1     skrll static BOOLEAN
    808  1.1.1.4.2.1     skrll OpcFindName (
    809  1.1.1.4.2.1     skrll     char                    **List,
    810  1.1.1.4.2.1     skrll     char                    *Name,
    811  1.1.1.4.2.1     skrll     UINT64                  *Index)
    812  1.1.1.4.2.1     skrll {
    813  1.1.1.4.2.1     skrll     char                     *Str;
    814  1.1.1.4.2.1     skrll     UINT32                   i;
    815  1.1.1.4.2.1     skrll 
    816  1.1.1.4.2.1     skrll 
    817  1.1.1.4.2.2     skrll     AcpiUtStrupr (Name);
    818  1.1.1.4.2.1     skrll 
    819  1.1.1.4.2.1     skrll     for (i = 0, Str = List[0]; Str; i++, Str = List[i])
    820  1.1.1.4.2.1     skrll     {
    821  1.1.1.4.2.2     skrll         if (!(strncmp (Str, Name, strlen (Name))))
    822  1.1.1.4.2.1     skrll         {
    823  1.1.1.4.2.1     skrll             *Index = i;
    824  1.1.1.4.2.1     skrll             return (TRUE);
    825  1.1.1.4.2.1     skrll         }
    826  1.1.1.4.2.1     skrll     }
    827  1.1.1.4.2.1     skrll 
    828  1.1.1.4.2.1     skrll     return (FALSE);
    829  1.1.1.4.2.1     skrll }
    830  1.1.1.4.2.1     skrll 
    831  1.1.1.4.2.1     skrll 
    832  1.1.1.4.2.1     skrll /*******************************************************************************
    833  1.1.1.4.2.1     skrll  *
    834  1.1.1.4.2.1     skrll  * FUNCTION:    OpcDoPld
    835  1.1.1.4.2.1     skrll  *
    836  1.1.1.4.2.1     skrll  * PARAMETERS:  Op                  - Parse node
    837  1.1.1.4.2.1     skrll  *
    838  1.1.1.4.2.1     skrll  * RETURN:      None
    839  1.1.1.4.2.1     skrll  *
    840  1.1.1.4.2.1     skrll  * DESCRIPTION: Convert ToPLD macro to 20-byte buffer
    841  1.1.1.4.2.1     skrll  *
    842  1.1.1.4.2.1     skrll  ******************************************************************************/
    843  1.1.1.4.2.1     skrll 
    844  1.1.1.4.2.1     skrll static void
    845  1.1.1.4.2.1     skrll OpcDoPld (
    846  1.1.1.4.2.1     skrll     ACPI_PARSE_OBJECT       *Op)
    847  1.1.1.4.2.1     skrll {
    848  1.1.1.4.2.1     skrll     UINT8                   *Buffer;
    849  1.1.1.4.2.1     skrll     ACPI_PARSE_OBJECT       *Node;
    850  1.1.1.4.2.1     skrll     ACPI_PLD_INFO           PldInfo;
    851  1.1.1.4.2.1     skrll     ACPI_PARSE_OBJECT       *NewOp;
    852  1.1.1.4.2.1     skrll 
    853  1.1.1.4.2.1     skrll 
    854  1.1.1.4.2.1     skrll     if (!Op)
    855  1.1.1.4.2.1     skrll     {
    856  1.1.1.4.2.1     skrll         AslError(ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL);
    857  1.1.1.4.2.1     skrll         return;
    858  1.1.1.4.2.1     skrll     }
    859  1.1.1.4.2.1     skrll 
    860  1.1.1.4.2.1     skrll     if (Op->Asl.ParseOpcode != PARSEOP_TOPLD)
    861  1.1.1.4.2.1     skrll     {
    862  1.1.1.4.2.1     skrll         AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL);
    863  1.1.1.4.2.1     skrll         return;
    864  1.1.1.4.2.1     skrll     }
    865  1.1.1.4.2.1     skrll 
    866  1.1.1.4.2.2     skrll     memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO));
    867  1.1.1.4.2.1     skrll 
    868  1.1.1.4.2.1     skrll     Node = Op->Asl.Child;
    869  1.1.1.4.2.1     skrll     while (Node)
    870  1.1.1.4.2.1     skrll     {
    871  1.1.1.4.2.1     skrll         switch (Node->Asl.ParseOpcode)
    872  1.1.1.4.2.1     skrll         {
    873  1.1.1.4.2.1     skrll         case PARSEOP_PLD_REVISION:
    874  1.1.1.4.2.1     skrll 
    875  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
    876  1.1.1.4.2.1     skrll             {
    877  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
    878  1.1.1.4.2.1     skrll                 break;
    879  1.1.1.4.2.1     skrll             }
    880  1.1.1.4.2.1     skrll 
    881  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 127)
    882  1.1.1.4.2.1     skrll             {
    883  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
    884  1.1.1.4.2.1     skrll                 break;
    885  1.1.1.4.2.1     skrll             }
    886  1.1.1.4.2.1     skrll 
    887  1.1.1.4.2.1     skrll             PldInfo.Revision = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    888  1.1.1.4.2.1     skrll             break;
    889  1.1.1.4.2.1     skrll 
    890  1.1.1.4.2.1     skrll         case PARSEOP_PLD_IGNORECOLOR:
    891  1.1.1.4.2.1     skrll 
    892  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
    893  1.1.1.4.2.1     skrll             {
    894  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
    895  1.1.1.4.2.1     skrll                 break;
    896  1.1.1.4.2.1     skrll             }
    897  1.1.1.4.2.1     skrll 
    898  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 1)
    899  1.1.1.4.2.1     skrll             {
    900  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
    901  1.1.1.4.2.1     skrll                 break;
    902  1.1.1.4.2.1     skrll             }
    903  1.1.1.4.2.1     skrll 
    904  1.1.1.4.2.1     skrll             PldInfo.IgnoreColor = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    905  1.1.1.4.2.1     skrll             break;
    906  1.1.1.4.2.1     skrll 
    907  1.1.1.4.2.1     skrll         case PARSEOP_PLD_RED:
    908  1.1.1.4.2.1     skrll         case PARSEOP_PLD_GREEN:
    909  1.1.1.4.2.1     skrll         case PARSEOP_PLD_BLUE:
    910  1.1.1.4.2.1     skrll 
    911  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
    912  1.1.1.4.2.1     skrll             {
    913  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
    914  1.1.1.4.2.1     skrll                 break;
    915  1.1.1.4.2.1     skrll             }
    916  1.1.1.4.2.1     skrll 
    917  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 255)
    918  1.1.1.4.2.1     skrll             {
    919  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
    920  1.1.1.4.2.1     skrll                 break;
    921  1.1.1.4.2.1     skrll             }
    922  1.1.1.4.2.1     skrll 
    923  1.1.1.4.2.1     skrll             if (Node->Asl.ParseOpcode == PARSEOP_PLD_RED)
    924  1.1.1.4.2.1     skrll             {
    925  1.1.1.4.2.1     skrll                 PldInfo.Red = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    926  1.1.1.4.2.1     skrll             }
    927  1.1.1.4.2.1     skrll             else if (Node->Asl.ParseOpcode == PARSEOP_PLD_GREEN)
    928  1.1.1.4.2.1     skrll             {
    929  1.1.1.4.2.1     skrll                 PldInfo.Green = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    930  1.1.1.4.2.1     skrll             }
    931  1.1.1.4.2.1     skrll             else /* PARSEOP_PLD_BLUE */
    932  1.1.1.4.2.1     skrll             {
    933  1.1.1.4.2.1     skrll                 PldInfo.Blue = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    934  1.1.1.4.2.1     skrll             }
    935  1.1.1.4.2.1     skrll             break;
    936  1.1.1.4.2.1     skrll 
    937  1.1.1.4.2.1     skrll         case PARSEOP_PLD_WIDTH:
    938  1.1.1.4.2.1     skrll         case PARSEOP_PLD_HEIGHT:
    939  1.1.1.4.2.1     skrll 
    940  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
    941  1.1.1.4.2.1     skrll             {
    942  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
    943  1.1.1.4.2.1     skrll                 break;
    944  1.1.1.4.2.1     skrll             }
    945  1.1.1.4.2.1     skrll 
    946  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 65535)
    947  1.1.1.4.2.1     skrll             {
    948  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
    949  1.1.1.4.2.1     skrll                 break;
    950  1.1.1.4.2.1     skrll             }
    951  1.1.1.4.2.1     skrll 
    952  1.1.1.4.2.1     skrll             if (Node->Asl.ParseOpcode == PARSEOP_PLD_WIDTH)
    953  1.1.1.4.2.1     skrll             {
    954  1.1.1.4.2.1     skrll                 PldInfo.Width = (UINT16) Node->Asl.Child->Asl.Value.Integer;
    955  1.1.1.4.2.1     skrll             }
    956  1.1.1.4.2.1     skrll             else /* PARSEOP_PLD_HEIGHT */
    957  1.1.1.4.2.1     skrll             {
    958  1.1.1.4.2.1     skrll                 PldInfo.Height = (UINT16) Node->Asl.Child->Asl.Value.Integer;
    959  1.1.1.4.2.1     skrll             }
    960  1.1.1.4.2.1     skrll 
    961  1.1.1.4.2.1     skrll             break;
    962  1.1.1.4.2.1     skrll 
    963  1.1.1.4.2.1     skrll         case PARSEOP_PLD_USERVISIBLE:
    964  1.1.1.4.2.1     skrll         case PARSEOP_PLD_DOCK:
    965  1.1.1.4.2.1     skrll         case PARSEOP_PLD_LID:
    966  1.1.1.4.2.1     skrll 
    967  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
    968  1.1.1.4.2.1     skrll             {
    969  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
    970  1.1.1.4.2.1     skrll                 break;
    971  1.1.1.4.2.1     skrll             }
    972  1.1.1.4.2.1     skrll 
    973  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 1)
    974  1.1.1.4.2.1     skrll             {
    975  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
    976  1.1.1.4.2.1     skrll                 break;
    977  1.1.1.4.2.1     skrll             }
    978  1.1.1.4.2.1     skrll 
    979  1.1.1.4.2.1     skrll             if (Node->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE)
    980  1.1.1.4.2.1     skrll             {
    981  1.1.1.4.2.1     skrll                 PldInfo.UserVisible = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    982  1.1.1.4.2.1     skrll             }
    983  1.1.1.4.2.1     skrll             else if (Node->Asl.ParseOpcode == PARSEOP_PLD_DOCK)
    984  1.1.1.4.2.1     skrll             {
    985  1.1.1.4.2.1     skrll                 PldInfo.Dock = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    986  1.1.1.4.2.1     skrll             }
    987  1.1.1.4.2.1     skrll             else
    988  1.1.1.4.2.1     skrll             {
    989  1.1.1.4.2.1     skrll                 PldInfo.Lid = (UINT8) Node->Asl.Child->Asl.Value.Integer;
    990  1.1.1.4.2.1     skrll             }
    991  1.1.1.4.2.1     skrll 
    992  1.1.1.4.2.1     skrll             break;
    993  1.1.1.4.2.1     skrll 
    994  1.1.1.4.2.1     skrll         case PARSEOP_PLD_PANEL:
    995  1.1.1.4.2.1     skrll 
    996  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
    997  1.1.1.4.2.1     skrll             {
    998  1.1.1.4.2.1     skrll                 if (Node->Asl.Child->Asl.Value.Integer > 6)
    999  1.1.1.4.2.1     skrll                 {
   1000  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1001  1.1.1.4.2.1     skrll                     break;
   1002  1.1.1.4.2.1     skrll                 }
   1003  1.1.1.4.2.1     skrll             }
   1004  1.1.1.4.2.1     skrll             else /* PARSEOP_STRING */
   1005  1.1.1.4.2.1     skrll             {
   1006  1.1.1.4.2.1     skrll                 if (!OpcFindName(AslPldPanelList,
   1007  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.String,
   1008  1.1.1.4.2.1     skrll                     &Node->Asl.Child->Asl.Value.Integer))
   1009  1.1.1.4.2.1     skrll                 {
   1010  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
   1011  1.1.1.4.2.1     skrll                     break;
   1012  1.1.1.4.2.1     skrll                 }
   1013  1.1.1.4.2.1     skrll             }
   1014  1.1.1.4.2.1     skrll 
   1015  1.1.1.4.2.1     skrll             PldInfo.Panel = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1016  1.1.1.4.2.1     skrll             break;
   1017  1.1.1.4.2.1     skrll 
   1018  1.1.1.4.2.1     skrll         case PARSEOP_PLD_VERTICALPOSITION:
   1019  1.1.1.4.2.1     skrll 
   1020  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
   1021  1.1.1.4.2.1     skrll             {
   1022  1.1.1.4.2.1     skrll                 if (Node->Asl.Child->Asl.Value.Integer > 2)
   1023  1.1.1.4.2.1     skrll                 {
   1024  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1025  1.1.1.4.2.1     skrll                     break;
   1026  1.1.1.4.2.1     skrll                 }
   1027  1.1.1.4.2.1     skrll             }
   1028  1.1.1.4.2.1     skrll             else /* PARSEOP_STRING */
   1029  1.1.1.4.2.1     skrll             {
   1030  1.1.1.4.2.1     skrll                 if (!OpcFindName(AslPldVerticalPositionList,
   1031  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.String,
   1032  1.1.1.4.2.1     skrll                     &Node->Asl.Child->Asl.Value.Integer))
   1033  1.1.1.4.2.1     skrll                 {
   1034  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
   1035  1.1.1.4.2.1     skrll                     break;
   1036  1.1.1.4.2.1     skrll                 }
   1037  1.1.1.4.2.1     skrll             }
   1038  1.1.1.4.2.1     skrll 
   1039  1.1.1.4.2.1     skrll             PldInfo.VerticalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1040  1.1.1.4.2.1     skrll             break;
   1041  1.1.1.4.2.1     skrll 
   1042  1.1.1.4.2.1     skrll         case PARSEOP_PLD_HORIZONTALPOSITION:
   1043  1.1.1.4.2.1     skrll 
   1044  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
   1045  1.1.1.4.2.1     skrll             {
   1046  1.1.1.4.2.1     skrll                 if (Node->Asl.Child->Asl.Value.Integer > 2)
   1047  1.1.1.4.2.1     skrll                 {
   1048  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1049  1.1.1.4.2.1     skrll                     break;
   1050  1.1.1.4.2.1     skrll                 }
   1051  1.1.1.4.2.1     skrll             }
   1052  1.1.1.4.2.1     skrll             else /* PARSEOP_STRING */
   1053  1.1.1.4.2.1     skrll             {
   1054  1.1.1.4.2.1     skrll                 if (!OpcFindName(AslPldHorizontalPositionList,
   1055  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.String,
   1056  1.1.1.4.2.1     skrll                     &Node->Asl.Child->Asl.Value.Integer))
   1057  1.1.1.4.2.1     skrll                 {
   1058  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
   1059  1.1.1.4.2.1     skrll                     break;
   1060  1.1.1.4.2.1     skrll                 }
   1061  1.1.1.4.2.1     skrll             }
   1062  1.1.1.4.2.1     skrll 
   1063  1.1.1.4.2.1     skrll             PldInfo.HorizontalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1064  1.1.1.4.2.1     skrll             break;
   1065  1.1.1.4.2.1     skrll 
   1066  1.1.1.4.2.1     skrll         case PARSEOP_PLD_SHAPE:
   1067  1.1.1.4.2.1     skrll 
   1068  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
   1069  1.1.1.4.2.1     skrll             {
   1070  1.1.1.4.2.1     skrll                 if (Node->Asl.Child->Asl.Value.Integer > 8)
   1071  1.1.1.4.2.1     skrll                 {
   1072  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1073  1.1.1.4.2.1     skrll                     break;
   1074  1.1.1.4.2.1     skrll                 }
   1075  1.1.1.4.2.1     skrll             }
   1076  1.1.1.4.2.1     skrll             else /* PARSEOP_STRING */
   1077  1.1.1.4.2.1     skrll             {
   1078  1.1.1.4.2.1     skrll                 if (!OpcFindName(AslPldShapeList,
   1079  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.String,
   1080  1.1.1.4.2.1     skrll                     &Node->Asl.Child->Asl.Value.Integer))
   1081  1.1.1.4.2.1     skrll                 {
   1082  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
   1083  1.1.1.4.2.1     skrll                     break;
   1084  1.1.1.4.2.1     skrll                 }
   1085  1.1.1.4.2.1     skrll             }
   1086  1.1.1.4.2.1     skrll 
   1087  1.1.1.4.2.1     skrll             PldInfo.Shape = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1088  1.1.1.4.2.1     skrll             break;
   1089  1.1.1.4.2.1     skrll 
   1090  1.1.1.4.2.1     skrll         case PARSEOP_PLD_GROUPORIENTATION:
   1091  1.1.1.4.2.1     skrll 
   1092  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1093  1.1.1.4.2.1     skrll             {
   1094  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1095  1.1.1.4.2.1     skrll                 break;
   1096  1.1.1.4.2.1     skrll             }
   1097  1.1.1.4.2.1     skrll 
   1098  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 1)
   1099  1.1.1.4.2.1     skrll             {
   1100  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1101  1.1.1.4.2.1     skrll                 break;
   1102  1.1.1.4.2.1     skrll             }
   1103  1.1.1.4.2.1     skrll 
   1104  1.1.1.4.2.1     skrll             PldInfo.GroupOrientation = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1105  1.1.1.4.2.1     skrll             break;
   1106  1.1.1.4.2.1     skrll 
   1107  1.1.1.4.2.1     skrll         case PARSEOP_PLD_GROUPTOKEN:
   1108  1.1.1.4.2.1     skrll         case PARSEOP_PLD_GROUPPOSITION:
   1109  1.1.1.4.2.1     skrll 
   1110  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1111  1.1.1.4.2.1     skrll             {
   1112  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1113  1.1.1.4.2.1     skrll                 break;
   1114  1.1.1.4.2.1     skrll             }
   1115  1.1.1.4.2.1     skrll 
   1116  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 255)
   1117  1.1.1.4.2.1     skrll             {
   1118  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1119  1.1.1.4.2.1     skrll                 break;
   1120  1.1.1.4.2.1     skrll             }
   1121  1.1.1.4.2.1     skrll 
   1122  1.1.1.4.2.1     skrll 
   1123  1.1.1.4.2.1     skrll             if (Node->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN)
   1124  1.1.1.4.2.1     skrll             {
   1125  1.1.1.4.2.1     skrll                 PldInfo.GroupToken = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1126  1.1.1.4.2.1     skrll             }
   1127  1.1.1.4.2.1     skrll             else /* PARSEOP_PLD_GROUPPOSITION */
   1128  1.1.1.4.2.1     skrll             {
   1129  1.1.1.4.2.1     skrll                 PldInfo.GroupPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1130  1.1.1.4.2.1     skrll             }
   1131  1.1.1.4.2.1     skrll 
   1132  1.1.1.4.2.1     skrll             break;
   1133  1.1.1.4.2.1     skrll 
   1134  1.1.1.4.2.1     skrll         case PARSEOP_PLD_BAY:
   1135  1.1.1.4.2.1     skrll         case PARSEOP_PLD_EJECTABLE:
   1136  1.1.1.4.2.1     skrll         case PARSEOP_PLD_EJECTREQUIRED:
   1137  1.1.1.4.2.1     skrll 
   1138  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1139  1.1.1.4.2.1     skrll             {
   1140  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1141  1.1.1.4.2.1     skrll                 break;
   1142  1.1.1.4.2.1     skrll             }
   1143  1.1.1.4.2.1     skrll 
   1144  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 1)
   1145  1.1.1.4.2.1     skrll             {
   1146  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1147  1.1.1.4.2.1     skrll                 break;
   1148  1.1.1.4.2.1     skrll             }
   1149  1.1.1.4.2.1     skrll 
   1150  1.1.1.4.2.1     skrll             if (Node->Asl.ParseOpcode == PARSEOP_PLD_BAY)
   1151  1.1.1.4.2.1     skrll             {
   1152  1.1.1.4.2.1     skrll                 PldInfo.Bay = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1153  1.1.1.4.2.1     skrll             }
   1154  1.1.1.4.2.1     skrll             else if (Node->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE)
   1155  1.1.1.4.2.1     skrll             {
   1156  1.1.1.4.2.1     skrll                 PldInfo.Ejectable = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1157  1.1.1.4.2.1     skrll             }
   1158  1.1.1.4.2.1     skrll             else /* PARSEOP_PLD_EJECTREQUIRED */
   1159  1.1.1.4.2.1     skrll             {
   1160  1.1.1.4.2.1     skrll                 PldInfo.OspmEjectRequired = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1161  1.1.1.4.2.1     skrll             }
   1162  1.1.1.4.2.1     skrll 
   1163  1.1.1.4.2.1     skrll             break;
   1164  1.1.1.4.2.1     skrll 
   1165  1.1.1.4.2.1     skrll         case PARSEOP_PLD_CABINETNUMBER:
   1166  1.1.1.4.2.1     skrll         case PARSEOP_PLD_CARDCAGENUMBER:
   1167  1.1.1.4.2.1     skrll 
   1168  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1169  1.1.1.4.2.1     skrll             {
   1170  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1171  1.1.1.4.2.1     skrll                 break;
   1172  1.1.1.4.2.1     skrll             }
   1173  1.1.1.4.2.1     skrll 
   1174  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 255)
   1175  1.1.1.4.2.1     skrll             {
   1176  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1177  1.1.1.4.2.1     skrll                 break;
   1178  1.1.1.4.2.1     skrll             }
   1179  1.1.1.4.2.1     skrll 
   1180  1.1.1.4.2.1     skrll             if (Node->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER)
   1181  1.1.1.4.2.1     skrll             {
   1182  1.1.1.4.2.1     skrll                 PldInfo.CabinetNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1183  1.1.1.4.2.1     skrll             }
   1184  1.1.1.4.2.1     skrll             else /* PARSEOP_PLD_CARDCAGENUMBER */
   1185  1.1.1.4.2.1     skrll             {
   1186  1.1.1.4.2.1     skrll                 PldInfo.CardCageNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1187  1.1.1.4.2.1     skrll             }
   1188  1.1.1.4.2.1     skrll 
   1189  1.1.1.4.2.1     skrll             break;
   1190  1.1.1.4.2.1     skrll 
   1191  1.1.1.4.2.1     skrll         case PARSEOP_PLD_REFERENCE:
   1192  1.1.1.4.2.1     skrll 
   1193  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1194  1.1.1.4.2.1     skrll             {
   1195  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1196  1.1.1.4.2.1     skrll                 break;
   1197  1.1.1.4.2.1     skrll             }
   1198  1.1.1.4.2.1     skrll 
   1199  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 1)
   1200  1.1.1.4.2.1     skrll             {
   1201  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1202  1.1.1.4.2.1     skrll                 break;
   1203  1.1.1.4.2.1     skrll             }
   1204  1.1.1.4.2.1     skrll 
   1205  1.1.1.4.2.1     skrll             PldInfo.Reference = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1206  1.1.1.4.2.1     skrll             break;
   1207  1.1.1.4.2.1     skrll 
   1208  1.1.1.4.2.1     skrll         case PARSEOP_PLD_ROTATION:
   1209  1.1.1.4.2.1     skrll 
   1210  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1211  1.1.1.4.2.1     skrll             {
   1212  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1213  1.1.1.4.2.1     skrll                 break;
   1214  1.1.1.4.2.1     skrll             }
   1215  1.1.1.4.2.1     skrll 
   1216  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 7)
   1217  1.1.1.4.2.1     skrll             {
   1218  1.1.1.4.2.1     skrll                 switch (Node->Asl.Child->Asl.Value.Integer)
   1219  1.1.1.4.2.1     skrll                 {
   1220  1.1.1.4.2.1     skrll                 case 45:
   1221  1.1.1.4.2.1     skrll 
   1222  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.Integer = 1;
   1223  1.1.1.4.2.1     skrll                     break;
   1224  1.1.1.4.2.1     skrll 
   1225  1.1.1.4.2.1     skrll                 case 90:
   1226  1.1.1.4.2.1     skrll 
   1227  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.Integer = 2;
   1228  1.1.1.4.2.1     skrll                     break;
   1229  1.1.1.4.2.1     skrll 
   1230  1.1.1.4.2.1     skrll                 case 135:
   1231  1.1.1.4.2.1     skrll 
   1232  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.Integer = 3;
   1233  1.1.1.4.2.1     skrll                     break;
   1234  1.1.1.4.2.1     skrll 
   1235  1.1.1.4.2.1     skrll                 case 180:
   1236  1.1.1.4.2.1     skrll 
   1237  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.Integer = 4;
   1238  1.1.1.4.2.1     skrll                     break;
   1239  1.1.1.4.2.1     skrll 
   1240  1.1.1.4.2.1     skrll                 case 225:
   1241  1.1.1.4.2.1     skrll 
   1242  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.Integer = 5;
   1243  1.1.1.4.2.1     skrll                     break;
   1244  1.1.1.4.2.1     skrll 
   1245  1.1.1.4.2.1     skrll                 case 270:
   1246  1.1.1.4.2.1     skrll 
   1247  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.Integer = 6;
   1248  1.1.1.4.2.1     skrll                     break;
   1249  1.1.1.4.2.1     skrll 
   1250  1.1.1.4.2.1     skrll                 case 315:
   1251  1.1.1.4.2.1     skrll 
   1252  1.1.1.4.2.1     skrll                     Node->Asl.Child->Asl.Value.Integer = 7;
   1253  1.1.1.4.2.1     skrll                     break;
   1254  1.1.1.4.2.1     skrll 
   1255  1.1.1.4.2.1     skrll                 default:
   1256  1.1.1.4.2.1     skrll 
   1257  1.1.1.4.2.1     skrll                     AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1258  1.1.1.4.2.1     skrll                     break;
   1259  1.1.1.4.2.1     skrll                 }
   1260  1.1.1.4.2.1     skrll             }
   1261  1.1.1.4.2.1     skrll 
   1262  1.1.1.4.2.1     skrll             PldInfo.Rotation = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1263  1.1.1.4.2.1     skrll             break;
   1264  1.1.1.4.2.1     skrll 
   1265  1.1.1.4.2.1     skrll         case PARSEOP_PLD_ORDER:
   1266  1.1.1.4.2.1     skrll 
   1267  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1268  1.1.1.4.2.1     skrll             {
   1269  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1270  1.1.1.4.2.1     skrll                 break;
   1271  1.1.1.4.2.1     skrll             }
   1272  1.1.1.4.2.1     skrll 
   1273  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 31)
   1274  1.1.1.4.2.1     skrll             {
   1275  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1276  1.1.1.4.2.1     skrll                 break;
   1277  1.1.1.4.2.1     skrll             }
   1278  1.1.1.4.2.1     skrll 
   1279  1.1.1.4.2.1     skrll             PldInfo.Order = (UINT8) Node->Asl.Child->Asl.Value.Integer;
   1280  1.1.1.4.2.1     skrll             break;
   1281  1.1.1.4.2.1     skrll 
   1282  1.1.1.4.2.1     skrll         case PARSEOP_PLD_VERTICALOFFSET:
   1283  1.1.1.4.2.1     skrll         case PARSEOP_PLD_HORIZONTALOFFSET:
   1284  1.1.1.4.2.1     skrll 
   1285  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
   1286  1.1.1.4.2.1     skrll             {
   1287  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1288  1.1.1.4.2.1     skrll                 break;
   1289  1.1.1.4.2.1     skrll             }
   1290  1.1.1.4.2.1     skrll 
   1291  1.1.1.4.2.1     skrll             if (Node->Asl.Child->Asl.Value.Integer > 65535)
   1292  1.1.1.4.2.1     skrll             {
   1293  1.1.1.4.2.1     skrll                 AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
   1294  1.1.1.4.2.1     skrll                 break;
   1295  1.1.1.4.2.1     skrll             }
   1296  1.1.1.4.2.1     skrll 
   1297  1.1.1.4.2.1     skrll             if (Node->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET)
   1298  1.1.1.4.2.1     skrll             {
   1299  1.1.1.4.2.1     skrll                 PldInfo.VerticalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer;
   1300  1.1.1.4.2.1     skrll             }
   1301  1.1.1.4.2.1     skrll             else /* PARSEOP_PLD_HORIZONTALOFFSET */
   1302  1.1.1.4.2.1     skrll             {
   1303  1.1.1.4.2.1     skrll                 PldInfo.HorizontalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer;
   1304  1.1.1.4.2.1     skrll             }
   1305  1.1.1.4.2.1     skrll 
   1306  1.1.1.4.2.1     skrll             break;
   1307  1.1.1.4.2.1     skrll 
   1308  1.1.1.4.2.1     skrll         default:
   1309  1.1.1.4.2.1     skrll 
   1310  1.1.1.4.2.1     skrll             AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
   1311  1.1.1.4.2.1     skrll             break;
   1312  1.1.1.4.2.1     skrll         }
   1313  1.1.1.4.2.1     skrll 
   1314  1.1.1.4.2.1     skrll         Node = Node->Asl.Next;
   1315  1.1.1.4.2.1     skrll     }
   1316  1.1.1.4.2.1     skrll 
   1317  1.1.1.4.2.1     skrll     Buffer = OpcEncodePldBuffer(&PldInfo);
   1318  1.1.1.4.2.1     skrll 
   1319  1.1.1.4.2.1     skrll     /* Change Op to a Buffer */
   1320  1.1.1.4.2.1     skrll 
   1321  1.1.1.4.2.1     skrll     Op->Asl.ParseOpcode = PARSEOP_BUFFER;
   1322  1.1.1.4.2.1     skrll     Op->Common.AmlOpcode = AML_BUFFER_OP;
   1323  1.1.1.4.2.1     skrll 
   1324  1.1.1.4.2.1     skrll     /* Disable further optimization */
   1325  1.1.1.4.2.1     skrll 
   1326  1.1.1.4.2.1     skrll     Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
   1327  1.1.1.4.2.1     skrll     UtSetParseOpName (Op);
   1328  1.1.1.4.2.1     skrll 
   1329  1.1.1.4.2.1     skrll     /* Child node is the buffer length */
   1330  1.1.1.4.2.1     skrll 
   1331  1.1.1.4.2.1     skrll     NewOp = TrAllocateNode (PARSEOP_INTEGER);
   1332  1.1.1.4.2.1     skrll 
   1333  1.1.1.4.2.1     skrll     NewOp->Asl.AmlOpcode     = AML_BYTE_OP;
   1334  1.1.1.4.2.1     skrll     NewOp->Asl.Value.Integer = 20;
   1335  1.1.1.4.2.1     skrll     NewOp->Asl.Parent        = Op;
   1336  1.1.1.4.2.1     skrll 
   1337  1.1.1.4.2.1     skrll     Op->Asl.Child = NewOp;
   1338  1.1.1.4.2.1     skrll     Op = NewOp;
   1339  1.1.1.4.2.1     skrll 
   1340  1.1.1.4.2.1     skrll     /* Peer to the child is the raw buffer data */
   1341  1.1.1.4.2.1     skrll 
   1342  1.1.1.4.2.1     skrll     NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
   1343  1.1.1.4.2.1     skrll     NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER;
   1344  1.1.1.4.2.1     skrll     NewOp->Asl.AmlLength     = 20;
   1345  1.1.1.4.2.1     skrll     NewOp->Asl.Value.String  = ACPI_CAST_PTR (char, Buffer);
   1346  1.1.1.4.2.1     skrll     NewOp->Asl.Parent        = Op->Asl.Parent;
   1347  1.1.1.4.2.1     skrll 
   1348  1.1.1.4.2.1     skrll     Op->Asl.Next = NewOp;
   1349  1.1.1.4.2.1     skrll }
   1350  1.1.1.4.2.1     skrll 
   1351  1.1.1.4.2.1     skrll 
   1352  1.1.1.4.2.1     skrll /*******************************************************************************
   1353  1.1.1.4.2.1     skrll  *
   1354      1.1.1.3  christos  * FUNCTION:    OpcDoUuId
   1355          1.1    jruoho  *
   1356  1.1.1.4.2.1     skrll  * PARAMETERS:  Op                  - Parse node
   1357          1.1    jruoho  *
   1358          1.1    jruoho  * RETURN:      None
   1359          1.1    jruoho  *
   1360          1.1    jruoho  * DESCRIPTION: Convert UUID string to 16-byte buffer
   1361          1.1    jruoho  *
   1362          1.1    jruoho  ******************************************************************************/
   1363          1.1    jruoho 
   1364          1.1    jruoho static void
   1365          1.1    jruoho OpcDoUuId (
   1366          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
   1367          1.1    jruoho {
   1368          1.1    jruoho     char                    *InString;
   1369      1.1.1.4  christos     UINT8                   *Buffer;
   1370          1.1    jruoho     ACPI_STATUS             Status = AE_OK;
   1371          1.1    jruoho     ACPI_PARSE_OBJECT       *NewOp;
   1372          1.1    jruoho 
   1373          1.1    jruoho 
   1374  1.1.1.4.2.1     skrll     InString = ACPI_CAST_PTR (char, Op->Asl.Value.String);
   1375          1.1    jruoho     Buffer = UtLocalCalloc (16);
   1376          1.1    jruoho 
   1377      1.1.1.2    jruoho     Status = AuValidateUuid (InString);
   1378          1.1    jruoho     if (ACPI_FAILURE (Status))
   1379          1.1    jruoho     {
   1380          1.1    jruoho         AslError (ASL_ERROR, ASL_MSG_INVALID_UUID, Op, Op->Asl.Value.String);
   1381          1.1    jruoho     }
   1382      1.1.1.2    jruoho     else
   1383          1.1    jruoho     {
   1384      1.1.1.4  christos         AcpiUtConvertStringToUuid (InString, Buffer);
   1385          1.1    jruoho     }
   1386          1.1    jruoho 
   1387          1.1    jruoho     /* Change Op to a Buffer */
   1388          1.1    jruoho 
   1389          1.1    jruoho     Op->Asl.ParseOpcode = PARSEOP_BUFFER;
   1390          1.1    jruoho     Op->Common.AmlOpcode = AML_BUFFER_OP;
   1391          1.1    jruoho 
   1392          1.1    jruoho     /* Disable further optimization */
   1393          1.1    jruoho 
   1394          1.1    jruoho     Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
   1395          1.1    jruoho     UtSetParseOpName (Op);
   1396          1.1    jruoho 
   1397          1.1    jruoho     /* Child node is the buffer length */
   1398          1.1    jruoho 
   1399          1.1    jruoho     NewOp = TrAllocateNode (PARSEOP_INTEGER);
   1400          1.1    jruoho 
   1401          1.1    jruoho     NewOp->Asl.AmlOpcode     = AML_BYTE_OP;
   1402          1.1    jruoho     NewOp->Asl.Value.Integer = 16;
   1403          1.1    jruoho     NewOp->Asl.Parent        = Op;
   1404          1.1    jruoho 
   1405          1.1    jruoho     Op->Asl.Child = NewOp;
   1406          1.1    jruoho     Op = NewOp;
   1407          1.1    jruoho 
   1408          1.1    jruoho     /* Peer to the child is the raw buffer data */
   1409          1.1    jruoho 
   1410          1.1    jruoho     NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
   1411          1.1    jruoho     NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER;
   1412          1.1    jruoho     NewOp->Asl.AmlLength     = 16;
   1413  1.1.1.4.2.1     skrll     NewOp->Asl.Value.String  = ACPI_CAST_PTR (char, Buffer);
   1414          1.1    jruoho     NewOp->Asl.Parent        = Op->Asl.Parent;
   1415          1.1    jruoho 
   1416          1.1    jruoho     Op->Asl.Next = NewOp;
   1417          1.1    jruoho }
   1418          1.1    jruoho 
   1419          1.1    jruoho 
   1420          1.1    jruoho /*******************************************************************************
   1421          1.1    jruoho  *
   1422          1.1    jruoho  * FUNCTION:    OpcGenerateAmlOpcode
   1423          1.1    jruoho  *
   1424  1.1.1.4.2.1     skrll  * PARAMETERS:  Op                  - Parse node
   1425          1.1    jruoho  *
   1426          1.1    jruoho  * RETURN:      None
   1427          1.1    jruoho  *
   1428          1.1    jruoho  * DESCRIPTION: Generate the AML opcode associated with the node and its
   1429      1.1.1.3  christos  *              parse (lex/flex) keyword opcode. Essentially implements
   1430          1.1    jruoho  *              a mapping between the parse opcodes and the actual AML opcodes.
   1431          1.1    jruoho  *
   1432          1.1    jruoho  ******************************************************************************/
   1433          1.1    jruoho 
   1434          1.1    jruoho void
   1435          1.1    jruoho OpcGenerateAmlOpcode (
   1436          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
   1437          1.1    jruoho {
   1438          1.1    jruoho     UINT16                  Index;
   1439          1.1    jruoho 
   1440          1.1    jruoho 
   1441          1.1    jruoho     Index = (UINT16) (Op->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE);
   1442          1.1    jruoho 
   1443          1.1    jruoho     Op->Asl.AmlOpcode     = AslKeywordMapping[Index].AmlOpcode;
   1444          1.1    jruoho     Op->Asl.AcpiBtype     = AslKeywordMapping[Index].AcpiBtype;
   1445          1.1    jruoho     Op->Asl.CompileFlags |= AslKeywordMapping[Index].Flags;
   1446          1.1    jruoho 
   1447          1.1    jruoho     if (!Op->Asl.Value.Integer)
   1448          1.1    jruoho     {
   1449          1.1    jruoho         Op->Asl.Value.Integer = AslKeywordMapping[Index].Value;
   1450          1.1    jruoho     }
   1451          1.1    jruoho 
   1452          1.1    jruoho     /* Special handling for some opcodes */
   1453          1.1    jruoho 
   1454          1.1    jruoho     switch (Op->Asl.ParseOpcode)
   1455          1.1    jruoho     {
   1456          1.1    jruoho     case PARSEOP_INTEGER:
   1457          1.1    jruoho         /*
   1458          1.1    jruoho          * Set the opcode based on the size of the integer
   1459          1.1    jruoho          */
   1460          1.1    jruoho         (void) OpcSetOptimalIntegerSize (Op);
   1461          1.1    jruoho         break;
   1462          1.1    jruoho 
   1463          1.1    jruoho     case PARSEOP_OFFSET:
   1464          1.1    jruoho 
   1465          1.1    jruoho         Op->Asl.AmlOpcodeLength = 1;
   1466          1.1    jruoho         break;
   1467          1.1    jruoho 
   1468          1.1    jruoho     case PARSEOP_ACCESSAS:
   1469          1.1    jruoho 
   1470          1.1    jruoho         OpcDoAccessAs (Op);
   1471          1.1    jruoho         break;
   1472          1.1    jruoho 
   1473      1.1.1.3  christos     case PARSEOP_CONNECTION:
   1474      1.1.1.3  christos 
   1475      1.1.1.3  christos         OpcDoConnection (Op);
   1476      1.1.1.3  christos         break;
   1477      1.1.1.3  christos 
   1478          1.1    jruoho     case PARSEOP_EISAID:
   1479          1.1    jruoho 
   1480          1.1    jruoho         OpcDoEisaId (Op);
   1481          1.1    jruoho         break;
   1482          1.1    jruoho 
   1483  1.1.1.4.2.1     skrll     case PARSEOP_PRINTF:
   1484  1.1.1.4.2.1     skrll 
   1485  1.1.1.4.2.1     skrll         OpcDoPrintf (Op);
   1486  1.1.1.4.2.1     skrll         break;
   1487  1.1.1.4.2.1     skrll 
   1488  1.1.1.4.2.1     skrll     case PARSEOP_FPRINTF:
   1489  1.1.1.4.2.1     skrll 
   1490  1.1.1.4.2.1     skrll         OpcDoFprintf (Op);
   1491  1.1.1.4.2.1     skrll         break;
   1492  1.1.1.4.2.1     skrll 
   1493  1.1.1.4.2.1     skrll     case PARSEOP_TOPLD:
   1494  1.1.1.4.2.1     skrll 
   1495  1.1.1.4.2.1     skrll         OpcDoPld (Op);
   1496  1.1.1.4.2.1     skrll         break;
   1497  1.1.1.4.2.1     skrll 
   1498          1.1    jruoho     case PARSEOP_TOUUID:
   1499          1.1    jruoho 
   1500          1.1    jruoho         OpcDoUuId (Op);
   1501          1.1    jruoho         break;
   1502          1.1    jruoho 
   1503          1.1    jruoho     case PARSEOP_UNICODE:
   1504          1.1    jruoho 
   1505          1.1    jruoho         OpcDoUnicode (Op);
   1506          1.1    jruoho         break;
   1507          1.1    jruoho 
   1508          1.1    jruoho     case PARSEOP_INCLUDE:
   1509          1.1    jruoho 
   1510          1.1    jruoho         Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
   1511          1.1    jruoho         Gbl_HasIncludeFiles = TRUE;
   1512          1.1    jruoho         break;
   1513          1.1    jruoho 
   1514          1.1    jruoho     case PARSEOP_EXTERNAL:
   1515          1.1    jruoho 
   1516          1.1    jruoho         Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
   1517          1.1    jruoho         Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
   1518          1.1    jruoho         break;
   1519          1.1    jruoho 
   1520      1.1.1.3  christos     case PARSEOP_TIMER:
   1521      1.1.1.3  christos 
   1522      1.1.1.3  christos         if (AcpiGbl_IntegerBitWidth == 32)
   1523      1.1.1.3  christos         {
   1524      1.1.1.3  christos             AslError (ASL_REMARK, ASL_MSG_TRUNCATION, Op, NULL);
   1525      1.1.1.3  christos         }
   1526      1.1.1.3  christos         break;
   1527      1.1.1.3  christos 
   1528          1.1    jruoho     default:
   1529      1.1.1.3  christos 
   1530          1.1    jruoho         /* Nothing to do for other opcodes */
   1531      1.1.1.3  christos 
   1532          1.1    jruoho         break;
   1533          1.1    jruoho     }
   1534          1.1    jruoho 
   1535          1.1    jruoho     return;
   1536          1.1    jruoho }
   1537