Home | History | Annotate | Line # | Download | only in compiler
asllength.c revision 1.1.1.4.2.5
      1          1.1    jruoho /******************************************************************************
      2          1.1    jruoho  *
      3          1.1    jruoho  * Module Name: asllength - Tree walk to determine package and opcode lengths
      4          1.1    jruoho  *
      5          1.1    jruoho  *****************************************************************************/
      6          1.1    jruoho 
      7      1.1.1.2    jruoho /*
      8  1.1.1.4.2.4     skrll  * Copyright (C) 2000 - 2017, 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.1.4.2.5     skrll #include "acconvert.h"
     48          1.1    jruoho 
     49          1.1    jruoho 
     50          1.1    jruoho #define _COMPONENT          ACPI_COMPILER
     51          1.1    jruoho         ACPI_MODULE_NAME    ("asllength")
     52          1.1    jruoho 
     53          1.1    jruoho /* Local prototypes */
     54          1.1    jruoho 
     55          1.1    jruoho static UINT8
     56          1.1    jruoho CgGetPackageLenByteCount (
     57          1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
     58          1.1    jruoho     UINT32                  PackageLength);
     59          1.1    jruoho 
     60          1.1    jruoho static void
     61          1.1    jruoho CgGenerateAmlOpcodeLength (
     62          1.1    jruoho     ACPI_PARSE_OBJECT       *Op);
     63          1.1    jruoho 
     64          1.1    jruoho 
     65          1.1    jruoho #ifdef ACPI_OBSOLETE_FUNCTIONS
     66          1.1    jruoho void
     67          1.1    jruoho LnAdjustLengthToRoot (
     68          1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
     69          1.1    jruoho     UINT32                  LengthDelta);
     70          1.1    jruoho #endif
     71          1.1    jruoho 
     72          1.1    jruoho 
     73          1.1    jruoho /*******************************************************************************
     74          1.1    jruoho  *
     75          1.1    jruoho  * FUNCTION:    LnInitLengthsWalk
     76          1.1    jruoho  *
     77          1.1    jruoho  * PARAMETERS:  ASL_WALK_CALLBACK
     78          1.1    jruoho  *
     79          1.1    jruoho  * RETURN:      Status
     80          1.1    jruoho  *
     81          1.1    jruoho  * DESCRIPTION: Walk callback to initialize (and re-initialize) the node
     82      1.1.1.3  christos  *              subtree length(s) to zero. The Subtree lengths are bubbled
     83          1.1    jruoho  *              up to the root node in order to get a total AML length.
     84          1.1    jruoho  *
     85          1.1    jruoho  ******************************************************************************/
     86          1.1    jruoho 
     87          1.1    jruoho ACPI_STATUS
     88          1.1    jruoho LnInitLengthsWalk (
     89          1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
     90          1.1    jruoho     UINT32                  Level,
     91          1.1    jruoho     void                    *Context)
     92          1.1    jruoho {
     93          1.1    jruoho 
     94          1.1    jruoho     Op->Asl.AmlSubtreeLength = 0;
     95          1.1    jruoho     return (AE_OK);
     96          1.1    jruoho }
     97          1.1    jruoho 
     98          1.1    jruoho 
     99          1.1    jruoho /*******************************************************************************
    100          1.1    jruoho  *
    101          1.1    jruoho  * FUNCTION:    LnPackageLengthWalk
    102          1.1    jruoho  *
    103          1.1    jruoho  * PARAMETERS:  ASL_WALK_CALLBACK
    104          1.1    jruoho  *
    105          1.1    jruoho  * RETURN:      Status
    106          1.1    jruoho  *
    107          1.1    jruoho  * DESCRIPTION: Walk callback to calculate the total AML length.
    108          1.1    jruoho  *              1) Calculate the AML lengths (opcode, package length, etc.) for
    109          1.1    jruoho  *                 THIS node.
    110          1.1    jruoho  *              2) Bubbble up all of these lengths to the parent node by summing
    111          1.1    jruoho  *                 them all into the parent subtree length.
    112          1.1    jruoho  *
    113          1.1    jruoho  * Note:  The SubtreeLength represents the total AML length of all child nodes
    114      1.1.1.3  christos  *        in all subtrees under a given node. Therefore, once this walk is
    115          1.1    jruoho  *        complete, the Root Node subtree length is the AML length of the entire
    116          1.1    jruoho  *        tree (and thus, the entire ACPI table)
    117          1.1    jruoho  *
    118          1.1    jruoho  ******************************************************************************/
    119          1.1    jruoho 
    120          1.1    jruoho ACPI_STATUS
    121          1.1    jruoho LnPackageLengthWalk (
    122          1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    123          1.1    jruoho     UINT32                  Level,
    124          1.1    jruoho     void                    *Context)
    125          1.1    jruoho {
    126          1.1    jruoho 
    127          1.1    jruoho     /* Generate the AML lengths for this node */
    128          1.1    jruoho 
    129          1.1    jruoho     CgGenerateAmlLengths (Op);
    130          1.1    jruoho 
    131          1.1    jruoho     /* Bubble up all lengths (this node and all below it) to the parent */
    132          1.1    jruoho 
    133          1.1    jruoho     if ((Op->Asl.Parent) &&
    134          1.1    jruoho         (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
    135          1.1    jruoho     {
    136  1.1.1.4.2.2     skrll         Op->Asl.Parent->Asl.AmlSubtreeLength += (
    137  1.1.1.4.2.2     skrll             Op->Asl.AmlLength +
    138  1.1.1.4.2.2     skrll             Op->Asl.AmlOpcodeLength +
    139  1.1.1.4.2.2     skrll             Op->Asl.AmlPkgLenBytes +
    140  1.1.1.4.2.5     skrll             Op->Asl.AmlSubtreeLength +
    141  1.1.1.4.2.5     skrll             CvCalculateCommentLengths (Op)
    142  1.1.1.4.2.5     skrll         );
    143          1.1    jruoho     }
    144          1.1    jruoho     return (AE_OK);
    145          1.1    jruoho }
    146          1.1    jruoho 
    147          1.1    jruoho 
    148          1.1    jruoho /*******************************************************************************
    149          1.1    jruoho  *
    150          1.1    jruoho  * FUNCTION:    CgGetPackageLenByteCount
    151          1.1    jruoho  *
    152          1.1    jruoho  * PARAMETERS:  Op              - Parse node
    153          1.1    jruoho  *              PackageLength   - Length to be encoded
    154          1.1    jruoho  *
    155          1.1    jruoho  * RETURN:      Required length of the package length encoding
    156          1.1    jruoho  *
    157          1.1    jruoho  * DESCRIPTION: Calculate the number of bytes required to encode the given
    158          1.1    jruoho  *              package length.
    159          1.1    jruoho  *
    160          1.1    jruoho  ******************************************************************************/
    161          1.1    jruoho 
    162          1.1    jruoho static UINT8
    163          1.1    jruoho CgGetPackageLenByteCount (
    164          1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    165          1.1    jruoho     UINT32                  PackageLength)
    166          1.1    jruoho {
    167          1.1    jruoho 
    168          1.1    jruoho     /*
    169          1.1    jruoho      * Determine the number of bytes required to encode the package length
    170          1.1    jruoho      * Note: the package length includes the number of bytes used to encode
    171          1.1    jruoho      * the package length, so we must account for this also.
    172          1.1    jruoho      */
    173          1.1    jruoho     if (PackageLength <= (0x0000003F - 1))
    174          1.1    jruoho     {
    175          1.1    jruoho         return (1);
    176          1.1    jruoho     }
    177          1.1    jruoho     else if (PackageLength <= (0x00000FFF - 2))
    178          1.1    jruoho     {
    179          1.1    jruoho         return (2);
    180          1.1    jruoho     }
    181          1.1    jruoho     else if (PackageLength <= (0x000FFFFF - 3))
    182          1.1    jruoho     {
    183          1.1    jruoho         return (3);
    184          1.1    jruoho     }
    185          1.1    jruoho     else if (PackageLength <= (0x0FFFFFFF - 4))
    186          1.1    jruoho     {
    187          1.1    jruoho         return (4);
    188          1.1    jruoho     }
    189          1.1    jruoho     else
    190          1.1    jruoho     {
    191          1.1    jruoho         /* Fatal error - the package length is too large to encode */
    192          1.1    jruoho 
    193          1.1    jruoho         AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Op, NULL);
    194          1.1    jruoho     }
    195          1.1    jruoho 
    196          1.1    jruoho     return (0);
    197          1.1    jruoho }
    198          1.1    jruoho 
    199          1.1    jruoho 
    200          1.1    jruoho /*******************************************************************************
    201          1.1    jruoho  *
    202          1.1    jruoho  * FUNCTION:    CgGenerateAmlOpcodeLength
    203          1.1    jruoho  *
    204          1.1    jruoho  * PARAMETERS:  Op          - Parse node whose AML opcode lengths will be
    205          1.1    jruoho  *                            calculated
    206          1.1    jruoho  *
    207          1.1    jruoho  * RETURN:      None.
    208          1.1    jruoho  *
    209          1.1    jruoho  * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength
    210          1.1    jruoho  *              fields for this node.
    211          1.1    jruoho  *
    212          1.1    jruoho  ******************************************************************************/
    213          1.1    jruoho 
    214          1.1    jruoho static void
    215          1.1    jruoho CgGenerateAmlOpcodeLength (
    216          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    217          1.1    jruoho {
    218          1.1    jruoho 
    219          1.1    jruoho     /* Check for two-byte opcode */
    220          1.1    jruoho 
    221          1.1    jruoho     if (Op->Asl.AmlOpcode > 0x00FF)
    222          1.1    jruoho     {
    223          1.1    jruoho         Op->Asl.AmlOpcodeLength = 2;
    224          1.1    jruoho     }
    225          1.1    jruoho     else
    226          1.1    jruoho     {
    227          1.1    jruoho         Op->Asl.AmlOpcodeLength = 1;
    228          1.1    jruoho     }
    229          1.1    jruoho 
    230          1.1    jruoho     /* Does this opcode have an associated "PackageLength" field? */
    231          1.1    jruoho 
    232          1.1    jruoho     Op->Asl.AmlPkgLenBytes = 0;
    233          1.1    jruoho     if (Op->Asl.CompileFlags & NODE_AML_PACKAGE)
    234          1.1    jruoho     {
    235          1.1    jruoho         Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (
    236  1.1.1.4.2.2     skrll             Op, Op->Asl.AmlSubtreeLength);
    237          1.1    jruoho     }
    238          1.1    jruoho 
    239          1.1    jruoho     /* Data opcode lengths are easy */
    240          1.1    jruoho 
    241          1.1    jruoho     switch (Op->Asl.AmlOpcode)
    242          1.1    jruoho     {
    243          1.1    jruoho     case AML_BYTE_OP:
    244          1.1    jruoho 
    245          1.1    jruoho         Op->Asl.AmlLength = 1;
    246          1.1    jruoho         break;
    247          1.1    jruoho 
    248          1.1    jruoho     case AML_WORD_OP:
    249          1.1    jruoho 
    250          1.1    jruoho         Op->Asl.AmlLength = 2;
    251          1.1    jruoho         break;
    252          1.1    jruoho 
    253          1.1    jruoho     case AML_DWORD_OP:
    254          1.1    jruoho 
    255          1.1    jruoho         Op->Asl.AmlLength = 4;
    256          1.1    jruoho         break;
    257          1.1    jruoho 
    258          1.1    jruoho     case AML_QWORD_OP:
    259          1.1    jruoho 
    260          1.1    jruoho         Op->Asl.AmlLength = 8;
    261          1.1    jruoho         break;
    262          1.1    jruoho 
    263          1.1    jruoho     default:
    264      1.1.1.3  christos 
    265          1.1    jruoho         /* All data opcodes must be above */
    266          1.1    jruoho         break;
    267          1.1    jruoho     }
    268          1.1    jruoho }
    269          1.1    jruoho 
    270          1.1    jruoho 
    271          1.1    jruoho /*******************************************************************************
    272          1.1    jruoho  *
    273          1.1    jruoho  * FUNCTION:    CgGenerateAmlLengths
    274          1.1    jruoho  *
    275          1.1    jruoho  * PARAMETERS:  Op        - Parse node
    276          1.1    jruoho  *
    277          1.1    jruoho  * RETURN:      None.
    278          1.1    jruoho  *
    279          1.1    jruoho  * DESCRIPTION: Generate internal length fields based on the AML opcode or
    280          1.1    jruoho  *              parse opcode.
    281          1.1    jruoho  *
    282          1.1    jruoho  ******************************************************************************/
    283          1.1    jruoho 
    284          1.1    jruoho void
    285          1.1    jruoho CgGenerateAmlLengths (
    286          1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    287          1.1    jruoho {
    288          1.1    jruoho     char                    *Buffer;
    289          1.1    jruoho     ACPI_STATUS             Status;
    290          1.1    jruoho 
    291          1.1    jruoho 
    292          1.1    jruoho     switch (Op->Asl.AmlOpcode)
    293          1.1    jruoho     {
    294          1.1    jruoho     case AML_RAW_DATA_BYTE:
    295          1.1    jruoho 
    296          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    297          1.1    jruoho         Op->Asl.AmlLength = 1;
    298          1.1    jruoho         return;
    299          1.1    jruoho 
    300          1.1    jruoho     case AML_RAW_DATA_WORD:
    301          1.1    jruoho 
    302          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    303          1.1    jruoho         Op->Asl.AmlLength = 2;
    304          1.1    jruoho         return;
    305          1.1    jruoho 
    306          1.1    jruoho     case AML_RAW_DATA_DWORD:
    307          1.1    jruoho 
    308          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    309          1.1    jruoho         Op->Asl.AmlLength = 4;
    310          1.1    jruoho         return;
    311          1.1    jruoho 
    312          1.1    jruoho     case AML_RAW_DATA_QWORD:
    313          1.1    jruoho 
    314          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    315          1.1    jruoho         Op->Asl.AmlLength = 8;
    316          1.1    jruoho         return;
    317          1.1    jruoho 
    318          1.1    jruoho     case AML_RAW_DATA_BUFFER:
    319          1.1    jruoho 
    320          1.1    jruoho         /* Aml length is/was set by creator */
    321          1.1    jruoho 
    322          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    323          1.1    jruoho         return;
    324          1.1    jruoho 
    325          1.1    jruoho     case AML_RAW_DATA_CHAIN:
    326          1.1    jruoho 
    327          1.1    jruoho         /* Aml length is/was set by creator */
    328          1.1    jruoho 
    329          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    330          1.1    jruoho         return;
    331          1.1    jruoho 
    332          1.1    jruoho     default:
    333      1.1.1.3  christos 
    334          1.1    jruoho         break;
    335          1.1    jruoho     }
    336          1.1    jruoho 
    337          1.1    jruoho     switch (Op->Asl.ParseOpcode)
    338          1.1    jruoho     {
    339  1.1.1.4.2.2     skrll     case PARSEOP_DEFINITION_BLOCK:
    340          1.1    jruoho 
    341  1.1.1.4.2.2     skrll         Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
    342          1.1    jruoho         break;
    343          1.1    jruoho 
    344          1.1    jruoho     case PARSEOP_NAMESEG:
    345          1.1    jruoho 
    346          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    347          1.1    jruoho         Op->Asl.AmlLength = 4;
    348          1.1    jruoho         Op->Asl.ExternalName = Op->Asl.Value.String;
    349          1.1    jruoho         break;
    350          1.1    jruoho 
    351          1.1    jruoho     case PARSEOP_NAMESTRING:
    352          1.1    jruoho     case PARSEOP_METHODCALL:
    353          1.1    jruoho 
    354          1.1    jruoho         if (Op->Asl.CompileFlags & NODE_NAME_INTERNALIZED)
    355          1.1    jruoho         {
    356          1.1    jruoho             break;
    357          1.1    jruoho         }
    358          1.1    jruoho 
    359          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    360          1.1    jruoho         Status = UtInternalizeName (Op->Asl.Value.String, &Buffer);
    361          1.1    jruoho         if (ACPI_FAILURE (Status))
    362          1.1    jruoho         {
    363          1.1    jruoho             DbgPrint (ASL_DEBUG_OUTPUT,
    364          1.1    jruoho                 "Failure from internalize name %X\n", Status);
    365          1.1    jruoho             break;
    366          1.1    jruoho         }
    367          1.1    jruoho 
    368          1.1    jruoho         Op->Asl.ExternalName = Op->Asl.Value.String;
    369          1.1    jruoho         Op->Asl.Value.String = Buffer;
    370          1.1    jruoho         Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED;
    371          1.1    jruoho         Op->Asl.AmlLength = strlen (Buffer);
    372          1.1    jruoho 
    373          1.1    jruoho         /*
    374          1.1    jruoho          * Check for single backslash reference to root,
    375          1.1    jruoho          * make it a null terminated string in the AML
    376          1.1    jruoho          */
    377          1.1    jruoho         if (Op->Asl.AmlLength == 1)
    378          1.1    jruoho         {
    379          1.1    jruoho             Op->Asl.AmlLength = 2;
    380          1.1    jruoho         }
    381          1.1    jruoho         break;
    382          1.1    jruoho 
    383          1.1    jruoho     case PARSEOP_STRING_LITERAL:
    384          1.1    jruoho 
    385          1.1    jruoho         Op->Asl.AmlOpcodeLength = 1;
    386          1.1    jruoho 
    387          1.1    jruoho         /* Get null terminator */
    388          1.1    jruoho 
    389          1.1    jruoho         Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1;
    390          1.1    jruoho         break;
    391          1.1    jruoho 
    392          1.1    jruoho     case PARSEOP_PACKAGE_LENGTH:
    393          1.1    jruoho 
    394          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    395          1.1    jruoho         Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op,
    396  1.1.1.4.2.2     skrll             (UINT32) Op->Asl.Value.Integer);
    397          1.1    jruoho         break;
    398          1.1    jruoho 
    399          1.1    jruoho     case PARSEOP_RAW_DATA:
    400          1.1    jruoho 
    401          1.1    jruoho         Op->Asl.AmlOpcodeLength = 0;
    402          1.1    jruoho         break;
    403          1.1    jruoho 
    404          1.1    jruoho     case PARSEOP_DEFAULT_ARG:
    405          1.1    jruoho     case PARSEOP_INCLUDE:
    406          1.1    jruoho     case PARSEOP_INCLUDE_END:
    407          1.1    jruoho 
    408          1.1    jruoho         /* Ignore the "default arg" nodes, they are extraneous at this point */
    409          1.1    jruoho 
    410          1.1    jruoho         break;
    411          1.1    jruoho 
    412  1.1.1.4.2.3     skrll     case PARSEOP_EXTERNAL:
    413  1.1.1.4.2.3     skrll 
    414  1.1.1.4.2.3     skrll         if (Gbl_DoExternals == TRUE)
    415  1.1.1.4.2.3     skrll         {
    416  1.1.1.4.2.3     skrll             CgGenerateAmlOpcodeLength (Op);
    417  1.1.1.4.2.3     skrll         }
    418  1.1.1.4.2.3     skrll         break;
    419  1.1.1.4.2.3     skrll 
    420          1.1    jruoho     default:
    421          1.1    jruoho 
    422          1.1    jruoho         CgGenerateAmlOpcodeLength (Op);
    423          1.1    jruoho         break;
    424          1.1    jruoho     }
    425          1.1    jruoho }
    426          1.1    jruoho 
    427          1.1    jruoho 
    428          1.1    jruoho #ifdef ACPI_OBSOLETE_FUNCTIONS
    429          1.1    jruoho /*******************************************************************************
    430          1.1    jruoho  *
    431          1.1    jruoho  * FUNCTION:    LnAdjustLengthToRoot
    432          1.1    jruoho  *
    433          1.1    jruoho  * PARAMETERS:  Op      - Node whose Length was changed
    434          1.1    jruoho  *
    435          1.1    jruoho  * RETURN:      None.
    436          1.1    jruoho  *
    437          1.1    jruoho  * DESCRIPTION: Change the Subtree length of the given node, and bubble the
    438      1.1.1.3  christos  *              change all the way up to the root node. This allows for
    439          1.1    jruoho  *              last second changes to a package length (for example, if the
    440          1.1    jruoho  *              package length encoding gets shorter or longer.)
    441          1.1    jruoho  *
    442          1.1    jruoho  ******************************************************************************/
    443          1.1    jruoho 
    444          1.1    jruoho void
    445          1.1    jruoho LnAdjustLengthToRoot (
    446          1.1    jruoho     ACPI_PARSE_OBJECT       *SubtreeOp,
    447          1.1    jruoho     UINT32                  LengthDelta)
    448          1.1    jruoho {
    449          1.1    jruoho     ACPI_PARSE_OBJECT       *Op;
    450          1.1    jruoho 
    451          1.1    jruoho 
    452          1.1    jruoho     /* Adjust all subtree lengths up to the root */
    453          1.1    jruoho 
    454          1.1    jruoho     Op = SubtreeOp->Asl.Parent;
    455          1.1    jruoho     while (Op)
    456          1.1    jruoho     {
    457          1.1    jruoho         Op->Asl.AmlSubtreeLength -= LengthDelta;
    458          1.1    jruoho         Op = Op->Asl.Parent;
    459          1.1    jruoho     }
    460          1.1    jruoho 
    461          1.1    jruoho     /* Adjust the global table length */
    462          1.1    jruoho 
    463          1.1    jruoho     Gbl_TableLength -= LengthDelta;
    464          1.1    jruoho }
    465          1.1    jruoho #endif
    466