xref: /freebsd/sys/contrib/dev/acpica/compiler/aslexternal.c (revision 722b16673c40aedf280895f2f2f676bb494518d7)
1f8146b88SJung-uk Kim /******************************************************************************
2f8146b88SJung-uk Kim  *
3f8146b88SJung-uk Kim  * Module Name: aslexternal - ASL External opcode compiler support
4f8146b88SJung-uk Kim  *
5f8146b88SJung-uk Kim  *****************************************************************************/
6f8146b88SJung-uk Kim 
70d84335fSJung-uk Kim /******************************************************************************
80d84335fSJung-uk Kim  *
90d84335fSJung-uk Kim  * 1. Copyright Notice
100d84335fSJung-uk Kim  *
11*722b1667SJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp.
12f8146b88SJung-uk Kim  * All rights reserved.
13f8146b88SJung-uk Kim  *
140d84335fSJung-uk Kim  * 2. License
150d84335fSJung-uk Kim  *
160d84335fSJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
170d84335fSJung-uk Kim  * rights. You may have additional license terms from the party that provided
180d84335fSJung-uk Kim  * you this software, covering your right to use that party's intellectual
190d84335fSJung-uk Kim  * property rights.
200d84335fSJung-uk Kim  *
210d84335fSJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220d84335fSJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
230d84335fSJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240d84335fSJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
250d84335fSJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
260d84335fSJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
270d84335fSJung-uk Kim  *
280d84335fSJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290d84335fSJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
300d84335fSJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
310d84335fSJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
320d84335fSJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
330d84335fSJung-uk Kim  * license, and in no event shall the patent license extend to any additions
340d84335fSJung-uk Kim  * to or modifications of the Original Intel Code. No other license or right
350d84335fSJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
360d84335fSJung-uk Kim  *
370d84335fSJung-uk Kim  * The above copyright and patent license is granted only if the following
380d84335fSJung-uk Kim  * conditions are met:
390d84335fSJung-uk Kim  *
400d84335fSJung-uk Kim  * 3. Conditions
410d84335fSJung-uk Kim  *
420d84335fSJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
440d84335fSJung-uk Kim  * Code or modification with rights to further distribute source must include
450d84335fSJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
460d84335fSJung-uk Kim  * and the following Disclaimer and Export Compliance provision. In addition,
470d84335fSJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
480d84335fSJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
490d84335fSJung-uk Kim  * Code and the date of any change. Licensee must include in that file the
500d84335fSJung-uk Kim  * documentation of any changes made by any predecessor Licensee. Licensee
510d84335fSJung-uk Kim  * must include a prominent statement that the modification is derived,
520d84335fSJung-uk Kim  * directly or indirectly, from Original Intel Code.
530d84335fSJung-uk Kim  *
540d84335fSJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
560d84335fSJung-uk Kim  * Code or modification without rights to further distribute source must
570d84335fSJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
580d84335fSJung-uk Kim  * documentation and/or other materials provided with distribution. In
590d84335fSJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
600d84335fSJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
610d84335fSJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
620d84335fSJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
630d84335fSJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
640d84335fSJung-uk Kim  * make.
650d84335fSJung-uk Kim  *
660d84335fSJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
670d84335fSJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
680d84335fSJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
690d84335fSJung-uk Kim  * provision in the documentation and/or other materials provided with the
700d84335fSJung-uk Kim  * distribution.
710d84335fSJung-uk Kim  *
720d84335fSJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
730d84335fSJung-uk Kim  * Intel Code.
740d84335fSJung-uk Kim  *
750d84335fSJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760d84335fSJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
770d84335fSJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
780d84335fSJung-uk Kim  * without prior written authorization from Intel.
790d84335fSJung-uk Kim  *
800d84335fSJung-uk Kim  * 4. Disclaimer and Export Compliance
810d84335fSJung-uk Kim  *
820d84335fSJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830d84335fSJung-uk Kim  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840d84335fSJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
850d84335fSJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
860d84335fSJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
870d84335fSJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880d84335fSJung-uk Kim  * PARTICULAR PURPOSE.
890d84335fSJung-uk Kim  *
900d84335fSJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910d84335fSJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920d84335fSJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930d84335fSJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940d84335fSJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950d84335fSJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
960d84335fSJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970d84335fSJung-uk Kim  * LIMITED REMEDY.
980d84335fSJung-uk Kim  *
990d84335fSJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000d84335fSJung-uk Kim  * software or system incorporating such software without first obtaining any
1010d84335fSJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
1020d84335fSJung-uk Kim  * any other agency or department of the United States Government. In the
1030d84335fSJung-uk Kim  * event Licensee exports any such software from the United States or
1040d84335fSJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
1050d84335fSJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
1060d84335fSJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
1070d84335fSJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080d84335fSJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
1090d84335fSJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
1100d84335fSJung-uk Kim  * United States government or any agency thereof requires an export license,
1110d84335fSJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
1120d84335fSJung-uk Kim  * such license, approval or letter.
1130d84335fSJung-uk Kim  *
1140d84335fSJung-uk Kim  *****************************************************************************
1150d84335fSJung-uk Kim  *
1160d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
1170d84335fSJung-uk Kim  * following license:
1180d84335fSJung-uk Kim  *
119f8146b88SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
120f8146b88SJung-uk Kim  * modification, are permitted provided that the following conditions
121f8146b88SJung-uk Kim  * are met:
122f8146b88SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
123f8146b88SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
124f8146b88SJung-uk Kim  *    without modification.
125f8146b88SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126f8146b88SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
127f8146b88SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
128f8146b88SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
129f8146b88SJung-uk Kim  *    binary redistribution.
130f8146b88SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
131f8146b88SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
132f8146b88SJung-uk Kim  *    from this software without specific prior written permission.
133f8146b88SJung-uk Kim  *
1340d84335fSJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1350d84335fSJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1360d84335fSJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1370d84335fSJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1380d84335fSJung-uk Kim  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1390d84335fSJung-uk Kim  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1400d84335fSJung-uk Kim  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1410d84335fSJung-uk Kim  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1420d84335fSJung-uk Kim  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1430d84335fSJung-uk Kim  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1440d84335fSJung-uk Kim  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1450d84335fSJung-uk Kim  *
1460d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
147f8146b88SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
148f8146b88SJung-uk Kim  * Software Foundation.
149f8146b88SJung-uk Kim  *
1500d84335fSJung-uk Kim  *****************************************************************************/
151f8146b88SJung-uk Kim 
152f8146b88SJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h>
153f8146b88SJung-uk Kim #include "aslcompiler.y.h"
154f8146b88SJung-uk Kim #include <contrib/dev/acpica/include/acparser.h>
155f8146b88SJung-uk Kim #include <contrib/dev/acpica/include/amlcode.h>
156f8146b88SJung-uk Kim #include <contrib/dev/acpica/include/acnamesp.h>
157f8146b88SJung-uk Kim 
158f8146b88SJung-uk Kim 
159f8146b88SJung-uk Kim #define _COMPONENT          ACPI_COMPILER
160f8146b88SJung-uk Kim         ACPI_MODULE_NAME    ("aslexternal")
161f8146b88SJung-uk Kim 
162f8146b88SJung-uk Kim 
163f8146b88SJung-uk Kim /* Local prototypes */
164f8146b88SJung-uk Kim 
165f8146b88SJung-uk Kim static void
166f8146b88SJung-uk Kim ExInsertArgCount (
167f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Op);
168f8146b88SJung-uk Kim 
169f8146b88SJung-uk Kim static void
170f8146b88SJung-uk Kim ExMoveExternals (
171f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *DefinitionBlockOp);
172f8146b88SJung-uk Kim 
173f8146b88SJung-uk Kim 
174f8146b88SJung-uk Kim /*******************************************************************************
175f8146b88SJung-uk Kim  *
176f8146b88SJung-uk Kim  * FUNCTION:    ExDoExternal
177f8146b88SJung-uk Kim  *
178f8146b88SJung-uk Kim  * PARAMETERS:  Op                  - Current Parse node
179f8146b88SJung-uk Kim  *
180f8146b88SJung-uk Kim  * RETURN:      None
181f8146b88SJung-uk Kim  *
182f8146b88SJung-uk Kim  * DESCRIPTION: Add an External() definition to the global list. This list
183f8146b88SJung-uk Kim  *              is used to generate External opcodes.
184f8146b88SJung-uk Kim  *
185f8146b88SJung-uk Kim  ******************************************************************************/
186f8146b88SJung-uk Kim 
187f8146b88SJung-uk Kim void
ExDoExternal(ACPI_PARSE_OBJECT * Op)188f8146b88SJung-uk Kim ExDoExternal (
189f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Op)
190f8146b88SJung-uk Kim {
191f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *ListOp;
192f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Prev;
193f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Next;
194f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *ArgCountOp;
195ec0234b4SJung-uk Kim     ACPI_PARSE_OBJECT       *TypeOp;
196ec0234b4SJung-uk Kim     ACPI_PARSE_OBJECT       *ExternTypeOp = Op->Asl.Child->Asl.Next;
197ec0234b4SJung-uk Kim     UINT32                  ExternType;
198ec0234b4SJung-uk Kim     UINT8                   ParamCount = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS;
199ec0234b4SJung-uk Kim     UINT32                  ParamTypes[ACPI_METHOD_NUM_ARGS];
200f8146b88SJung-uk Kim 
201f8146b88SJung-uk Kim 
202ec0234b4SJung-uk Kim     ExternType = AnMapObjTypeToBtype (ExternTypeOp);
20361b18036SJung-uk Kim     if (ExternType != ACPI_BTYPE_METHOD)
20461b18036SJung-uk Kim     {
20561b18036SJung-uk Kim         /*
20661b18036SJung-uk Kim          * If this is not a method, it has zero parameters this local variable
20761b18036SJung-uk Kim          * is used only for methods
20861b18036SJung-uk Kim          */
20961b18036SJung-uk Kim         ParamCount = 0;
21061b18036SJung-uk Kim     }
211ec0234b4SJung-uk Kim 
212ec0234b4SJung-uk Kim     /*
213ec0234b4SJung-uk Kim      * The parser allows optional parameter return types regardless of the
214ec0234b4SJung-uk Kim      * type. Check object type keyword emit error if optional parameter/return
215ec0234b4SJung-uk Kim      * types exist.
216ec0234b4SJung-uk Kim      *
217ec0234b4SJung-uk Kim      * Check the parameter return type
218ec0234b4SJung-uk Kim      */
219ec0234b4SJung-uk Kim     TypeOp = ExternTypeOp->Asl.Next;
220ec0234b4SJung-uk Kim     if (TypeOp->Asl.Child)
221ec0234b4SJung-uk Kim     {
222ec0234b4SJung-uk Kim         /* Ignore the return type for now. */
223ec0234b4SJung-uk Kim 
224ec0234b4SJung-uk Kim         (void) MtProcessTypeOp (TypeOp->Asl.Child);
225ec0234b4SJung-uk Kim         if (ExternType != ACPI_BTYPE_METHOD)
226ec0234b4SJung-uk Kim         {
227ec0234b4SJung-uk Kim             sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType));
228ec0234b4SJung-uk Kim             AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_RET_TYPE, TypeOp,
229ec0234b4SJung-uk Kim                 AslGbl_MsgBuffer);
230ec0234b4SJung-uk Kim         }
231ec0234b4SJung-uk Kim     }
232ec0234b4SJung-uk Kim 
233ec0234b4SJung-uk Kim     /* Check the parameter types */
234ec0234b4SJung-uk Kim 
235ec0234b4SJung-uk Kim     TypeOp = TypeOp->Asl.Next;
236ec0234b4SJung-uk Kim     if (TypeOp->Asl.Child)
237ec0234b4SJung-uk Kim     {
238ec0234b4SJung-uk Kim         ParamCount = MtProcessParameterTypeList (TypeOp->Asl.Child, ParamTypes);
239ec0234b4SJung-uk Kim         if (ExternType != ACPI_BTYPE_METHOD)
240ec0234b4SJung-uk Kim         {
241ec0234b4SJung-uk Kim             sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType));
242ec0234b4SJung-uk Kim             AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_PARAM_TYPE, TypeOp,
243ec0234b4SJung-uk Kim                 AslGbl_MsgBuffer);
244ec0234b4SJung-uk Kim         }
245ec0234b4SJung-uk Kim     }
246ec0234b4SJung-uk Kim 
247f8146b88SJung-uk Kim     ArgCountOp = Op->Asl.Child->Asl.Next->Asl.Next;
248f8146b88SJung-uk Kim     ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
249f8146b88SJung-uk Kim     ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
250ec0234b4SJung-uk Kim     ArgCountOp->Asl.Value.Integer = ParamCount;
251f8146b88SJung-uk Kim     UtSetParseOpName (ArgCountOp);
252f8146b88SJung-uk Kim 
253f8146b88SJung-uk Kim     /* Create new list node of arbitrary type */
254f8146b88SJung-uk Kim 
2555f9b24faSJung-uk Kim     ListOp = TrAllocateOp (PARSEOP_DEFAULT_ARG);
256f8146b88SJung-uk Kim 
257f8146b88SJung-uk Kim     /* Store External node as child */
258f8146b88SJung-uk Kim 
259f8146b88SJung-uk Kim     ListOp->Asl.Child = Op;
260f8146b88SJung-uk Kim     ListOp->Asl.Next = NULL;
261f8146b88SJung-uk Kim 
2626f1f1a63SJung-uk Kim     if (AslGbl_ExternalsListHead)
263f8146b88SJung-uk Kim     {
264f8146b88SJung-uk Kim         /* Link new External to end of list */
265f8146b88SJung-uk Kim 
2666f1f1a63SJung-uk Kim         Prev = AslGbl_ExternalsListHead;
267f8146b88SJung-uk Kim         Next = Prev;
268f8146b88SJung-uk Kim         while (Next)
269f8146b88SJung-uk Kim         {
270f8146b88SJung-uk Kim             Prev = Next;
271f8146b88SJung-uk Kim             Next = Next->Asl.Next;
272f8146b88SJung-uk Kim         }
273f8146b88SJung-uk Kim 
274f8146b88SJung-uk Kim         Prev->Asl.Next = ListOp;
275f8146b88SJung-uk Kim     }
276f8146b88SJung-uk Kim     else
277f8146b88SJung-uk Kim     {
2786f1f1a63SJung-uk Kim         AslGbl_ExternalsListHead = ListOp;
279f8146b88SJung-uk Kim     }
280f8146b88SJung-uk Kim }
281f8146b88SJung-uk Kim 
282f8146b88SJung-uk Kim 
283f8146b88SJung-uk Kim /*******************************************************************************
284f8146b88SJung-uk Kim  *
285f8146b88SJung-uk Kim  * FUNCTION:    ExInsertArgCount
286f8146b88SJung-uk Kim  *
287f8146b88SJung-uk Kim  * PARAMETERS:  Op              - Op for a method invocation
288f8146b88SJung-uk Kim  *
289f8146b88SJung-uk Kim  * RETURN:      None
290f8146b88SJung-uk Kim  *
291f8146b88SJung-uk Kim  * DESCRIPTION: Obtain the number of arguments for a control method -- from
292f8146b88SJung-uk Kim  *              the actual invocation.
293f8146b88SJung-uk Kim  *
294f8146b88SJung-uk Kim  ******************************************************************************/
295f8146b88SJung-uk Kim 
296f8146b88SJung-uk Kim static void
ExInsertArgCount(ACPI_PARSE_OBJECT * Op)297f8146b88SJung-uk Kim ExInsertArgCount (
298f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Op)
299f8146b88SJung-uk Kim {
300f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Next;
301f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *NameOp;
302f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Child;
303f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *ArgCountOp;
304f8146b88SJung-uk Kim     char *                  ExternalName;
305f8146b88SJung-uk Kim     char *                  CallName;
306f8146b88SJung-uk Kim     UINT16                  ArgCount = 0;
307f8146b88SJung-uk Kim     ACPI_STATUS             Status;
308f8146b88SJung-uk Kim 
309f8146b88SJung-uk Kim 
310f8146b88SJung-uk Kim     CallName = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE);
311f8146b88SJung-uk Kim 
3126f1f1a63SJung-uk Kim     Next = AslGbl_ExternalsListHead;
313f8146b88SJung-uk Kim     while (Next)
314f8146b88SJung-uk Kim     {
315f8146b88SJung-uk Kim         ArgCount = 0;
316f8146b88SJung-uk Kim 
317f8146b88SJung-uk Kim         /* Skip if External node already handled */
318f8146b88SJung-uk Kim 
3195f9b24faSJung-uk Kim         if (Next->Asl.Child->Asl.CompileFlags & OP_VISITED)
320f8146b88SJung-uk Kim         {
321f8146b88SJung-uk Kim             Next = Next->Asl.Next;
322f8146b88SJung-uk Kim             continue;
323f8146b88SJung-uk Kim         }
324f8146b88SJung-uk Kim 
325f8146b88SJung-uk Kim         NameOp = Next->Asl.Child->Asl.Child;
326f8146b88SJung-uk Kim         ExternalName = AcpiNsGetNormalizedPathname (NameOp->Asl.Node, TRUE);
327f8146b88SJung-uk Kim 
328f8146b88SJung-uk Kim         if (strcmp (CallName, ExternalName))
329f8146b88SJung-uk Kim         {
330f8146b88SJung-uk Kim             ACPI_FREE (ExternalName);
331f8146b88SJung-uk Kim             Next = Next->Asl.Next;
332f8146b88SJung-uk Kim             continue;
333f8146b88SJung-uk Kim         }
334f8146b88SJung-uk Kim 
3355f9b24faSJung-uk Kim         Next->Asl.Child->Asl.CompileFlags |= OP_VISITED;
336f8146b88SJung-uk Kim 
337f8146b88SJung-uk Kim         /*
338f8146b88SJung-uk Kim          * Since we will reposition Externals to the Root, set Namepath
339f8146b88SJung-uk Kim          * to the fully qualified name and recalculate the aml length
340f8146b88SJung-uk Kim          */
341f8146b88SJung-uk Kim         Status = UtInternalizeName (ExternalName,
342f8146b88SJung-uk Kim             &NameOp->Asl.Value.String);
343f8146b88SJung-uk Kim 
344f8146b88SJung-uk Kim         ACPI_FREE (ExternalName);
345f8146b88SJung-uk Kim         if (ACPI_FAILURE (Status))
346f8146b88SJung-uk Kim         {
347f8146b88SJung-uk Kim             AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
348f8146b88SJung-uk Kim                 NULL, "- Could not Internalize External");
349f8146b88SJung-uk Kim             break;
350f8146b88SJung-uk Kim         }
351f8146b88SJung-uk Kim 
352f8146b88SJung-uk Kim         NameOp->Asl.AmlLength = strlen (NameOp->Asl.Value.String);
353f8146b88SJung-uk Kim 
354f8146b88SJung-uk Kim         /* Get argument count */
355f8146b88SJung-uk Kim 
356f8146b88SJung-uk Kim         Child = Op->Asl.Child;
357f8146b88SJung-uk Kim         while (Child)
358f8146b88SJung-uk Kim         {
359f8146b88SJung-uk Kim             ArgCount++;
360f8146b88SJung-uk Kim             Child = Child->Asl.Next;
361f8146b88SJung-uk Kim         }
362f8146b88SJung-uk Kim 
363f8146b88SJung-uk Kim         /* Setup ArgCount operand */
364f8146b88SJung-uk Kim 
365f8146b88SJung-uk Kim         ArgCountOp = Next->Asl.Child->Asl.Child->Asl.Next->Asl.Next;
366f8146b88SJung-uk Kim         ArgCountOp->Asl.Value.Integer = ArgCount;
367f8146b88SJung-uk Kim         break;
368f8146b88SJung-uk Kim     }
369f8146b88SJung-uk Kim 
370f8146b88SJung-uk Kim     ACPI_FREE (CallName);
371f8146b88SJung-uk Kim }
372f8146b88SJung-uk Kim 
373f8146b88SJung-uk Kim 
374f8146b88SJung-uk Kim /*******************************************************************************
375f8146b88SJung-uk Kim  *
376f8146b88SJung-uk Kim  * FUNCTION:    ExAmlExternalWalkBegin
377f8146b88SJung-uk Kim  *
378f8146b88SJung-uk Kim  * PARAMETERS:  ASL_WALK_CALLBACK
379f8146b88SJung-uk Kim  *
380f8146b88SJung-uk Kim  * RETURN:      None
381f8146b88SJung-uk Kim  *
382f8146b88SJung-uk Kim  * DESCRIPTION: Parse tree walk to create external opcode list for methods.
383f8146b88SJung-uk Kim  *
384f8146b88SJung-uk Kim  ******************************************************************************/
385f8146b88SJung-uk Kim 
386f8146b88SJung-uk Kim ACPI_STATUS
ExAmlExternalWalkBegin(ACPI_PARSE_OBJECT * Op,UINT32 Level,void * Context)387f8146b88SJung-uk Kim ExAmlExternalWalkBegin (
388f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Op,
389f8146b88SJung-uk Kim     UINT32                  Level,
390f8146b88SJung-uk Kim     void                    *Context)
391f8146b88SJung-uk Kim {
392f8146b88SJung-uk Kim 
393f8146b88SJung-uk Kim     /* External list head saved in the definition block op */
394f8146b88SJung-uk Kim 
395f8146b88SJung-uk Kim     if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)
396f8146b88SJung-uk Kim     {
3976f1f1a63SJung-uk Kim         AslGbl_ExternalsListHead = Op->Asl.Value.Arg;
398f8146b88SJung-uk Kim     }
399f8146b88SJung-uk Kim 
4006f1f1a63SJung-uk Kim     if (!AslGbl_ExternalsListHead)
401f8146b88SJung-uk Kim     {
402f8146b88SJung-uk Kim         return (AE_OK);
403f8146b88SJung-uk Kim     }
404f8146b88SJung-uk Kim 
405f8146b88SJung-uk Kim     if (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)
406f8146b88SJung-uk Kim     {
407f8146b88SJung-uk Kim         return (AE_OK);
408f8146b88SJung-uk Kim     }
409f8146b88SJung-uk Kim 
410f8146b88SJung-uk Kim     /*
411f8146b88SJung-uk Kim      * The NameOp child under an ExternalOp gets turned into PARSE_METHODCALL
412f8146b88SJung-uk Kim      * by XfNamespaceLocateBegin(). Ignore these.
413f8146b88SJung-uk Kim      */
414f8146b88SJung-uk Kim     if (Op->Asl.Parent &&
415f8146b88SJung-uk Kim         Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_EXTERNAL)
416f8146b88SJung-uk Kim     {
417f8146b88SJung-uk Kim         return (AE_OK);
418f8146b88SJung-uk Kim     }
419f8146b88SJung-uk Kim 
420f8146b88SJung-uk Kim     ExInsertArgCount (Op);
421f8146b88SJung-uk Kim     return (AE_OK);
422f8146b88SJung-uk Kim }
423f8146b88SJung-uk Kim 
424f8146b88SJung-uk Kim 
425f8146b88SJung-uk Kim /*******************************************************************************
426f8146b88SJung-uk Kim  *
427f8146b88SJung-uk Kim  * FUNCTION:    ExAmlExternalWalkEnd
428f8146b88SJung-uk Kim  *
429f8146b88SJung-uk Kim  * PARAMETERS:  ASL_WALK_CALLBACK
430f8146b88SJung-uk Kim  *
431f8146b88SJung-uk Kim  * RETURN:      None
432f8146b88SJung-uk Kim  *
433f8146b88SJung-uk Kim  * DESCRIPTION: Parse tree walk to create external opcode list for methods.
434f8146b88SJung-uk Kim  *              Here, we just want to catch the case where a definition block
435f8146b88SJung-uk Kim  *              has been completed. Then we move all of the externals into
436f8146b88SJung-uk Kim  *              a single block in the parse tree and thus the AML code.
437f8146b88SJung-uk Kim  *
438f8146b88SJung-uk Kim  ******************************************************************************/
439f8146b88SJung-uk Kim 
440f8146b88SJung-uk Kim ACPI_STATUS
ExAmlExternalWalkEnd(ACPI_PARSE_OBJECT * Op,UINT32 Level,void * Context)441f8146b88SJung-uk Kim ExAmlExternalWalkEnd (
442f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Op,
443f8146b88SJung-uk Kim     UINT32                  Level,
444f8146b88SJung-uk Kim     void                    *Context)
445f8146b88SJung-uk Kim {
446f8146b88SJung-uk Kim 
447f8146b88SJung-uk Kim     if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)
448f8146b88SJung-uk Kim     {
449f8146b88SJung-uk Kim         /*
450f8146b88SJung-uk Kim          * Process any existing external list. (Support for
451f8146b88SJung-uk Kim          * multiple definition blocks in a single file/compile)
452f8146b88SJung-uk Kim          */
453f8146b88SJung-uk Kim         ExMoveExternals (Op);
4546f1f1a63SJung-uk Kim         AslGbl_ExternalsListHead = NULL;
455f8146b88SJung-uk Kim     }
456f8146b88SJung-uk Kim 
457f8146b88SJung-uk Kim     return (AE_OK);
458f8146b88SJung-uk Kim }
459f8146b88SJung-uk Kim 
460f8146b88SJung-uk Kim 
461f8146b88SJung-uk Kim /*******************************************************************************
462f8146b88SJung-uk Kim  *
463f8146b88SJung-uk Kim  * FUNCTION:    ExMoveExternals
464f8146b88SJung-uk Kim  *
465f8146b88SJung-uk Kim  * PARAMETERS:  DefinitionBlockOp       - Op for current definition block
466f8146b88SJung-uk Kim  *
467f8146b88SJung-uk Kim  * RETURN:      None
468f8146b88SJung-uk Kim  *
469f8146b88SJung-uk Kim  * DESCRIPTION: Move all externals present in the source file into a single
470f8146b88SJung-uk Kim  *              block of AML code, surrounded by an "If (0)" to prevent
471f8146b88SJung-uk Kim  *              AML interpreters from attempting to execute the External
472f8146b88SJung-uk Kim  *              opcodes.
473f8146b88SJung-uk Kim  *
474f8146b88SJung-uk Kim  ******************************************************************************/
475f8146b88SJung-uk Kim 
476f8146b88SJung-uk Kim static void
ExMoveExternals(ACPI_PARSE_OBJECT * DefinitionBlockOp)477f8146b88SJung-uk Kim ExMoveExternals (
478f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *DefinitionBlockOp)
479f8146b88SJung-uk Kim {
480f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *ParentOp;
481f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *ExternalOp;
482f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *PredicateOp;
483f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *NextOp;
484f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Prev;
485f8146b88SJung-uk Kim     ACPI_PARSE_OBJECT       *Next;
4861cc50d6bSJung-uk Kim     char                    *ExternalName;
487f8146b88SJung-uk Kim     ACPI_OBJECT_TYPE        ObjType;
488af051161SJung-uk Kim     ACPI_STATUS             Status;
489f8146b88SJung-uk Kim     UINT32                  i;
490f8146b88SJung-uk Kim 
491f8146b88SJung-uk Kim 
4926f1f1a63SJung-uk Kim     if (!AslGbl_ExternalsListHead)
493f8146b88SJung-uk Kim     {
494f8146b88SJung-uk Kim         return;
495f8146b88SJung-uk Kim     }
496f8146b88SJung-uk Kim 
497f8146b88SJung-uk Kim     /* Remove the External nodes from the tree */
498f8146b88SJung-uk Kim 
4996f1f1a63SJung-uk Kim     NextOp = AslGbl_ExternalsListHead;
500f8146b88SJung-uk Kim     while (NextOp)
501f8146b88SJung-uk Kim     {
502f8146b88SJung-uk Kim         /*
503f8146b88SJung-uk Kim          * The External is stored in child pointer of each node in the
504f8146b88SJung-uk Kim          * list
505f8146b88SJung-uk Kim          */
506f8146b88SJung-uk Kim         ExternalOp = NextOp->Asl.Child;
507f8146b88SJung-uk Kim 
5081cc50d6bSJung-uk Kim         /* Get/set the fully qualified name */
5091cc50d6bSJung-uk Kim 
5101cc50d6bSJung-uk Kim         ExternalName = AcpiNsGetNormalizedPathname (ExternalOp->Asl.Node, TRUE);
5111cc50d6bSJung-uk Kim         ExternalOp->Asl.ExternalName = ExternalName;
5121cc50d6bSJung-uk Kim         ExternalOp->Asl.Namepath = ExternalName;
5131cc50d6bSJung-uk Kim 
514f8146b88SJung-uk Kim         /* Set line numbers (for listings, etc.) */
515f8146b88SJung-uk Kim 
516f8146b88SJung-uk Kim         ExternalOp->Asl.LineNumber = 0;
517f8146b88SJung-uk Kim         ExternalOp->Asl.LogicalLineNumber = 0;
518f8146b88SJung-uk Kim 
519f8146b88SJung-uk Kim         Next = ExternalOp->Asl.Child;
520f8146b88SJung-uk Kim         Next->Asl.LineNumber = 0;
521f8146b88SJung-uk Kim         Next->Asl.LogicalLineNumber = 0;
522f8146b88SJung-uk Kim 
5231cc50d6bSJung-uk Kim         if (Next->Asl.ParseOpcode == PARSEOP_NAMESEG)
5241cc50d6bSJung-uk Kim         {
5251cc50d6bSJung-uk Kim             Next->Asl.ParseOpcode = PARSEOP_NAMESTRING;
5261cc50d6bSJung-uk Kim         }
527af051161SJung-uk Kim 
5281cc50d6bSJung-uk Kim         Next->Asl.ExternalName = ExternalName;
529af051161SJung-uk Kim         Status = UtInternalizeName (ExternalName, &Next->Asl.Value.String);
530af051161SJung-uk Kim         if (ACPI_FAILURE (Status))
531af051161SJung-uk Kim         {
532af051161SJung-uk Kim             AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
533af051161SJung-uk Kim                 Next, "Could not internalize namestring");
534af051161SJung-uk Kim             return;
535af051161SJung-uk Kim         }
536af051161SJung-uk Kim 
5371cc50d6bSJung-uk Kim         Next->Asl.AmlLength = strlen (Next->Asl.Value.String);
5381cc50d6bSJung-uk Kim 
539f8146b88SJung-uk Kim         Next = Next->Asl.Next;
540f8146b88SJung-uk Kim         Next->Asl.LineNumber = 0;
541f8146b88SJung-uk Kim         Next->Asl.LogicalLineNumber = 0;
542f8146b88SJung-uk Kim 
543f8146b88SJung-uk Kim         Next = Next->Asl.Next;
544f8146b88SJung-uk Kim         Next->Asl.LineNumber = 0;
545f8146b88SJung-uk Kim         Next->Asl.LogicalLineNumber = 0;
546f8146b88SJung-uk Kim 
547f8146b88SJung-uk Kim         Next = Next->Asl.Next;
548f8146b88SJung-uk Kim         Next->Asl.LineNumber = 0;
549f8146b88SJung-uk Kim         Next->Asl.LogicalLineNumber = 0;
550f8146b88SJung-uk Kim 
551f8146b88SJung-uk Kim         ParentOp = ExternalOp->Asl.Parent;
552f8146b88SJung-uk Kim         Prev = Next = ParentOp->Asl.Child;
553f8146b88SJung-uk Kim 
554f8146b88SJung-uk Kim         /* Now find the External node's position in parse tree */
555f8146b88SJung-uk Kim 
556f8146b88SJung-uk Kim         while (Next != ExternalOp)
557f8146b88SJung-uk Kim         {
558f8146b88SJung-uk Kim             Prev = Next;
559f8146b88SJung-uk Kim             Next = Next->Asl.Next;
560f8146b88SJung-uk Kim         }
561f8146b88SJung-uk Kim 
562f8146b88SJung-uk Kim         /* Remove the External from the parse tree */
563f8146b88SJung-uk Kim 
564f8146b88SJung-uk Kim         if (Prev == ExternalOp)
565f8146b88SJung-uk Kim         {
566f8146b88SJung-uk Kim             /* External was the first child node */
567f8146b88SJung-uk Kim 
568f8146b88SJung-uk Kim             ParentOp->Asl.Child = ExternalOp->Asl.Next;
569f8146b88SJung-uk Kim         }
570f8146b88SJung-uk Kim 
571f8146b88SJung-uk Kim         Prev->Asl.Next = ExternalOp->Asl.Next;
572f8146b88SJung-uk Kim         ExternalOp->Asl.Next = NULL;
5736f1f1a63SJung-uk Kim         ExternalOp->Asl.Parent = AslGbl_ExternalsListHead;
574f8146b88SJung-uk Kim 
575f8146b88SJung-uk Kim         /* Point the External to the next in the list */
576f8146b88SJung-uk Kim 
577f8146b88SJung-uk Kim         if (NextOp->Asl.Next)
578f8146b88SJung-uk Kim         {
579f8146b88SJung-uk Kim             ExternalOp->Asl.Next = NextOp->Asl.Next->Asl.Child;
580f8146b88SJung-uk Kim         }
581f8146b88SJung-uk Kim 
582f8146b88SJung-uk Kim         NextOp = NextOp->Asl.Next;
583f8146b88SJung-uk Kim     }
584f8146b88SJung-uk Kim 
585f8146b88SJung-uk Kim     /*
586f8146b88SJung-uk Kim      * Loop again to remove MethodObj Externals for which
587f8146b88SJung-uk Kim      * a MethodCall was not found (dead external reference)
588f8146b88SJung-uk Kim      */
5896f1f1a63SJung-uk Kim     Prev = AslGbl_ExternalsListHead->Asl.Child;
590f8146b88SJung-uk Kim     Next = Prev;
591f8146b88SJung-uk Kim     while (Next)
592f8146b88SJung-uk Kim     {
593f8146b88SJung-uk Kim         ObjType = (ACPI_OBJECT_TYPE)
594f8146b88SJung-uk Kim             Next->Asl.Child->Asl.Next->Asl.Value.Integer;
595f8146b88SJung-uk Kim 
596f8146b88SJung-uk Kim         if (ObjType == ACPI_TYPE_METHOD &&
5975f9b24faSJung-uk Kim             !(Next->Asl.CompileFlags & OP_VISITED))
598f8146b88SJung-uk Kim         {
599f8146b88SJung-uk Kim             if (Next == Prev)
600f8146b88SJung-uk Kim             {
6016f1f1a63SJung-uk Kim                 AslGbl_ExternalsListHead->Asl.Child = Next->Asl.Next;
602f8146b88SJung-uk Kim                 Next->Asl.Next = NULL;
6036f1f1a63SJung-uk Kim                 Prev = AslGbl_ExternalsListHead->Asl.Child;
604f8146b88SJung-uk Kim                 Next = Prev;
605f8146b88SJung-uk Kim                 continue;
606f8146b88SJung-uk Kim             }
607f8146b88SJung-uk Kim             else
608f8146b88SJung-uk Kim             {
609f8146b88SJung-uk Kim                 Prev->Asl.Next = Next->Asl.Next;
610f8146b88SJung-uk Kim                 Next->Asl.Next = NULL;
611f8146b88SJung-uk Kim                 Next = Prev->Asl.Next;
612f8146b88SJung-uk Kim                 continue;
613f8146b88SJung-uk Kim             }
614f8146b88SJung-uk Kim         }
615f8146b88SJung-uk Kim 
616f8146b88SJung-uk Kim         Prev = Next;
617f8146b88SJung-uk Kim         Next = Next->Asl.Next;
618f8146b88SJung-uk Kim     }
619f8146b88SJung-uk Kim 
620f8146b88SJung-uk Kim     /* If list is now empty, don't bother to make If (0) block */
621f8146b88SJung-uk Kim 
6226f1f1a63SJung-uk Kim     if (!AslGbl_ExternalsListHead->Asl.Child)
623f8146b88SJung-uk Kim     {
624f8146b88SJung-uk Kim         return;
625f8146b88SJung-uk Kim     }
626f8146b88SJung-uk Kim 
627f8146b88SJung-uk Kim     /* Convert Gbl_ExternalsListHead parent to If(). */
628f8146b88SJung-uk Kim 
6296f1f1a63SJung-uk Kim     AslGbl_ExternalsListHead->Asl.ParseOpcode = PARSEOP_IF;
6306f1f1a63SJung-uk Kim     AslGbl_ExternalsListHead->Asl.AmlOpcode = AML_IF_OP;
6316f1f1a63SJung-uk Kim     AslGbl_ExternalsListHead->Asl.CompileFlags = OP_AML_PACKAGE;
6326f1f1a63SJung-uk Kim     UtSetParseOpName (AslGbl_ExternalsListHead);
633f8146b88SJung-uk Kim 
634f8146b88SJung-uk Kim     /* Create a Zero op for the If predicate */
635f8146b88SJung-uk Kim 
6365f9b24faSJung-uk Kim     PredicateOp = TrAllocateOp (PARSEOP_ZERO);
637f8146b88SJung-uk Kim     PredicateOp->Asl.AmlOpcode = AML_ZERO_OP;
638f8146b88SJung-uk Kim 
6396f1f1a63SJung-uk Kim     PredicateOp->Asl.Parent = AslGbl_ExternalsListHead;
640f8146b88SJung-uk Kim     PredicateOp->Asl.Child = NULL;
6416f1f1a63SJung-uk Kim     PredicateOp->Asl.Next = AslGbl_ExternalsListHead->Asl.Child;
6426f1f1a63SJung-uk Kim     AslGbl_ExternalsListHead->Asl.Child = PredicateOp;
643f8146b88SJung-uk Kim 
644f8146b88SJung-uk Kim     /* Set line numbers (for listings, etc.) */
645f8146b88SJung-uk Kim 
6466f1f1a63SJung-uk Kim     AslGbl_ExternalsListHead->Asl.LineNumber = 0;
6476f1f1a63SJung-uk Kim     AslGbl_ExternalsListHead->Asl.LogicalLineNumber = 0;
648f8146b88SJung-uk Kim 
649f8146b88SJung-uk Kim     PredicateOp->Asl.LineNumber = 0;
650f8146b88SJung-uk Kim     PredicateOp->Asl.LogicalLineNumber = 0;
651f8146b88SJung-uk Kim 
652f8146b88SJung-uk Kim     /* Insert block back in the list */
653f8146b88SJung-uk Kim 
654f8146b88SJung-uk Kim     Prev = DefinitionBlockOp->Asl.Child;
655f8146b88SJung-uk Kim     Next = Prev;
656f8146b88SJung-uk Kim 
657f8146b88SJung-uk Kim     /* Find last default arg */
658f8146b88SJung-uk Kim 
659f8146b88SJung-uk Kim     for (i = 0; i < 6; i++)
660f8146b88SJung-uk Kim     {
661f8146b88SJung-uk Kim         Prev = Next;
662f8146b88SJung-uk Kim         Next = Prev->Asl.Next;
663f8146b88SJung-uk Kim     }
664f8146b88SJung-uk Kim 
665f8146b88SJung-uk Kim     if (Next)
666f8146b88SJung-uk Kim     {
667f8146b88SJung-uk Kim         /* Definition Block is not empty */
668f8146b88SJung-uk Kim 
6696f1f1a63SJung-uk Kim         AslGbl_ExternalsListHead->Asl.Next = Next;
670f8146b88SJung-uk Kim     }
671f8146b88SJung-uk Kim     else
672f8146b88SJung-uk Kim     {
673f8146b88SJung-uk Kim         /* Definition Block is empty. */
674f8146b88SJung-uk Kim 
6756f1f1a63SJung-uk Kim         AslGbl_ExternalsListHead->Asl.Next = NULL;
676f8146b88SJung-uk Kim     }
677f8146b88SJung-uk Kim 
6786f1f1a63SJung-uk Kim     Prev->Asl.Next = AslGbl_ExternalsListHead;
6796f1f1a63SJung-uk Kim     AslGbl_ExternalsListHead->Asl.Parent = Prev->Asl.Parent;
680f8146b88SJung-uk Kim }
681