1a9643ea8Slogwang /*******************************************************************************
2a9643ea8Slogwang  *
3a9643ea8Slogwang  * Module Name: dbmethod - Debug commands for control methods
4a9643ea8Slogwang  *
5a9643ea8Slogwang  ******************************************************************************/
6a9643ea8Slogwang 
7*22ce4affSfengbojiang /******************************************************************************
8*22ce4affSfengbojiang  *
9*22ce4affSfengbojiang  * 1. Copyright Notice
10*22ce4affSfengbojiang  *
11*22ce4affSfengbojiang  * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp.
12a9643ea8Slogwang  * All rights reserved.
13a9643ea8Slogwang  *
14*22ce4affSfengbojiang  * 2. License
15*22ce4affSfengbojiang  *
16*22ce4affSfengbojiang  * 2.1. This is your license from Intel Corp. under its intellectual property
17*22ce4affSfengbojiang  * rights. You may have additional license terms from the party that provided
18*22ce4affSfengbojiang  * you this software, covering your right to use that party's intellectual
19*22ce4affSfengbojiang  * property rights.
20*22ce4affSfengbojiang  *
21*22ce4affSfengbojiang  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*22ce4affSfengbojiang  * copy of the source code appearing in this file ("Covered Code") an
23*22ce4affSfengbojiang  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*22ce4affSfengbojiang  * base code distributed originally by Intel ("Original Intel Code") to copy,
25*22ce4affSfengbojiang  * make derivatives, distribute, use and display any portion of the Covered
26*22ce4affSfengbojiang  * Code in any form, with the right to sublicense such rights; and
27*22ce4affSfengbojiang  *
28*22ce4affSfengbojiang  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29*22ce4affSfengbojiang  * license (with the right to sublicense), under only those claims of Intel
30*22ce4affSfengbojiang  * patents that are infringed by the Original Intel Code, to make, use, sell,
31*22ce4affSfengbojiang  * offer to sell, and import the Covered Code and derivative works thereof
32*22ce4affSfengbojiang  * solely to the minimum extent necessary to exercise the above copyright
33*22ce4affSfengbojiang  * license, and in no event shall the patent license extend to any additions
34*22ce4affSfengbojiang  * to or modifications of the Original Intel Code. No other license or right
35*22ce4affSfengbojiang  * is granted directly or by implication, estoppel or otherwise;
36*22ce4affSfengbojiang  *
37*22ce4affSfengbojiang  * The above copyright and patent license is granted only if the following
38*22ce4affSfengbojiang  * conditions are met:
39*22ce4affSfengbojiang  *
40*22ce4affSfengbojiang  * 3. Conditions
41*22ce4affSfengbojiang  *
42*22ce4affSfengbojiang  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43*22ce4affSfengbojiang  * Redistribution of source code of any substantial portion of the Covered
44*22ce4affSfengbojiang  * Code or modification with rights to further distribute source must include
45*22ce4affSfengbojiang  * the above Copyright Notice, the above License, this list of Conditions,
46*22ce4affSfengbojiang  * and the following Disclaimer and Export Compliance provision. In addition,
47*22ce4affSfengbojiang  * Licensee must cause all Covered Code to which Licensee contributes to
48*22ce4affSfengbojiang  * contain a file documenting the changes Licensee made to create that Covered
49*22ce4affSfengbojiang  * Code and the date of any change. Licensee must include in that file the
50*22ce4affSfengbojiang  * documentation of any changes made by any predecessor Licensee. Licensee
51*22ce4affSfengbojiang  * must include a prominent statement that the modification is derived,
52*22ce4affSfengbojiang  * directly or indirectly, from Original Intel Code.
53*22ce4affSfengbojiang  *
54*22ce4affSfengbojiang  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55*22ce4affSfengbojiang  * Redistribution of source code of any substantial portion of the Covered
56*22ce4affSfengbojiang  * Code or modification without rights to further distribute source must
57*22ce4affSfengbojiang  * include the following Disclaimer and Export Compliance provision in the
58*22ce4affSfengbojiang  * documentation and/or other materials provided with distribution. In
59*22ce4affSfengbojiang  * addition, Licensee may not authorize further sublicense of source of any
60*22ce4affSfengbojiang  * portion of the Covered Code, and must include terms to the effect that the
61*22ce4affSfengbojiang  * license from Licensee to its licensee is limited to the intellectual
62*22ce4affSfengbojiang  * property embodied in the software Licensee provides to its licensee, and
63*22ce4affSfengbojiang  * not to intellectual property embodied in modifications its licensee may
64*22ce4affSfengbojiang  * make.
65*22ce4affSfengbojiang  *
66*22ce4affSfengbojiang  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67*22ce4affSfengbojiang  * substantial portion of the Covered Code or modification must reproduce the
68*22ce4affSfengbojiang  * above Copyright Notice, and the following Disclaimer and Export Compliance
69*22ce4affSfengbojiang  * provision in the documentation and/or other materials provided with the
70*22ce4affSfengbojiang  * distribution.
71*22ce4affSfengbojiang  *
72*22ce4affSfengbojiang  * 3.4. Intel retains all right, title, and interest in and to the Original
73*22ce4affSfengbojiang  * Intel Code.
74*22ce4affSfengbojiang  *
75*22ce4affSfengbojiang  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76*22ce4affSfengbojiang  * Intel shall be used in advertising or otherwise to promote the sale, use or
77*22ce4affSfengbojiang  * other dealings in products derived from or relating to the Covered Code
78*22ce4affSfengbojiang  * without prior written authorization from Intel.
79*22ce4affSfengbojiang  *
80*22ce4affSfengbojiang  * 4. Disclaimer and Export Compliance
81*22ce4affSfengbojiang  *
82*22ce4affSfengbojiang  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83*22ce4affSfengbojiang  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84*22ce4affSfengbojiang  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85*22ce4affSfengbojiang  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86*22ce4affSfengbojiang  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87*22ce4affSfengbojiang  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88*22ce4affSfengbojiang  * PARTICULAR PURPOSE.
89*22ce4affSfengbojiang  *
90*22ce4affSfengbojiang  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91*22ce4affSfengbojiang  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92*22ce4affSfengbojiang  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93*22ce4affSfengbojiang  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94*22ce4affSfengbojiang  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95*22ce4affSfengbojiang  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96*22ce4affSfengbojiang  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97*22ce4affSfengbojiang  * LIMITED REMEDY.
98*22ce4affSfengbojiang  *
99*22ce4affSfengbojiang  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100*22ce4affSfengbojiang  * software or system incorporating such software without first obtaining any
101*22ce4affSfengbojiang  * required license or other approval from the U. S. Department of Commerce or
102*22ce4affSfengbojiang  * any other agency or department of the United States Government. In the
103*22ce4affSfengbojiang  * event Licensee exports any such software from the United States or
104*22ce4affSfengbojiang  * re-exports any such software from a foreign destination, Licensee shall
105*22ce4affSfengbojiang  * ensure that the distribution and export/re-export of the software is in
106*22ce4affSfengbojiang  * compliance with all laws, regulations, orders, or other restrictions of the
107*22ce4affSfengbojiang  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108*22ce4affSfengbojiang  * any of its subsidiaries will export/re-export any technical data, process,
109*22ce4affSfengbojiang  * software, or service, directly or indirectly, to any country for which the
110*22ce4affSfengbojiang  * United States government or any agency thereof requires an export license,
111*22ce4affSfengbojiang  * other governmental approval, or letter of assurance, without first obtaining
112*22ce4affSfengbojiang  * such license, approval or letter.
113*22ce4affSfengbojiang  *
114*22ce4affSfengbojiang  *****************************************************************************
115*22ce4affSfengbojiang  *
116*22ce4affSfengbojiang  * Alternatively, you may choose to be licensed under the terms of the
117*22ce4affSfengbojiang  * following license:
118*22ce4affSfengbojiang  *
119a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
120a9643ea8Slogwang  * modification, are permitted provided that the following conditions
121a9643ea8Slogwang  * are met:
122a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright
123a9643ea8Slogwang  *    notice, this list of conditions, and the following disclaimer,
124a9643ea8Slogwang  *    without modification.
125a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126a9643ea8Slogwang  *    substantially similar to the "NO WARRANTY" disclaimer below
127a9643ea8Slogwang  *    ("Disclaimer") and any redistribution must be conditioned upon
128a9643ea8Slogwang  *    including a substantially similar Disclaimer requirement for further
129a9643ea8Slogwang  *    binary redistribution.
130a9643ea8Slogwang  * 3. Neither the names of the above-listed copyright holders nor the names
131a9643ea8Slogwang  *    of any contributors may be used to endorse or promote products derived
132a9643ea8Slogwang  *    from this software without specific prior written permission.
133a9643ea8Slogwang  *
134*22ce4affSfengbojiang  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135*22ce4affSfengbojiang  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136*22ce4affSfengbojiang  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137*22ce4affSfengbojiang  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138*22ce4affSfengbojiang  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139*22ce4affSfengbojiang  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140*22ce4affSfengbojiang  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141*22ce4affSfengbojiang  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142*22ce4affSfengbojiang  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143*22ce4affSfengbojiang  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144*22ce4affSfengbojiang  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145*22ce4affSfengbojiang  *
146*22ce4affSfengbojiang  * Alternatively, you may choose to be licensed under the terms of the
147a9643ea8Slogwang  * GNU General Public License ("GPL") version 2 as published by the Free
148a9643ea8Slogwang  * Software Foundation.
149a9643ea8Slogwang  *
150*22ce4affSfengbojiang  *****************************************************************************/
151a9643ea8Slogwang 
152a9643ea8Slogwang #include <contrib/dev/acpica/include/acpi.h>
153a9643ea8Slogwang #include <contrib/dev/acpica/include/accommon.h>
154a9643ea8Slogwang #include <contrib/dev/acpica/include/acdispat.h>
155a9643ea8Slogwang #include <contrib/dev/acpica/include/acnamesp.h>
156a9643ea8Slogwang #include <contrib/dev/acpica/include/acdebug.h>
157a9643ea8Slogwang #include <contrib/dev/acpica/include/acparser.h>
158a9643ea8Slogwang #include <contrib/dev/acpica/include/acpredef.h>
159a9643ea8Slogwang 
160a9643ea8Slogwang 
161a9643ea8Slogwang #define _COMPONENT          ACPI_CA_DEBUGGER
162a9643ea8Slogwang         ACPI_MODULE_NAME    ("dbmethod")
163a9643ea8Slogwang 
164*22ce4affSfengbojiang /* Local prototypes */
165*22ce4affSfengbojiang 
166*22ce4affSfengbojiang static ACPI_STATUS
167*22ce4affSfengbojiang AcpiDbWalkForExecute (
168*22ce4affSfengbojiang     ACPI_HANDLE             ObjHandle,
169*22ce4affSfengbojiang     UINT32                  NestingLevel,
170*22ce4affSfengbojiang     void                    *Context,
171*22ce4affSfengbojiang     void                    **ReturnValue);
172*22ce4affSfengbojiang 
173*22ce4affSfengbojiang static ACPI_STATUS
174*22ce4affSfengbojiang AcpiDbEvaluateObject (
175*22ce4affSfengbojiang     ACPI_NAMESPACE_NODE     *Node);
176*22ce4affSfengbojiang 
177a9643ea8Slogwang 
178a9643ea8Slogwang /*******************************************************************************
179a9643ea8Slogwang  *
180a9643ea8Slogwang  * FUNCTION:    AcpiDbSetMethodBreakpoint
181a9643ea8Slogwang  *
182a9643ea8Slogwang  * PARAMETERS:  Location            - AML offset of breakpoint
183a9643ea8Slogwang  *              WalkState           - Current walk info
184a9643ea8Slogwang  *              Op                  - Current Op (from parse walk)
185a9643ea8Slogwang  *
186a9643ea8Slogwang  * RETURN:      None
187a9643ea8Slogwang  *
188a9643ea8Slogwang  * DESCRIPTION: Set a breakpoint in a control method at the specified
189a9643ea8Slogwang  *              AML offset
190a9643ea8Slogwang  *
191a9643ea8Slogwang  ******************************************************************************/
192a9643ea8Slogwang 
193a9643ea8Slogwang void
AcpiDbSetMethodBreakpoint(char * Location,ACPI_WALK_STATE * WalkState,ACPI_PARSE_OBJECT * Op)194a9643ea8Slogwang AcpiDbSetMethodBreakpoint (
195a9643ea8Slogwang     char                    *Location,
196a9643ea8Slogwang     ACPI_WALK_STATE         *WalkState,
197a9643ea8Slogwang     ACPI_PARSE_OBJECT       *Op)
198a9643ea8Slogwang {
199a9643ea8Slogwang     UINT32                  Address;
200a9643ea8Slogwang     UINT32                  AmlOffset;
201a9643ea8Slogwang 
202a9643ea8Slogwang 
203a9643ea8Slogwang     if (!Op)
204a9643ea8Slogwang     {
205a9643ea8Slogwang         AcpiOsPrintf ("There is no method currently executing\n");
206a9643ea8Slogwang         return;
207a9643ea8Slogwang     }
208a9643ea8Slogwang 
209a9643ea8Slogwang     /* Get and verify the breakpoint address */
210a9643ea8Slogwang 
211a9643ea8Slogwang     Address = strtoul (Location, NULL, 16);
212a9643ea8Slogwang     AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
213a9643ea8Slogwang         WalkState->ParserState.AmlStart);
214a9643ea8Slogwang     if (Address <= AmlOffset)
215a9643ea8Slogwang     {
216a9643ea8Slogwang         AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
217a9643ea8Slogwang             Address, AmlOffset);
218a9643ea8Slogwang     }
219a9643ea8Slogwang 
220a9643ea8Slogwang     /* Save breakpoint in current walk */
221a9643ea8Slogwang 
222a9643ea8Slogwang     WalkState->UserBreakpoint = Address;
223a9643ea8Slogwang     AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
224a9643ea8Slogwang }
225a9643ea8Slogwang 
226a9643ea8Slogwang 
227a9643ea8Slogwang /*******************************************************************************
228a9643ea8Slogwang  *
229a9643ea8Slogwang  * FUNCTION:    AcpiDbSetMethodCallBreakpoint
230a9643ea8Slogwang  *
231a9643ea8Slogwang  * PARAMETERS:  Op                  - Current Op (from parse walk)
232a9643ea8Slogwang  *
233a9643ea8Slogwang  * RETURN:      None
234a9643ea8Slogwang  *
235a9643ea8Slogwang  * DESCRIPTION: Set a breakpoint in a control method at the specified
236a9643ea8Slogwang  *              AML offset
237a9643ea8Slogwang  *
238a9643ea8Slogwang  ******************************************************************************/
239a9643ea8Slogwang 
240a9643ea8Slogwang void
AcpiDbSetMethodCallBreakpoint(ACPI_PARSE_OBJECT * Op)241a9643ea8Slogwang AcpiDbSetMethodCallBreakpoint (
242a9643ea8Slogwang     ACPI_PARSE_OBJECT       *Op)
243a9643ea8Slogwang {
244a9643ea8Slogwang 
245a9643ea8Slogwang 
246a9643ea8Slogwang     if (!Op)
247a9643ea8Slogwang     {
248a9643ea8Slogwang         AcpiOsPrintf ("There is no method currently executing\n");
249a9643ea8Slogwang         return;
250a9643ea8Slogwang     }
251a9643ea8Slogwang 
252a9643ea8Slogwang     AcpiGbl_StepToNextCall = TRUE;
253a9643ea8Slogwang }
254a9643ea8Slogwang 
255a9643ea8Slogwang 
256a9643ea8Slogwang /*******************************************************************************
257a9643ea8Slogwang  *
258a9643ea8Slogwang  * FUNCTION:    AcpiDbSetMethodData
259a9643ea8Slogwang  *
260a9643ea8Slogwang  * PARAMETERS:  TypeArg         - L for local, A for argument
261a9643ea8Slogwang  *              IndexArg        - which one
262a9643ea8Slogwang  *              ValueArg        - Value to set.
263a9643ea8Slogwang  *
264a9643ea8Slogwang  * RETURN:      None
265a9643ea8Slogwang  *
266a9643ea8Slogwang  * DESCRIPTION: Set a local or argument for the running control method.
267a9643ea8Slogwang  *              NOTE: only object supported is Number.
268a9643ea8Slogwang  *
269a9643ea8Slogwang  ******************************************************************************/
270a9643ea8Slogwang 
271a9643ea8Slogwang void
AcpiDbSetMethodData(char * TypeArg,char * IndexArg,char * ValueArg)272a9643ea8Slogwang AcpiDbSetMethodData (
273a9643ea8Slogwang     char                    *TypeArg,
274a9643ea8Slogwang     char                    *IndexArg,
275a9643ea8Slogwang     char                    *ValueArg)
276a9643ea8Slogwang {
277a9643ea8Slogwang     char                    Type;
278a9643ea8Slogwang     UINT32                  Index;
279a9643ea8Slogwang     UINT32                  Value;
280a9643ea8Slogwang     ACPI_WALK_STATE         *WalkState;
281a9643ea8Slogwang     ACPI_OPERAND_OBJECT     *ObjDesc;
282a9643ea8Slogwang     ACPI_STATUS             Status;
283a9643ea8Slogwang     ACPI_NAMESPACE_NODE     *Node;
284a9643ea8Slogwang 
285a9643ea8Slogwang 
286a9643ea8Slogwang     /* Validate TypeArg */
287a9643ea8Slogwang 
288a9643ea8Slogwang     AcpiUtStrupr (TypeArg);
289a9643ea8Slogwang     Type = TypeArg[0];
290a9643ea8Slogwang     if ((Type != 'L') &&
291a9643ea8Slogwang         (Type != 'A') &&
292a9643ea8Slogwang         (Type != 'N'))
293a9643ea8Slogwang     {
294a9643ea8Slogwang         AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
295a9643ea8Slogwang         return;
296a9643ea8Slogwang     }
297a9643ea8Slogwang 
298a9643ea8Slogwang     Value = strtoul (ValueArg, NULL, 16);
299a9643ea8Slogwang 
300a9643ea8Slogwang     if (Type == 'N')
301a9643ea8Slogwang     {
302a9643ea8Slogwang         Node = AcpiDbConvertToNode (IndexArg);
303a9643ea8Slogwang         if (!Node)
304a9643ea8Slogwang         {
305a9643ea8Slogwang             return;
306a9643ea8Slogwang         }
307a9643ea8Slogwang 
308a9643ea8Slogwang         if (Node->Type != ACPI_TYPE_INTEGER)
309a9643ea8Slogwang         {
310a9643ea8Slogwang             AcpiOsPrintf ("Can only set Integer nodes\n");
311a9643ea8Slogwang             return;
312a9643ea8Slogwang         }
313a9643ea8Slogwang         ObjDesc = Node->Object;
314a9643ea8Slogwang         ObjDesc->Integer.Value = Value;
315a9643ea8Slogwang         return;
316a9643ea8Slogwang     }
317a9643ea8Slogwang 
318a9643ea8Slogwang     /* Get the index and value */
319a9643ea8Slogwang 
320a9643ea8Slogwang     Index = strtoul (IndexArg, NULL, 16);
321a9643ea8Slogwang 
322a9643ea8Slogwang     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
323a9643ea8Slogwang     if (!WalkState)
324a9643ea8Slogwang     {
325a9643ea8Slogwang         AcpiOsPrintf ("There is no method currently executing\n");
326a9643ea8Slogwang         return;
327a9643ea8Slogwang     }
328a9643ea8Slogwang 
329a9643ea8Slogwang     /* Create and initialize the new object */
330a9643ea8Slogwang 
331a9643ea8Slogwang     ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
332a9643ea8Slogwang     if (!ObjDesc)
333a9643ea8Slogwang     {
334a9643ea8Slogwang         AcpiOsPrintf ("Could not create an internal object\n");
335a9643ea8Slogwang         return;
336a9643ea8Slogwang     }
337a9643ea8Slogwang 
338a9643ea8Slogwang     /* Store the new object into the target */
339a9643ea8Slogwang 
340a9643ea8Slogwang     switch (Type)
341a9643ea8Slogwang     {
342a9643ea8Slogwang     case 'A':
343a9643ea8Slogwang 
344a9643ea8Slogwang         /* Set a method argument */
345a9643ea8Slogwang 
346a9643ea8Slogwang         if (Index > ACPI_METHOD_MAX_ARG)
347a9643ea8Slogwang         {
348a9643ea8Slogwang             AcpiOsPrintf ("Arg%u - Invalid argument name\n",
349a9643ea8Slogwang                 Index);
350a9643ea8Slogwang             goto Cleanup;
351a9643ea8Slogwang         }
352a9643ea8Slogwang 
353a9643ea8Slogwang         Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG,
354a9643ea8Slogwang             Index, ObjDesc, WalkState);
355a9643ea8Slogwang         if (ACPI_FAILURE (Status))
356a9643ea8Slogwang         {
357a9643ea8Slogwang             goto Cleanup;
358a9643ea8Slogwang         }
359a9643ea8Slogwang 
360a9643ea8Slogwang         ObjDesc = WalkState->Arguments[Index].Object;
361a9643ea8Slogwang 
362a9643ea8Slogwang         AcpiOsPrintf ("Arg%u: ", Index);
363a9643ea8Slogwang         AcpiDbDisplayInternalObject (ObjDesc, WalkState);
364a9643ea8Slogwang         break;
365a9643ea8Slogwang 
366a9643ea8Slogwang     case 'L':
367a9643ea8Slogwang 
368a9643ea8Slogwang         /* Set a method local */
369a9643ea8Slogwang 
370a9643ea8Slogwang         if (Index > ACPI_METHOD_MAX_LOCAL)
371a9643ea8Slogwang         {
372a9643ea8Slogwang             AcpiOsPrintf ("Local%u - Invalid local variable name\n",
373a9643ea8Slogwang                 Index);
374a9643ea8Slogwang             goto Cleanup;
375a9643ea8Slogwang         }
376a9643ea8Slogwang 
377a9643ea8Slogwang         Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL,
378a9643ea8Slogwang             Index, ObjDesc, WalkState);
379a9643ea8Slogwang         if (ACPI_FAILURE (Status))
380a9643ea8Slogwang         {
381a9643ea8Slogwang             goto Cleanup;
382a9643ea8Slogwang         }
383a9643ea8Slogwang 
384a9643ea8Slogwang         ObjDesc = WalkState->LocalVariables[Index].Object;
385a9643ea8Slogwang 
386a9643ea8Slogwang         AcpiOsPrintf ("Local%u: ", Index);
387a9643ea8Slogwang         AcpiDbDisplayInternalObject (ObjDesc, WalkState);
388a9643ea8Slogwang         break;
389a9643ea8Slogwang 
390a9643ea8Slogwang     default:
391a9643ea8Slogwang 
392a9643ea8Slogwang         break;
393a9643ea8Slogwang     }
394a9643ea8Slogwang 
395a9643ea8Slogwang Cleanup:
396a9643ea8Slogwang     AcpiUtRemoveReference (ObjDesc);
397a9643ea8Slogwang }
398a9643ea8Slogwang 
399a9643ea8Slogwang 
400*22ce4affSfengbojiang #ifdef ACPI_DISASSEMBLER
401a9643ea8Slogwang /*******************************************************************************
402a9643ea8Slogwang  *
403a9643ea8Slogwang  * FUNCTION:    AcpiDbDisassembleAml
404a9643ea8Slogwang  *
405a9643ea8Slogwang  * PARAMETERS:  Statements          - Number of statements to disassemble
406a9643ea8Slogwang  *              Op                  - Current Op (from parse walk)
407a9643ea8Slogwang  *
408a9643ea8Slogwang  * RETURN:      None
409a9643ea8Slogwang  *
410a9643ea8Slogwang  * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
411a9643ea8Slogwang  *              of statements specified.
412a9643ea8Slogwang  *
413a9643ea8Slogwang  ******************************************************************************/
414a9643ea8Slogwang 
415a9643ea8Slogwang void
AcpiDbDisassembleAml(char * Statements,ACPI_PARSE_OBJECT * Op)416a9643ea8Slogwang AcpiDbDisassembleAml (
417a9643ea8Slogwang     char                    *Statements,
418a9643ea8Slogwang     ACPI_PARSE_OBJECT       *Op)
419a9643ea8Slogwang {
420a9643ea8Slogwang     UINT32                  NumStatements = 8;
421a9643ea8Slogwang 
422a9643ea8Slogwang 
423a9643ea8Slogwang     if (!Op)
424a9643ea8Slogwang     {
425a9643ea8Slogwang         AcpiOsPrintf ("There is no method currently executing\n");
426a9643ea8Slogwang         return;
427a9643ea8Slogwang     }
428a9643ea8Slogwang 
429a9643ea8Slogwang     if (Statements)
430a9643ea8Slogwang     {
431a9643ea8Slogwang         NumStatements = strtoul (Statements, NULL, 0);
432a9643ea8Slogwang     }
433a9643ea8Slogwang 
434a9643ea8Slogwang     AcpiDmDisassemble (NULL, Op, NumStatements);
435a9643ea8Slogwang }
436a9643ea8Slogwang 
437a9643ea8Slogwang 
438a9643ea8Slogwang /*******************************************************************************
439a9643ea8Slogwang  *
440a9643ea8Slogwang  * FUNCTION:    AcpiDbDisassembleMethod
441a9643ea8Slogwang  *
442a9643ea8Slogwang  * PARAMETERS:  Name            - Name of control method
443a9643ea8Slogwang  *
444a9643ea8Slogwang  * RETURN:      None
445a9643ea8Slogwang  *
446a9643ea8Slogwang  * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
447a9643ea8Slogwang  *              of statements specified.
448a9643ea8Slogwang  *
449a9643ea8Slogwang  ******************************************************************************/
450a9643ea8Slogwang 
451a9643ea8Slogwang ACPI_STATUS
AcpiDbDisassembleMethod(char * Name)452a9643ea8Slogwang AcpiDbDisassembleMethod (
453a9643ea8Slogwang     char                    *Name)
454a9643ea8Slogwang {
455a9643ea8Slogwang     ACPI_STATUS             Status;
456a9643ea8Slogwang     ACPI_PARSE_OBJECT       *Op;
457a9643ea8Slogwang     ACPI_WALK_STATE         *WalkState;
458a9643ea8Slogwang     ACPI_OPERAND_OBJECT     *ObjDesc;
459a9643ea8Slogwang     ACPI_NAMESPACE_NODE     *Method;
460a9643ea8Slogwang 
461a9643ea8Slogwang 
462a9643ea8Slogwang     Method = AcpiDbConvertToNode (Name);
463a9643ea8Slogwang     if (!Method)
464a9643ea8Slogwang     {
465a9643ea8Slogwang         return (AE_BAD_PARAMETER);
466a9643ea8Slogwang     }
467a9643ea8Slogwang 
468a9643ea8Slogwang     if (Method->Type != ACPI_TYPE_METHOD)
469a9643ea8Slogwang     {
470a9643ea8Slogwang         ACPI_ERROR ((AE_INFO, "%s (%s): Object must be a control method",
471a9643ea8Slogwang             Name, AcpiUtGetTypeName (Method->Type)));
472a9643ea8Slogwang         return (AE_BAD_PARAMETER);
473a9643ea8Slogwang     }
474a9643ea8Slogwang 
475a9643ea8Slogwang     ObjDesc = Method->Object;
476a9643ea8Slogwang 
477a9643ea8Slogwang     Op = AcpiPsCreateScopeOp (ObjDesc->Method.AmlStart);
478a9643ea8Slogwang     if (!Op)
479a9643ea8Slogwang     {
480a9643ea8Slogwang         return (AE_NO_MEMORY);
481a9643ea8Slogwang     }
482a9643ea8Slogwang 
483a9643ea8Slogwang     /* Create and initialize a new walk state */
484a9643ea8Slogwang 
485a9643ea8Slogwang     WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
486a9643ea8Slogwang     if (!WalkState)
487a9643ea8Slogwang     {
488a9643ea8Slogwang         return (AE_NO_MEMORY);
489a9643ea8Slogwang     }
490a9643ea8Slogwang 
491a9643ea8Slogwang     Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
492a9643ea8Slogwang         ObjDesc->Method.AmlStart,
493a9643ea8Slogwang         ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
494a9643ea8Slogwang     if (ACPI_FAILURE (Status))
495a9643ea8Slogwang     {
496a9643ea8Slogwang         return (Status);
497a9643ea8Slogwang     }
498a9643ea8Slogwang 
499a9643ea8Slogwang     Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
500*22ce4affSfengbojiang     if (ACPI_FAILURE(Status))
501*22ce4affSfengbojiang     {
502*22ce4affSfengbojiang         return (Status);
503*22ce4affSfengbojiang     }
504*22ce4affSfengbojiang 
505a9643ea8Slogwang     WalkState->OwnerId = ObjDesc->Method.OwnerId;
506a9643ea8Slogwang 
507a9643ea8Slogwang     /* Push start scope on scope stack and make it current */
508a9643ea8Slogwang 
509a9643ea8Slogwang     Status = AcpiDsScopeStackPush (Method,
510a9643ea8Slogwang         Method->Type, WalkState);
511a9643ea8Slogwang     if (ACPI_FAILURE (Status))
512a9643ea8Slogwang     {
513a9643ea8Slogwang         return (Status);
514a9643ea8Slogwang     }
515a9643ea8Slogwang 
516a9643ea8Slogwang     /* Parse the entire method AML including deferred operators */
517a9643ea8Slogwang 
518a9643ea8Slogwang     WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
519a9643ea8Slogwang     WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
520a9643ea8Slogwang 
521a9643ea8Slogwang     Status = AcpiPsParseAml (WalkState);
522*22ce4affSfengbojiang     if (ACPI_FAILURE(Status))
523*22ce4affSfengbojiang     {
524*22ce4affSfengbojiang         return (Status);
525*22ce4affSfengbojiang     }
526a9643ea8Slogwang 
527a9643ea8Slogwang     (void) AcpiDmParseDeferredOps (Op);
528a9643ea8Slogwang 
529a9643ea8Slogwang     /* Now we can disassemble the method */
530a9643ea8Slogwang 
531a9643ea8Slogwang     AcpiGbl_DmOpt_Verbose = FALSE;
532a9643ea8Slogwang     AcpiDmDisassemble (NULL, Op, 0);
533a9643ea8Slogwang     AcpiGbl_DmOpt_Verbose = TRUE;
534a9643ea8Slogwang 
535a9643ea8Slogwang     AcpiPsDeleteParseTree (Op);
536a9643ea8Slogwang 
537a9643ea8Slogwang     /* Method cleanup */
538a9643ea8Slogwang 
539a9643ea8Slogwang     AcpiNsDeleteNamespaceSubtree (Method);
540a9643ea8Slogwang     AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId);
541a9643ea8Slogwang     AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId);
542a9643ea8Slogwang     return (AE_OK);
543a9643ea8Slogwang }
544*22ce4affSfengbojiang #endif
545*22ce4affSfengbojiang 
546*22ce4affSfengbojiang 
547*22ce4affSfengbojiang /*******************************************************************************
548*22ce4affSfengbojiang  *
549*22ce4affSfengbojiang  * FUNCTION:    AcpiDbEvaluateObject
550*22ce4affSfengbojiang  *
551*22ce4affSfengbojiang  * PARAMETERS:  Node                - Namespace node for the object
552*22ce4affSfengbojiang  *
553*22ce4affSfengbojiang  * RETURN:      Status
554*22ce4affSfengbojiang  *
555*22ce4affSfengbojiang  * DESCRIPTION: Main execution function for the Evaluate/Execute/All debugger
556*22ce4affSfengbojiang  *              commands.
557*22ce4affSfengbojiang  *
558*22ce4affSfengbojiang  ******************************************************************************/
559*22ce4affSfengbojiang 
560*22ce4affSfengbojiang static ACPI_STATUS
AcpiDbEvaluateObject(ACPI_NAMESPACE_NODE * Node)561*22ce4affSfengbojiang AcpiDbEvaluateObject (
562*22ce4affSfengbojiang     ACPI_NAMESPACE_NODE     *Node)
563*22ce4affSfengbojiang {
564*22ce4affSfengbojiang     char                    *Pathname;
565*22ce4affSfengbojiang     UINT32                  i;
566*22ce4affSfengbojiang     ACPI_DEVICE_INFO        *ObjInfo;
567*22ce4affSfengbojiang     ACPI_OBJECT_LIST        ParamObjects;
568*22ce4affSfengbojiang     ACPI_OBJECT             Params[ACPI_METHOD_NUM_ARGS];
569*22ce4affSfengbojiang     ACPI_BUFFER             ReturnObj;
570*22ce4affSfengbojiang     ACPI_STATUS             Status;
571*22ce4affSfengbojiang 
572*22ce4affSfengbojiang 
573*22ce4affSfengbojiang     Pathname = AcpiNsGetExternalPathname (Node);
574*22ce4affSfengbojiang     if (!Pathname)
575*22ce4affSfengbojiang     {
576*22ce4affSfengbojiang         return (AE_OK);
577*22ce4affSfengbojiang     }
578*22ce4affSfengbojiang 
579*22ce4affSfengbojiang     /* Get the object info for number of method parameters */
580*22ce4affSfengbojiang 
581*22ce4affSfengbojiang     Status = AcpiGetObjectInfo (Node, &ObjInfo);
582*22ce4affSfengbojiang     if (ACPI_FAILURE (Status))
583*22ce4affSfengbojiang     {
584*22ce4affSfengbojiang         ACPI_FREE (Pathname);
585*22ce4affSfengbojiang         return (Status);
586*22ce4affSfengbojiang     }
587*22ce4affSfengbojiang 
588*22ce4affSfengbojiang     ParamObjects.Pointer = NULL;
589*22ce4affSfengbojiang     ParamObjects.Count   = 0;
590*22ce4affSfengbojiang 
591*22ce4affSfengbojiang     if (ObjInfo->Type == ACPI_TYPE_METHOD)
592*22ce4affSfengbojiang     {
593*22ce4affSfengbojiang         /* Setup default parameters */
594*22ce4affSfengbojiang 
595*22ce4affSfengbojiang         for (i = 0; i < ObjInfo->ParamCount; i++)
596*22ce4affSfengbojiang         {
597*22ce4affSfengbojiang             Params[i].Type           = ACPI_TYPE_INTEGER;
598*22ce4affSfengbojiang             Params[i].Integer.Value  = 1;
599*22ce4affSfengbojiang         }
600*22ce4affSfengbojiang 
601*22ce4affSfengbojiang         ParamObjects.Pointer     = Params;
602*22ce4affSfengbojiang         ParamObjects.Count       = ObjInfo->ParamCount;
603*22ce4affSfengbojiang     }
604*22ce4affSfengbojiang 
605*22ce4affSfengbojiang     ACPI_FREE (ObjInfo);
606*22ce4affSfengbojiang     ReturnObj.Pointer = NULL;
607*22ce4affSfengbojiang     ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
608*22ce4affSfengbojiang 
609*22ce4affSfengbojiang     /* Do the actual method execution */
610*22ce4affSfengbojiang 
611*22ce4affSfengbojiang     AcpiGbl_MethodExecuting = TRUE;
612*22ce4affSfengbojiang 
613*22ce4affSfengbojiang     Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
614*22ce4affSfengbojiang     AcpiGbl_MethodExecuting = FALSE;
615*22ce4affSfengbojiang 
616*22ce4affSfengbojiang     AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
617*22ce4affSfengbojiang     if (ReturnObj.Length)
618*22ce4affSfengbojiang     {
619*22ce4affSfengbojiang         AcpiOsPrintf ("Evaluation of %s returned object %p, "
620*22ce4affSfengbojiang             "external buffer length %X\n",
621*22ce4affSfengbojiang             Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length);
622*22ce4affSfengbojiang 
623*22ce4affSfengbojiang         AcpiDbDumpExternalObject (ReturnObj.Pointer, 1);
624*22ce4affSfengbojiang         AcpiOsPrintf ("\n");
625*22ce4affSfengbojiang     }
626*22ce4affSfengbojiang 
627*22ce4affSfengbojiang     ACPI_FREE (Pathname);
628*22ce4affSfengbojiang 
629*22ce4affSfengbojiang     /* Ignore status from method execution */
630*22ce4affSfengbojiang 
631*22ce4affSfengbojiang     return (AE_OK);
632*22ce4affSfengbojiang 
633*22ce4affSfengbojiang     /* Update count, check if we have executed enough methods */
634*22ce4affSfengbojiang 
635*22ce4affSfengbojiang }
636*22ce4affSfengbojiang 
637*22ce4affSfengbojiang /*******************************************************************************
638*22ce4affSfengbojiang  *
639*22ce4affSfengbojiang  * FUNCTION:    AcpiDbWalkForExecute
640*22ce4affSfengbojiang  *
641*22ce4affSfengbojiang  * PARAMETERS:  Callback from WalkNamespace
642*22ce4affSfengbojiang  *
643*22ce4affSfengbojiang  * RETURN:      Status
644*22ce4affSfengbojiang  *
645*22ce4affSfengbojiang  * DESCRIPTION: Batch execution function. Evaluates all "predefined" objects --
646*22ce4affSfengbojiang  *              the nameseg begins with an underscore.
647*22ce4affSfengbojiang  *
648*22ce4affSfengbojiang  ******************************************************************************/
649*22ce4affSfengbojiang 
650*22ce4affSfengbojiang static ACPI_STATUS
AcpiDbWalkForExecute(ACPI_HANDLE ObjHandle,UINT32 NestingLevel,void * Context,void ** ReturnValue)651*22ce4affSfengbojiang AcpiDbWalkForExecute (
652*22ce4affSfengbojiang     ACPI_HANDLE             ObjHandle,
653*22ce4affSfengbojiang     UINT32                  NestingLevel,
654*22ce4affSfengbojiang     void                    *Context,
655*22ce4affSfengbojiang     void                    **ReturnValue)
656*22ce4affSfengbojiang {
657*22ce4affSfengbojiang     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
658*22ce4affSfengbojiang     ACPI_DB_EXECUTE_WALK    *Info = (ACPI_DB_EXECUTE_WALK *) Context;
659*22ce4affSfengbojiang     ACPI_STATUS             Status;
660*22ce4affSfengbojiang     const ACPI_PREDEFINED_INFO *Predefined;
661*22ce4affSfengbojiang 
662*22ce4affSfengbojiang 
663*22ce4affSfengbojiang     Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
664*22ce4affSfengbojiang     if (!Predefined)
665*22ce4affSfengbojiang     {
666*22ce4affSfengbojiang         return (AE_OK);
667*22ce4affSfengbojiang     }
668*22ce4affSfengbojiang 
669*22ce4affSfengbojiang     if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
670*22ce4affSfengbojiang     {
671*22ce4affSfengbojiang         return (AE_OK);
672*22ce4affSfengbojiang     }
673*22ce4affSfengbojiang 
674*22ce4affSfengbojiang     AcpiDbEvaluateObject (Node);
675*22ce4affSfengbojiang 
676*22ce4affSfengbojiang     /* Ignore status from object evaluation */
677*22ce4affSfengbojiang 
678*22ce4affSfengbojiang     Status = AE_OK;
679*22ce4affSfengbojiang 
680*22ce4affSfengbojiang     /* Update count, check if we have executed enough methods */
681*22ce4affSfengbojiang 
682*22ce4affSfengbojiang     Info->Count++;
683*22ce4affSfengbojiang     if (Info->Count >= Info->MaxCount)
684*22ce4affSfengbojiang     {
685*22ce4affSfengbojiang         Status = AE_CTRL_TERMINATE;
686*22ce4affSfengbojiang     }
687*22ce4affSfengbojiang 
688*22ce4affSfengbojiang     return (Status);
689*22ce4affSfengbojiang }
690*22ce4affSfengbojiang 
691*22ce4affSfengbojiang 
692*22ce4affSfengbojiang /*******************************************************************************
693*22ce4affSfengbojiang  *
694*22ce4affSfengbojiang  * FUNCTION:    AcpiDbWalkForExecuteAll
695*22ce4affSfengbojiang  *
696*22ce4affSfengbojiang  * PARAMETERS:  Callback from WalkNamespace
697*22ce4affSfengbojiang  *
698*22ce4affSfengbojiang  * RETURN:      Status
699*22ce4affSfengbojiang  *
700*22ce4affSfengbojiang  * DESCRIPTION: Batch execution function. Evaluates all objects whose path ends
701*22ce4affSfengbojiang  *              with the nameseg "Info->NameSeg". Used for the "ALL" command.
702*22ce4affSfengbojiang  *
703*22ce4affSfengbojiang  ******************************************************************************/
704*22ce4affSfengbojiang 
705*22ce4affSfengbojiang static ACPI_STATUS
AcpiDbWalkForExecuteAll(ACPI_HANDLE ObjHandle,UINT32 NestingLevel,void * Context,void ** ReturnValue)706*22ce4affSfengbojiang AcpiDbWalkForExecuteAll (
707*22ce4affSfengbojiang     ACPI_HANDLE             ObjHandle,
708*22ce4affSfengbojiang     UINT32                  NestingLevel,
709*22ce4affSfengbojiang     void                    *Context,
710*22ce4affSfengbojiang     void                    **ReturnValue)
711*22ce4affSfengbojiang {
712*22ce4affSfengbojiang     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
713*22ce4affSfengbojiang     ACPI_DB_EXECUTE_WALK    *Info = (ACPI_DB_EXECUTE_WALK *) Context;
714*22ce4affSfengbojiang     ACPI_STATUS             Status;
715*22ce4affSfengbojiang 
716*22ce4affSfengbojiang 
717*22ce4affSfengbojiang     if (!ACPI_COMPARE_NAMESEG (Node->Name.Ascii, Info->NameSeg))
718*22ce4affSfengbojiang     {
719*22ce4affSfengbojiang         return (AE_OK);
720*22ce4affSfengbojiang     }
721*22ce4affSfengbojiang 
722*22ce4affSfengbojiang     if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
723*22ce4affSfengbojiang     {
724*22ce4affSfengbojiang         return (AE_OK);
725*22ce4affSfengbojiang     }
726*22ce4affSfengbojiang 
727*22ce4affSfengbojiang     /* Now evaluate the input object (node) */
728*22ce4affSfengbojiang 
729*22ce4affSfengbojiang     AcpiDbEvaluateObject (Node);
730*22ce4affSfengbojiang 
731*22ce4affSfengbojiang     /* Ignore status from method execution */
732*22ce4affSfengbojiang 
733*22ce4affSfengbojiang     Status = AE_OK;
734*22ce4affSfengbojiang 
735*22ce4affSfengbojiang     /* Update count of executed methods/objects */
736*22ce4affSfengbojiang 
737*22ce4affSfengbojiang     Info->Count++;
738*22ce4affSfengbojiang     return (Status);
739*22ce4affSfengbojiang }
740*22ce4affSfengbojiang 
741*22ce4affSfengbojiang 
742*22ce4affSfengbojiang /*******************************************************************************
743*22ce4affSfengbojiang  *
744*22ce4affSfengbojiang  * FUNCTION:    AcpiDbEvaluatePredefinedNames
745*22ce4affSfengbojiang  *
746*22ce4affSfengbojiang  * PARAMETERS:  None
747*22ce4affSfengbojiang  *
748*22ce4affSfengbojiang  * RETURN:      None
749*22ce4affSfengbojiang  *
750*22ce4affSfengbojiang  * DESCRIPTION: Namespace batch execution. Execute predefined names in the
751*22ce4affSfengbojiang  *              namespace, up to the max count, if specified.
752*22ce4affSfengbojiang  *
753*22ce4affSfengbojiang  ******************************************************************************/
754*22ce4affSfengbojiang 
755*22ce4affSfengbojiang void
AcpiDbEvaluatePredefinedNames(void)756*22ce4affSfengbojiang AcpiDbEvaluatePredefinedNames (
757*22ce4affSfengbojiang     void)
758*22ce4affSfengbojiang {
759*22ce4affSfengbojiang     ACPI_DB_EXECUTE_WALK    Info;
760*22ce4affSfengbojiang 
761*22ce4affSfengbojiang 
762*22ce4affSfengbojiang     Info.Count = 0;
763*22ce4affSfengbojiang     Info.MaxCount = ACPI_UINT32_MAX;
764*22ce4affSfengbojiang 
765*22ce4affSfengbojiang     /* Search all nodes in namespace */
766*22ce4affSfengbojiang 
767*22ce4affSfengbojiang     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
768*22ce4affSfengbojiang                 AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
769*22ce4affSfengbojiang 
770*22ce4affSfengbojiang     AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count);
771*22ce4affSfengbojiang }
772*22ce4affSfengbojiang 
773*22ce4affSfengbojiang 
774*22ce4affSfengbojiang /*******************************************************************************
775*22ce4affSfengbojiang  *
776*22ce4affSfengbojiang  * FUNCTION:    AcpiDbEvaluateAll
777*22ce4affSfengbojiang  *
778*22ce4affSfengbojiang  * PARAMETERS:  NoneAcpiGbl_DbMethodInfo
779*22ce4affSfengbojiang  *
780*22ce4affSfengbojiang  * RETURN:      None
781*22ce4affSfengbojiang  *
782*22ce4affSfengbojiang  * DESCRIPTION: Namespace batch execution. Implements the "ALL" command.
783*22ce4affSfengbojiang  *              Execute all namepaths whose final nameseg matches the
784*22ce4affSfengbojiang  *              input nameseg.
785*22ce4affSfengbojiang  *
786*22ce4affSfengbojiang  ******************************************************************************/
787*22ce4affSfengbojiang 
788*22ce4affSfengbojiang void
AcpiDbEvaluateAll(char * NameSeg)789*22ce4affSfengbojiang AcpiDbEvaluateAll (
790*22ce4affSfengbojiang     char                    *NameSeg)
791*22ce4affSfengbojiang {
792*22ce4affSfengbojiang     ACPI_DB_EXECUTE_WALK    Info;
793*22ce4affSfengbojiang 
794*22ce4affSfengbojiang 
795*22ce4affSfengbojiang     Info.Count = 0;
796*22ce4affSfengbojiang     Info.MaxCount = ACPI_UINT32_MAX;
797*22ce4affSfengbojiang     ACPI_COPY_NAMESEG (Info.NameSeg, NameSeg);
798*22ce4affSfengbojiang     Info.NameSeg[ACPI_NAMESEG_SIZE] = 0;
799*22ce4affSfengbojiang 
800*22ce4affSfengbojiang     /* Search all nodes in namespace */
801*22ce4affSfengbojiang 
802*22ce4affSfengbojiang     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
803*22ce4affSfengbojiang                 AcpiDbWalkForExecuteAll, NULL, (void *) &Info, NULL);
804*22ce4affSfengbojiang 
805*22ce4affSfengbojiang     AcpiOsPrintf ("Evaluated %u names in the namespace\n", Info.Count);
806*22ce4affSfengbojiang }
807