1a159c266SJung-uk Kim /******************************************************************************
2a159c266SJung-uk Kim *
3a159c266SJung-uk Kim * Module Name: dswload - Dispatcher first pass namespace load callbacks
4a159c266SJung-uk Kim *
5a159c266SJung-uk Kim *****************************************************************************/
6a159c266SJung-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.
12a159c266SJung-uk Kim * All rights reserved.
13a159c266SJung-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 *
119a159c266SJung-uk Kim * Redistribution and use in source and binary forms, with or without
120a159c266SJung-uk Kim * modification, are permitted provided that the following conditions
121a159c266SJung-uk Kim * are met:
122a159c266SJung-uk Kim * 1. Redistributions of source code must retain the above copyright
123a159c266SJung-uk Kim * notice, this list of conditions, and the following disclaimer,
124a159c266SJung-uk Kim * without modification.
125a159c266SJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126a159c266SJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below
127a159c266SJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon
128a159c266SJung-uk Kim * including a substantially similar Disclaimer requirement for further
129a159c266SJung-uk Kim * binary redistribution.
130a159c266SJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names
131a159c266SJung-uk Kim * of any contributors may be used to endorse or promote products derived
132a159c266SJung-uk Kim * from this software without specific prior written permission.
133a159c266SJung-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
147a159c266SJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free
148a159c266SJung-uk Kim * Software Foundation.
149a159c266SJung-uk Kim *
1500d84335fSJung-uk Kim *****************************************************************************/
151a159c266SJung-uk Kim
152a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
153a159c266SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
154a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acparser.h>
155a159c266SJung-uk Kim #include <contrib/dev/acpica/include/amlcode.h>
156a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acdispat.h>
157a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acinterp.h>
158a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acnamesp.h>
159a159c266SJung-uk Kim #ifdef ACPI_ASL_COMPILER
160a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h>
161a159c266SJung-uk Kim #endif
162a159c266SJung-uk Kim
163a159c266SJung-uk Kim #define _COMPONENT ACPI_DISPATCHER
164a159c266SJung-uk Kim ACPI_MODULE_NAME ("dswload")
165a159c266SJung-uk Kim
166a159c266SJung-uk Kim
167a159c266SJung-uk Kim /*******************************************************************************
168a159c266SJung-uk Kim *
169a159c266SJung-uk Kim * FUNCTION: AcpiDsInitCallbacks
170a159c266SJung-uk Kim *
171a159c266SJung-uk Kim * PARAMETERS: WalkState - Current state of the parse tree walk
172a159c266SJung-uk Kim * PassNumber - 1, 2, or 3
173a159c266SJung-uk Kim *
174a159c266SJung-uk Kim * RETURN: Status
175a159c266SJung-uk Kim *
176a159c266SJung-uk Kim * DESCRIPTION: Init walk state callbacks
177a159c266SJung-uk Kim *
178a159c266SJung-uk Kim ******************************************************************************/
179a159c266SJung-uk Kim
180a159c266SJung-uk Kim ACPI_STATUS
AcpiDsInitCallbacks(ACPI_WALK_STATE * WalkState,UINT32 PassNumber)181a159c266SJung-uk Kim AcpiDsInitCallbacks (
182a159c266SJung-uk Kim ACPI_WALK_STATE *WalkState,
183a159c266SJung-uk Kim UINT32 PassNumber)
184a159c266SJung-uk Kim {
185a159c266SJung-uk Kim
186a159c266SJung-uk Kim switch (PassNumber)
187a159c266SJung-uk Kim {
188313a0c13SJung-uk Kim case 0:
189313a0c13SJung-uk Kim
190313a0c13SJung-uk Kim /* Parse only - caller will setup callbacks */
191313a0c13SJung-uk Kim
192313a0c13SJung-uk Kim WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
193313a0c13SJung-uk Kim ACPI_PARSE_DELETE_TREE |
194313a0c13SJung-uk Kim ACPI_PARSE_DISASSEMBLE;
195313a0c13SJung-uk Kim WalkState->DescendingCallback = NULL;
196313a0c13SJung-uk Kim WalkState->AscendingCallback = NULL;
197313a0c13SJung-uk Kim break;
198313a0c13SJung-uk Kim
199a159c266SJung-uk Kim case 1:
200a9d8d09cSJung-uk Kim
201313a0c13SJung-uk Kim /* Load pass 1 */
202313a0c13SJung-uk Kim
203a159c266SJung-uk Kim WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
204a159c266SJung-uk Kim ACPI_PARSE_DELETE_TREE;
205a159c266SJung-uk Kim WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
206a159c266SJung-uk Kim WalkState->AscendingCallback = AcpiDsLoad1EndOp;
207a159c266SJung-uk Kim break;
208a159c266SJung-uk Kim
209a159c266SJung-uk Kim case 2:
210a9d8d09cSJung-uk Kim
211313a0c13SJung-uk Kim /* Load pass 2 */
212313a0c13SJung-uk Kim
213a159c266SJung-uk Kim WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
214a159c266SJung-uk Kim ACPI_PARSE_DELETE_TREE;
215a159c266SJung-uk Kim WalkState->DescendingCallback = AcpiDsLoad2BeginOp;
216a159c266SJung-uk Kim WalkState->AscendingCallback = AcpiDsLoad2EndOp;
217a159c266SJung-uk Kim break;
218a159c266SJung-uk Kim
219a159c266SJung-uk Kim case 3:
220a9d8d09cSJung-uk Kim
221313a0c13SJung-uk Kim /* Execution pass */
222313a0c13SJung-uk Kim
223a159c266SJung-uk Kim WalkState->ParseFlags |= ACPI_PARSE_EXECUTE |
224a159c266SJung-uk Kim ACPI_PARSE_DELETE_TREE;
225a159c266SJung-uk Kim WalkState->DescendingCallback = AcpiDsExecBeginOp;
226a159c266SJung-uk Kim WalkState->AscendingCallback = AcpiDsExecEndOp;
227a159c266SJung-uk Kim break;
228a159c266SJung-uk Kim
229a159c266SJung-uk Kim default:
230a9d8d09cSJung-uk Kim
231a159c266SJung-uk Kim return (AE_BAD_PARAMETER);
232a159c266SJung-uk Kim }
233a159c266SJung-uk Kim
234a159c266SJung-uk Kim return (AE_OK);
235a159c266SJung-uk Kim }
236a159c266SJung-uk Kim
237a159c266SJung-uk Kim
238a159c266SJung-uk Kim /*******************************************************************************
239a159c266SJung-uk Kim *
240a159c266SJung-uk Kim * FUNCTION: AcpiDsLoad1BeginOp
241a159c266SJung-uk Kim *
242a159c266SJung-uk Kim * PARAMETERS: WalkState - Current state of the parse tree walk
243a159c266SJung-uk Kim * OutOp - Where to return op if a new one is created
244a159c266SJung-uk Kim *
245a159c266SJung-uk Kim * RETURN: Status
246a159c266SJung-uk Kim *
247a159c266SJung-uk Kim * DESCRIPTION: Descending callback used during the loading of ACPI tables.
248a159c266SJung-uk Kim *
249a159c266SJung-uk Kim ******************************************************************************/
250a159c266SJung-uk Kim
251a159c266SJung-uk Kim ACPI_STATUS
AcpiDsLoad1BeginOp(ACPI_WALK_STATE * WalkState,ACPI_PARSE_OBJECT ** OutOp)252a159c266SJung-uk Kim AcpiDsLoad1BeginOp (
253a159c266SJung-uk Kim ACPI_WALK_STATE *WalkState,
254a159c266SJung-uk Kim ACPI_PARSE_OBJECT **OutOp)
255a159c266SJung-uk Kim {
256a159c266SJung-uk Kim ACPI_PARSE_OBJECT *Op;
257a159c266SJung-uk Kim ACPI_NAMESPACE_NODE *Node;
258a159c266SJung-uk Kim ACPI_STATUS Status;
259a159c266SJung-uk Kim ACPI_OBJECT_TYPE ObjectType;
260a159c266SJung-uk Kim char *Path;
261a159c266SJung-uk Kim UINT32 Flags;
262a159c266SJung-uk Kim
263a159c266SJung-uk Kim
264ff879b07SJung-uk Kim ACPI_FUNCTION_TRACE_PTR (DsLoad1BeginOp, WalkState->Op);
265a159c266SJung-uk Kim
266a159c266SJung-uk Kim
267a159c266SJung-uk Kim Op = WalkState->Op;
268a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
269a159c266SJung-uk Kim
270a159c266SJung-uk Kim /* We are only interested in opcodes that have an associated name */
271a159c266SJung-uk Kim
272a159c266SJung-uk Kim if (Op)
273a159c266SJung-uk Kim {
274a159c266SJung-uk Kim if (!(WalkState->OpInfo->Flags & AML_NAMED))
275a159c266SJung-uk Kim {
276a159c266SJung-uk Kim *OutOp = Op;
277a159c266SJung-uk Kim return_ACPI_STATUS (AE_OK);
278a159c266SJung-uk Kim }
279a159c266SJung-uk Kim
280a159c266SJung-uk Kim /* Check if this object has already been installed in the namespace */
281a159c266SJung-uk Kim
282a159c266SJung-uk Kim if (Op->Common.Node)
283a159c266SJung-uk Kim {
284a159c266SJung-uk Kim *OutOp = Op;
285a159c266SJung-uk Kim return_ACPI_STATUS (AE_OK);
286a159c266SJung-uk Kim }
287a159c266SJung-uk Kim }
288a159c266SJung-uk Kim
289a159c266SJung-uk Kim Path = AcpiPsGetNextNamestring (&WalkState->ParserState);
290a159c266SJung-uk Kim
291a159c266SJung-uk Kim /* Map the raw opcode into an internal object type */
292a159c266SJung-uk Kim
293a159c266SJung-uk Kim ObjectType = WalkState->OpInfo->ObjectType;
294a159c266SJung-uk Kim
295a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
296f8146b88SJung-uk Kim "State=%p Op=%p [%s]\n", WalkState, Op,
297f8146b88SJung-uk Kim AcpiUtGetTypeName (ObjectType)));
298a159c266SJung-uk Kim
299a159c266SJung-uk Kim switch (WalkState->Opcode)
300a159c266SJung-uk Kim {
301a159c266SJung-uk Kim case AML_SCOPE_OP:
302a159c266SJung-uk Kim /*
303a159c266SJung-uk Kim * The target name of the Scope() operator must exist at this point so
304a159c266SJung-uk Kim * that we can actually open the scope to enter new names underneath it.
305a159c266SJung-uk Kim * Allow search-to-root for single namesegs.
306a159c266SJung-uk Kim */
307a159c266SJung-uk Kim Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
308a159c266SJung-uk Kim ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
309a159c266SJung-uk Kim #ifdef ACPI_ASL_COMPILER
310a159c266SJung-uk Kim if (Status == AE_NOT_FOUND)
311a159c266SJung-uk Kim {
312a159c266SJung-uk Kim /*
313a159c266SJung-uk Kim * Table disassembly:
314a159c266SJung-uk Kim * Target of Scope() not found. Generate an External for it, and
315a159c266SJung-uk Kim * insert the name into the namespace.
316a159c266SJung-uk Kim */
317313a0c13SJung-uk Kim AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0, 0);
318a159c266SJung-uk Kim Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
319a159c266SJung-uk Kim ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
320a159c266SJung-uk Kim WalkState, &Node);
321a159c266SJung-uk Kim }
322a159c266SJung-uk Kim #endif
323a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
324a159c266SJung-uk Kim {
325b7b7e711SJung-uk Kim ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status);
326a159c266SJung-uk Kim return_ACPI_STATUS (Status);
327a159c266SJung-uk Kim }
328a159c266SJung-uk Kim
329a159c266SJung-uk Kim /*
330a159c266SJung-uk Kim * Check to make sure that the target is
331a159c266SJung-uk Kim * one of the opcodes that actually opens a scope
332a159c266SJung-uk Kim */
333a159c266SJung-uk Kim switch (Node->Type)
334a159c266SJung-uk Kim {
335a159c266SJung-uk Kim case ACPI_TYPE_ANY:
336a159c266SJung-uk Kim case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
337a159c266SJung-uk Kim case ACPI_TYPE_DEVICE:
338a159c266SJung-uk Kim case ACPI_TYPE_POWER:
339a159c266SJung-uk Kim case ACPI_TYPE_PROCESSOR:
340a159c266SJung-uk Kim case ACPI_TYPE_THERMAL:
341a159c266SJung-uk Kim
342a159c266SJung-uk Kim /* These are acceptable types */
343a159c266SJung-uk Kim break;
344a159c266SJung-uk Kim
345a159c266SJung-uk Kim case ACPI_TYPE_INTEGER:
346a159c266SJung-uk Kim case ACPI_TYPE_STRING:
347a159c266SJung-uk Kim case ACPI_TYPE_BUFFER:
348a159c266SJung-uk Kim /*
349a159c266SJung-uk Kim * These types we will allow, but we will change the type.
350a159c266SJung-uk Kim * This enables some existing code of the form:
351a159c266SJung-uk Kim *
352a159c266SJung-uk Kim * Name (DEB, 0)
353a159c266SJung-uk Kim * Scope (DEB) { ... }
354a159c266SJung-uk Kim *
355a159c266SJung-uk Kim * Note: silently change the type here. On the second pass,
356a159c266SJung-uk Kim * we will report a warning
357a159c266SJung-uk Kim */
358a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
359a159c266SJung-uk Kim "Type override - [%4.4s] had invalid type (%s) "
360a159c266SJung-uk Kim "for Scope operator, changed to type ANY\n",
361a159c266SJung-uk Kim AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
362a159c266SJung-uk Kim
363a159c266SJung-uk Kim Node->Type = ACPI_TYPE_ANY;
364a159c266SJung-uk Kim WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
365a159c266SJung-uk Kim break;
366a159c266SJung-uk Kim
3671df130f1SJung-uk Kim case ACPI_TYPE_METHOD:
3681df130f1SJung-uk Kim /*
3691df130f1SJung-uk Kim * Allow scope change to root during execution of module-level
3701df130f1SJung-uk Kim * code. Root is typed METHOD during this time.
3711df130f1SJung-uk Kim */
3721df130f1SJung-uk Kim if ((Node == AcpiGbl_RootNode) &&
3731df130f1SJung-uk Kim (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
3741df130f1SJung-uk Kim {
3751df130f1SJung-uk Kim break;
3761df130f1SJung-uk Kim }
3771df130f1SJung-uk Kim
378385fb5d9SJung-uk Kim ACPI_FALLTHROUGH;
3791df130f1SJung-uk Kim
380a159c266SJung-uk Kim default:
381a159c266SJung-uk Kim
382a159c266SJung-uk Kim /* All other types are an error */
383a159c266SJung-uk Kim
384a159c266SJung-uk Kim ACPI_ERROR ((AE_INFO,
385a159c266SJung-uk Kim "Invalid type (%s) for target of "
386a159c266SJung-uk Kim "Scope operator [%4.4s] (Cannot override)",
387a159c266SJung-uk Kim AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
388a159c266SJung-uk Kim
389a159c266SJung-uk Kim return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
390a159c266SJung-uk Kim }
391a159c266SJung-uk Kim break;
392a159c266SJung-uk Kim
393a159c266SJung-uk Kim default:
394a159c266SJung-uk Kim /*
395a159c266SJung-uk Kim * For all other named opcodes, we will enter the name into
396a159c266SJung-uk Kim * the namespace.
397a159c266SJung-uk Kim *
398a159c266SJung-uk Kim * Setup the search flags.
399a159c266SJung-uk Kim * Since we are entering a name into the namespace, we do not want to
400a159c266SJung-uk Kim * enable the search-to-root upsearch.
401a159c266SJung-uk Kim *
402a159c266SJung-uk Kim * There are only two conditions where it is acceptable that the name
403a159c266SJung-uk Kim * already exists:
404a159c266SJung-uk Kim * 1) the Scope() operator can reopen a scoping object that was
405a159c266SJung-uk Kim * previously defined (Scope, Method, Device, etc.)
406a159c266SJung-uk Kim * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer,
407a159c266SJung-uk Kim * BufferField, or Package), the name of the object is already
408a159c266SJung-uk Kim * in the namespace.
409a159c266SJung-uk Kim */
410a159c266SJung-uk Kim if (WalkState->DeferredNode)
411a159c266SJung-uk Kim {
412a159c266SJung-uk Kim /* This name is already in the namespace, get the node */
413a159c266SJung-uk Kim
414a159c266SJung-uk Kim Node = WalkState->DeferredNode;
415a159c266SJung-uk Kim Status = AE_OK;
416a159c266SJung-uk Kim break;
417a159c266SJung-uk Kim }
418a159c266SJung-uk Kim
419a159c266SJung-uk Kim /*
420a159c266SJung-uk Kim * If we are executing a method, do not create any namespace objects
421a159c266SJung-uk Kim * during the load phase, only during execution.
422a159c266SJung-uk Kim */
423a159c266SJung-uk Kim if (WalkState->MethodNode)
424a159c266SJung-uk Kim {
425a159c266SJung-uk Kim Node = NULL;
426a159c266SJung-uk Kim Status = AE_OK;
427a159c266SJung-uk Kim break;
428a159c266SJung-uk Kim }
429a159c266SJung-uk Kim
430a159c266SJung-uk Kim Flags = ACPI_NS_NO_UPSEARCH;
431a159c266SJung-uk Kim if ((WalkState->Opcode != AML_SCOPE_OP) &&
432a159c266SJung-uk Kim (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)))
433a159c266SJung-uk Kim {
4345ef50723SJung-uk Kim if (WalkState->NamespaceOverride)
4355ef50723SJung-uk Kim {
4365ef50723SJung-uk Kim Flags |= ACPI_NS_OVERRIDE_IF_FOUND;
4375ef50723SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed\n",
4385ef50723SJung-uk Kim AcpiUtGetTypeName (ObjectType)));
4395ef50723SJung-uk Kim }
4405ef50723SJung-uk Kim else
4415ef50723SJung-uk Kim {
442a159c266SJung-uk Kim Flags |= ACPI_NS_ERROR_IF_FOUND;
443a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
444a159c266SJung-uk Kim AcpiUtGetTypeName (ObjectType)));
445a159c266SJung-uk Kim }
4465ef50723SJung-uk Kim }
447a159c266SJung-uk Kim else
448a159c266SJung-uk Kim {
449a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
450a159c266SJung-uk Kim "[%s] Both Find or Create allowed\n",
451a159c266SJung-uk Kim AcpiUtGetTypeName (ObjectType)));
452a159c266SJung-uk Kim }
453a159c266SJung-uk Kim
454a159c266SJung-uk Kim /*
455a159c266SJung-uk Kim * Enter the named type into the internal namespace. We enter the name
456a159c266SJung-uk Kim * as we go downward in the parse tree. Any necessary subobjects that
457a159c266SJung-uk Kim * involve arguments to the opcode must be created as we go back up the
458a159c266SJung-uk Kim * parse tree later.
459a159c266SJung-uk Kim */
460a159c266SJung-uk Kim Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
461a159c266SJung-uk Kim ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
462a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
463a159c266SJung-uk Kim {
464a159c266SJung-uk Kim if (Status == AE_ALREADY_EXISTS)
465a159c266SJung-uk Kim {
466a159c266SJung-uk Kim /* The name already exists in this scope */
467a159c266SJung-uk Kim
468a159c266SJung-uk Kim if (Node->Flags & ANOBJ_IS_EXTERNAL)
469a159c266SJung-uk Kim {
470a159c266SJung-uk Kim /*
471a159c266SJung-uk Kim * Allow one create on an object or segment that was
472a159c266SJung-uk Kim * previously declared External
473a159c266SJung-uk Kim */
474a159c266SJung-uk Kim Node->Flags &= ~ANOBJ_IS_EXTERNAL;
475a159c266SJung-uk Kim Node->Type = (UINT8) ObjectType;
476a159c266SJung-uk Kim
477a159c266SJung-uk Kim /* Just retyped a node, probably will need to open a scope */
478a159c266SJung-uk Kim
479a159c266SJung-uk Kim if (AcpiNsOpensScope (ObjectType))
480a159c266SJung-uk Kim {
481f8146b88SJung-uk Kim Status = AcpiDsScopeStackPush (
482f8146b88SJung-uk Kim Node, ObjectType, WalkState);
483a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
484a159c266SJung-uk Kim {
485a159c266SJung-uk Kim return_ACPI_STATUS (Status);
486a159c266SJung-uk Kim }
487a159c266SJung-uk Kim }
488a159c266SJung-uk Kim
489a159c266SJung-uk Kim Status = AE_OK;
490a159c266SJung-uk Kim }
491a159c266SJung-uk Kim }
492a159c266SJung-uk Kim
493a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
494a159c266SJung-uk Kim {
495b7b7e711SJung-uk Kim ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status);
496a159c266SJung-uk Kim return_ACPI_STATUS (Status);
497a159c266SJung-uk Kim }
498a159c266SJung-uk Kim }
499a159c266SJung-uk Kim break;
500a159c266SJung-uk Kim }
501a159c266SJung-uk Kim
502a159c266SJung-uk Kim /* Common exit */
503a159c266SJung-uk Kim
504a159c266SJung-uk Kim if (!Op)
505a159c266SJung-uk Kim {
506a159c266SJung-uk Kim /* Create a new op */
507a159c266SJung-uk Kim
508fe0f0bbbSJung-uk Kim Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);
509a159c266SJung-uk Kim if (!Op)
510a159c266SJung-uk Kim {
511a159c266SJung-uk Kim return_ACPI_STATUS (AE_NO_MEMORY);
512a159c266SJung-uk Kim }
513a159c266SJung-uk Kim }
514a159c266SJung-uk Kim
515a159c266SJung-uk Kim /* Initialize the op */
516a159c266SJung-uk Kim
51790b566fdSJung-uk Kim #ifdef ACPI_CONSTANT_EVAL_ONLY
518af051161SJung-uk Kim Op->Named.Path = Path;
519a159c266SJung-uk Kim #endif
520a159c266SJung-uk Kim
521a159c266SJung-uk Kim if (Node)
522a159c266SJung-uk Kim {
523a159c266SJung-uk Kim /*
524a159c266SJung-uk Kim * Put the Node in the "op" object that the parser uses, so we
525a159c266SJung-uk Kim * can get it again quickly when this scope is closed
526a159c266SJung-uk Kim */
527a159c266SJung-uk Kim Op->Common.Node = Node;
528a159c266SJung-uk Kim Op->Named.Name = Node->Name.Integer;
529a159c266SJung-uk Kim }
530a159c266SJung-uk Kim
531a159c266SJung-uk Kim AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op);
532a159c266SJung-uk Kim *OutOp = Op;
533a159c266SJung-uk Kim return_ACPI_STATUS (Status);
534a159c266SJung-uk Kim }
535a159c266SJung-uk Kim
536a159c266SJung-uk Kim
537a159c266SJung-uk Kim /*******************************************************************************
538a159c266SJung-uk Kim *
539a159c266SJung-uk Kim * FUNCTION: AcpiDsLoad1EndOp
540a159c266SJung-uk Kim *
541a159c266SJung-uk Kim * PARAMETERS: WalkState - Current state of the parse tree walk
542a159c266SJung-uk Kim *
543a159c266SJung-uk Kim * RETURN: Status
544a159c266SJung-uk Kim *
545a159c266SJung-uk Kim * DESCRIPTION: Ascending callback used during the loading of the namespace,
546a159c266SJung-uk Kim * both control methods and everything else.
547a159c266SJung-uk Kim *
548a159c266SJung-uk Kim ******************************************************************************/
549a159c266SJung-uk Kim
550a159c266SJung-uk Kim ACPI_STATUS
AcpiDsLoad1EndOp(ACPI_WALK_STATE * WalkState)551a159c266SJung-uk Kim AcpiDsLoad1EndOp (
552a159c266SJung-uk Kim ACPI_WALK_STATE *WalkState)
553a159c266SJung-uk Kim {
554a159c266SJung-uk Kim ACPI_PARSE_OBJECT *Op;
555a159c266SJung-uk Kim ACPI_OBJECT_TYPE ObjectType;
556a159c266SJung-uk Kim ACPI_STATUS Status = AE_OK;
557af051161SJung-uk Kim #ifdef ACPI_ASL_COMPILER
558af051161SJung-uk Kim UINT8 ParamCount;
559af051161SJung-uk Kim #endif
560af051161SJung-uk Kim
561a159c266SJung-uk Kim
562a159c266SJung-uk Kim ACPI_FUNCTION_TRACE (DsLoad1EndOp);
563a159c266SJung-uk Kim
564a159c266SJung-uk Kim
565a159c266SJung-uk Kim Op = WalkState->Op;
566a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
567a159c266SJung-uk Kim
568f9a6772eSJung-uk Kim /*
569f9a6772eSJung-uk Kim * Disassembler: handle create field operators here.
570f9a6772eSJung-uk Kim *
571f9a6772eSJung-uk Kim * CreateBufferField is a deferred op that is typically processed in load
572f9a6772eSJung-uk Kim * pass 2. However, disassembly of control method contents walk the parse
573f9a6772eSJung-uk Kim * tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed
574f9a6772eSJung-uk Kim * in a later walk. This is a problem when there is a control method that
575f9a6772eSJung-uk Kim * has the same name as the AML_CREATE object. In this case, any use of the
576f9a6772eSJung-uk Kim * name segment will be detected as a method call rather than a reference
577f9a6772eSJung-uk Kim * to a buffer field.
578f9a6772eSJung-uk Kim *
579f9a6772eSJung-uk Kim * This earlier creation during disassembly solves this issue by inserting
580f9a6772eSJung-uk Kim * the named object in the ACPI namespace so that references to this name
581f9a6772eSJung-uk Kim * would be a name string rather than a method call.
582f9a6772eSJung-uk Kim */
583f9a6772eSJung-uk Kim if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) &&
584f9a6772eSJung-uk Kim (WalkState->OpInfo->Flags & AML_CREATE))
585f9a6772eSJung-uk Kim {
586f9a6772eSJung-uk Kim Status = AcpiDsCreateBufferField (Op, WalkState);
587f9a6772eSJung-uk Kim return_ACPI_STATUS (Status);
588f9a6772eSJung-uk Kim }
589f9a6772eSJung-uk Kim
590a159c266SJung-uk Kim /* We are only interested in opcodes that have an associated name */
591a159c266SJung-uk Kim
592a159c266SJung-uk Kim if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))
593a159c266SJung-uk Kim {
594a159c266SJung-uk Kim return_ACPI_STATUS (AE_OK);
595a159c266SJung-uk Kim }
596a159c266SJung-uk Kim
597a159c266SJung-uk Kim /* Get the object type to determine if we should pop the scope */
598a159c266SJung-uk Kim
599a159c266SJung-uk Kim ObjectType = WalkState->OpInfo->ObjectType;
600a159c266SJung-uk Kim
601a159c266SJung-uk Kim if (WalkState->OpInfo->Flags & AML_FIELD)
602a159c266SJung-uk Kim {
603a159c266SJung-uk Kim /*
604a159c266SJung-uk Kim * If we are executing a method, do not create any namespace objects
605a159c266SJung-uk Kim * during the load phase, only during execution.
606a159c266SJung-uk Kim */
607a159c266SJung-uk Kim if (!WalkState->MethodNode)
608a159c266SJung-uk Kim {
609a159c266SJung-uk Kim if (WalkState->Opcode == AML_FIELD_OP ||
610a159c266SJung-uk Kim WalkState->Opcode == AML_BANK_FIELD_OP ||
611a159c266SJung-uk Kim WalkState->Opcode == AML_INDEX_FIELD_OP)
612a159c266SJung-uk Kim {
613a159c266SJung-uk Kim Status = AcpiDsInitFieldObjects (Op, WalkState);
614a159c266SJung-uk Kim }
615a159c266SJung-uk Kim }
616a159c266SJung-uk Kim return_ACPI_STATUS (Status);
617a159c266SJung-uk Kim }
618a159c266SJung-uk Kim
619a159c266SJung-uk Kim /*
620a159c266SJung-uk Kim * If we are executing a method, do not create any namespace objects
621a159c266SJung-uk Kim * during the load phase, only during execution.
622a159c266SJung-uk Kim */
623a159c266SJung-uk Kim if (!WalkState->MethodNode)
624a159c266SJung-uk Kim {
625a159c266SJung-uk Kim if (Op->Common.AmlOpcode == AML_REGION_OP)
626a159c266SJung-uk Kim {
627a159c266SJung-uk Kim Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
628f8146b88SJung-uk Kim (ACPI_ADR_SPACE_TYPE)
629f8146b88SJung-uk Kim ((Op->Common.Value.Arg)->Common.Value.Integer),
630a159c266SJung-uk Kim WalkState);
631a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
632a159c266SJung-uk Kim {
633a159c266SJung-uk Kim return_ACPI_STATUS (Status);
634a159c266SJung-uk Kim }
635a159c266SJung-uk Kim }
636a159c266SJung-uk Kim else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
637a159c266SJung-uk Kim {
638a159c266SJung-uk Kim Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
639a159c266SJung-uk Kim ACPI_ADR_SPACE_DATA_TABLE, WalkState);
640a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
641a159c266SJung-uk Kim {
642a159c266SJung-uk Kim return_ACPI_STATUS (Status);
643a159c266SJung-uk Kim }
644a159c266SJung-uk Kim }
645a159c266SJung-uk Kim }
646a159c266SJung-uk Kim
647a159c266SJung-uk Kim if (Op->Common.AmlOpcode == AML_NAME_OP)
648a159c266SJung-uk Kim {
649a159c266SJung-uk Kim /* For Name opcode, get the object type from the argument */
650a159c266SJung-uk Kim
651a159c266SJung-uk Kim if (Op->Common.Value.Arg)
652a159c266SJung-uk Kim {
653a159c266SJung-uk Kim ObjectType = (AcpiPsGetOpcodeInfo (
654a159c266SJung-uk Kim (Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType;
655a159c266SJung-uk Kim
656a159c266SJung-uk Kim /* Set node type if we have a namespace node */
657a159c266SJung-uk Kim
658a159c266SJung-uk Kim if (Op->Common.Node)
659a159c266SJung-uk Kim {
660a159c266SJung-uk Kim Op->Common.Node->Type = (UINT8) ObjectType;
661a159c266SJung-uk Kim }
662a159c266SJung-uk Kim }
663a159c266SJung-uk Kim }
664a159c266SJung-uk Kim
665af051161SJung-uk Kim #ifdef ACPI_ASL_COMPILER
666af051161SJung-uk Kim /*
667af051161SJung-uk Kim * For external opcode, get the object type from the argument and
668af051161SJung-uk Kim * get the parameter count from the argument's next.
669af051161SJung-uk Kim */
670af051161SJung-uk Kim if (AcpiGbl_DisasmFlag &&
671af051161SJung-uk Kim Op->Common.Node &&
672af051161SJung-uk Kim Op->Common.AmlOpcode == AML_EXTERNAL_OP)
673af051161SJung-uk Kim {
674af051161SJung-uk Kim /*
675af051161SJung-uk Kim * Note, if this external is not a method
676af051161SJung-uk Kim * Op->Common.Value.Arg->Common.Next->Common.Value.Integer == 0
677af051161SJung-uk Kim * Therefore, ParamCount will be 0.
678af051161SJung-uk Kim */
679af051161SJung-uk Kim ParamCount = (UINT8) Op->Common.Value.Arg->Common.Next->Common.Value.Integer;
680af051161SJung-uk Kim ObjectType = (UINT8) Op->Common.Value.Arg->Common.Value.Integer;
681af051161SJung-uk Kim Op->Common.Node->Flags |= ANOBJ_IS_EXTERNAL;
682af051161SJung-uk Kim Op->Common.Node->Type = (UINT8) ObjectType;
683af051161SJung-uk Kim
684af051161SJung-uk Kim AcpiDmCreateSubobjectForExternal ((UINT8)ObjectType,
685af051161SJung-uk Kim &Op->Common.Node, ParamCount);
686af051161SJung-uk Kim
687af051161SJung-uk Kim /*
688af051161SJung-uk Kim * Add the external to the external list because we may be
689af051161SJung-uk Kim * emitting code based off of the items within the external list.
690af051161SJung-uk Kim */
691af051161SJung-uk Kim AcpiDmAddOpToExternalList (Op, Op->Named.Path, (UINT8)ObjectType, ParamCount,
692af051161SJung-uk Kim ACPI_EXT_ORIGIN_FROM_OPCODE | ACPI_EXT_RESOLVED_REFERENCE);
693af051161SJung-uk Kim }
694af051161SJung-uk Kim #endif
695af051161SJung-uk Kim
696a159c266SJung-uk Kim /*
697a159c266SJung-uk Kim * If we are executing a method, do not create any namespace objects
698a159c266SJung-uk Kim * during the load phase, only during execution.
699a159c266SJung-uk Kim */
700a159c266SJung-uk Kim if (!WalkState->MethodNode)
701a159c266SJung-uk Kim {
702a159c266SJung-uk Kim if (Op->Common.AmlOpcode == AML_METHOD_OP)
703a159c266SJung-uk Kim {
704a159c266SJung-uk Kim /*
705a159c266SJung-uk Kim * MethodOp PkgLength NameString MethodFlags TermList
706a159c266SJung-uk Kim *
707a159c266SJung-uk Kim * Note: We must create the method node/object pair as soon as we
708a159c266SJung-uk Kim * see the method declaration. This allows later pass1 parsing
709a159c266SJung-uk Kim * of invocations of the method (need to know the number of
710a159c266SJung-uk Kim * arguments.)
711a159c266SJung-uk Kim */
712a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
713a159c266SJung-uk Kim "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
714a159c266SJung-uk Kim WalkState, Op, Op->Named.Node));
715a159c266SJung-uk Kim
716a159c266SJung-uk Kim if (!AcpiNsGetAttachedObject (Op->Named.Node))
717a159c266SJung-uk Kim {
718a159c266SJung-uk Kim WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
719a159c266SJung-uk Kim WalkState->NumOperands = 1;
720a159c266SJung-uk Kim
721f8146b88SJung-uk Kim Status = AcpiDsCreateOperands (
722f8146b88SJung-uk Kim WalkState, Op->Common.Value.Arg);
723a159c266SJung-uk Kim if (ACPI_SUCCESS (Status))
724a159c266SJung-uk Kim {
725a159c266SJung-uk Kim Status = AcpiExCreateMethod (Op->Named.Data,
726a159c266SJung-uk Kim Op->Named.Length, WalkState);
727a159c266SJung-uk Kim }
728a159c266SJung-uk Kim
729a159c266SJung-uk Kim WalkState->Operands[0] = NULL;
730a159c266SJung-uk Kim WalkState->NumOperands = 0;
731a159c266SJung-uk Kim
732a159c266SJung-uk Kim if (ACPI_FAILURE (Status))
733a159c266SJung-uk Kim {
734a159c266SJung-uk Kim return_ACPI_STATUS (Status);
735a159c266SJung-uk Kim }
736a159c266SJung-uk Kim }
737a159c266SJung-uk Kim }
738a159c266SJung-uk Kim }
739a159c266SJung-uk Kim
740a159c266SJung-uk Kim /* Pop the scope stack (only if loading a table) */
741a159c266SJung-uk Kim
742a159c266SJung-uk Kim if (!WalkState->MethodNode &&
743af051161SJung-uk Kim Op->Common.AmlOpcode != AML_EXTERNAL_OP &&
744a159c266SJung-uk Kim AcpiNsOpensScope (ObjectType))
745a159c266SJung-uk Kim {
746a159c266SJung-uk Kim ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
747a159c266SJung-uk Kim AcpiUtGetTypeName (ObjectType), Op));
748a159c266SJung-uk Kim
749a159c266SJung-uk Kim Status = AcpiDsScopeStackPop (WalkState);
750a159c266SJung-uk Kim }
751a159c266SJung-uk Kim
752a159c266SJung-uk Kim return_ACPI_STATUS (Status);
753a159c266SJung-uk Kim }
754