dbmethod.c revision 1.13 1 1.1 jruoho /*******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: dbmethod - Debug commands for control methods
4 1.1 jruoho *
5 1.1 jruoho ******************************************************************************/
6 1.1 jruoho
7 1.1 jruoho /*
8 1.12 christos * Copyright (C) 2000 - 2019, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1 jruoho * modification, are permitted provided that the following conditions
13 1.1 jruoho * are met:
14 1.1 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1 jruoho * without modification.
17 1.1 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1 jruoho * binary redistribution.
22 1.1 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1 jruoho * from this software without specific prior written permission.
25 1.1 jruoho *
26 1.1 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1 jruoho * Software Foundation.
29 1.1 jruoho *
30 1.1 jruoho * NO WARRANTY
31 1.1 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1 jruoho */
43 1.1 jruoho
44 1.1 jruoho #include "acpi.h"
45 1.1 jruoho #include "accommon.h"
46 1.1 jruoho #include "acdispat.h"
47 1.1 jruoho #include "acnamesp.h"
48 1.1 jruoho #include "acdebug.h"
49 1.1 jruoho #include "acparser.h"
50 1.2 christos #include "acpredef.h"
51 1.1 jruoho
52 1.1 jruoho
53 1.1 jruoho #define _COMPONENT ACPI_CA_DEBUGGER
54 1.1 jruoho ACPI_MODULE_NAME ("dbmethod")
55 1.1 jruoho
56 1.7 christos /* Local prototypes */
57 1.7 christos
58 1.7 christos static ACPI_STATUS
59 1.7 christos AcpiDbWalkForExecute (
60 1.7 christos ACPI_HANDLE ObjHandle,
61 1.7 christos UINT32 NestingLevel,
62 1.7 christos void *Context,
63 1.7 christos void **ReturnValue);
64 1.7 christos
65 1.1 jruoho
66 1.1 jruoho /*******************************************************************************
67 1.1 jruoho *
68 1.1 jruoho * FUNCTION: AcpiDbSetMethodBreakpoint
69 1.1 jruoho *
70 1.1 jruoho * PARAMETERS: Location - AML offset of breakpoint
71 1.1 jruoho * WalkState - Current walk info
72 1.1 jruoho * Op - Current Op (from parse walk)
73 1.1 jruoho *
74 1.1 jruoho * RETURN: None
75 1.1 jruoho *
76 1.1 jruoho * DESCRIPTION: Set a breakpoint in a control method at the specified
77 1.1 jruoho * AML offset
78 1.1 jruoho *
79 1.1 jruoho ******************************************************************************/
80 1.1 jruoho
81 1.1 jruoho void
82 1.1 jruoho AcpiDbSetMethodBreakpoint (
83 1.1 jruoho char *Location,
84 1.1 jruoho ACPI_WALK_STATE *WalkState,
85 1.1 jruoho ACPI_PARSE_OBJECT *Op)
86 1.1 jruoho {
87 1.1 jruoho UINT32 Address;
88 1.5 christos UINT32 AmlOffset;
89 1.1 jruoho
90 1.1 jruoho
91 1.1 jruoho if (!Op)
92 1.1 jruoho {
93 1.1 jruoho AcpiOsPrintf ("There is no method currently executing\n");
94 1.1 jruoho return;
95 1.1 jruoho }
96 1.1 jruoho
97 1.1 jruoho /* Get and verify the breakpoint address */
98 1.1 jruoho
99 1.5 christos Address = strtoul (Location, NULL, 16);
100 1.5 christos AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
101 1.6 christos WalkState->ParserState.AmlStart);
102 1.5 christos if (Address <= AmlOffset)
103 1.1 jruoho {
104 1.1 jruoho AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
105 1.5 christos Address, AmlOffset);
106 1.1 jruoho }
107 1.1 jruoho
108 1.1 jruoho /* Save breakpoint in current walk */
109 1.1 jruoho
110 1.1 jruoho WalkState->UserBreakpoint = Address;
111 1.1 jruoho AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
112 1.1 jruoho }
113 1.1 jruoho
114 1.1 jruoho
115 1.1 jruoho /*******************************************************************************
116 1.1 jruoho *
117 1.1 jruoho * FUNCTION: AcpiDbSetMethodCallBreakpoint
118 1.1 jruoho *
119 1.1 jruoho * PARAMETERS: Op - Current Op (from parse walk)
120 1.1 jruoho *
121 1.1 jruoho * RETURN: None
122 1.1 jruoho *
123 1.1 jruoho * DESCRIPTION: Set a breakpoint in a control method at the specified
124 1.1 jruoho * AML offset
125 1.1 jruoho *
126 1.1 jruoho ******************************************************************************/
127 1.1 jruoho
128 1.1 jruoho void
129 1.1 jruoho AcpiDbSetMethodCallBreakpoint (
130 1.1 jruoho ACPI_PARSE_OBJECT *Op)
131 1.1 jruoho {
132 1.1 jruoho
133 1.1 jruoho
134 1.1 jruoho if (!Op)
135 1.1 jruoho {
136 1.1 jruoho AcpiOsPrintf ("There is no method currently executing\n");
137 1.1 jruoho return;
138 1.1 jruoho }
139 1.1 jruoho
140 1.1 jruoho AcpiGbl_StepToNextCall = TRUE;
141 1.1 jruoho }
142 1.1 jruoho
143 1.1 jruoho
144 1.1 jruoho /*******************************************************************************
145 1.1 jruoho *
146 1.1 jruoho * FUNCTION: AcpiDbSetMethodData
147 1.1 jruoho *
148 1.1 jruoho * PARAMETERS: TypeArg - L for local, A for argument
149 1.1 jruoho * IndexArg - which one
150 1.1 jruoho * ValueArg - Value to set.
151 1.1 jruoho *
152 1.1 jruoho * RETURN: None
153 1.1 jruoho *
154 1.1 jruoho * DESCRIPTION: Set a local or argument for the running control method.
155 1.1 jruoho * NOTE: only object supported is Number.
156 1.1 jruoho *
157 1.1 jruoho ******************************************************************************/
158 1.1 jruoho
159 1.1 jruoho void
160 1.1 jruoho AcpiDbSetMethodData (
161 1.1 jruoho char *TypeArg,
162 1.1 jruoho char *IndexArg,
163 1.1 jruoho char *ValueArg)
164 1.1 jruoho {
165 1.1 jruoho char Type;
166 1.1 jruoho UINT32 Index;
167 1.1 jruoho UINT32 Value;
168 1.1 jruoho ACPI_WALK_STATE *WalkState;
169 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
170 1.1 jruoho ACPI_STATUS Status;
171 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
172 1.1 jruoho
173 1.1 jruoho
174 1.1 jruoho /* Validate TypeArg */
175 1.1 jruoho
176 1.1 jruoho AcpiUtStrupr (TypeArg);
177 1.1 jruoho Type = TypeArg[0];
178 1.1 jruoho if ((Type != 'L') &&
179 1.1 jruoho (Type != 'A') &&
180 1.1 jruoho (Type != 'N'))
181 1.1 jruoho {
182 1.1 jruoho AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
183 1.1 jruoho return;
184 1.1 jruoho }
185 1.1 jruoho
186 1.5 christos Value = strtoul (ValueArg, NULL, 16);
187 1.1 jruoho
188 1.1 jruoho if (Type == 'N')
189 1.1 jruoho {
190 1.1 jruoho Node = AcpiDbConvertToNode (IndexArg);
191 1.3 christos if (!Node)
192 1.3 christos {
193 1.3 christos return;
194 1.3 christos }
195 1.3 christos
196 1.1 jruoho if (Node->Type != ACPI_TYPE_INTEGER)
197 1.1 jruoho {
198 1.1 jruoho AcpiOsPrintf ("Can only set Integer nodes\n");
199 1.1 jruoho return;
200 1.1 jruoho }
201 1.1 jruoho ObjDesc = Node->Object;
202 1.1 jruoho ObjDesc->Integer.Value = Value;
203 1.1 jruoho return;
204 1.1 jruoho }
205 1.1 jruoho
206 1.1 jruoho /* Get the index and value */
207 1.1 jruoho
208 1.5 christos Index = strtoul (IndexArg, NULL, 16);
209 1.1 jruoho
210 1.1 jruoho WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
211 1.1 jruoho if (!WalkState)
212 1.1 jruoho {
213 1.1 jruoho AcpiOsPrintf ("There is no method currently executing\n");
214 1.1 jruoho return;
215 1.1 jruoho }
216 1.1 jruoho
217 1.1 jruoho /* Create and initialize the new object */
218 1.1 jruoho
219 1.1 jruoho ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
220 1.1 jruoho if (!ObjDesc)
221 1.1 jruoho {
222 1.1 jruoho AcpiOsPrintf ("Could not create an internal object\n");
223 1.1 jruoho return;
224 1.1 jruoho }
225 1.1 jruoho
226 1.1 jruoho /* Store the new object into the target */
227 1.1 jruoho
228 1.1 jruoho switch (Type)
229 1.1 jruoho {
230 1.1 jruoho case 'A':
231 1.1 jruoho
232 1.1 jruoho /* Set a method argument */
233 1.1 jruoho
234 1.1 jruoho if (Index > ACPI_METHOD_MAX_ARG)
235 1.1 jruoho {
236 1.6 christos AcpiOsPrintf ("Arg%u - Invalid argument name\n",
237 1.6 christos Index);
238 1.1 jruoho goto Cleanup;
239 1.1 jruoho }
240 1.1 jruoho
241 1.6 christos Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG,
242 1.6 christos Index, ObjDesc, WalkState);
243 1.1 jruoho if (ACPI_FAILURE (Status))
244 1.1 jruoho {
245 1.1 jruoho goto Cleanup;
246 1.1 jruoho }
247 1.1 jruoho
248 1.1 jruoho ObjDesc = WalkState->Arguments[Index].Object;
249 1.1 jruoho
250 1.1 jruoho AcpiOsPrintf ("Arg%u: ", Index);
251 1.5 christos AcpiDbDisplayInternalObject (ObjDesc, WalkState);
252 1.1 jruoho break;
253 1.1 jruoho
254 1.1 jruoho case 'L':
255 1.1 jruoho
256 1.1 jruoho /* Set a method local */
257 1.1 jruoho
258 1.1 jruoho if (Index > ACPI_METHOD_MAX_LOCAL)
259 1.1 jruoho {
260 1.6 christos AcpiOsPrintf ("Local%u - Invalid local variable name\n",
261 1.6 christos Index);
262 1.1 jruoho goto Cleanup;
263 1.1 jruoho }
264 1.1 jruoho
265 1.6 christos Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL,
266 1.6 christos Index, ObjDesc, WalkState);
267 1.1 jruoho if (ACPI_FAILURE (Status))
268 1.1 jruoho {
269 1.1 jruoho goto Cleanup;
270 1.1 jruoho }
271 1.1 jruoho
272 1.1 jruoho ObjDesc = WalkState->LocalVariables[Index].Object;
273 1.1 jruoho
274 1.1 jruoho AcpiOsPrintf ("Local%u: ", Index);
275 1.5 christos AcpiDbDisplayInternalObject (ObjDesc, WalkState);
276 1.1 jruoho break;
277 1.1 jruoho
278 1.1 jruoho default:
279 1.2 christos
280 1.1 jruoho break;
281 1.1 jruoho }
282 1.1 jruoho
283 1.1 jruoho Cleanup:
284 1.1 jruoho AcpiUtRemoveReference (ObjDesc);
285 1.1 jruoho }
286 1.1 jruoho
287 1.1 jruoho
288 1.11 christos #ifdef ACPI_DISASSEMBLER
289 1.1 jruoho /*******************************************************************************
290 1.1 jruoho *
291 1.1 jruoho * FUNCTION: AcpiDbDisassembleAml
292 1.1 jruoho *
293 1.1 jruoho * PARAMETERS: Statements - Number of statements to disassemble
294 1.1 jruoho * Op - Current Op (from parse walk)
295 1.1 jruoho *
296 1.1 jruoho * RETURN: None
297 1.1 jruoho *
298 1.1 jruoho * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
299 1.1 jruoho * of statements specified.
300 1.1 jruoho *
301 1.1 jruoho ******************************************************************************/
302 1.1 jruoho
303 1.1 jruoho void
304 1.1 jruoho AcpiDbDisassembleAml (
305 1.1 jruoho char *Statements,
306 1.1 jruoho ACPI_PARSE_OBJECT *Op)
307 1.1 jruoho {
308 1.1 jruoho UINT32 NumStatements = 8;
309 1.1 jruoho
310 1.1 jruoho
311 1.1 jruoho if (!Op)
312 1.1 jruoho {
313 1.1 jruoho AcpiOsPrintf ("There is no method currently executing\n");
314 1.1 jruoho return;
315 1.1 jruoho }
316 1.1 jruoho
317 1.1 jruoho if (Statements)
318 1.1 jruoho {
319 1.5 christos NumStatements = strtoul (Statements, NULL, 0);
320 1.1 jruoho }
321 1.1 jruoho
322 1.1 jruoho AcpiDmDisassemble (NULL, Op, NumStatements);
323 1.1 jruoho }
324 1.1 jruoho
325 1.1 jruoho
326 1.1 jruoho /*******************************************************************************
327 1.1 jruoho *
328 1.1 jruoho * FUNCTION: AcpiDbDisassembleMethod
329 1.1 jruoho *
330 1.1 jruoho * PARAMETERS: Name - Name of control method
331 1.1 jruoho *
332 1.1 jruoho * RETURN: None
333 1.1 jruoho *
334 1.1 jruoho * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
335 1.1 jruoho * of statements specified.
336 1.1 jruoho *
337 1.1 jruoho ******************************************************************************/
338 1.1 jruoho
339 1.1 jruoho ACPI_STATUS
340 1.1 jruoho AcpiDbDisassembleMethod (
341 1.1 jruoho char *Name)
342 1.1 jruoho {
343 1.1 jruoho ACPI_STATUS Status;
344 1.1 jruoho ACPI_PARSE_OBJECT *Op;
345 1.1 jruoho ACPI_WALK_STATE *WalkState;
346 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc;
347 1.1 jruoho ACPI_NAMESPACE_NODE *Method;
348 1.1 jruoho
349 1.1 jruoho
350 1.1 jruoho Method = AcpiDbConvertToNode (Name);
351 1.1 jruoho if (!Method)
352 1.1 jruoho {
353 1.1 jruoho return (AE_BAD_PARAMETER);
354 1.1 jruoho }
355 1.1 jruoho
356 1.2 christos if (Method->Type != ACPI_TYPE_METHOD)
357 1.2 christos {
358 1.2 christos ACPI_ERROR ((AE_INFO, "%s (%s): Object must be a control method",
359 1.2 christos Name, AcpiUtGetTypeName (Method->Type)));
360 1.2 christos return (AE_BAD_PARAMETER);
361 1.2 christos }
362 1.2 christos
363 1.1 jruoho ObjDesc = Method->Object;
364 1.1 jruoho
365 1.5 christos Op = AcpiPsCreateScopeOp (ObjDesc->Method.AmlStart);
366 1.1 jruoho if (!Op)
367 1.1 jruoho {
368 1.1 jruoho return (AE_NO_MEMORY);
369 1.1 jruoho }
370 1.1 jruoho
371 1.1 jruoho /* Create and initialize a new walk state */
372 1.1 jruoho
373 1.1 jruoho WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
374 1.1 jruoho if (!WalkState)
375 1.1 jruoho {
376 1.1 jruoho return (AE_NO_MEMORY);
377 1.1 jruoho }
378 1.1 jruoho
379 1.1 jruoho Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
380 1.2 christos ObjDesc->Method.AmlStart,
381 1.2 christos ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
382 1.2 christos if (ACPI_FAILURE (Status))
383 1.2 christos {
384 1.2 christos return (Status);
385 1.2 christos }
386 1.2 christos
387 1.2 christos Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
388 1.13 christos if (ACPI_FAILURE(Status))
389 1.13 christos {
390 1.13 christos return (Status);
391 1.13 christos }
392 1.13 christos
393 1.2 christos WalkState->OwnerId = ObjDesc->Method.OwnerId;
394 1.2 christos
395 1.2 christos /* Push start scope on scope stack and make it current */
396 1.2 christos
397 1.2 christos Status = AcpiDsScopeStackPush (Method,
398 1.2 christos Method->Type, WalkState);
399 1.1 jruoho if (ACPI_FAILURE (Status))
400 1.1 jruoho {
401 1.1 jruoho return (Status);
402 1.1 jruoho }
403 1.1 jruoho
404 1.2 christos /* Parse the entire method AML including deferred operators */
405 1.1 jruoho
406 1.1 jruoho WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
407 1.1 jruoho WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
408 1.2 christos
409 1.1 jruoho Status = AcpiPsParseAml (WalkState);
410 1.2 christos (void) AcpiDmParseDeferredOps (Op);
411 1.2 christos
412 1.2 christos /* Now we can disassemble the method */
413 1.1 jruoho
414 1.6 christos AcpiGbl_DmOpt_Verbose = FALSE;
415 1.1 jruoho AcpiDmDisassemble (NULL, Op, 0);
416 1.6 christos AcpiGbl_DmOpt_Verbose = TRUE;
417 1.2 christos
418 1.1 jruoho AcpiPsDeleteParseTree (Op);
419 1.2 christos
420 1.2 christos /* Method cleanup */
421 1.2 christos
422 1.2 christos AcpiNsDeleteNamespaceSubtree (Method);
423 1.2 christos AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId);
424 1.2 christos AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId);
425 1.1 jruoho return (AE_OK);
426 1.1 jruoho }
427 1.11 christos #endif
428 1.7 christos
429 1.7 christos
430 1.7 christos /*******************************************************************************
431 1.7 christos *
432 1.7 christos * FUNCTION: AcpiDbWalkForExecute
433 1.7 christos *
434 1.7 christos * PARAMETERS: Callback from WalkNamespace
435 1.7 christos *
436 1.7 christos * RETURN: Status
437 1.7 christos *
438 1.7 christos * DESCRIPTION: Batch execution module. Currently only executes predefined
439 1.7 christos * ACPI names.
440 1.7 christos *
441 1.7 christos ******************************************************************************/
442 1.7 christos
443 1.7 christos static ACPI_STATUS
444 1.7 christos AcpiDbWalkForExecute (
445 1.7 christos ACPI_HANDLE ObjHandle,
446 1.7 christos UINT32 NestingLevel,
447 1.7 christos void *Context,
448 1.7 christos void **ReturnValue)
449 1.7 christos {
450 1.7 christos ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
451 1.7 christos ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context;
452 1.7 christos ACPI_BUFFER ReturnObj;
453 1.7 christos ACPI_STATUS Status;
454 1.7 christos char *Pathname;
455 1.7 christos UINT32 i;
456 1.7 christos ACPI_DEVICE_INFO *ObjInfo;
457 1.7 christos ACPI_OBJECT_LIST ParamObjects;
458 1.7 christos ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
459 1.7 christos const ACPI_PREDEFINED_INFO *Predefined;
460 1.7 christos
461 1.7 christos
462 1.7 christos Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
463 1.7 christos if (!Predefined)
464 1.7 christos {
465 1.7 christos return (AE_OK);
466 1.7 christos }
467 1.7 christos
468 1.7 christos if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
469 1.7 christos {
470 1.7 christos return (AE_OK);
471 1.7 christos }
472 1.7 christos
473 1.7 christos Pathname = AcpiNsGetExternalPathname (Node);
474 1.7 christos if (!Pathname)
475 1.7 christos {
476 1.7 christos return (AE_OK);
477 1.7 christos }
478 1.7 christos
479 1.7 christos /* Get the object info for number of method parameters */
480 1.7 christos
481 1.7 christos Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
482 1.7 christos if (ACPI_FAILURE (Status))
483 1.7 christos {
484 1.9 christos ACPI_FREE (Pathname);
485 1.7 christos return (Status);
486 1.7 christos }
487 1.7 christos
488 1.7 christos ParamObjects.Pointer = NULL;
489 1.7 christos ParamObjects.Count = 0;
490 1.7 christos
491 1.7 christos if (ObjInfo->Type == ACPI_TYPE_METHOD)
492 1.7 christos {
493 1.7 christos /* Setup default parameters */
494 1.7 christos
495 1.7 christos for (i = 0; i < ObjInfo->ParamCount; i++)
496 1.7 christos {
497 1.7 christos Params[i].Type = ACPI_TYPE_INTEGER;
498 1.7 christos Params[i].Integer.Value = 1;
499 1.7 christos }
500 1.7 christos
501 1.7 christos ParamObjects.Pointer = Params;
502 1.7 christos ParamObjects.Count = ObjInfo->ParamCount;
503 1.7 christos }
504 1.7 christos
505 1.7 christos ACPI_FREE (ObjInfo);
506 1.7 christos ReturnObj.Pointer = NULL;
507 1.7 christos ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
508 1.7 christos
509 1.7 christos /* Do the actual method execution */
510 1.7 christos
511 1.7 christos AcpiGbl_MethodExecuting = TRUE;
512 1.7 christos
513 1.7 christos Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
514 1.7 christos
515 1.7 christos AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
516 1.7 christos AcpiGbl_MethodExecuting = FALSE;
517 1.7 christos ACPI_FREE (Pathname);
518 1.7 christos
519 1.7 christos /* Ignore status from method execution */
520 1.7 christos
521 1.7 christos Status = AE_OK;
522 1.7 christos
523 1.7 christos /* Update count, check if we have executed enough methods */
524 1.7 christos
525 1.7 christos Info->Count++;
526 1.7 christos if (Info->Count >= Info->MaxCount)
527 1.7 christos {
528 1.7 christos Status = AE_CTRL_TERMINATE;
529 1.7 christos }
530 1.7 christos
531 1.7 christos return (Status);
532 1.7 christos }
533 1.7 christos
534 1.7 christos
535 1.7 christos /*******************************************************************************
536 1.7 christos *
537 1.7 christos * FUNCTION: AcpiDbEvaluatePredefinedNames
538 1.7 christos *
539 1.7 christos * PARAMETERS: None
540 1.7 christos *
541 1.7 christos * RETURN: None
542 1.7 christos *
543 1.7 christos * DESCRIPTION: Namespace batch execution. Execute predefined names in the
544 1.7 christos * namespace, up to the max count, if specified.
545 1.7 christos *
546 1.7 christos ******************************************************************************/
547 1.7 christos
548 1.7 christos void
549 1.7 christos AcpiDbEvaluatePredefinedNames (
550 1.7 christos void)
551 1.7 christos {
552 1.7 christos ACPI_DB_EXECUTE_WALK Info;
553 1.7 christos
554 1.7 christos
555 1.7 christos Info.Count = 0;
556 1.7 christos Info.MaxCount = ACPI_UINT32_MAX;
557 1.7 christos
558 1.7 christos /* Search all nodes in namespace */
559 1.7 christos
560 1.7 christos (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
561 1.7 christos AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
562 1.7 christos
563 1.7 christos AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count);
564 1.7 christos }
565