167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: psxface - Parser external interfaces
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7316303Sjkim/******************************************************************************
8316303Sjkim *
9316303Sjkim * 1. Copyright Notice
10316303Sjkim *
11316303Sjkim * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
1270243Smsmith * All rights reserved.
1367754Smsmith *
14316303Sjkim * 2. License
15316303Sjkim *
16316303Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property
17316303Sjkim * rights. You may have additional license terms from the party that provided
18316303Sjkim * you this software, covering your right to use that party's intellectual
19316303Sjkim * property rights.
20316303Sjkim *
21316303Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22316303Sjkim * copy of the source code appearing in this file ("Covered Code") an
23316303Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24316303Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy,
25316303Sjkim * make derivatives, distribute, use and display any portion of the Covered
26316303Sjkim * Code in any form, with the right to sublicense such rights; and
27316303Sjkim *
28316303Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29316303Sjkim * license (with the right to sublicense), under only those claims of Intel
30316303Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell,
31316303Sjkim * offer to sell, and import the Covered Code and derivative works thereof
32316303Sjkim * solely to the minimum extent necessary to exercise the above copyright
33316303Sjkim * license, and in no event shall the patent license extend to any additions
34316303Sjkim * to or modifications of the Original Intel Code. No other license or right
35316303Sjkim * is granted directly or by implication, estoppel or otherwise;
36316303Sjkim *
37316303Sjkim * The above copyright and patent license is granted only if the following
38316303Sjkim * conditions are met:
39316303Sjkim *
40316303Sjkim * 3. Conditions
41316303Sjkim *
42316303Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43316303Sjkim * Redistribution of source code of any substantial portion of the Covered
44316303Sjkim * Code or modification with rights to further distribute source must include
45316303Sjkim * the above Copyright Notice, the above License, this list of Conditions,
46316303Sjkim * and the following Disclaimer and Export Compliance provision. In addition,
47316303Sjkim * Licensee must cause all Covered Code to which Licensee contributes to
48316303Sjkim * contain a file documenting the changes Licensee made to create that Covered
49316303Sjkim * Code and the date of any change. Licensee must include in that file the
50316303Sjkim * documentation of any changes made by any predecessor Licensee. Licensee
51316303Sjkim * must include a prominent statement that the modification is derived,
52316303Sjkim * directly or indirectly, from Original Intel Code.
53316303Sjkim *
54316303Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55316303Sjkim * Redistribution of source code of any substantial portion of the Covered
56316303Sjkim * Code or modification without rights to further distribute source must
57316303Sjkim * include the following Disclaimer and Export Compliance provision in the
58316303Sjkim * documentation and/or other materials provided with distribution. In
59316303Sjkim * addition, Licensee may not authorize further sublicense of source of any
60316303Sjkim * portion of the Covered Code, and must include terms to the effect that the
61316303Sjkim * license from Licensee to its licensee is limited to the intellectual
62316303Sjkim * property embodied in the software Licensee provides to its licensee, and
63316303Sjkim * not to intellectual property embodied in modifications its licensee may
64316303Sjkim * make.
65316303Sjkim *
66316303Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any
67316303Sjkim * substantial portion of the Covered Code or modification must reproduce the
68316303Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance
69316303Sjkim * provision in the documentation and/or other materials provided with the
70316303Sjkim * distribution.
71316303Sjkim *
72316303Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original
73316303Sjkim * Intel Code.
74316303Sjkim *
75316303Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76316303Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or
77316303Sjkim * other dealings in products derived from or relating to the Covered Code
78316303Sjkim * without prior written authorization from Intel.
79316303Sjkim *
80316303Sjkim * 4. Disclaimer and Export Compliance
81316303Sjkim *
82316303Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83316303Sjkim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84316303Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85316303Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86316303Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87316303Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88316303Sjkim * PARTICULAR PURPOSE.
89316303Sjkim *
90316303Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91316303Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92316303Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93316303Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94316303Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95316303Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96316303Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97316303Sjkim * LIMITED REMEDY.
98316303Sjkim *
99316303Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this
100316303Sjkim * software or system incorporating such software without first obtaining any
101316303Sjkim * required license or other approval from the U. S. Department of Commerce or
102316303Sjkim * any other agency or department of the United States Government. In the
103316303Sjkim * event Licensee exports any such software from the United States or
104316303Sjkim * re-exports any such software from a foreign destination, Licensee shall
105316303Sjkim * ensure that the distribution and export/re-export of the software is in
106316303Sjkim * compliance with all laws, regulations, orders, or other restrictions of the
107316303Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108316303Sjkim * any of its subsidiaries will export/re-export any technical data, process,
109316303Sjkim * software, or service, directly or indirectly, to any country for which the
110316303Sjkim * United States government or any agency thereof requires an export license,
111316303Sjkim * other governmental approval, or letter of assurance, without first obtaining
112316303Sjkim * such license, approval or letter.
113316303Sjkim *
114316303Sjkim *****************************************************************************
115316303Sjkim *
116316303Sjkim * Alternatively, you may choose to be licensed under the terms of the
117316303Sjkim * following license:
118316303Sjkim *
119217365Sjkim * Redistribution and use in source and binary forms, with or without
120217365Sjkim * modification, are permitted provided that the following conditions
121217365Sjkim * are met:
122217365Sjkim * 1. Redistributions of source code must retain the above copyright
123217365Sjkim *    notice, this list of conditions, and the following disclaimer,
124217365Sjkim *    without modification.
125217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
127217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
128217365Sjkim *    including a substantially similar Disclaimer requirement for further
129217365Sjkim *    binary redistribution.
130217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
131217365Sjkim *    of any contributors may be used to endorse or promote products derived
132217365Sjkim *    from this software without specific prior written permission.
13367754Smsmith *
134316303Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135316303Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136316303Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137316303Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138316303Sjkim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139316303Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140316303Sjkim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141316303Sjkim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142316303Sjkim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143316303Sjkim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144316303Sjkim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145316303Sjkim *
146316303Sjkim * Alternatively, you may choose to be licensed under the terms of the
147217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
148217365Sjkim * Software Foundation.
14967754Smsmith *
150316303Sjkim *****************************************************************************/
15167754Smsmith
152193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
153193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
154193341Sjkim#include <contrib/dev/acpica/include/acparser.h>
155193341Sjkim#include <contrib/dev/acpica/include/acdispat.h>
156193341Sjkim#include <contrib/dev/acpica/include/acinterp.h>
157206117Sjkim#include <contrib/dev/acpica/include/actables.h>
158285797Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
15967754Smsmith
16067754Smsmith
16177424Smsmith#define _COMPONENT          ACPI_PARSER
16291116Smsmith        ACPI_MODULE_NAME    ("psxface")
16367754Smsmith
164151937Sjkim/* Local Prototypes */
16567754Smsmith
166151937Sjkimstatic void
167151937SjkimAcpiPsUpdateParameterList (
168167802Sjkim    ACPI_EVALUATE_INFO      *Info,
169151937Sjkim    UINT16                  Action);
170151937Sjkim
171151937Sjkim
17280062Smsmith/*******************************************************************************
17367754Smsmith *
174151937Sjkim * FUNCTION:    AcpiDebugTrace
17567754Smsmith *
176151937Sjkim * PARAMETERS:  MethodName      - Valid ACPI name string
177151937Sjkim *              DebugLevel      - Optional level mask. 0 to use default
178151937Sjkim *              DebugLayer      - Optional layer mask. 0 to use default
179151937Sjkim *              Flags           - bit 1: one shot(1) or persistent(0)
18067754Smsmith *
18167754Smsmith * RETURN:      Status
18267754Smsmith *
183151937Sjkim * DESCRIPTION: External interface to enable debug tracing during control
184151937Sjkim *              method execution
18567754Smsmith *
18680062Smsmith ******************************************************************************/
18767754Smsmith
18867754SmsmithACPI_STATUS
189151937SjkimAcpiDebugTrace (
190285797Sjkim    const char              *Name,
191151937Sjkim    UINT32                  DebugLevel,
192151937Sjkim    UINT32                  DebugLayer,
193151937Sjkim    UINT32                  Flags)
194151937Sjkim{
195151937Sjkim    ACPI_STATUS             Status;
196151937Sjkim
197151937Sjkim
198151937Sjkim    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
199151937Sjkim    if (ACPI_FAILURE (Status))
200151937Sjkim    {
201151937Sjkim        return (Status);
202151937Sjkim    }
203151937Sjkim
204285797Sjkim    AcpiGbl_TraceMethodName = Name;
205151937Sjkim    AcpiGbl_TraceFlags = Flags;
206285797Sjkim    AcpiGbl_TraceDbgLevel = DebugLevel;
207285797Sjkim    AcpiGbl_TraceDbgLayer = DebugLayer;
208285797Sjkim    Status = AE_OK;
209151937Sjkim
210151937Sjkim    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
211285797Sjkim    return (Status);
212151937Sjkim}
213151937Sjkim
214151937Sjkim
215151937Sjkim/*******************************************************************************
216151937Sjkim *
217151937Sjkim * FUNCTION:    AcpiPsExecuteMethod
218151937Sjkim *
219151937Sjkim * PARAMETERS:  Info            - Method info block, contains:
220151937Sjkim *                  Node            - Method Node to execute
221151937Sjkim *                  ObjDesc         - Method object
222151937Sjkim *                  Parameters      - List of parameters to pass to the method,
223151937Sjkim *                                    terminated by NULL. Params itself may be
224151937Sjkim *                                    NULL if no parameters are being passed.
225151937Sjkim *                  ReturnObject    - Where to put method's return value (if
226151937Sjkim *                                    any). If NULL, no value is returned.
227151937Sjkim *                  ParameterType   - Type of Parameter list
228151937Sjkim *                  ReturnObject    - Where to put method's return value (if
229151937Sjkim *                                    any). If NULL, no value is returned.
230151937Sjkim *                  PassNumber      - Parse or execute pass
231151937Sjkim *
232151937Sjkim * RETURN:      Status
233151937Sjkim *
234151937Sjkim * DESCRIPTION: Execute a control method
235151937Sjkim *
236151937Sjkim ******************************************************************************/
237151937Sjkim
238151937SjkimACPI_STATUS
239151937SjkimAcpiPsExecuteMethod (
240167802Sjkim    ACPI_EVALUATE_INFO      *Info)
241151937Sjkim{
242151937Sjkim    ACPI_STATUS             Status;
243167802Sjkim    ACPI_PARSE_OBJECT       *Op;
244167802Sjkim    ACPI_WALK_STATE         *WalkState;
245151937Sjkim
246151937Sjkim
247167802Sjkim    ACPI_FUNCTION_TRACE (PsExecuteMethod);
248151937Sjkim
249151937Sjkim
250206117Sjkim    /* Quick validation of DSDT header */
251206117Sjkim
252206117Sjkim    AcpiTbCheckDsdtHeader ();
253206117Sjkim
254151937Sjkim    /* Validate the Info and method Node */
255151937Sjkim
256249663Sjkim    if (!Info || !Info->Node)
25784491Smsmith    {
258151937Sjkim        return_ACPI_STATUS (AE_NULL_ENTRY);
25984491Smsmith    }
26084491Smsmith
261151937Sjkim    /* Init for new method, wait on concurrency semaphore */
262151937Sjkim
263249663Sjkim    Status = AcpiDsBeginMethodExecution (Info->Node, Info->ObjDesc, NULL);
26484491Smsmith    if (ACPI_FAILURE (Status))
26584491Smsmith    {
266151937Sjkim        return_ACPI_STATUS (Status);
26784491Smsmith    }
26884491Smsmith
269151937Sjkim    /*
270167802Sjkim     * The caller "owns" the parameters, so give each one an extra reference
271151937Sjkim     */
272151937Sjkim    AcpiPsUpdateParameterList (Info, REF_INCREMENT);
27384491Smsmith
274151937Sjkim    /*
275167802Sjkim     * Execute the method. Performs parse simultaneously
276151937Sjkim     */
277151937Sjkim    ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
278167802Sjkim        "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
279249663Sjkim        Info->Node->Name.Ascii, Info->Node, Info->ObjDesc));
280151937Sjkim
281167802Sjkim    /* Create and init a Root Node */
282167802Sjkim
283285797Sjkim    Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
284167802Sjkim    if (!Op)
285167802Sjkim    {
286167802Sjkim        Status = AE_NO_MEMORY;
287167802Sjkim        goto Cleanup;
288167802Sjkim    }
289167802Sjkim
290167802Sjkim    /* Create and initialize a new walk state */
291167802Sjkim
292167802Sjkim    Info->PassNumber = ACPI_IMODE_EXECUTE;
293167802Sjkim    WalkState = AcpiDsCreateWalkState (
294298714Sjkim        Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
295167802Sjkim    if (!WalkState)
296167802Sjkim    {
297167802Sjkim        Status = AE_NO_MEMORY;
298167802Sjkim        goto Cleanup;
299167802Sjkim    }
300167802Sjkim
301249663Sjkim    Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
302298714Sjkim        Info->ObjDesc->Method.AmlStart,
303298714Sjkim        Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
304123315Snjl    if (ACPI_FAILURE (Status))
305123315Snjl    {
306167802Sjkim        AcpiDsDeleteWalkState (WalkState);
307151937Sjkim        goto Cleanup;
308123315Snjl    }
309123315Snjl
310217365Sjkim    if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
311197104Sjkim    {
312197104Sjkim        WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
313197104Sjkim    }
314197104Sjkim
315193267Sjkim    /* Invoke an internal method if necessary */
316193267Sjkim
317217365Sjkim    if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY)
318193267Sjkim    {
319217365Sjkim        Status = Info->ObjDesc->Method.Dispatch.Implementation (WalkState);
320193267Sjkim        Info->ReturnObject = WalkState->ReturnDesc;
321193267Sjkim
322193267Sjkim        /* Cleanup states */
323193267Sjkim
324193267Sjkim        AcpiDsScopeStackClear (WalkState);
325193267Sjkim        AcpiPsCleanupScope (&WalkState->ParserState);
326193267Sjkim        AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
327193267Sjkim        AcpiDsDeleteWalkState (WalkState);
328193267Sjkim        goto Cleanup;
329193267Sjkim    }
330193267Sjkim
331193267Sjkim    /*
332238381Sjkim     * Start method evaluation with an implicit return of zero.
333238381Sjkim     * This is done for Windows compatibility.
334193267Sjkim     */
335193267Sjkim    if (AcpiGbl_EnableInterpreterSlack)
336193267Sjkim    {
337193267Sjkim        WalkState->ImplicitReturnObj =
338199337Sjkim            AcpiUtCreateIntegerObject ((UINT64) 0);
339193267Sjkim        if (!WalkState->ImplicitReturnObj)
340193267Sjkim        {
341193267Sjkim            Status = AE_NO_MEMORY;
342193267Sjkim            AcpiDsDeleteWalkState (WalkState);
343193267Sjkim            goto Cleanup;
344193267Sjkim        }
345193267Sjkim    }
346193267Sjkim
347167802Sjkim    /* Parse the AML */
34884491Smsmith
349167802Sjkim    Status = AcpiPsParseAml (WalkState);
35067754Smsmith
351167802Sjkim    /* WalkState was deleted by ParseAml */
35267754Smsmith
353151937SjkimCleanup:
354167802Sjkim    AcpiPsDeleteParseTree (Op);
355167802Sjkim
356151937Sjkim    /* Take away the extra reference that we gave the parameters above */
35784491Smsmith
358151937Sjkim    AcpiPsUpdateParameterList (Info, REF_DECREMENT);
35984491Smsmith
360151937Sjkim    /* Exit now if error above */
361151937Sjkim
36284491Smsmith    if (ACPI_FAILURE (Status))
36384491Smsmith    {
364151937Sjkim        return_ACPI_STATUS (Status);
36584491Smsmith    }
36684491Smsmith
36767754Smsmith    /*
368151937Sjkim     * If the method has returned an object, signal this to the caller with
369151937Sjkim     * a control exception code
37067754Smsmith     */
371151937Sjkim    if (Info->ReturnObject)
372151937Sjkim    {
373151937Sjkim        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
374151937Sjkim            Info->ReturnObject));
375151937Sjkim        ACPI_DUMP_STACK_ENTRY (Info->ReturnObject);
376123315Snjl
377151937Sjkim        Status = AE_CTRL_RETURN_VALUE;
378151937Sjkim    }
379123315Snjl
380151937Sjkim    return_ACPI_STATUS (Status);
381151937Sjkim}
382123315Snjl
38367754Smsmith
384151937Sjkim/*******************************************************************************
385151937Sjkim *
386316303Sjkim * FUNCTION:    AcpiPsExecuteTable
387316303Sjkim *
388316303Sjkim * PARAMETERS:  Info            - Method info block, contains:
389316303Sjkim *              Node            - Node to where the is entered into the
390316303Sjkim *                                namespace
391316303Sjkim *              ObjDesc         - Pseudo method object describing the AML
392316303Sjkim *                                code of the entire table
393316303Sjkim *              PassNumber      - Parse or execute pass
394316303Sjkim *
395316303Sjkim * RETURN:      Status
396316303Sjkim *
397316303Sjkim * DESCRIPTION: Execute a table
398316303Sjkim *
399316303Sjkim ******************************************************************************/
400316303Sjkim
401316303SjkimACPI_STATUS
402316303SjkimAcpiPsExecuteTable (
403316303Sjkim    ACPI_EVALUATE_INFO      *Info)
404316303Sjkim{
405316303Sjkim    ACPI_STATUS             Status;
406316303Sjkim    ACPI_PARSE_OBJECT       *Op = NULL;
407316303Sjkim    ACPI_WALK_STATE         *WalkState = NULL;
408316303Sjkim
409316303Sjkim
410316303Sjkim    ACPI_FUNCTION_TRACE (PsExecuteTable);
411316303Sjkim
412316303Sjkim
413316303Sjkim    /* Create and init a Root Node */
414316303Sjkim
415316303Sjkim    Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
416316303Sjkim    if (!Op)
417316303Sjkim    {
418316303Sjkim        Status = AE_NO_MEMORY;
419316303Sjkim        goto Cleanup;
420316303Sjkim    }
421316303Sjkim
422316303Sjkim    /* Create and initialize a new walk state */
423316303Sjkim
424316303Sjkim    WalkState = AcpiDsCreateWalkState (
425316303Sjkim        Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
426316303Sjkim    if (!WalkState)
427316303Sjkim    {
428316303Sjkim        Status = AE_NO_MEMORY;
429316303Sjkim        goto Cleanup;
430316303Sjkim    }
431316303Sjkim
432316303Sjkim    Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
433316303Sjkim        Info->ObjDesc->Method.AmlStart,
434316303Sjkim        Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
435316303Sjkim    if (ACPI_FAILURE (Status))
436316303Sjkim    {
437316303Sjkim        goto Cleanup;
438316303Sjkim    }
439316303Sjkim
440316303Sjkim    if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
441316303Sjkim    {
442316303Sjkim        WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
443316303Sjkim    }
444316303Sjkim
445316303Sjkim    /* Info->Node is the default location to load the table  */
446316303Sjkim
447316303Sjkim    if (Info->Node && Info->Node != AcpiGbl_RootNode)
448316303Sjkim    {
449316303Sjkim        Status = AcpiDsScopeStackPush (
450316303Sjkim            Info->Node, ACPI_TYPE_METHOD, WalkState);
451316303Sjkim        if (ACPI_FAILURE (Status))
452316303Sjkim        {
453316303Sjkim            goto Cleanup;
454316303Sjkim        }
455316303Sjkim    }
456316303Sjkim
457316303Sjkim    /*
458316303Sjkim     * Parse the AML, WalkState will be deleted by ParseAml
459316303Sjkim     */
460316303Sjkim    AcpiExEnterInterpreter ();
461316303Sjkim    Status = AcpiPsParseAml (WalkState);
462316303Sjkim    AcpiExExitInterpreter ();
463316303Sjkim    WalkState = NULL;
464316303Sjkim
465316303SjkimCleanup:
466316303Sjkim    if (WalkState)
467316303Sjkim    {
468316303Sjkim        AcpiDsDeleteWalkState (WalkState);
469316303Sjkim    }
470316303Sjkim    if (Op)
471316303Sjkim    {
472316303Sjkim        AcpiPsDeleteParseTree (Op);
473316303Sjkim    }
474316303Sjkim    return_ACPI_STATUS (Status);
475316303Sjkim}
476316303Sjkim
477316303Sjkim
478316303Sjkim/*******************************************************************************
479316303Sjkim *
480151937Sjkim * FUNCTION:    AcpiPsUpdateParameterList
481151937Sjkim *
482167802Sjkim * PARAMETERS:  Info            - See ACPI_EVALUATE_INFO
483151937Sjkim *                                (Used: ParameterType and Parameters)
484151937Sjkim *              Action          - Add or Remove reference
485151937Sjkim *
486151937Sjkim * RETURN:      Status
487151937Sjkim *
488151937Sjkim * DESCRIPTION: Update reference count on all method parameter objects
489151937Sjkim *
490151937Sjkim ******************************************************************************/
491151937Sjkim
492151937Sjkimstatic void
493151937SjkimAcpiPsUpdateParameterList (
494167802Sjkim    ACPI_EVALUATE_INFO      *Info,
495151937Sjkim    UINT16                  Action)
496151937Sjkim{
497193267Sjkim    UINT32                  i;
498151937Sjkim
499151937Sjkim
500193267Sjkim    if (Info->Parameters)
50167754Smsmith    {
502151937Sjkim        /* Update reference count for each parameter */
50367754Smsmith
504129684Snjl        for (i = 0; Info->Parameters[i]; i++)
50567754Smsmith        {
50699679Siwasaki            /* Ignore errors, just do them all */
50799679Siwasaki
508298714Sjkim            (void) AcpiUtUpdateObjectReference (
509298714Sjkim                Info->Parameters[i], Action);
51067754Smsmith        }
51167754Smsmith    }
512151937Sjkim}
513