dbutils.c revision 1.3.4.2 1 1.3.4.2 rmind /*******************************************************************************
2 1.3.4.2 rmind *
3 1.3.4.2 rmind * Module Name: dbutils - AML debugger utilities
4 1.3.4.2 rmind *
5 1.3.4.2 rmind ******************************************************************************/
6 1.3.4.2 rmind
7 1.3.4.2 rmind /*
8 1.3.4.2 rmind * Copyright (C) 2000 - 2011, Intel Corp.
9 1.3.4.2 rmind * All rights reserved.
10 1.3.4.2 rmind *
11 1.3.4.2 rmind * Redistribution and use in source and binary forms, with or without
12 1.3.4.2 rmind * modification, are permitted provided that the following conditions
13 1.3.4.2 rmind * are met:
14 1.3.4.2 rmind * 1. Redistributions of source code must retain the above copyright
15 1.3.4.2 rmind * notice, this list of conditions, and the following disclaimer,
16 1.3.4.2 rmind * without modification.
17 1.3.4.2 rmind * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.3.4.2 rmind * substantially similar to the "NO WARRANTY" disclaimer below
19 1.3.4.2 rmind * ("Disclaimer") and any redistribution must be conditioned upon
20 1.3.4.2 rmind * including a substantially similar Disclaimer requirement for further
21 1.3.4.2 rmind * binary redistribution.
22 1.3.4.2 rmind * 3. Neither the names of the above-listed copyright holders nor the names
23 1.3.4.2 rmind * of any contributors may be used to endorse or promote products derived
24 1.3.4.2 rmind * from this software without specific prior written permission.
25 1.3.4.2 rmind *
26 1.3.4.2 rmind * Alternatively, this software may be distributed under the terms of the
27 1.3.4.2 rmind * GNU General Public License ("GPL") version 2 as published by the Free
28 1.3.4.2 rmind * Software Foundation.
29 1.3.4.2 rmind *
30 1.3.4.2 rmind * NO WARRANTY
31 1.3.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.3.4.2 rmind * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.3.4.2 rmind * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.3.4.2 rmind * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.3.4.2 rmind * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.3.4.2 rmind * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.3.4.2 rmind * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.3.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.3.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.3.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.3.4.2 rmind * POSSIBILITY OF SUCH DAMAGES.
42 1.3.4.2 rmind */
43 1.3.4.2 rmind
44 1.3.4.2 rmind
45 1.3.4.2 rmind #include "acpi.h"
46 1.3.4.2 rmind #include "accommon.h"
47 1.3.4.2 rmind #include "acnamesp.h"
48 1.3.4.2 rmind #include "acdebug.h"
49 1.3.4.2 rmind #include "acdisasm.h"
50 1.3.4.2 rmind
51 1.3.4.2 rmind
52 1.3.4.2 rmind #ifdef ACPI_DEBUGGER
53 1.3.4.2 rmind
54 1.3.4.2 rmind #define _COMPONENT ACPI_CA_DEBUGGER
55 1.3.4.2 rmind ACPI_MODULE_NAME ("dbutils")
56 1.3.4.2 rmind
57 1.3.4.2 rmind /* Local prototypes */
58 1.3.4.2 rmind
59 1.3.4.2 rmind #ifdef ACPI_OBSOLETE_FUNCTIONS
60 1.3.4.2 rmind ACPI_STATUS
61 1.3.4.2 rmind AcpiDbSecondPassParse (
62 1.3.4.2 rmind ACPI_PARSE_OBJECT *Root);
63 1.3.4.2 rmind
64 1.3.4.2 rmind void
65 1.3.4.2 rmind AcpiDbDumpBuffer (
66 1.3.4.2 rmind UINT32 Address);
67 1.3.4.2 rmind #endif
68 1.3.4.2 rmind
69 1.3.4.2 rmind static const char *Converter = "0123456789ABCDEF";
70 1.3.4.2 rmind
71 1.3.4.2 rmind
72 1.3.4.2 rmind /*******************************************************************************
73 1.3.4.2 rmind *
74 1.3.4.2 rmind * FUNCTION: AcpiDbMatchArgument
75 1.3.4.2 rmind *
76 1.3.4.2 rmind * PARAMETERS: UserArgument - User command line
77 1.3.4.2 rmind * Arguments - Array of commands to match against
78 1.3.4.2 rmind *
79 1.3.4.2 rmind * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found
80 1.3.4.2 rmind *
81 1.3.4.2 rmind * DESCRIPTION: Search command array for a command match
82 1.3.4.2 rmind *
83 1.3.4.2 rmind ******************************************************************************/
84 1.3.4.2 rmind
85 1.3.4.2 rmind ACPI_OBJECT_TYPE
86 1.3.4.2 rmind AcpiDbMatchArgument (
87 1.3.4.2 rmind char *UserArgument,
88 1.3.4.2 rmind ARGUMENT_INFO *Arguments)
89 1.3.4.2 rmind {
90 1.3.4.2 rmind UINT32 i;
91 1.3.4.2 rmind
92 1.3.4.2 rmind
93 1.3.4.2 rmind if (!UserArgument || UserArgument[0] == 0)
94 1.3.4.2 rmind {
95 1.3.4.2 rmind return (ACPI_TYPE_NOT_FOUND);
96 1.3.4.2 rmind }
97 1.3.4.2 rmind
98 1.3.4.2 rmind for (i = 0; Arguments[i].Name; i++)
99 1.3.4.2 rmind {
100 1.3.4.2 rmind if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name)
101 1.3.4.2 rmind {
102 1.3.4.2 rmind return (i);
103 1.3.4.2 rmind }
104 1.3.4.2 rmind }
105 1.3.4.2 rmind
106 1.3.4.2 rmind /* Argument not recognized */
107 1.3.4.2 rmind
108 1.3.4.2 rmind return (ACPI_TYPE_NOT_FOUND);
109 1.3.4.2 rmind }
110 1.3.4.2 rmind
111 1.3.4.2 rmind
112 1.3.4.2 rmind /*******************************************************************************
113 1.3.4.2 rmind *
114 1.3.4.2 rmind * FUNCTION: AcpiDbSetOutputDestination
115 1.3.4.2 rmind *
116 1.3.4.2 rmind * PARAMETERS: OutputFlags - Current flags word
117 1.3.4.2 rmind *
118 1.3.4.2 rmind * RETURN: None
119 1.3.4.2 rmind *
120 1.3.4.2 rmind * DESCRIPTION: Set the current destination for debugger output. Also sets
121 1.3.4.2 rmind * the debug output level accordingly.
122 1.3.4.2 rmind *
123 1.3.4.2 rmind ******************************************************************************/
124 1.3.4.2 rmind
125 1.3.4.2 rmind void
126 1.3.4.2 rmind AcpiDbSetOutputDestination (
127 1.3.4.2 rmind UINT32 OutputFlags)
128 1.3.4.2 rmind {
129 1.3.4.2 rmind
130 1.3.4.2 rmind AcpiGbl_DbOutputFlags = (UINT8) OutputFlags;
131 1.3.4.2 rmind
132 1.3.4.2 rmind if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && AcpiGbl_DbOutputToFile)
133 1.3.4.2 rmind {
134 1.3.4.2 rmind AcpiDbgLevel = AcpiGbl_DbDebugLevel;
135 1.3.4.2 rmind }
136 1.3.4.2 rmind else
137 1.3.4.2 rmind {
138 1.3.4.2 rmind AcpiDbgLevel = AcpiGbl_DbConsoleDebugLevel;
139 1.3.4.2 rmind }
140 1.3.4.2 rmind }
141 1.3.4.2 rmind
142 1.3.4.2 rmind
143 1.3.4.2 rmind /*******************************************************************************
144 1.3.4.2 rmind *
145 1.3.4.2 rmind * FUNCTION: AcpiDbDumpExternalObject
146 1.3.4.2 rmind *
147 1.3.4.2 rmind * PARAMETERS: ObjDesc - External ACPI object to dump
148 1.3.4.2 rmind * Level - Nesting level.
149 1.3.4.2 rmind *
150 1.3.4.2 rmind * RETURN: None
151 1.3.4.2 rmind *
152 1.3.4.2 rmind * DESCRIPTION: Dump the contents of an ACPI external object
153 1.3.4.2 rmind *
154 1.3.4.2 rmind ******************************************************************************/
155 1.3.4.2 rmind
156 1.3.4.2 rmind void
157 1.3.4.2 rmind AcpiDbDumpExternalObject (
158 1.3.4.2 rmind ACPI_OBJECT *ObjDesc,
159 1.3.4.2 rmind UINT32 Level)
160 1.3.4.2 rmind {
161 1.3.4.2 rmind UINT32 i;
162 1.3.4.2 rmind
163 1.3.4.2 rmind
164 1.3.4.2 rmind if (!ObjDesc)
165 1.3.4.2 rmind {
166 1.3.4.2 rmind AcpiOsPrintf ("[Null Object]\n");
167 1.3.4.2 rmind return;
168 1.3.4.2 rmind }
169 1.3.4.2 rmind
170 1.3.4.2 rmind for (i = 0; i < Level; i++)
171 1.3.4.2 rmind {
172 1.3.4.2 rmind AcpiOsPrintf (" ");
173 1.3.4.2 rmind }
174 1.3.4.2 rmind
175 1.3.4.2 rmind switch (ObjDesc->Type)
176 1.3.4.2 rmind {
177 1.3.4.2 rmind case ACPI_TYPE_ANY:
178 1.3.4.2 rmind
179 1.3.4.2 rmind AcpiOsPrintf ("[Null Object] (Type=0)\n");
180 1.3.4.2 rmind break;
181 1.3.4.2 rmind
182 1.3.4.2 rmind
183 1.3.4.2 rmind case ACPI_TYPE_INTEGER:
184 1.3.4.2 rmind
185 1.3.4.2 rmind AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
186 1.3.4.2 rmind ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
187 1.3.4.2 rmind break;
188 1.3.4.2 rmind
189 1.3.4.2 rmind
190 1.3.4.2 rmind case ACPI_TYPE_STRING:
191 1.3.4.2 rmind
192 1.3.4.2 rmind AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length);
193 1.3.4.2 rmind for (i = 0; i < ObjDesc->String.Length; i++)
194 1.3.4.2 rmind {
195 1.3.4.2 rmind AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
196 1.3.4.2 rmind }
197 1.3.4.2 rmind AcpiOsPrintf ("\n");
198 1.3.4.2 rmind break;
199 1.3.4.2 rmind
200 1.3.4.2 rmind
201 1.3.4.2 rmind case ACPI_TYPE_BUFFER:
202 1.3.4.2 rmind
203 1.3.4.2 rmind AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
204 1.3.4.2 rmind if (ObjDesc->Buffer.Length)
205 1.3.4.2 rmind {
206 1.3.4.2 rmind if (ObjDesc->Buffer.Length > 16)
207 1.3.4.2 rmind {
208 1.3.4.2 rmind AcpiOsPrintf ("\n");
209 1.3.4.2 rmind }
210 1.3.4.2 rmind AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
211 1.3.4.2 rmind ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
212 1.3.4.2 rmind }
213 1.3.4.2 rmind else
214 1.3.4.2 rmind {
215 1.3.4.2 rmind AcpiOsPrintf ("\n");
216 1.3.4.2 rmind }
217 1.3.4.2 rmind break;
218 1.3.4.2 rmind
219 1.3.4.2 rmind
220 1.3.4.2 rmind case ACPI_TYPE_PACKAGE:
221 1.3.4.2 rmind
222 1.3.4.2 rmind AcpiOsPrintf ("[Package] Contains %u Elements:\n",
223 1.3.4.2 rmind ObjDesc->Package.Count);
224 1.3.4.2 rmind
225 1.3.4.2 rmind for (i = 0; i < ObjDesc->Package.Count; i++)
226 1.3.4.2 rmind {
227 1.3.4.2 rmind AcpiDbDumpExternalObject (&ObjDesc->Package.Elements[i], Level+1);
228 1.3.4.2 rmind }
229 1.3.4.2 rmind break;
230 1.3.4.2 rmind
231 1.3.4.2 rmind
232 1.3.4.2 rmind case ACPI_TYPE_LOCAL_REFERENCE:
233 1.3.4.2 rmind
234 1.3.4.2 rmind AcpiOsPrintf ("[Object Reference] = ");
235 1.3.4.2 rmind AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
236 1.3.4.2 rmind break;
237 1.3.4.2 rmind
238 1.3.4.2 rmind
239 1.3.4.2 rmind case ACPI_TYPE_PROCESSOR:
240 1.3.4.2 rmind
241 1.3.4.2 rmind AcpiOsPrintf ("[Processor]\n");
242 1.3.4.2 rmind break;
243 1.3.4.2 rmind
244 1.3.4.2 rmind
245 1.3.4.2 rmind case ACPI_TYPE_POWER:
246 1.3.4.2 rmind
247 1.3.4.2 rmind AcpiOsPrintf ("[Power Resource]\n");
248 1.3.4.2 rmind break;
249 1.3.4.2 rmind
250 1.3.4.2 rmind
251 1.3.4.2 rmind default:
252 1.3.4.2 rmind
253 1.3.4.2 rmind AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Type);
254 1.3.4.2 rmind break;
255 1.3.4.2 rmind }
256 1.3.4.2 rmind }
257 1.3.4.2 rmind
258 1.3.4.2 rmind
259 1.3.4.2 rmind /*******************************************************************************
260 1.3.4.2 rmind *
261 1.3.4.2 rmind * FUNCTION: AcpiDbPrepNamestring
262 1.3.4.2 rmind *
263 1.3.4.2 rmind * PARAMETERS: Name - String to prepare
264 1.3.4.2 rmind *
265 1.3.4.2 rmind * RETURN: None
266 1.3.4.2 rmind *
267 1.3.4.2 rmind * DESCRIPTION: Translate all forward slashes and dots to backslashes.
268 1.3.4.2 rmind *
269 1.3.4.2 rmind ******************************************************************************/
270 1.3.4.2 rmind
271 1.3.4.2 rmind void
272 1.3.4.2 rmind AcpiDbPrepNamestring (
273 1.3.4.2 rmind char *Name)
274 1.3.4.2 rmind {
275 1.3.4.2 rmind
276 1.3.4.2 rmind if (!Name)
277 1.3.4.2 rmind {
278 1.3.4.2 rmind return;
279 1.3.4.2 rmind }
280 1.3.4.2 rmind
281 1.3.4.2 rmind AcpiUtStrupr (Name);
282 1.3.4.2 rmind
283 1.3.4.2 rmind /* Convert a leading forward slash to a backslash */
284 1.3.4.2 rmind
285 1.3.4.2 rmind if (*Name == '/')
286 1.3.4.2 rmind {
287 1.3.4.2 rmind *Name = '\\';
288 1.3.4.2 rmind }
289 1.3.4.2 rmind
290 1.3.4.2 rmind /* Ignore a leading backslash, this is the root prefix */
291 1.3.4.2 rmind
292 1.3.4.2 rmind if (*Name == '\\')
293 1.3.4.2 rmind {
294 1.3.4.2 rmind Name++;
295 1.3.4.2 rmind }
296 1.3.4.2 rmind
297 1.3.4.2 rmind /* Convert all slash path separators to dots */
298 1.3.4.2 rmind
299 1.3.4.2 rmind while (*Name)
300 1.3.4.2 rmind {
301 1.3.4.2 rmind if ((*Name == '/') ||
302 1.3.4.2 rmind (*Name == '\\'))
303 1.3.4.2 rmind {
304 1.3.4.2 rmind *Name = '.';
305 1.3.4.2 rmind }
306 1.3.4.2 rmind
307 1.3.4.2 rmind Name++;
308 1.3.4.2 rmind }
309 1.3.4.2 rmind }
310 1.3.4.2 rmind
311 1.3.4.2 rmind
312 1.3.4.2 rmind /*******************************************************************************
313 1.3.4.2 rmind *
314 1.3.4.2 rmind * FUNCTION: AcpiDbLocalNsLookup
315 1.3.4.2 rmind *
316 1.3.4.2 rmind * PARAMETERS: Name - Name to lookup
317 1.3.4.2 rmind *
318 1.3.4.2 rmind * RETURN: Pointer to a namespace node, null on failure
319 1.3.4.2 rmind *
320 1.3.4.2 rmind * DESCRIPTION: Lookup a name in the ACPI namespace
321 1.3.4.2 rmind *
322 1.3.4.2 rmind * Note: Currently begins search from the root. Could be enhanced to use
323 1.3.4.2 rmind * the current prefix (scope) node as the search beginning point.
324 1.3.4.2 rmind *
325 1.3.4.2 rmind ******************************************************************************/
326 1.3.4.2 rmind
327 1.3.4.2 rmind ACPI_NAMESPACE_NODE *
328 1.3.4.2 rmind AcpiDbLocalNsLookup (
329 1.3.4.2 rmind char *Name)
330 1.3.4.2 rmind {
331 1.3.4.2 rmind char *InternalPath;
332 1.3.4.2 rmind ACPI_STATUS Status;
333 1.3.4.2 rmind ACPI_NAMESPACE_NODE *Node = NULL;
334 1.3.4.2 rmind
335 1.3.4.2 rmind
336 1.3.4.2 rmind AcpiDbPrepNamestring (Name);
337 1.3.4.2 rmind
338 1.3.4.2 rmind /* Build an internal namestring */
339 1.3.4.2 rmind
340 1.3.4.2 rmind Status = AcpiNsInternalizeName (Name, &InternalPath);
341 1.3.4.2 rmind if (ACPI_FAILURE (Status))
342 1.3.4.2 rmind {
343 1.3.4.2 rmind AcpiOsPrintf ("Invalid namestring: %s\n", Name);
344 1.3.4.2 rmind return (NULL);
345 1.3.4.2 rmind }
346 1.3.4.2 rmind
347 1.3.4.2 rmind /*
348 1.3.4.2 rmind * Lookup the name.
349 1.3.4.2 rmind * (Uses root node as the search starting point)
350 1.3.4.2 rmind */
351 1.3.4.2 rmind Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
352 1.3.4.2 rmind ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
353 1.3.4.2 rmind if (ACPI_FAILURE (Status))
354 1.3.4.2 rmind {
355 1.3.4.2 rmind AcpiOsPrintf ("Could not locate name: %s, %s\n",
356 1.3.4.2 rmind Name, AcpiFormatException (Status));
357 1.3.4.2 rmind }
358 1.3.4.2 rmind
359 1.3.4.2 rmind ACPI_FREE (InternalPath);
360 1.3.4.2 rmind return (Node);
361 1.3.4.2 rmind }
362 1.3.4.2 rmind
363 1.3.4.2 rmind
364 1.3.4.2 rmind /*******************************************************************************
365 1.3.4.2 rmind *
366 1.3.4.2 rmind * FUNCTION: AcpiDbUInt32ToHexString
367 1.3.4.2 rmind *
368 1.3.4.2 rmind * PARAMETERS: Value - The value to be converted to string
369 1.3.4.2 rmind * Buffer - Buffer for result (not less than 11 bytes)
370 1.3.4.2 rmind *
371 1.3.4.2 rmind * RETURN: None
372 1.3.4.2 rmind *
373 1.3.4.2 rmind * DESCRIPTION: Convert the unsigned 32-bit value to the hexadecimal image
374 1.3.4.2 rmind *
375 1.3.4.2 rmind * NOTE: It is the caller's responsibility to ensure that the length of buffer
376 1.3.4.2 rmind * is sufficient.
377 1.3.4.2 rmind *
378 1.3.4.2 rmind ******************************************************************************/
379 1.3.4.2 rmind
380 1.3.4.2 rmind void
381 1.3.4.2 rmind AcpiDbUInt32ToHexString (
382 1.3.4.2 rmind UINT32 Value,
383 1.3.4.2 rmind char *Buffer)
384 1.3.4.2 rmind {
385 1.3.4.2 rmind UINT8 i;
386 1.3.4.2 rmind
387 1.3.4.2 rmind
388 1.3.4.2 rmind if (Value == 0)
389 1.3.4.2 rmind {
390 1.3.4.2 rmind ACPI_STRCPY (Buffer, "0");
391 1.3.4.2 rmind return;
392 1.3.4.2 rmind }
393 1.3.4.2 rmind
394 1.3.4.2 rmind ACPI_STRCPY (Buffer, "0x");
395 1.3.4.2 rmind Buffer[10] = '\0';
396 1.3.4.2 rmind
397 1.3.4.2 rmind for (i = 9; i > 1; i--)
398 1.3.4.2 rmind {
399 1.3.4.2 rmind Buffer[i] = Converter [Value & 0x0F];
400 1.3.4.2 rmind Value = Value >> 4;
401 1.3.4.2 rmind }
402 1.3.4.2 rmind }
403 1.3.4.2 rmind
404 1.3.4.2 rmind
405 1.3.4.2 rmind #ifdef ACPI_OBSOLETE_FUNCTIONS
406 1.3.4.2 rmind /*******************************************************************************
407 1.3.4.2 rmind *
408 1.3.4.2 rmind * FUNCTION: AcpiDbSecondPassParse
409 1.3.4.2 rmind *
410 1.3.4.2 rmind * PARAMETERS: Root - Root of the parse tree
411 1.3.4.2 rmind *
412 1.3.4.2 rmind * RETURN: Status
413 1.3.4.2 rmind *
414 1.3.4.2 rmind * DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until
415 1.3.4.2 rmind * second pass to parse the control methods
416 1.3.4.2 rmind *
417 1.3.4.2 rmind ******************************************************************************/
418 1.3.4.2 rmind
419 1.3.4.2 rmind ACPI_STATUS
420 1.3.4.2 rmind AcpiDbSecondPassParse (
421 1.3.4.2 rmind ACPI_PARSE_OBJECT *Root)
422 1.3.4.2 rmind {
423 1.3.4.2 rmind ACPI_PARSE_OBJECT *Op = Root;
424 1.3.4.2 rmind ACPI_PARSE_OBJECT *Method;
425 1.3.4.2 rmind ACPI_PARSE_OBJECT *SearchOp;
426 1.3.4.2 rmind ACPI_PARSE_OBJECT *StartOp;
427 1.3.4.2 rmind ACPI_STATUS Status = AE_OK;
428 1.3.4.2 rmind UINT32 BaseAmlOffset;
429 1.3.4.2 rmind ACPI_WALK_STATE *WalkState;
430 1.3.4.2 rmind
431 1.3.4.2 rmind
432 1.3.4.2 rmind ACPI_FUNCTION_ENTRY ();
433 1.3.4.2 rmind
434 1.3.4.2 rmind
435 1.3.4.2 rmind AcpiOsPrintf ("Pass two parse ....\n");
436 1.3.4.2 rmind
437 1.3.4.2 rmind while (Op)
438 1.3.4.2 rmind {
439 1.3.4.2 rmind if (Op->Common.AmlOpcode == AML_METHOD_OP)
440 1.3.4.2 rmind {
441 1.3.4.2 rmind Method = Op;
442 1.3.4.2 rmind
443 1.3.4.2 rmind /* Create a new walk state for the parse */
444 1.3.4.2 rmind
445 1.3.4.2 rmind WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
446 1.3.4.2 rmind if (!WalkState)
447 1.3.4.2 rmind {
448 1.3.4.2 rmind return (AE_NO_MEMORY);
449 1.3.4.2 rmind }
450 1.3.4.2 rmind
451 1.3.4.2 rmind /* Init the Walk State */
452 1.3.4.2 rmind
453 1.3.4.2 rmind WalkState->ParserState.Aml =
454 1.3.4.2 rmind WalkState->ParserState.AmlStart = Method->Named.Data;
455 1.3.4.2 rmind WalkState->ParserState.AmlEnd =
456 1.3.4.2 rmind WalkState->ParserState.PkgEnd = Method->Named.Data +
457 1.3.4.2 rmind Method->Named.Length;
458 1.3.4.2 rmind WalkState->ParserState.StartScope = Op;
459 1.3.4.2 rmind
460 1.3.4.2 rmind WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
461 1.3.4.2 rmind WalkState->AscendingCallback = AcpiDsLoad1EndOp;
462 1.3.4.2 rmind
463 1.3.4.2 rmind /* Perform the AML parse */
464 1.3.4.2 rmind
465 1.3.4.2 rmind Status = AcpiPsParseAml (WalkState);
466 1.3.4.2 rmind
467 1.3.4.2 rmind BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1;
468 1.3.4.2 rmind StartOp = (Method->Common.Value.Arg)->Common.Next;
469 1.3.4.2 rmind SearchOp = StartOp;
470 1.3.4.2 rmind
471 1.3.4.2 rmind while (SearchOp)
472 1.3.4.2 rmind {
473 1.3.4.2 rmind SearchOp->Common.AmlOffset += BaseAmlOffset;
474 1.3.4.2 rmind SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
475 1.3.4.2 rmind }
476 1.3.4.2 rmind }
477 1.3.4.2 rmind
478 1.3.4.2 rmind if (Op->Common.AmlOpcode == AML_REGION_OP)
479 1.3.4.2 rmind {
480 1.3.4.2 rmind /* TBD: [Investigate] this isn't quite the right thing to do! */
481 1.3.4.2 rmind /*
482 1.3.4.2 rmind *
483 1.3.4.2 rmind * Method = (ACPI_DEFERRED_OP *) Op;
484 1.3.4.2 rmind * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength);
485 1.3.4.2 rmind */
486 1.3.4.2 rmind }
487 1.3.4.2 rmind
488 1.3.4.2 rmind if (ACPI_FAILURE (Status))
489 1.3.4.2 rmind {
490 1.3.4.2 rmind break;
491 1.3.4.2 rmind }
492 1.3.4.2 rmind
493 1.3.4.2 rmind Op = AcpiPsGetDepthNext (Root, Op);
494 1.3.4.2 rmind }
495 1.3.4.2 rmind
496 1.3.4.2 rmind return (Status);
497 1.3.4.2 rmind }
498 1.3.4.2 rmind
499 1.3.4.2 rmind
500 1.3.4.2 rmind /*******************************************************************************
501 1.3.4.2 rmind *
502 1.3.4.2 rmind * FUNCTION: AcpiDbDumpBuffer
503 1.3.4.2 rmind *
504 1.3.4.2 rmind * PARAMETERS: Address - Pointer to the buffer
505 1.3.4.2 rmind *
506 1.3.4.2 rmind * RETURN: None
507 1.3.4.2 rmind *
508 1.3.4.2 rmind * DESCRIPTION: Print a portion of a buffer
509 1.3.4.2 rmind *
510 1.3.4.2 rmind ******************************************************************************/
511 1.3.4.2 rmind
512 1.3.4.2 rmind void
513 1.3.4.2 rmind AcpiDbDumpBuffer (
514 1.3.4.2 rmind UINT32 Address)
515 1.3.4.2 rmind {
516 1.3.4.2 rmind
517 1.3.4.2 rmind AcpiOsPrintf ("\nLocation %X:\n", Address);
518 1.3.4.2 rmind
519 1.3.4.2 rmind AcpiDbgLevel |= ACPI_LV_TABLES;
520 1.3.4.2 rmind AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY,
521 1.3.4.2 rmind ACPI_UINT32_MAX);
522 1.3.4.2 rmind }
523 1.3.4.2 rmind #endif
524 1.3.4.2 rmind
525 1.3.4.2 rmind #endif /* ACPI_DEBUGGER */
526 1.3.4.2 rmind
527 1.3.4.2 rmind
528