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