xref: /netbsd-src/sys/external/bsd/acpica/dist/compiler/asllength.c (revision 046a29855e04359424fd074e8313af6b6be8cfb6)
128c506b8Sjruoho /******************************************************************************
228c506b8Sjruoho  *
328c506b8Sjruoho  * Module Name: asllength - Tree walk to determine package and opcode lengths
428c506b8Sjruoho  *
528c506b8Sjruoho  *****************************************************************************/
628c506b8Sjruoho 
7124f4c82Sjruoho /*
8*046a2985Schristos  * Copyright (C) 2000 - 2023, Intel Corp.
928c506b8Sjruoho  * All rights reserved.
1028c506b8Sjruoho  *
11124f4c82Sjruoho  * Redistribution and use in source and binary forms, with or without
12124f4c82Sjruoho  * modification, are permitted provided that the following conditions
13124f4c82Sjruoho  * are met:
14124f4c82Sjruoho  * 1. Redistributions of source code must retain the above copyright
15124f4c82Sjruoho  *    notice, this list of conditions, and the following disclaimer,
16124f4c82Sjruoho  *    without modification.
17124f4c82Sjruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18124f4c82Sjruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
19124f4c82Sjruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
20124f4c82Sjruoho  *    including a substantially similar Disclaimer requirement for further
21124f4c82Sjruoho  *    binary redistribution.
22124f4c82Sjruoho  * 3. Neither the names of the above-listed copyright holders nor the names
23124f4c82Sjruoho  *    of any contributors may be used to endorse or promote products derived
24124f4c82Sjruoho  *    from this software without specific prior written permission.
2528c506b8Sjruoho  *
26124f4c82Sjruoho  * Alternatively, this software may be distributed under the terms of the
27124f4c82Sjruoho  * GNU General Public License ("GPL") version 2 as published by the Free
28124f4c82Sjruoho  * Software Foundation.
2928c506b8Sjruoho  *
30124f4c82Sjruoho  * NO WARRANTY
31124f4c82Sjruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32124f4c82Sjruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3346a330b4Schristos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34124f4c82Sjruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35124f4c82Sjruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36124f4c82Sjruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37124f4c82Sjruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38124f4c82Sjruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39124f4c82Sjruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40124f4c82Sjruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41124f4c82Sjruoho  * POSSIBILITY OF SUCH DAMAGES.
42124f4c82Sjruoho  */
4328c506b8Sjruoho 
4428c506b8Sjruoho #include "aslcompiler.h"
4528c506b8Sjruoho #include "aslcompiler.y.h"
4628c506b8Sjruoho #include "amlcode.h"
47835858a6Schristos #include "acconvert.h"
4828c506b8Sjruoho 
4928c506b8Sjruoho 
5028c506b8Sjruoho #define _COMPONENT          ACPI_COMPILER
5128c506b8Sjruoho         ACPI_MODULE_NAME    ("asllength")
5228c506b8Sjruoho 
5328c506b8Sjruoho /* Local prototypes */
5428c506b8Sjruoho 
5528c506b8Sjruoho static UINT8
5628c506b8Sjruoho CgGetPackageLenByteCount (
5728c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op,
5828c506b8Sjruoho     UINT32                  PackageLength);
5928c506b8Sjruoho 
6028c506b8Sjruoho static void
6128c506b8Sjruoho CgGenerateAmlOpcodeLength (
6228c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op);
6328c506b8Sjruoho 
6428c506b8Sjruoho 
6528c506b8Sjruoho #ifdef ACPI_OBSOLETE_FUNCTIONS
6628c506b8Sjruoho void
6728c506b8Sjruoho LnAdjustLengthToRoot (
6828c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op,
6928c506b8Sjruoho     UINT32                  LengthDelta);
7028c506b8Sjruoho #endif
7128c506b8Sjruoho 
7228c506b8Sjruoho 
7328c506b8Sjruoho /*******************************************************************************
7428c506b8Sjruoho  *
7528c506b8Sjruoho  * FUNCTION:    LnInitLengthsWalk
7628c506b8Sjruoho  *
7728c506b8Sjruoho  * PARAMETERS:  ASL_WALK_CALLBACK
7828c506b8Sjruoho  *
7928c506b8Sjruoho  * RETURN:      Status
8028c506b8Sjruoho  *
8128c506b8Sjruoho  * DESCRIPTION: Walk callback to initialize (and re-initialize) the node
8228c506b8Sjruoho  *              subtree length(s) to zero. The Subtree lengths are bubbled
8328c506b8Sjruoho  *              up to the root node in order to get a total AML length.
8428c506b8Sjruoho  *
8528c506b8Sjruoho  ******************************************************************************/
8628c506b8Sjruoho 
8728c506b8Sjruoho ACPI_STATUS
LnInitLengthsWalk(ACPI_PARSE_OBJECT * Op,UINT32 Level,void * Context)8828c506b8Sjruoho LnInitLengthsWalk (
8928c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op,
9028c506b8Sjruoho     UINT32                  Level,
9128c506b8Sjruoho     void                    *Context)
9228c506b8Sjruoho {
9328c506b8Sjruoho 
9428c506b8Sjruoho     Op->Asl.AmlSubtreeLength = 0;
9528c506b8Sjruoho     return (AE_OK);
9628c506b8Sjruoho }
9728c506b8Sjruoho 
9828c506b8Sjruoho 
9928c506b8Sjruoho /*******************************************************************************
10028c506b8Sjruoho  *
10128c506b8Sjruoho  * FUNCTION:    LnPackageLengthWalk
10228c506b8Sjruoho  *
10328c506b8Sjruoho  * PARAMETERS:  ASL_WALK_CALLBACK
10428c506b8Sjruoho  *
10528c506b8Sjruoho  * RETURN:      Status
10628c506b8Sjruoho  *
10728c506b8Sjruoho  * DESCRIPTION: Walk callback to calculate the total AML length.
10828c506b8Sjruoho  *              1) Calculate the AML lengths (opcode, package length, etc.) for
10928c506b8Sjruoho  *                 THIS node.
11028c506b8Sjruoho  *              2) Bubbble up all of these lengths to the parent node by summing
11128c506b8Sjruoho  *                 them all into the parent subtree length.
11228c506b8Sjruoho  *
11328c506b8Sjruoho  * Note:  The SubtreeLength represents the total AML length of all child nodes
11428c506b8Sjruoho  *        in all subtrees under a given node. Therefore, once this walk is
11528c506b8Sjruoho  *        complete, the Root Node subtree length is the AML length of the entire
11628c506b8Sjruoho  *        tree (and thus, the entire ACPI table)
11728c506b8Sjruoho  *
11828c506b8Sjruoho  ******************************************************************************/
11928c506b8Sjruoho 
12028c506b8Sjruoho ACPI_STATUS
LnPackageLengthWalk(ACPI_PARSE_OBJECT * Op,UINT32 Level,void * Context)12128c506b8Sjruoho LnPackageLengthWalk (
12228c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op,
12328c506b8Sjruoho     UINT32                  Level,
12428c506b8Sjruoho     void                    *Context)
12528c506b8Sjruoho {
12628c506b8Sjruoho 
12728c506b8Sjruoho     /* Generate the AML lengths for this node */
12828c506b8Sjruoho 
12928c506b8Sjruoho     CgGenerateAmlLengths (Op);
13028c506b8Sjruoho 
13128c506b8Sjruoho     /* Bubble up all lengths (this node and all below it) to the parent */
13228c506b8Sjruoho 
13328c506b8Sjruoho     if ((Op->Asl.Parent) &&
13428c506b8Sjruoho         (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
13528c506b8Sjruoho     {
13671e38f1dSchristos         Op->Asl.Parent->Asl.AmlSubtreeLength += (
13771e38f1dSchristos             Op->Asl.AmlLength +
13828c506b8Sjruoho             Op->Asl.AmlOpcodeLength +
13928c506b8Sjruoho             Op->Asl.AmlPkgLenBytes +
140835858a6Schristos             Op->Asl.AmlSubtreeLength +
141835858a6Schristos             CvCalculateCommentLengths (Op)
142835858a6Schristos         );
14328c506b8Sjruoho     }
14428c506b8Sjruoho     return (AE_OK);
14528c506b8Sjruoho }
14628c506b8Sjruoho 
14728c506b8Sjruoho 
14828c506b8Sjruoho /*******************************************************************************
14928c506b8Sjruoho  *
15028c506b8Sjruoho  * FUNCTION:    CgGetPackageLenByteCount
15128c506b8Sjruoho  *
15228c506b8Sjruoho  * PARAMETERS:  Op              - Parse node
15328c506b8Sjruoho  *              PackageLength   - Length to be encoded
15428c506b8Sjruoho  *
15528c506b8Sjruoho  * RETURN:      Required length of the package length encoding
15628c506b8Sjruoho  *
15728c506b8Sjruoho  * DESCRIPTION: Calculate the number of bytes required to encode the given
15828c506b8Sjruoho  *              package length.
15928c506b8Sjruoho  *
16028c506b8Sjruoho  ******************************************************************************/
16128c506b8Sjruoho 
16228c506b8Sjruoho static UINT8
CgGetPackageLenByteCount(ACPI_PARSE_OBJECT * Op,UINT32 PackageLength)16328c506b8Sjruoho CgGetPackageLenByteCount (
16428c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op,
16528c506b8Sjruoho     UINT32                  PackageLength)
16628c506b8Sjruoho {
16728c506b8Sjruoho 
16828c506b8Sjruoho     /*
16928c506b8Sjruoho      * Determine the number of bytes required to encode the package length
17028c506b8Sjruoho      * Note: the package length includes the number of bytes used to encode
17128c506b8Sjruoho      * the package length, so we must account for this also.
17228c506b8Sjruoho      */
17328c506b8Sjruoho     if (PackageLength <= (0x0000003F - 1))
17428c506b8Sjruoho     {
17528c506b8Sjruoho         return (1);
17628c506b8Sjruoho     }
17728c506b8Sjruoho     else if (PackageLength <= (0x00000FFF - 2))
17828c506b8Sjruoho     {
17928c506b8Sjruoho         return (2);
18028c506b8Sjruoho     }
18128c506b8Sjruoho     else if (PackageLength <= (0x000FFFFF - 3))
18228c506b8Sjruoho     {
18328c506b8Sjruoho         return (3);
18428c506b8Sjruoho     }
18528c506b8Sjruoho     else if (PackageLength <= (0x0FFFFFFF - 4))
18628c506b8Sjruoho     {
18728c506b8Sjruoho         return (4);
18828c506b8Sjruoho     }
18928c506b8Sjruoho     else
19028c506b8Sjruoho     {
19128c506b8Sjruoho         /* Fatal error - the package length is too large to encode */
19228c506b8Sjruoho 
19328c506b8Sjruoho         AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Op, NULL);
19428c506b8Sjruoho     }
19528c506b8Sjruoho 
19628c506b8Sjruoho     return (0);
19728c506b8Sjruoho }
19828c506b8Sjruoho 
19928c506b8Sjruoho 
20028c506b8Sjruoho /*******************************************************************************
20128c506b8Sjruoho  *
20228c506b8Sjruoho  * FUNCTION:    CgGenerateAmlOpcodeLength
20328c506b8Sjruoho  *
20428c506b8Sjruoho  * PARAMETERS:  Op          - Parse node whose AML opcode lengths will be
20528c506b8Sjruoho  *                            calculated
20628c506b8Sjruoho  *
20728c506b8Sjruoho  * RETURN:      None.
20828c506b8Sjruoho  *
20928c506b8Sjruoho  * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength
21028c506b8Sjruoho  *              fields for this node.
21128c506b8Sjruoho  *
21228c506b8Sjruoho  ******************************************************************************/
21328c506b8Sjruoho 
21428c506b8Sjruoho static void
CgGenerateAmlOpcodeLength(ACPI_PARSE_OBJECT * Op)21528c506b8Sjruoho CgGenerateAmlOpcodeLength (
21628c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op)
21728c506b8Sjruoho {
21828c506b8Sjruoho 
21928c506b8Sjruoho     /* Check for two-byte opcode */
22028c506b8Sjruoho 
22128c506b8Sjruoho     if (Op->Asl.AmlOpcode > 0x00FF)
22228c506b8Sjruoho     {
22328c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 2;
22428c506b8Sjruoho     }
22528c506b8Sjruoho     else
22628c506b8Sjruoho     {
22728c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 1;
22828c506b8Sjruoho     }
22928c506b8Sjruoho 
23028c506b8Sjruoho     /* Does this opcode have an associated "PackageLength" field? */
23128c506b8Sjruoho 
23228c506b8Sjruoho     Op->Asl.AmlPkgLenBytes = 0;
23389b8eb6cSchristos     if (Op->Asl.CompileFlags & OP_AML_PACKAGE)
23428c506b8Sjruoho     {
23528c506b8Sjruoho         Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (
23628c506b8Sjruoho             Op, Op->Asl.AmlSubtreeLength);
23728c506b8Sjruoho     }
23828c506b8Sjruoho 
23928c506b8Sjruoho     /* Data opcode lengths are easy */
24028c506b8Sjruoho 
24128c506b8Sjruoho     switch (Op->Asl.AmlOpcode)
24228c506b8Sjruoho     {
24328c506b8Sjruoho     case AML_BYTE_OP:
24428c506b8Sjruoho 
24528c506b8Sjruoho         Op->Asl.AmlLength = 1;
24628c506b8Sjruoho         break;
24728c506b8Sjruoho 
24828c506b8Sjruoho     case AML_WORD_OP:
24928c506b8Sjruoho 
25028c506b8Sjruoho         Op->Asl.AmlLength = 2;
25128c506b8Sjruoho         break;
25228c506b8Sjruoho 
25328c506b8Sjruoho     case AML_DWORD_OP:
25428c506b8Sjruoho 
25528c506b8Sjruoho         Op->Asl.AmlLength = 4;
25628c506b8Sjruoho         break;
25728c506b8Sjruoho 
25828c506b8Sjruoho     case AML_QWORD_OP:
25928c506b8Sjruoho 
26028c506b8Sjruoho         Op->Asl.AmlLength = 8;
26128c506b8Sjruoho         break;
26228c506b8Sjruoho 
26328c506b8Sjruoho     default:
264ff4a156dSchristos 
26528c506b8Sjruoho         /* All data opcodes must be above */
26628c506b8Sjruoho         break;
26728c506b8Sjruoho     }
26828c506b8Sjruoho }
26928c506b8Sjruoho 
27028c506b8Sjruoho 
27128c506b8Sjruoho /*******************************************************************************
27228c506b8Sjruoho  *
27328c506b8Sjruoho  * FUNCTION:    CgGenerateAmlLengths
27428c506b8Sjruoho  *
27528c506b8Sjruoho  * PARAMETERS:  Op        - Parse node
27628c506b8Sjruoho  *
27728c506b8Sjruoho  * RETURN:      None.
27828c506b8Sjruoho  *
27928c506b8Sjruoho  * DESCRIPTION: Generate internal length fields based on the AML opcode or
28028c506b8Sjruoho  *              parse opcode.
28128c506b8Sjruoho  *
28228c506b8Sjruoho  ******************************************************************************/
28328c506b8Sjruoho 
28428c506b8Sjruoho void
CgGenerateAmlLengths(ACPI_PARSE_OBJECT * Op)28528c506b8Sjruoho CgGenerateAmlLengths (
28628c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op)
28728c506b8Sjruoho {
28828c506b8Sjruoho     char                    *Buffer;
28928c506b8Sjruoho     ACPI_STATUS             Status;
29028c506b8Sjruoho 
29128c506b8Sjruoho 
29228c506b8Sjruoho     switch (Op->Asl.AmlOpcode)
29328c506b8Sjruoho     {
29428c506b8Sjruoho     case AML_RAW_DATA_BYTE:
29528c506b8Sjruoho 
29628c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
29728c506b8Sjruoho         Op->Asl.AmlLength = 1;
29828c506b8Sjruoho         return;
29928c506b8Sjruoho 
30028c506b8Sjruoho     case AML_RAW_DATA_WORD:
30128c506b8Sjruoho 
30228c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
30328c506b8Sjruoho         Op->Asl.AmlLength = 2;
30428c506b8Sjruoho         return;
30528c506b8Sjruoho 
30628c506b8Sjruoho     case AML_RAW_DATA_DWORD:
30728c506b8Sjruoho 
30828c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
30928c506b8Sjruoho         Op->Asl.AmlLength = 4;
31028c506b8Sjruoho         return;
31128c506b8Sjruoho 
31228c506b8Sjruoho     case AML_RAW_DATA_QWORD:
31328c506b8Sjruoho 
31428c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
31528c506b8Sjruoho         Op->Asl.AmlLength = 8;
31628c506b8Sjruoho         return;
31728c506b8Sjruoho 
31828c506b8Sjruoho     case AML_RAW_DATA_BUFFER:
31928c506b8Sjruoho 
32028c506b8Sjruoho         /* Aml length is/was set by creator */
32128c506b8Sjruoho 
32228c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
32328c506b8Sjruoho         return;
32428c506b8Sjruoho 
32528c506b8Sjruoho     case AML_RAW_DATA_CHAIN:
32628c506b8Sjruoho 
32728c506b8Sjruoho         /* Aml length is/was set by creator */
32828c506b8Sjruoho 
32928c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
33028c506b8Sjruoho         return;
33128c506b8Sjruoho 
33228c506b8Sjruoho     default:
333ff4a156dSchristos 
33428c506b8Sjruoho         break;
33528c506b8Sjruoho     }
33628c506b8Sjruoho 
33728c506b8Sjruoho     switch (Op->Asl.ParseOpcode)
33828c506b8Sjruoho     {
33971e38f1dSchristos     case PARSEOP_DEFINITION_BLOCK:
34028c506b8Sjruoho 
3414c4e8184Schristos         AslGbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
34228c506b8Sjruoho         break;
34328c506b8Sjruoho 
34428c506b8Sjruoho     case PARSEOP_NAMESEG:
34528c506b8Sjruoho 
34628c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
34728c506b8Sjruoho         Op->Asl.AmlLength = 4;
34828c506b8Sjruoho         Op->Asl.ExternalName = Op->Asl.Value.String;
34928c506b8Sjruoho         break;
35028c506b8Sjruoho 
35128c506b8Sjruoho     case PARSEOP_NAMESTRING:
35228c506b8Sjruoho     case PARSEOP_METHODCALL:
35328c506b8Sjruoho 
35489b8eb6cSchristos         if (Op->Asl.CompileFlags & OP_NAME_INTERNALIZED)
35528c506b8Sjruoho         {
35628c506b8Sjruoho             break;
35728c506b8Sjruoho         }
35828c506b8Sjruoho 
35928c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
36028c506b8Sjruoho         Status = UtInternalizeName (Op->Asl.Value.String, &Buffer);
36128c506b8Sjruoho         if (ACPI_FAILURE (Status))
36228c506b8Sjruoho         {
36328c506b8Sjruoho             DbgPrint (ASL_DEBUG_OUTPUT,
36428c506b8Sjruoho                 "Failure from internalize name %X\n", Status);
36528c506b8Sjruoho             break;
36628c506b8Sjruoho         }
36728c506b8Sjruoho 
36828c506b8Sjruoho         Op->Asl.ExternalName = Op->Asl.Value.String;
36928c506b8Sjruoho         Op->Asl.Value.String = Buffer;
37089b8eb6cSchristos         Op->Asl.CompileFlags |= OP_NAME_INTERNALIZED;
37128c506b8Sjruoho         Op->Asl.AmlLength = strlen (Buffer);
37228c506b8Sjruoho 
37328c506b8Sjruoho         /*
374783af925Schristos          * Check for single backslash reference to root or reference to a name
375783af925Schristos          * consisting of only prefix (^) characters. Make it a null terminated
376783af925Schristos          * string in the AML.
37728c506b8Sjruoho          */
378783af925Schristos         if (Op->Asl.AmlLength == 1 || UtNameContainsAllPrefix(Op))
37928c506b8Sjruoho         {
380783af925Schristos             Op->Asl.AmlLength++;
38128c506b8Sjruoho         }
38228c506b8Sjruoho         break;
38328c506b8Sjruoho 
38428c506b8Sjruoho     case PARSEOP_STRING_LITERAL:
38528c506b8Sjruoho 
38628c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 1;
38728c506b8Sjruoho 
38828c506b8Sjruoho         /* Get null terminator */
38928c506b8Sjruoho 
39028c506b8Sjruoho         Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1;
39128c506b8Sjruoho         break;
39228c506b8Sjruoho 
39328c506b8Sjruoho     case PARSEOP_PACKAGE_LENGTH:
39428c506b8Sjruoho 
39528c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
39628c506b8Sjruoho         Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op,
39728c506b8Sjruoho             (UINT32) Op->Asl.Value.Integer);
39828c506b8Sjruoho         break;
39928c506b8Sjruoho 
40028c506b8Sjruoho     case PARSEOP_RAW_DATA:
40128c506b8Sjruoho 
40228c506b8Sjruoho         Op->Asl.AmlOpcodeLength = 0;
40328c506b8Sjruoho         break;
40428c506b8Sjruoho 
40528c506b8Sjruoho     case PARSEOP_DEFAULT_ARG:
40628c506b8Sjruoho     case PARSEOP_INCLUDE:
40728c506b8Sjruoho     case PARSEOP_INCLUDE_END:
40828c506b8Sjruoho 
40928c506b8Sjruoho         /* Ignore the "default arg" nodes, they are extraneous at this point */
41028c506b8Sjruoho 
41128c506b8Sjruoho         break;
41228c506b8Sjruoho 
413cfbb7280Schristos     case PARSEOP_EXTERNAL:
414cfbb7280Schristos 
415cfbb7280Schristos         CgGenerateAmlOpcodeLength (Op);
416cfbb7280Schristos         break;
417cfbb7280Schristos 
41828c506b8Sjruoho     default:
41928c506b8Sjruoho 
42028c506b8Sjruoho         CgGenerateAmlOpcodeLength (Op);
42128c506b8Sjruoho         break;
42228c506b8Sjruoho     }
42328c506b8Sjruoho }
42428c506b8Sjruoho 
42528c506b8Sjruoho 
42628c506b8Sjruoho #ifdef ACPI_OBSOLETE_FUNCTIONS
42728c506b8Sjruoho /*******************************************************************************
42828c506b8Sjruoho  *
42928c506b8Sjruoho  * FUNCTION:    LnAdjustLengthToRoot
43028c506b8Sjruoho  *
43128c506b8Sjruoho  * PARAMETERS:  Op      - Node whose Length was changed
43228c506b8Sjruoho  *
43328c506b8Sjruoho  * RETURN:      None.
43428c506b8Sjruoho  *
43528c506b8Sjruoho  * DESCRIPTION: Change the Subtree length of the given node, and bubble the
43628c506b8Sjruoho  *              change all the way up to the root node. This allows for
43728c506b8Sjruoho  *              last second changes to a package length (for example, if the
43828c506b8Sjruoho  *              package length encoding gets shorter or longer.)
43928c506b8Sjruoho  *
44028c506b8Sjruoho  ******************************************************************************/
44128c506b8Sjruoho 
44228c506b8Sjruoho void
LnAdjustLengthToRoot(ACPI_PARSE_OBJECT * SubtreeOp,UINT32 LengthDelta)44328c506b8Sjruoho LnAdjustLengthToRoot (
44428c506b8Sjruoho     ACPI_PARSE_OBJECT       *SubtreeOp,
44528c506b8Sjruoho     UINT32                  LengthDelta)
44628c506b8Sjruoho {
44728c506b8Sjruoho     ACPI_PARSE_OBJECT       *Op;
44828c506b8Sjruoho 
44928c506b8Sjruoho 
45028c506b8Sjruoho     /* Adjust all subtree lengths up to the root */
45128c506b8Sjruoho 
45228c506b8Sjruoho     Op = SubtreeOp->Asl.Parent;
45328c506b8Sjruoho     while (Op)
45428c506b8Sjruoho     {
45528c506b8Sjruoho         Op->Asl.AmlSubtreeLength -= LengthDelta;
45628c506b8Sjruoho         Op = Op->Asl.Parent;
45728c506b8Sjruoho     }
45828c506b8Sjruoho 
45928c506b8Sjruoho     /* Adjust the global table length */
46028c506b8Sjruoho 
4614c4e8184Schristos     AslGbl_TableLength -= LengthDelta;
46228c506b8Sjruoho }
46328c506b8Sjruoho #endif
464