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