dbdisply.c revision 1.3.2.3 1 1.3.2.2 bouyer /*******************************************************************************
2 1.3.2.2 bouyer *
3 1.3.2.2 bouyer * Module Name: dbdisply - debug display commands
4 1.3.2.2 bouyer *
5 1.3.2.2 bouyer ******************************************************************************/
6 1.3.2.2 bouyer
7 1.3.2.2 bouyer /*
8 1.3.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
9 1.3.2.2 bouyer * All rights reserved.
10 1.3.2.2 bouyer *
11 1.3.2.2 bouyer * Redistribution and use in source and binary forms, with or without
12 1.3.2.2 bouyer * modification, are permitted provided that the following conditions
13 1.3.2.2 bouyer * are met:
14 1.3.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
15 1.3.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
16 1.3.2.2 bouyer * without modification.
17 1.3.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.3.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
19 1.3.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
20 1.3.2.2 bouyer * including a substantially similar Disclaimer requirement for further
21 1.3.2.2 bouyer * binary redistribution.
22 1.3.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
23 1.3.2.2 bouyer * of any contributors may be used to endorse or promote products derived
24 1.3.2.2 bouyer * from this software without specific prior written permission.
25 1.3.2.2 bouyer *
26 1.3.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
27 1.3.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
28 1.3.2.2 bouyer * Software Foundation.
29 1.3.2.2 bouyer *
30 1.3.2.2 bouyer * NO WARRANTY
31 1.3.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.3.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.3.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.3.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.3.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.3.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.3.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.3.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.3.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.3.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.3.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
42 1.3.2.2 bouyer */
43 1.3.2.2 bouyer
44 1.3.2.2 bouyer
45 1.3.2.2 bouyer #include "acpi.h"
46 1.3.2.2 bouyer #include "accommon.h"
47 1.3.2.2 bouyer #include "amlcode.h"
48 1.3.2.2 bouyer #include "acdispat.h"
49 1.3.2.2 bouyer #include "acnamesp.h"
50 1.3.2.2 bouyer #include "acparser.h"
51 1.3.2.2 bouyer #include "acinterp.h"
52 1.3.2.2 bouyer #include "acdebug.h"
53 1.3.2.2 bouyer #include "acdisasm.h"
54 1.3.2.2 bouyer
55 1.3.2.2 bouyer
56 1.3.2.2 bouyer #ifdef ACPI_DEBUGGER
57 1.3.2.2 bouyer
58 1.3.2.2 bouyer #define _COMPONENT ACPI_CA_DEBUGGER
59 1.3.2.2 bouyer ACPI_MODULE_NAME ("dbdisply")
60 1.3.2.2 bouyer
61 1.3.2.2 bouyer /* Local prototypes */
62 1.3.2.2 bouyer
63 1.3.2.2 bouyer static void
64 1.3.2.2 bouyer AcpiDbDumpParserDescriptor (
65 1.3.2.2 bouyer ACPI_PARSE_OBJECT *Op);
66 1.3.2.2 bouyer
67 1.3.2.2 bouyer static void *
68 1.3.2.2 bouyer AcpiDbGetPointer (
69 1.3.2.2 bouyer void *Target);
70 1.3.2.2 bouyer
71 1.3.2.2 bouyer
72 1.3.2.2 bouyer /*******************************************************************************
73 1.3.2.2 bouyer *
74 1.3.2.2 bouyer * FUNCTION: AcpiDbGetPointer
75 1.3.2.2 bouyer *
76 1.3.2.2 bouyer * PARAMETERS: Target - Pointer to string to be converted
77 1.3.2.2 bouyer *
78 1.3.2.2 bouyer * RETURN: Converted pointer
79 1.3.2.2 bouyer *
80 1.3.2.2 bouyer * DESCRIPTION: Convert an ascii pointer value to a real value
81 1.3.2.2 bouyer *
82 1.3.2.2 bouyer ******************************************************************************/
83 1.3.2.2 bouyer
84 1.3.2.2 bouyer static void *
85 1.3.2.2 bouyer AcpiDbGetPointer (
86 1.3.2.2 bouyer void *Target)
87 1.3.2.2 bouyer {
88 1.3.2.2 bouyer void *ObjPtr;
89 1.3.2.2 bouyer
90 1.3.2.2 bouyer
91 1.3.2.2 bouyer ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
92 1.3.2.2 bouyer return (ObjPtr);
93 1.3.2.2 bouyer }
94 1.3.2.2 bouyer
95 1.3.2.2 bouyer
96 1.3.2.2 bouyer /*******************************************************************************
97 1.3.2.2 bouyer *
98 1.3.2.2 bouyer * FUNCTION: AcpiDbDumpParserDescriptor
99 1.3.2.2 bouyer *
100 1.3.2.2 bouyer * PARAMETERS: Op - A parser Op descriptor
101 1.3.2.2 bouyer *
102 1.3.2.2 bouyer * RETURN: None
103 1.3.2.2 bouyer *
104 1.3.2.2 bouyer * DESCRIPTION: Display a formatted parser object
105 1.3.2.2 bouyer *
106 1.3.2.2 bouyer ******************************************************************************/
107 1.3.2.2 bouyer
108 1.3.2.2 bouyer static void
109 1.3.2.2 bouyer AcpiDbDumpParserDescriptor (
110 1.3.2.2 bouyer ACPI_PARSE_OBJECT *Op)
111 1.3.2.2 bouyer {
112 1.3.2.2 bouyer const ACPI_OPCODE_INFO *Info;
113 1.3.2.2 bouyer
114 1.3.2.2 bouyer
115 1.3.2.2 bouyer Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
116 1.3.2.2 bouyer
117 1.3.2.2 bouyer AcpiOsPrintf ("Parser Op Descriptor:\n");
118 1.3.2.2 bouyer AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
119 1.3.2.2 bouyer
120 1.3.2.2 bouyer ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name",
121 1.3.2.2 bouyer Info->Name));
122 1.3.2.2 bouyer
123 1.3.2.2 bouyer AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
124 1.3.2.2 bouyer AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
125 1.3.2.2 bouyer AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next);
126 1.3.2.2 bouyer }
127 1.3.2.2 bouyer
128 1.3.2.2 bouyer
129 1.3.2.2 bouyer /*******************************************************************************
130 1.3.2.2 bouyer *
131 1.3.2.2 bouyer * FUNCTION: AcpiDbDecodeAndDisplayObject
132 1.3.2.2 bouyer *
133 1.3.2.2 bouyer * PARAMETERS: Target - String with object to be displayed. Names
134 1.3.2.2 bouyer * and hex pointers are supported.
135 1.3.2.2 bouyer * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q)
136 1.3.2.2 bouyer *
137 1.3.2.2 bouyer * RETURN: None
138 1.3.2.2 bouyer *
139 1.3.2.2 bouyer * DESCRIPTION: Display a formatted ACPI object
140 1.3.2.2 bouyer *
141 1.3.2.2 bouyer ******************************************************************************/
142 1.3.2.2 bouyer
143 1.3.2.2 bouyer void
144 1.3.2.2 bouyer AcpiDbDecodeAndDisplayObject (
145 1.3.2.2 bouyer char *Target,
146 1.3.2.2 bouyer char *OutputType)
147 1.3.2.2 bouyer {
148 1.3.2.2 bouyer void *ObjPtr;
149 1.3.2.2 bouyer ACPI_NAMESPACE_NODE *Node;
150 1.3.2.2 bouyer ACPI_OPERAND_OBJECT *ObjDesc;
151 1.3.2.2 bouyer UINT32 Display = DB_BYTE_DISPLAY;
152 1.3.2.2 bouyer char Buffer[80];
153 1.3.2.2 bouyer ACPI_BUFFER RetBuf;
154 1.3.2.2 bouyer ACPI_STATUS Status;
155 1.3.2.2 bouyer UINT32 Size;
156 1.3.2.2 bouyer
157 1.3.2.2 bouyer
158 1.3.2.2 bouyer if (!Target)
159 1.3.2.2 bouyer {
160 1.3.2.2 bouyer return;
161 1.3.2.2 bouyer }
162 1.3.2.2 bouyer
163 1.3.2.2 bouyer /* Decode the output type */
164 1.3.2.2 bouyer
165 1.3.2.2 bouyer if (OutputType)
166 1.3.2.2 bouyer {
167 1.3.2.2 bouyer AcpiUtStrupr (OutputType);
168 1.3.2.2 bouyer if (OutputType[0] == 'W')
169 1.3.2.2 bouyer {
170 1.3.2.2 bouyer Display = DB_WORD_DISPLAY;
171 1.3.2.2 bouyer }
172 1.3.2.2 bouyer else if (OutputType[0] == 'D')
173 1.3.2.2 bouyer {
174 1.3.2.2 bouyer Display = DB_DWORD_DISPLAY;
175 1.3.2.2 bouyer }
176 1.3.2.2 bouyer else if (OutputType[0] == 'Q')
177 1.3.2.2 bouyer {
178 1.3.2.2 bouyer Display = DB_QWORD_DISPLAY;
179 1.3.2.2 bouyer }
180 1.3.2.2 bouyer }
181 1.3.2.2 bouyer
182 1.3.2.2 bouyer RetBuf.Length = sizeof (Buffer);
183 1.3.2.2 bouyer RetBuf.Pointer = Buffer;
184 1.3.2.2 bouyer
185 1.3.2.2 bouyer /* Differentiate between a number and a name */
186 1.3.2.2 bouyer
187 1.3.2.2 bouyer if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
188 1.3.2.2 bouyer {
189 1.3.2.2 bouyer ObjPtr = AcpiDbGetPointer (Target);
190 1.3.2.2 bouyer if (!AcpiOsReadable (ObjPtr, 16))
191 1.3.2.2 bouyer {
192 1.3.2.2 bouyer AcpiOsPrintf ("Address %p is invalid in this address space\n",
193 1.3.2.2 bouyer ObjPtr);
194 1.3.2.2 bouyer return;
195 1.3.2.2 bouyer }
196 1.3.2.2 bouyer
197 1.3.2.2 bouyer /* Decode the object type */
198 1.3.2.2 bouyer
199 1.3.2.2 bouyer switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
200 1.3.2.2 bouyer {
201 1.3.2.2 bouyer case ACPI_DESC_TYPE_NAMED:
202 1.3.2.2 bouyer
203 1.3.2.2 bouyer /* This is a namespace Node */
204 1.3.2.2 bouyer
205 1.3.2.2 bouyer if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
206 1.3.2.2 bouyer {
207 1.3.2.2 bouyer AcpiOsPrintf (
208 1.3.2.2 bouyer "Cannot read entire Named object at address %p\n", ObjPtr);
209 1.3.2.2 bouyer return;
210 1.3.2.2 bouyer }
211 1.3.2.2 bouyer
212 1.3.2.2 bouyer Node = ObjPtr;
213 1.3.2.2 bouyer goto DumpNode;
214 1.3.2.2 bouyer
215 1.3.2.2 bouyer
216 1.3.2.2 bouyer case ACPI_DESC_TYPE_OPERAND:
217 1.3.2.2 bouyer
218 1.3.2.2 bouyer /* This is a ACPI OPERAND OBJECT */
219 1.3.2.2 bouyer
220 1.3.2.2 bouyer if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
221 1.3.2.2 bouyer {
222 1.3.2.2 bouyer AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n",
223 1.3.2.2 bouyer ObjPtr);
224 1.3.2.2 bouyer return;
225 1.3.2.2 bouyer }
226 1.3.2.2 bouyer
227 1.3.2.2 bouyer AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display,
228 1.3.2.2 bouyer ACPI_UINT32_MAX);
229 1.3.2.2 bouyer AcpiExDumpObjectDescriptor (ObjPtr, 1);
230 1.3.2.2 bouyer break;
231 1.3.2.2 bouyer
232 1.3.2.2 bouyer
233 1.3.2.2 bouyer case ACPI_DESC_TYPE_PARSER:
234 1.3.2.2 bouyer
235 1.3.2.2 bouyer /* This is a Parser Op object */
236 1.3.2.2 bouyer
237 1.3.2.2 bouyer if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
238 1.3.2.2 bouyer {
239 1.3.2.2 bouyer AcpiOsPrintf (
240 1.3.2.2 bouyer "Cannot read entire Parser object at address %p\n", ObjPtr);
241 1.3.2.2 bouyer return;
242 1.3.2.2 bouyer }
243 1.3.2.2 bouyer
244 1.3.2.2 bouyer AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display,
245 1.3.2.2 bouyer ACPI_UINT32_MAX);
246 1.3.2.2 bouyer AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
247 1.3.2.2 bouyer break;
248 1.3.2.2 bouyer
249 1.3.2.2 bouyer
250 1.3.2.2 bouyer default:
251 1.3.2.2 bouyer
252 1.3.2.2 bouyer /* Is not a recognizeable object */
253 1.3.2.2 bouyer
254 1.3.2.2 bouyer Size = 16;
255 1.3.2.2 bouyer if (AcpiOsReadable (ObjPtr, 64))
256 1.3.2.2 bouyer {
257 1.3.2.2 bouyer Size = 64;
258 1.3.2.2 bouyer }
259 1.3.2.2 bouyer
260 1.3.2.2 bouyer /* Just dump some memory */
261 1.3.2.2 bouyer
262 1.3.2.2 bouyer AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
263 1.3.2.2 bouyer break;
264 1.3.2.2 bouyer }
265 1.3.2.2 bouyer
266 1.3.2.2 bouyer return;
267 1.3.2.2 bouyer }
268 1.3.2.2 bouyer
269 1.3.2.2 bouyer /* The parameter is a name string that must be resolved to a Named obj */
270 1.3.2.2 bouyer
271 1.3.2.2 bouyer Node = AcpiDbLocalNsLookup (Target);
272 1.3.2.2 bouyer if (!Node)
273 1.3.2.2 bouyer {
274 1.3.2.2 bouyer return;
275 1.3.2.2 bouyer }
276 1.3.2.2 bouyer
277 1.3.2.2 bouyer
278 1.3.2.2 bouyer DumpNode:
279 1.3.2.2 bouyer /* Now dump the NS node */
280 1.3.2.2 bouyer
281 1.3.2.2 bouyer Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
282 1.3.2.2 bouyer if (ACPI_FAILURE (Status))
283 1.3.2.2 bouyer {
284 1.3.2.2 bouyer AcpiOsPrintf ("Could not convert name to pathname\n");
285 1.3.2.2 bouyer }
286 1.3.2.2 bouyer
287 1.3.2.2 bouyer else
288 1.3.2.2 bouyer {
289 1.3.2.2 bouyer AcpiOsPrintf ("Object (%p) Pathname: %s\n",
290 1.3.2.2 bouyer Node, (char *) RetBuf.Pointer);
291 1.3.2.2 bouyer }
292 1.3.2.2 bouyer
293 1.3.2.2 bouyer if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
294 1.3.2.2 bouyer {
295 1.3.2.2 bouyer AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
296 1.3.2.2 bouyer return;
297 1.3.2.2 bouyer }
298 1.3.2.2 bouyer
299 1.3.2.2 bouyer AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
300 1.3.2.2 bouyer Display, ACPI_UINT32_MAX);
301 1.3.2.2 bouyer AcpiExDumpNamespaceNode (Node, 1);
302 1.3.2.2 bouyer
303 1.3.2.2 bouyer ObjDesc = AcpiNsGetAttachedObject (Node);
304 1.3.2.2 bouyer if (ObjDesc)
305 1.3.2.2 bouyer {
306 1.3.2.2 bouyer AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
307 1.3.2.2 bouyer if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
308 1.3.2.2 bouyer {
309 1.3.2.2 bouyer AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
310 1.3.2.2 bouyer ObjDesc);
311 1.3.2.2 bouyer return;
312 1.3.2.2 bouyer }
313 1.3.2.2 bouyer
314 1.3.2.2 bouyer AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT),
315 1.3.2.2 bouyer Display, ACPI_UINT32_MAX);
316 1.3.2.2 bouyer AcpiExDumpObjectDescriptor (ObjDesc, 1);
317 1.3.2.2 bouyer }
318 1.3.2.2 bouyer }
319 1.3.2.2 bouyer
320 1.3.2.2 bouyer
321 1.3.2.2 bouyer /*******************************************************************************
322 1.3.2.2 bouyer *
323 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayMethodInfo
324 1.3.2.2 bouyer *
325 1.3.2.2 bouyer * PARAMETERS: StartOp - Root of the control method parse tree
326 1.3.2.2 bouyer *
327 1.3.2.2 bouyer * RETURN: None
328 1.3.2.2 bouyer *
329 1.3.2.2 bouyer * DESCRIPTION: Display information about the current method
330 1.3.2.2 bouyer *
331 1.3.2.2 bouyer ******************************************************************************/
332 1.3.2.2 bouyer
333 1.3.2.2 bouyer void
334 1.3.2.2 bouyer AcpiDbDisplayMethodInfo (
335 1.3.2.2 bouyer ACPI_PARSE_OBJECT *StartOp)
336 1.3.2.2 bouyer {
337 1.3.2.2 bouyer ACPI_WALK_STATE *WalkState;
338 1.3.2.2 bouyer ACPI_OPERAND_OBJECT *ObjDesc;
339 1.3.2.2 bouyer ACPI_NAMESPACE_NODE *Node;
340 1.3.2.2 bouyer ACPI_PARSE_OBJECT *RootOp;
341 1.3.2.2 bouyer ACPI_PARSE_OBJECT *Op;
342 1.3.2.2 bouyer const ACPI_OPCODE_INFO *OpInfo;
343 1.3.2.2 bouyer UINT32 NumOps = 0;
344 1.3.2.2 bouyer UINT32 NumOperands = 0;
345 1.3.2.2 bouyer UINT32 NumOperators = 0;
346 1.3.2.2 bouyer UINT32 NumRemainingOps = 0;
347 1.3.2.2 bouyer UINT32 NumRemainingOperands = 0;
348 1.3.2.2 bouyer UINT32 NumRemainingOperators = 0;
349 1.3.2.2 bouyer BOOLEAN CountRemaining = FALSE;
350 1.3.2.2 bouyer
351 1.3.2.2 bouyer
352 1.3.2.2 bouyer WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
353 1.3.2.2 bouyer if (!WalkState)
354 1.3.2.2 bouyer {
355 1.3.2.2 bouyer AcpiOsPrintf ("There is no method currently executing\n");
356 1.3.2.2 bouyer return;
357 1.3.2.2 bouyer }
358 1.3.2.2 bouyer
359 1.3.2.2 bouyer ObjDesc = WalkState->MethodDesc;
360 1.3.2.2 bouyer Node = WalkState->MethodNode;
361 1.3.2.2 bouyer
362 1.3.2.2 bouyer AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
363 1.3.2.2 bouyer AcpiUtGetNodeName (Node));
364 1.3.2.2 bouyer AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n",
365 1.3.2.2 bouyer (UINT32) ObjDesc->Method.ParamCount,
366 1.3.2.2 bouyer (UINT32) ObjDesc->Method.SyncLevel);
367 1.3.2.2 bouyer
368 1.3.2.2 bouyer
369 1.3.2.2 bouyer RootOp = StartOp;
370 1.3.2.2 bouyer while (RootOp->Common.Parent)
371 1.3.2.2 bouyer {
372 1.3.2.2 bouyer RootOp = RootOp->Common.Parent;
373 1.3.2.2 bouyer }
374 1.3.2.2 bouyer
375 1.3.2.2 bouyer Op = RootOp;
376 1.3.2.2 bouyer
377 1.3.2.2 bouyer while (Op)
378 1.3.2.2 bouyer {
379 1.3.2.2 bouyer if (Op == StartOp)
380 1.3.2.2 bouyer {
381 1.3.2.2 bouyer CountRemaining = TRUE;
382 1.3.2.2 bouyer }
383 1.3.2.2 bouyer
384 1.3.2.2 bouyer NumOps++;
385 1.3.2.2 bouyer if (CountRemaining)
386 1.3.2.2 bouyer {
387 1.3.2.2 bouyer NumRemainingOps++;
388 1.3.2.2 bouyer }
389 1.3.2.2 bouyer
390 1.3.2.2 bouyer /* Decode the opcode */
391 1.3.2.2 bouyer
392 1.3.2.2 bouyer OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
393 1.3.2.2 bouyer switch (OpInfo->Class)
394 1.3.2.2 bouyer {
395 1.3.2.2 bouyer case AML_CLASS_ARGUMENT:
396 1.3.2.2 bouyer if (CountRemaining)
397 1.3.2.2 bouyer {
398 1.3.2.2 bouyer NumRemainingOperands++;
399 1.3.2.2 bouyer }
400 1.3.2.2 bouyer
401 1.3.2.2 bouyer NumOperands++;
402 1.3.2.2 bouyer break;
403 1.3.2.2 bouyer
404 1.3.2.2 bouyer case AML_CLASS_UNKNOWN:
405 1.3.2.2 bouyer /* Bad opcode or ASCII character */
406 1.3.2.2 bouyer
407 1.3.2.2 bouyer continue;
408 1.3.2.2 bouyer
409 1.3.2.2 bouyer default:
410 1.3.2.2 bouyer if (CountRemaining)
411 1.3.2.2 bouyer {
412 1.3.2.2 bouyer NumRemainingOperators++;
413 1.3.2.2 bouyer }
414 1.3.2.2 bouyer
415 1.3.2.2 bouyer NumOperators++;
416 1.3.2.2 bouyer break;
417 1.3.2.2 bouyer }
418 1.3.2.2 bouyer
419 1.3.2.2 bouyer Op = AcpiPsGetDepthNext (StartOp, Op);
420 1.3.2.2 bouyer }
421 1.3.2.2 bouyer
422 1.3.2.2 bouyer AcpiOsPrintf (
423 1.3.2.2 bouyer "Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
424 1.3.2.2 bouyer NumOps, NumOperators, NumOperands);
425 1.3.2.2 bouyer
426 1.3.2.2 bouyer AcpiOsPrintf (
427 1.3.2.2 bouyer "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
428 1.3.2.2 bouyer NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
429 1.3.2.2 bouyer }
430 1.3.2.2 bouyer
431 1.3.2.2 bouyer
432 1.3.2.2 bouyer /*******************************************************************************
433 1.3.2.2 bouyer *
434 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayLocals
435 1.3.2.2 bouyer *
436 1.3.2.2 bouyer * PARAMETERS: None
437 1.3.2.2 bouyer *
438 1.3.2.2 bouyer * RETURN: None
439 1.3.2.2 bouyer *
440 1.3.2.2 bouyer * DESCRIPTION: Display all locals for the currently running control method
441 1.3.2.2 bouyer *
442 1.3.2.2 bouyer ******************************************************************************/
443 1.3.2.2 bouyer
444 1.3.2.2 bouyer void
445 1.3.2.2 bouyer AcpiDbDisplayLocals (
446 1.3.2.2 bouyer void)
447 1.3.2.2 bouyer {
448 1.3.2.2 bouyer ACPI_WALK_STATE *WalkState;
449 1.3.2.2 bouyer
450 1.3.2.2 bouyer
451 1.3.2.2 bouyer WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
452 1.3.2.2 bouyer if (!WalkState)
453 1.3.2.2 bouyer {
454 1.3.2.2 bouyer AcpiOsPrintf ("There is no method currently executing\n");
455 1.3.2.2 bouyer return;
456 1.3.2.2 bouyer }
457 1.3.2.2 bouyer
458 1.3.2.2 bouyer AcpiDmDisplayLocals (WalkState);
459 1.3.2.2 bouyer }
460 1.3.2.2 bouyer
461 1.3.2.2 bouyer
462 1.3.2.2 bouyer /*******************************************************************************
463 1.3.2.2 bouyer *
464 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayArguments
465 1.3.2.2 bouyer *
466 1.3.2.2 bouyer * PARAMETERS: None
467 1.3.2.2 bouyer *
468 1.3.2.2 bouyer * RETURN: None
469 1.3.2.2 bouyer *
470 1.3.2.2 bouyer * DESCRIPTION: Display all arguments for the currently running control method
471 1.3.2.2 bouyer *
472 1.3.2.2 bouyer ******************************************************************************/
473 1.3.2.2 bouyer
474 1.3.2.2 bouyer void
475 1.3.2.2 bouyer AcpiDbDisplayArguments (
476 1.3.2.2 bouyer void)
477 1.3.2.2 bouyer {
478 1.3.2.2 bouyer ACPI_WALK_STATE *WalkState;
479 1.3.2.2 bouyer
480 1.3.2.2 bouyer
481 1.3.2.2 bouyer WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
482 1.3.2.2 bouyer if (!WalkState)
483 1.3.2.2 bouyer {
484 1.3.2.2 bouyer AcpiOsPrintf ("There is no method currently executing\n");
485 1.3.2.2 bouyer return;
486 1.3.2.2 bouyer }
487 1.3.2.2 bouyer
488 1.3.2.2 bouyer AcpiDmDisplayArguments (WalkState);
489 1.3.2.2 bouyer }
490 1.3.2.2 bouyer
491 1.3.2.2 bouyer
492 1.3.2.2 bouyer /*******************************************************************************
493 1.3.2.2 bouyer *
494 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayResults
495 1.3.2.2 bouyer *
496 1.3.2.2 bouyer * PARAMETERS: None
497 1.3.2.2 bouyer *
498 1.3.2.2 bouyer * RETURN: None
499 1.3.2.2 bouyer *
500 1.3.2.2 bouyer * DESCRIPTION: Display current contents of a method result stack
501 1.3.2.2 bouyer *
502 1.3.2.2 bouyer ******************************************************************************/
503 1.3.2.2 bouyer
504 1.3.2.2 bouyer void
505 1.3.2.2 bouyer AcpiDbDisplayResults (
506 1.3.2.2 bouyer void)
507 1.3.2.2 bouyer {
508 1.3.2.2 bouyer UINT32 i;
509 1.3.2.2 bouyer ACPI_WALK_STATE *WalkState;
510 1.3.2.2 bouyer ACPI_OPERAND_OBJECT *ObjDesc;
511 1.3.2.2 bouyer UINT32 ResultCount = 0;
512 1.3.2.2 bouyer ACPI_NAMESPACE_NODE *Node;
513 1.3.2.2 bouyer ACPI_GENERIC_STATE *Frame;
514 1.3.2.2 bouyer UINT32 Index; /* Index onto current frame */
515 1.3.2.2 bouyer
516 1.3.2.2 bouyer
517 1.3.2.2 bouyer WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
518 1.3.2.2 bouyer if (!WalkState)
519 1.3.2.2 bouyer {
520 1.3.2.2 bouyer AcpiOsPrintf ("There is no method currently executing\n");
521 1.3.2.2 bouyer return;
522 1.3.2.2 bouyer }
523 1.3.2.2 bouyer
524 1.3.2.2 bouyer ObjDesc = WalkState->MethodDesc;
525 1.3.2.2 bouyer Node = WalkState->MethodNode;
526 1.3.2.2 bouyer
527 1.3.2.2 bouyer if (WalkState->Results)
528 1.3.2.2 bouyer {
529 1.3.2.2 bouyer ResultCount = WalkState->ResultCount;
530 1.3.2.2 bouyer }
531 1.3.2.2 bouyer
532 1.3.2.2 bouyer AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
533 1.3.2.2 bouyer AcpiUtGetNodeName (Node), ResultCount);
534 1.3.2.2 bouyer
535 1.3.2.2 bouyer /* From the top element of result stack */
536 1.3.2.2 bouyer
537 1.3.2.2 bouyer Frame = WalkState->Results;
538 1.3.2.2 bouyer Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
539 1.3.2.2 bouyer
540 1.3.2.2 bouyer for (i = 0; i < ResultCount; i++)
541 1.3.2.2 bouyer {
542 1.3.2.2 bouyer ObjDesc = Frame->Results.ObjDesc[Index];
543 1.3.2.2 bouyer AcpiOsPrintf ("Result%u: ", i);
544 1.3.2.2 bouyer AcpiDmDisplayInternalObject (ObjDesc, WalkState);
545 1.3.2.2 bouyer if (Index == 0)
546 1.3.2.2 bouyer {
547 1.3.2.2 bouyer Frame = Frame->Results.Next;
548 1.3.2.2 bouyer Index = ACPI_RESULTS_FRAME_OBJ_NUM;
549 1.3.2.2 bouyer }
550 1.3.2.2 bouyer Index--;
551 1.3.2.2 bouyer }
552 1.3.2.2 bouyer }
553 1.3.2.2 bouyer
554 1.3.2.2 bouyer
555 1.3.2.2 bouyer /*******************************************************************************
556 1.3.2.2 bouyer *
557 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayCallingTree
558 1.3.2.2 bouyer *
559 1.3.2.2 bouyer * PARAMETERS: None
560 1.3.2.2 bouyer *
561 1.3.2.2 bouyer * RETURN: None
562 1.3.2.2 bouyer *
563 1.3.2.2 bouyer * DESCRIPTION: Display current calling tree of nested control methods
564 1.3.2.2 bouyer *
565 1.3.2.2 bouyer ******************************************************************************/
566 1.3.2.2 bouyer
567 1.3.2.2 bouyer void
568 1.3.2.2 bouyer AcpiDbDisplayCallingTree (
569 1.3.2.2 bouyer void)
570 1.3.2.2 bouyer {
571 1.3.2.2 bouyer ACPI_WALK_STATE *WalkState;
572 1.3.2.2 bouyer ACPI_NAMESPACE_NODE *Node;
573 1.3.2.2 bouyer
574 1.3.2.2 bouyer
575 1.3.2.2 bouyer WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
576 1.3.2.2 bouyer if (!WalkState)
577 1.3.2.2 bouyer {
578 1.3.2.2 bouyer AcpiOsPrintf ("There is no method currently executing\n");
579 1.3.2.2 bouyer return;
580 1.3.2.2 bouyer }
581 1.3.2.2 bouyer
582 1.3.2.2 bouyer Node = WalkState->MethodNode;
583 1.3.2.2 bouyer AcpiOsPrintf ("Current Control Method Call Tree\n");
584 1.3.2.2 bouyer
585 1.3.2.2 bouyer while (WalkState)
586 1.3.2.2 bouyer {
587 1.3.2.2 bouyer Node = WalkState->MethodNode;
588 1.3.2.2 bouyer
589 1.3.2.2 bouyer AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node));
590 1.3.2.2 bouyer
591 1.3.2.2 bouyer WalkState = WalkState->Next;
592 1.3.2.2 bouyer }
593 1.3.2.2 bouyer }
594 1.3.2.2 bouyer
595 1.3.2.2 bouyer
596 1.3.2.2 bouyer /*******************************************************************************
597 1.3.2.2 bouyer *
598 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayObjectType
599 1.3.2.2 bouyer *
600 1.3.2.2 bouyer * PARAMETERS: ObjectArg - User entered NS node handle
601 1.3.2.2 bouyer *
602 1.3.2.2 bouyer * RETURN: None
603 1.3.2.2 bouyer *
604 1.3.2.2 bouyer * DESCRIPTION: Display type of an arbitrary NS node
605 1.3.2.2 bouyer *
606 1.3.2.2 bouyer ******************************************************************************/
607 1.3.2.2 bouyer
608 1.3.2.2 bouyer void
609 1.3.2.2 bouyer AcpiDbDisplayObjectType (
610 1.3.2.2 bouyer char *ObjectArg)
611 1.3.2.2 bouyer {
612 1.3.2.2 bouyer ACPI_HANDLE Handle;
613 1.3.2.2 bouyer ACPI_DEVICE_INFO *Info;
614 1.3.2.2 bouyer ACPI_STATUS Status;
615 1.3.2.2 bouyer UINT32 i;
616 1.3.2.2 bouyer
617 1.3.2.2 bouyer
618 1.3.2.2 bouyer Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
619 1.3.2.2 bouyer
620 1.3.2.2 bouyer Status = AcpiGetObjectInfo (Handle, &Info);
621 1.3.2.2 bouyer if (ACPI_FAILURE (Status))
622 1.3.2.2 bouyer {
623 1.3.2.2 bouyer AcpiOsPrintf ("Could not get object info, %s\n",
624 1.3.2.2 bouyer AcpiFormatException (Status));
625 1.3.2.2 bouyer return;
626 1.3.2.2 bouyer }
627 1.3.2.2 bouyer
628 1.3.2.2 bouyer AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
629 1.3.2.2 bouyer ACPI_FORMAT_UINT64 (Info->Address),
630 1.3.2.2 bouyer Info->CurrentStatus, Info->Flags);
631 1.3.2.2 bouyer
632 1.3.2.2 bouyer AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
633 1.3.2.2 bouyer Info->HighestDstates[0], Info->HighestDstates[1],
634 1.3.2.2 bouyer Info->HighestDstates[2], Info->HighestDstates[3]);
635 1.3.2.2 bouyer
636 1.3.2.2 bouyer AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
637 1.3.2.2 bouyer Info->LowestDstates[0], Info->LowestDstates[1],
638 1.3.2.2 bouyer Info->LowestDstates[2], Info->LowestDstates[3],
639 1.3.2.2 bouyer Info->LowestDstates[4]);
640 1.3.2.2 bouyer
641 1.3.2.2 bouyer if (Info->Valid & ACPI_VALID_HID)
642 1.3.2.2 bouyer {
643 1.3.2.2 bouyer AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String);
644 1.3.2.2 bouyer }
645 1.3.2.2 bouyer if (Info->Valid & ACPI_VALID_UID)
646 1.3.2.2 bouyer {
647 1.3.2.2 bouyer AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String);
648 1.3.2.2 bouyer }
649 1.3.2.2 bouyer if (Info->Valid & ACPI_VALID_CID)
650 1.3.2.2 bouyer {
651 1.3.2.2 bouyer for (i = 0; i < Info->CompatibleIdList.Count; i++)
652 1.3.2.2 bouyer {
653 1.3.2.2 bouyer AcpiOsPrintf ("CID %u: %s\n", i,
654 1.3.2.2 bouyer Info->CompatibleIdList.Ids[i].String);
655 1.3.2.2 bouyer }
656 1.3.2.2 bouyer }
657 1.3.2.2 bouyer
658 1.3.2.2 bouyer ACPI_FREE (Info);
659 1.3.2.2 bouyer }
660 1.3.2.2 bouyer
661 1.3.2.2 bouyer
662 1.3.2.2 bouyer /*******************************************************************************
663 1.3.2.2 bouyer *
664 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayResultObject
665 1.3.2.2 bouyer *
666 1.3.2.2 bouyer * PARAMETERS: ObjDesc - Object to be displayed
667 1.3.2.2 bouyer * WalkState - Current walk state
668 1.3.2.2 bouyer *
669 1.3.2.2 bouyer * RETURN: None
670 1.3.2.2 bouyer *
671 1.3.2.2 bouyer * DESCRIPTION: Display the result of an AML opcode
672 1.3.2.2 bouyer *
673 1.3.2.2 bouyer * Note: Curently only displays the result object if we are single stepping.
674 1.3.2.2 bouyer * However, this output may be useful in other contexts and could be enabled
675 1.3.2.2 bouyer * to do so if needed.
676 1.3.2.2 bouyer *
677 1.3.2.2 bouyer ******************************************************************************/
678 1.3.2.2 bouyer
679 1.3.2.2 bouyer void
680 1.3.2.2 bouyer AcpiDbDisplayResultObject (
681 1.3.2.2 bouyer ACPI_OPERAND_OBJECT *ObjDesc,
682 1.3.2.2 bouyer ACPI_WALK_STATE *WalkState)
683 1.3.2.2 bouyer {
684 1.3.2.2 bouyer
685 1.3.2.2 bouyer /* Only display if single stepping */
686 1.3.2.2 bouyer
687 1.3.2.2 bouyer if (!AcpiGbl_CmSingleStep)
688 1.3.2.2 bouyer {
689 1.3.2.2 bouyer return;
690 1.3.2.2 bouyer }
691 1.3.2.2 bouyer
692 1.3.2.2 bouyer AcpiOsPrintf ("ResultObj: ");
693 1.3.2.2 bouyer AcpiDmDisplayInternalObject (ObjDesc, WalkState);
694 1.3.2.2 bouyer AcpiOsPrintf ("\n");
695 1.3.2.2 bouyer }
696 1.3.2.2 bouyer
697 1.3.2.2 bouyer
698 1.3.2.2 bouyer /*******************************************************************************
699 1.3.2.2 bouyer *
700 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayArgumentObject
701 1.3.2.2 bouyer *
702 1.3.2.2 bouyer * PARAMETERS: ObjDesc - Object to be displayed
703 1.3.2.2 bouyer * WalkState - Current walk state
704 1.3.2.2 bouyer *
705 1.3.2.2 bouyer * RETURN: None
706 1.3.2.2 bouyer *
707 1.3.2.2 bouyer * DESCRIPTION: Display the result of an AML opcode
708 1.3.2.2 bouyer *
709 1.3.2.2 bouyer ******************************************************************************/
710 1.3.2.2 bouyer
711 1.3.2.2 bouyer void
712 1.3.2.2 bouyer AcpiDbDisplayArgumentObject (
713 1.3.2.2 bouyer ACPI_OPERAND_OBJECT *ObjDesc,
714 1.3.2.2 bouyer ACPI_WALK_STATE *WalkState)
715 1.3.2.2 bouyer {
716 1.3.2.2 bouyer
717 1.3.2.2 bouyer if (!AcpiGbl_CmSingleStep)
718 1.3.2.2 bouyer {
719 1.3.2.2 bouyer return;
720 1.3.2.2 bouyer }
721 1.3.2.2 bouyer
722 1.3.2.2 bouyer AcpiOsPrintf ("ArgObj: ");
723 1.3.2.2 bouyer AcpiDmDisplayInternalObject (ObjDesc, WalkState);
724 1.3.2.2 bouyer }
725 1.3.2.2 bouyer
726 1.3.2.2 bouyer
727 1.3.2.2 bouyer /*******************************************************************************
728 1.3.2.2 bouyer *
729 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayGpes
730 1.3.2.2 bouyer *
731 1.3.2.2 bouyer * PARAMETERS: None
732 1.3.2.2 bouyer *
733 1.3.2.2 bouyer * RETURN: None
734 1.3.2.2 bouyer *
735 1.3.2.2 bouyer * DESCRIPTION: Display the current GPE structures
736 1.3.2.2 bouyer *
737 1.3.2.2 bouyer ******************************************************************************/
738 1.3.2.2 bouyer
739 1.3.2.2 bouyer void
740 1.3.2.2 bouyer AcpiDbDisplayGpes (
741 1.3.2.2 bouyer void)
742 1.3.2.2 bouyer {
743 1.3.2.2 bouyer ACPI_GPE_BLOCK_INFO *GpeBlock;
744 1.3.2.2 bouyer ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
745 1.3.2.2 bouyer ACPI_GPE_EVENT_INFO *GpeEventInfo;
746 1.3.2.2 bouyer ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
747 1.3.2.2 bouyer const char *GpeType;
748 1.3.2.2 bouyer UINT32 GpeIndex;
749 1.3.2.2 bouyer UINT32 Block = 0;
750 1.3.2.2 bouyer UINT32 i;
751 1.3.2.2 bouyer UINT32 j;
752 1.3.2.2 bouyer char Buffer[80];
753 1.3.2.2 bouyer ACPI_BUFFER RetBuf;
754 1.3.2.2 bouyer ACPI_STATUS Status;
755 1.3.2.2 bouyer
756 1.3.2.2 bouyer
757 1.3.2.2 bouyer RetBuf.Length = sizeof (Buffer);
758 1.3.2.2 bouyer RetBuf.Pointer = Buffer;
759 1.3.2.2 bouyer
760 1.3.2.2 bouyer Block = 0;
761 1.3.2.2 bouyer
762 1.3.2.2 bouyer /* Walk the GPE lists */
763 1.3.2.2 bouyer
764 1.3.2.2 bouyer GpeXruptInfo = AcpiGbl_GpeXruptListHead;
765 1.3.2.2 bouyer while (GpeXruptInfo)
766 1.3.2.2 bouyer {
767 1.3.2.2 bouyer GpeBlock = GpeXruptInfo->GpeBlockListHead;
768 1.3.2.2 bouyer while (GpeBlock)
769 1.3.2.2 bouyer {
770 1.3.2.2 bouyer Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
771 1.3.2.2 bouyer if (ACPI_FAILURE (Status))
772 1.3.2.2 bouyer {
773 1.3.2.2 bouyer AcpiOsPrintf ("Could not convert name to pathname\n");
774 1.3.2.2 bouyer }
775 1.3.2.2 bouyer
776 1.3.2.2 bouyer if (GpeBlock->Node == AcpiGbl_FadtGpeDevice)
777 1.3.2.2 bouyer {
778 1.3.2.2 bouyer GpeType = "FADT-defined GPE block";
779 1.3.2.2 bouyer }
780 1.3.2.2 bouyer else
781 1.3.2.2 bouyer {
782 1.3.2.2 bouyer GpeType = "GPE Block Device";
783 1.3.2.2 bouyer }
784 1.3.2.2 bouyer
785 1.3.2.2 bouyer AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
786 1.3.2.2 bouyer Block, GpeBlock, GpeBlock->Node, Buffer, GpeType);
787 1.3.2.2 bouyer
788 1.3.2.2 bouyer AcpiOsPrintf (" Registers: %u (%u GPEs)\n",
789 1.3.2.2 bouyer GpeBlock->RegisterCount, GpeBlock->GpeCount);
790 1.3.2.2 bouyer
791 1.3.2.2 bouyer AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n",
792 1.3.2.2 bouyer GpeBlock->BlockBaseNumber,
793 1.3.2.2 bouyer GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1),
794 1.3.2.2 bouyer GpeXruptInfo->InterruptNumber);
795 1.3.2.2 bouyer
796 1.3.2.2 bouyer AcpiOsPrintf (
797 1.3.2.2 bouyer " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
798 1.3.2.2 bouyer GpeBlock->RegisterInfo,
799 1.3.2.2 bouyer ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address),
800 1.3.2.2 bouyer ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address));
801 1.3.2.2 bouyer
802 1.3.2.2 bouyer AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
803 1.3.2.2 bouyer
804 1.3.2.2 bouyer /* Examine each GPE Register within the block */
805 1.3.2.2 bouyer
806 1.3.2.2 bouyer for (i = 0; i < GpeBlock->RegisterCount; i++)
807 1.3.2.2 bouyer {
808 1.3.2.2 bouyer GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
809 1.3.2.2 bouyer
810 1.3.2.2 bouyer AcpiOsPrintf (
811 1.3.2.2 bouyer " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X"
812 1.3.2.2 bouyer " Status %8.8X%8.8X Enable %8.8X%8.8X\n",
813 1.3.2.2 bouyer i, GpeRegisterInfo->BaseGpeNumber,
814 1.3.2.2 bouyer GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
815 1.3.2.2 bouyer GpeRegisterInfo->EnableForRun,
816 1.3.2.2 bouyer GpeRegisterInfo->EnableForWake,
817 1.3.2.2 bouyer ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address),
818 1.3.2.2 bouyer ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address));
819 1.3.2.2 bouyer
820 1.3.2.2 bouyer /* Now look at the individual GPEs in this byte register */
821 1.3.2.2 bouyer
822 1.3.2.2 bouyer for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
823 1.3.2.2 bouyer {
824 1.3.2.2 bouyer GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
825 1.3.2.2 bouyer GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
826 1.3.2.2 bouyer
827 1.3.2.2 bouyer if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
828 1.3.2.2 bouyer ACPI_GPE_DISPATCH_NONE)
829 1.3.2.2 bouyer {
830 1.3.2.2 bouyer /* This GPE is not used (no method or handler), ignore it */
831 1.3.2.2 bouyer
832 1.3.2.2 bouyer continue;
833 1.3.2.2 bouyer }
834 1.3.2.2 bouyer
835 1.3.2.2 bouyer AcpiOsPrintf (
836 1.3.2.2 bouyer " GPE %.2X: %p RunRefs %2.2X Flags %2.2X (",
837 1.3.2.2 bouyer GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo,
838 1.3.2.2 bouyer GpeEventInfo->RuntimeCount, GpeEventInfo->Flags);
839 1.3.2.2 bouyer
840 1.3.2.2 bouyer /* Decode the flags byte */
841 1.3.2.2 bouyer
842 1.3.2.2 bouyer if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
843 1.3.2.2 bouyer {
844 1.3.2.2 bouyer AcpiOsPrintf ("Level, ");
845 1.3.2.2 bouyer }
846 1.3.2.2 bouyer else
847 1.3.2.2 bouyer {
848 1.3.2.2 bouyer AcpiOsPrintf ("Edge, ");
849 1.3.2.2 bouyer }
850 1.3.2.2 bouyer
851 1.3.2.2 bouyer if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
852 1.3.2.2 bouyer {
853 1.3.2.2 bouyer AcpiOsPrintf ("CanWake, ");
854 1.3.2.2 bouyer }
855 1.3.2.2 bouyer else
856 1.3.2.2 bouyer {
857 1.3.2.2 bouyer AcpiOsPrintf ("RunOnly, ");
858 1.3.2.2 bouyer }
859 1.3.2.2 bouyer
860 1.3.2.2 bouyer switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
861 1.3.2.2 bouyer {
862 1.3.2.2 bouyer case ACPI_GPE_DISPATCH_NONE:
863 1.3.2.2 bouyer AcpiOsPrintf ("NotUsed");
864 1.3.2.2 bouyer break;
865 1.3.2.2 bouyer case ACPI_GPE_DISPATCH_METHOD:
866 1.3.2.2 bouyer AcpiOsPrintf ("Method");
867 1.3.2.2 bouyer break;
868 1.3.2.2 bouyer case ACPI_GPE_DISPATCH_HANDLER:
869 1.3.2.2 bouyer AcpiOsPrintf ("Handler");
870 1.3.2.2 bouyer break;
871 1.3.2.2 bouyer case ACPI_GPE_DISPATCH_NOTIFY:
872 1.3.2.2 bouyer AcpiOsPrintf ("Notify");
873 1.3.2.2 bouyer break;
874 1.3.2.2 bouyer default:
875 1.3.2.2 bouyer AcpiOsPrintf ("UNKNOWN: %X",
876 1.3.2.2 bouyer GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK);
877 1.3.2.2 bouyer break;
878 1.3.2.2 bouyer }
879 1.3.2.2 bouyer
880 1.3.2.2 bouyer AcpiOsPrintf (")\n");
881 1.3.2.2 bouyer }
882 1.3.2.2 bouyer }
883 1.3.2.2 bouyer Block++;
884 1.3.2.2 bouyer GpeBlock = GpeBlock->Next;
885 1.3.2.2 bouyer }
886 1.3.2.2 bouyer GpeXruptInfo = GpeXruptInfo->Next;
887 1.3.2.2 bouyer }
888 1.3.2.2 bouyer }
889 1.3.2.2 bouyer
890 1.3.2.2 bouyer /*******************************************************************************
891 1.3.2.2 bouyer *
892 1.3.2.2 bouyer * FUNCTION: AcpiDbDisplayHandlers
893 1.3.2.2 bouyer *
894 1.3.2.2 bouyer * PARAMETERS: None
895 1.3.2.2 bouyer *
896 1.3.2.2 bouyer * RETURN: None
897 1.3.2.2 bouyer *
898 1.3.2.2 bouyer * DESCRIPTION: Display the currently installed global handlers
899 1.3.2.2 bouyer *
900 1.3.2.2 bouyer ******************************************************************************/
901 1.3.2.2 bouyer
902 1.3.2.2 bouyer #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
903 1.3.2.2 bouyer #define ACPI_HANDLER_NAME_STRING "%30s : "
904 1.3.2.2 bouyer #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
905 1.3.2.2 bouyer #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
906 1.3.2.2 bouyer
907 1.3.2.2 bouyer /* All predefined Space IDs */
908 1.3.2.2 bouyer
909 1.3.2.2 bouyer static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
910 1.3.2.2 bouyer {
911 1.3.2.2 bouyer ACPI_ADR_SPACE_SYSTEM_MEMORY,
912 1.3.2.2 bouyer ACPI_ADR_SPACE_SYSTEM_IO,
913 1.3.2.2 bouyer ACPI_ADR_SPACE_PCI_CONFIG,
914 1.3.2.2 bouyer ACPI_ADR_SPACE_EC,
915 1.3.2.2 bouyer ACPI_ADR_SPACE_SMBUS,
916 1.3.2.2 bouyer ACPI_ADR_SPACE_CMOS,
917 1.3.2.2 bouyer ACPI_ADR_SPACE_PCI_BAR_TARGET,
918 1.3.2.2 bouyer ACPI_ADR_SPACE_IPMI,
919 1.3.2.2 bouyer ACPI_ADR_SPACE_DATA_TABLE,
920 1.3.2.2 bouyer ACPI_ADR_SPACE_FIXED_HARDWARE
921 1.3.2.2 bouyer };
922 1.3.2.2 bouyer
923 1.3.2.2 bouyer /* Global handler information */
924 1.3.2.2 bouyer
925 1.3.2.2 bouyer typedef struct acpi_handler_info
926 1.3.2.2 bouyer {
927 1.3.2.2 bouyer void *Handler;
928 1.3.2.3 bouyer const char *Name;
929 1.3.2.2 bouyer
930 1.3.2.2 bouyer } ACPI_HANDLER_INFO;
931 1.3.2.2 bouyer
932 1.3.2.2 bouyer ACPI_HANDLER_INFO HandlerList[] =
933 1.3.2.2 bouyer {
934 1.3.2.2 bouyer {&AcpiGbl_SystemNotify.Handler, "System Notifications"},
935 1.3.2.2 bouyer {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
936 1.3.2.2 bouyer {&AcpiGbl_TableHandler, "ACPI Table Events"},
937 1.3.2.2 bouyer {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
938 1.3.2.2 bouyer {&AcpiGbl_InterfaceHandler, "OSI Invocations"}
939 1.3.2.2 bouyer };
940 1.3.2.2 bouyer
941 1.3.2.2 bouyer
942 1.3.2.2 bouyer void
943 1.3.2.2 bouyer AcpiDbDisplayHandlers (
944 1.3.2.2 bouyer void)
945 1.3.2.2 bouyer {
946 1.3.2.2 bouyer ACPI_OPERAND_OBJECT *ObjDesc;
947 1.3.2.2 bouyer ACPI_OPERAND_OBJECT *HandlerObj;
948 1.3.2.2 bouyer ACPI_ADR_SPACE_TYPE SpaceId;
949 1.3.2.2 bouyer UINT32 i;
950 1.3.2.2 bouyer
951 1.3.2.2 bouyer
952 1.3.2.2 bouyer /* Operation region handlers */
953 1.3.2.2 bouyer
954 1.3.2.2 bouyer AcpiOsPrintf ("\nOperation Region Handlers:\n");
955 1.3.2.2 bouyer
956 1.3.2.2 bouyer ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
957 1.3.2.2 bouyer if (ObjDesc)
958 1.3.2.2 bouyer {
959 1.3.2.2 bouyer for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
960 1.3.2.2 bouyer {
961 1.3.2.2 bouyer SpaceId = SpaceIdList[i];
962 1.3.2.2 bouyer HandlerObj = ObjDesc->Device.Handler;
963 1.3.2.2 bouyer
964 1.3.2.2 bouyer AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
965 1.3.2.2 bouyer AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId);
966 1.3.2.2 bouyer
967 1.3.2.2 bouyer while (HandlerObj)
968 1.3.2.2 bouyer {
969 1.3.2.2 bouyer if (i == HandlerObj->AddressSpace.SpaceId)
970 1.3.2.2 bouyer {
971 1.3.2.2 bouyer AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
972 1.3.2.2 bouyer (HandlerObj->AddressSpace.HandlerFlags &
973 1.3.2.2 bouyer ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
974 1.3.2.2 bouyer HandlerObj->AddressSpace.Handler);
975 1.3.2.2 bouyer goto FoundHandler;
976 1.3.2.2 bouyer }
977 1.3.2.2 bouyer
978 1.3.2.2 bouyer HandlerObj = HandlerObj->AddressSpace.Next;
979 1.3.2.2 bouyer }
980 1.3.2.2 bouyer
981 1.3.2.2 bouyer /* There is no handler for this SpaceId */
982 1.3.2.2 bouyer
983 1.3.2.2 bouyer AcpiOsPrintf ("None\n");
984 1.3.2.2 bouyer
985 1.3.2.2 bouyer FoundHandler:;
986 1.3.2.2 bouyer }
987 1.3.2.2 bouyer }
988 1.3.2.2 bouyer
989 1.3.2.2 bouyer /* Fixed event handlers */
990 1.3.2.2 bouyer
991 1.3.2.2 bouyer AcpiOsPrintf ("\nFixed Event Handlers:\n");
992 1.3.2.2 bouyer
993 1.3.2.2 bouyer for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
994 1.3.2.2 bouyer {
995 1.3.2.2 bouyer AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i);
996 1.3.2.2 bouyer if (AcpiGbl_FixedEventHandlers[i].Handler)
997 1.3.2.2 bouyer {
998 1.3.2.2 bouyer AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
999 1.3.2.2 bouyer AcpiGbl_FixedEventHandlers[i].Handler);
1000 1.3.2.2 bouyer }
1001 1.3.2.2 bouyer else
1002 1.3.2.2 bouyer {
1003 1.3.2.2 bouyer AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1004 1.3.2.2 bouyer }
1005 1.3.2.2 bouyer }
1006 1.3.2.2 bouyer
1007 1.3.2.2 bouyer /* Miscellaneous global handlers */
1008 1.3.2.2 bouyer
1009 1.3.2.2 bouyer AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
1010 1.3.2.2 bouyer
1011 1.3.2.2 bouyer for (i = 0; i < ACPI_ARRAY_LENGTH (HandlerList); i++)
1012 1.3.2.2 bouyer {
1013 1.3.2.2 bouyer AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, HandlerList[i].Name);
1014 1.3.2.2 bouyer if (HandlerList[i].Handler)
1015 1.3.2.2 bouyer {
1016 1.3.2.2 bouyer AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1017 1.3.2.2 bouyer HandlerList[i].Handler);
1018 1.3.2.2 bouyer }
1019 1.3.2.2 bouyer else
1020 1.3.2.2 bouyer {
1021 1.3.2.2 bouyer AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1022 1.3.2.2 bouyer }
1023 1.3.2.2 bouyer }
1024 1.3.2.2 bouyer }
1025 1.3.2.2 bouyer
1026 1.3.2.2 bouyer #endif /* ACPI_DEBUGGER */
1027