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.
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 * System handler information.
74 * Used for Handlers command, in AcpiDbDisplayHandlers.
75 */
76 #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
77 #define ACPI_HANDLER_NAME_STRING "%30s : "
78 #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
79 #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
80
81 /* All predefined Address Space IDs */
82
83 static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] =
84 {
85 ACPI_ADR_SPACE_SYSTEM_MEMORY,
86 ACPI_ADR_SPACE_SYSTEM_IO,
87 ACPI_ADR_SPACE_PCI_CONFIG,
88 ACPI_ADR_SPACE_EC,
89 ACPI_ADR_SPACE_SMBUS,
90 ACPI_ADR_SPACE_CMOS,
91 ACPI_ADR_SPACE_PCI_BAR_TARGET,
92 ACPI_ADR_SPACE_IPMI,
93 ACPI_ADR_SPACE_DATA_TABLE,
94 ACPI_ADR_SPACE_FIXED_HARDWARE
95 };
96
97 /* Global handler information */
98
99 typedef struct acpi_handler_info
100 {
101 void *Handler;
102 char *Name;
103
104 } ACPI_HANDLER_INFO;
105
106 static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] =
107 {
108 {&AcpiGbl_SystemNotify.Handler, "System Notifications"},
109 {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
110 {&AcpiGbl_TableHandler, "ACPI Table Events"},
111 {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
112 {&AcpiGbl_InterfaceHandler, "OSI Invocations"}
113 };
114
115
116 /*******************************************************************************
117 *
118 * FUNCTION: AcpiDbGetPointer
119 *
120 * PARAMETERS: Target - Pointer to string to be converted
121 *
122 * RETURN: Converted pointer
123 *
124 * DESCRIPTION: Convert an ascii pointer value to a real value
125 *
126 ******************************************************************************/
127
128 static void *
129 AcpiDbGetPointer (
130 void *Target)
131 {
132 void *ObjPtr;
133
134
135 ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
136 return (ObjPtr);
137 }
138
139
140 /*******************************************************************************
141 *
142 * FUNCTION: AcpiDbDumpParserDescriptor
143 *
144 * PARAMETERS: Op - A parser Op descriptor
145 *
146 * RETURN: None
147 *
148 * DESCRIPTION: Display a formatted parser object
149 *
150 ******************************************************************************/
151
152 static void
153 AcpiDbDumpParserDescriptor (
154 ACPI_PARSE_OBJECT *Op)
155 {
239 }
240
241 /* Decode the object type */
242
243 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
244 {
245 case ACPI_DESC_TYPE_NAMED:
246
247 /* This is a namespace Node */
248
249 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
250 {
251 AcpiOsPrintf (
252 "Cannot read entire Named object at address %p\n", ObjPtr);
253 return;
254 }
255
256 Node = ObjPtr;
257 goto DumpNode;
258
259
260 case ACPI_DESC_TYPE_OPERAND:
261
262 /* This is a ACPI OPERAND OBJECT */
263
264 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
265 {
266 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n",
267 ObjPtr);
268 return;
269 }
270
271 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display,
272 ACPI_UINT32_MAX);
273 AcpiExDumpObjectDescriptor (ObjPtr, 1);
274 break;
275
276
277 case ACPI_DESC_TYPE_PARSER:
278
279 /* This is a Parser Op object */
280
281 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
282 {
283 AcpiOsPrintf (
284 "Cannot read entire Parser object at address %p\n", ObjPtr);
285 return;
286 }
287
288 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display,
289 ACPI_UINT32_MAX);
290 AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
291 break;
292
293
294 default:
295
296 /* Is not a recognizeable object */
297
298 Size = 16;
299 if (AcpiOsReadable (ObjPtr, 64))
300 {
301 Size = 64;
302 }
303
304 /* Just dump some memory */
305
306 AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
307 break;
308 }
309
310 return;
311 }
312
313 /* The parameter is a name string that must be resolved to a Named obj */
314
315 Node = AcpiDbLocalNsLookup (Target);
316 if (!Node)
317 {
318 return;
319 }
320
321
322 DumpNode:
323 /* Now dump the NS node */
324
325 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
326 if (ACPI_FAILURE (Status))
327 {
328 AcpiOsPrintf ("Could not convert name to pathname\n");
329 }
330
331 else
332 {
333 AcpiOsPrintf ("Object (%p) Pathname: %s\n",
334 Node, (char *) RetBuf.Pointer);
335 }
336
337 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
338 {
339 AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
340 return;
341 }
342
343 AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
344 Display, ACPI_UINT32_MAX);
345 AcpiExDumpNamespaceNode (Node, 1);
346
347 ObjDesc = AcpiNsGetAttachedObject (Node);
348 if (ObjDesc)
349 {
350 AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
351 if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
352 {
353 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
354 ObjDesc);
355 return;
356 }
357
358 AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT),
359 Display, ACPI_UINT32_MAX);
360 AcpiExDumpObjectDescriptor (ObjDesc, 1);
361 }
362 }
363
364
365 /*******************************************************************************
366 *
367 * FUNCTION: AcpiDbDisplayMethodInfo
368 *
369 * PARAMETERS: StartOp - Root of the control method parse tree
370 *
371 * RETURN: None
372 *
373 * DESCRIPTION: Display information about the current method
374 *
375 ******************************************************************************/
376
377 void
378 AcpiDbDisplayMethodInfo (
420
421 while (Op)
422 {
423 if (Op == StartOp)
424 {
425 CountRemaining = TRUE;
426 }
427
428 NumOps++;
429 if (CountRemaining)
430 {
431 NumRemainingOps++;
432 }
433
434 /* Decode the opcode */
435
436 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
437 switch (OpInfo->Class)
438 {
439 case AML_CLASS_ARGUMENT:
440 if (CountRemaining)
441 {
442 NumRemainingOperands++;
443 }
444
445 NumOperands++;
446 break;
447
448 case AML_CLASS_UNKNOWN:
449 /* Bad opcode or ASCII character */
450
451 continue;
452
453 default:
454 if (CountRemaining)
455 {
456 NumRemainingOperators++;
457 }
458
459 NumOperators++;
460 break;
461 }
462
463 Op = AcpiPsGetDepthNext (StartOp, Op);
464 }
465
466 AcpiOsPrintf (
467 "Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
468 NumOps, NumOperators, NumOperands);
469
470 AcpiOsPrintf (
471 "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
472 NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
473 }
624 }
625
626 Node = WalkState->MethodNode;
627 AcpiOsPrintf ("Current Control Method Call Tree\n");
628
629 while (WalkState)
630 {
631 Node = WalkState->MethodNode;
632
633 AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node));
634
635 WalkState = WalkState->Next;
636 }
637 }
638
639
640 /*******************************************************************************
641 *
642 * FUNCTION: AcpiDbDisplayObjectType
643 *
644 * PARAMETERS: ObjectArg - User entered NS node handle
645 *
646 * RETURN: None
647 *
648 * DESCRIPTION: Display type of an arbitrary NS node
649 *
650 ******************************************************************************/
651
652 void
653 AcpiDbDisplayObjectType (
654 char *ObjectArg)
655 {
656 ACPI_HANDLE Handle;
657 ACPI_DEVICE_INFO *Info;
658 ACPI_STATUS Status;
659 UINT32 i;
660
661
662 Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
663
664 Status = AcpiGetObjectInfo (Handle, &Info);
665 if (ACPI_FAILURE (Status))
666 {
667 AcpiOsPrintf ("Could not get object info, %s\n",
668 AcpiFormatException (Status));
669 return;
670 }
671
672 AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
673 ACPI_FORMAT_UINT64 (Info->Address),
674 Info->CurrentStatus, Info->Flags);
675
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 if (Info->Valid & ACPI_VALID_HID)
686 {
687 AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String);
688 }
689 if (Info->Valid & ACPI_VALID_UID)
690 {
691 AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String);
692 }
693 if (Info->Valid & ACPI_VALID_CID)
694 {
695 for (i = 0; i < Info->CompatibleIdList.Count; i++)
696 {
697 AcpiOsPrintf ("CID %u: %s\n", i,
698 Info->CompatibleIdList.Ids[i].String);
699 }
700 }
701
702 ACPI_FREE (Info);
703 }
704
705
706 /*******************************************************************************
707 *
708 * FUNCTION: AcpiDbDisplayResultObject
709 *
710 * PARAMETERS: ObjDesc - Object to be displayed
711 * WalkState - Current walk state
712 *
751 * DESCRIPTION: Display the result of an AML opcode
752 *
753 ******************************************************************************/
754
755 void
756 AcpiDbDisplayArgumentObject (
757 ACPI_OPERAND_OBJECT *ObjDesc,
758 ACPI_WALK_STATE *WalkState)
759 {
760
761 if (!AcpiGbl_CmSingleStep)
762 {
763 return;
764 }
765
766 AcpiOsPrintf ("ArgObj: ");
767 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
768 }
769
770
771 /*******************************************************************************
772 *
773 * FUNCTION: AcpiDbDisplayGpes
774 *
775 * PARAMETERS: None
776 *
777 * RETURN: None
778 *
779 * DESCRIPTION: Display the current GPE structures
780 *
781 ******************************************************************************/
782
783 void
784 AcpiDbDisplayGpes (
785 void)
786 {
787 ACPI_GPE_BLOCK_INFO *GpeBlock;
788 ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
789 ACPI_GPE_EVENT_INFO *GpeEventInfo;
790 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
791 char *GpeType;
792 UINT32 GpeIndex;
793 UINT32 Block = 0;
794 UINT32 i;
795 UINT32 j;
796 char Buffer[80];
797 ACPI_BUFFER RetBuf;
798 ACPI_STATUS Status;
799
800
801 RetBuf.Length = sizeof (Buffer);
802 RetBuf.Pointer = Buffer;
803
804 Block = 0;
805
806 /* Walk the GPE lists */
807
808 GpeXruptInfo = AcpiGbl_GpeXruptListHead;
809 while (GpeXruptInfo)
810 {
811 GpeBlock = GpeXruptInfo->GpeBlockListHead;
812 while (GpeBlock)
813 {
814 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
815 if (ACPI_FAILURE (Status))
887 {
888 AcpiOsPrintf ("Level, ");
889 }
890 else
891 {
892 AcpiOsPrintf ("Edge, ");
893 }
894
895 if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
896 {
897 AcpiOsPrintf ("CanWake, ");
898 }
899 else
900 {
901 AcpiOsPrintf ("RunOnly, ");
902 }
903
904 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
905 {
906 case ACPI_GPE_DISPATCH_NONE:
907 AcpiOsPrintf ("NotUsed");
908 break;
909 case ACPI_GPE_DISPATCH_METHOD:
910 AcpiOsPrintf ("Method");
911 break;
912 case ACPI_GPE_DISPATCH_HANDLER:
913 AcpiOsPrintf ("Handler");
914 break;
915 case ACPI_GPE_DISPATCH_NOTIFY:
916 AcpiOsPrintf ("Notify");
917 break;
918 default:
919 AcpiOsPrintf ("UNKNOWN: %X",
920 GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK);
921 break;
922 }
923
924 AcpiOsPrintf (")\n");
925 }
926 }
927 Block++;
928 GpeBlock = GpeBlock->Next;
929 }
930 GpeXruptInfo = GpeXruptInfo->Next;
931 }
932 }
933
934
935 /*******************************************************************************
936 *
937 * FUNCTION: AcpiDbDisplayHandlers
938 *
939 * PARAMETERS: None
940 *
941 * RETURN: None
942 *
943 * DESCRIPTION: Display the currently installed global handlers
944 *
945 ******************************************************************************/
946
947 void
948 AcpiDbDisplayHandlers (
949 void)
950 {
951 ACPI_OPERAND_OBJECT *ObjDesc;
952 ACPI_OPERAND_OBJECT *HandlerObj;
953 ACPI_ADR_SPACE_TYPE SpaceId;
954 UINT32 i;
955
956
957 /* Operation region handlers */
958
959 AcpiOsPrintf ("\nOperation Region Handlers:\n");
960
961 ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
962 if (ObjDesc)
963 {
964 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++)
965 {
966 SpaceId = AcpiGbl_SpaceIdList[i];
967 HandlerObj = ObjDesc->Device.Handler;
968
969 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
970 AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId);
971
972 while (HandlerObj)
973 {
974 if (i == HandlerObj->AddressSpace.SpaceId)
975 {
976 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
977 (HandlerObj->AddressSpace.HandlerFlags &
978 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
979 HandlerObj->AddressSpace.Handler);
980 goto FoundHandler;
981 }
982
983 HandlerObj = HandlerObj->AddressSpace.Next;
984 }
985
986 /* There is no handler for this SpaceId */
987
988 AcpiOsPrintf ("None\n");
989
990 FoundHandler:;
991 }
992 }
993
994 /* Fixed event handlers */
995
996 AcpiOsPrintf ("\nFixed Event Handlers:\n");
997
998 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
999 {
1000 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i);
1001 if (AcpiGbl_FixedEventHandlers[i].Handler)
1002 {
1003 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1004 AcpiGbl_FixedEventHandlers[i].Handler);
1005 }
1006 else
1007 {
1008 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1009 }
1010 }
1011
1012 /* Miscellaneous global handlers */
1013
1014 AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
1015
1016 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++)
1017 {
1018 AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name);
1019 if (AcpiGbl_HandlerList[i].Handler)
1020 {
1021 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1022 AcpiGbl_HandlerList[i].Handler);
1023 }
1024 else
1025 {
1026 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1027 }
1028 }
1029 }
1030
1031 #endif /* ACPI_DEBUGGER */
|
1 /*******************************************************************************
2 *
3 * Module Name: dbdisply - debug display commands
4 *
5 ******************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2014, 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.
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 static ACPI_STATUS
72 AcpiDbDisplayNonRootHandlers (
73 ACPI_HANDLE ObjHandle,
74 UINT32 NestingLevel,
75 void *Context,
76 void **ReturnValue);
77
78 /*
79 * System handler information.
80 * Used for Handlers command, in AcpiDbDisplayHandlers.
81 */
82 #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
83 #define ACPI_HANDLER_NAME_STRING "%30s : "
84 #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
85 #define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)"
86 #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
87
88 /* All predefined Address Space IDs */
89
90 static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] =
91 {
92 ACPI_ADR_SPACE_SYSTEM_MEMORY,
93 ACPI_ADR_SPACE_SYSTEM_IO,
94 ACPI_ADR_SPACE_PCI_CONFIG,
95 ACPI_ADR_SPACE_EC,
96 ACPI_ADR_SPACE_SMBUS,
97 ACPI_ADR_SPACE_CMOS,
98 ACPI_ADR_SPACE_PCI_BAR_TARGET,
99 ACPI_ADR_SPACE_IPMI,
100 ACPI_ADR_SPACE_GPIO,
101 ACPI_ADR_SPACE_GSBUS,
102 ACPI_ADR_SPACE_DATA_TABLE,
103 ACPI_ADR_SPACE_FIXED_HARDWARE
104 };
105
106 /* Global handler information */
107
108 typedef struct acpi_handler_info
109 {
110 void *Handler;
111 char *Name;
112
113 } ACPI_HANDLER_INFO;
114
115 static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] =
116 {
117 {&AcpiGbl_GlobalNotify[0].Handler, "System Notifications"},
118 {&AcpiGbl_GlobalNotify[1].Handler, "Device Notifications"},
119 {&AcpiGbl_TableHandler, "ACPI Table Events"},
120 {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
121 {&AcpiGbl_InterfaceHandler, "OSI Invocations"}
122 };
123
124
125 /*******************************************************************************
126 *
127 * FUNCTION: AcpiDbGetPointer
128 *
129 * PARAMETERS: Target - Pointer to string to be converted
130 *
131 * RETURN: Converted pointer
132 *
133 * DESCRIPTION: Convert an ascii pointer value to a real value
134 *
135 ******************************************************************************/
136
137 static void *
138 AcpiDbGetPointer (
139 void *Target)
140 {
141 void *ObjPtr;
142 ACPI_SIZE Address;
143
144
145 Address = ACPI_STRTOUL (Target, NULL, 16);
146 ObjPtr = ACPI_TO_POINTER (Address);
147 return (ObjPtr);
148 }
149
150
151 /*******************************************************************************
152 *
153 * FUNCTION: AcpiDbDumpParserDescriptor
154 *
155 * PARAMETERS: Op - A parser Op descriptor
156 *
157 * RETURN: None
158 *
159 * DESCRIPTION: Display a formatted parser object
160 *
161 ******************************************************************************/
162
163 static void
164 AcpiDbDumpParserDescriptor (
165 ACPI_PARSE_OBJECT *Op)
166 {
250 }
251
252 /* Decode the object type */
253
254 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
255 {
256 case ACPI_DESC_TYPE_NAMED:
257
258 /* This is a namespace Node */
259
260 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
261 {
262 AcpiOsPrintf (
263 "Cannot read entire Named object at address %p\n", ObjPtr);
264 return;
265 }
266
267 Node = ObjPtr;
268 goto DumpNode;
269
270 case ACPI_DESC_TYPE_OPERAND:
271
272 /* This is a ACPI OPERAND OBJECT */
273
274 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
275 {
276 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n",
277 ObjPtr);
278 return;
279 }
280
281 AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display,
282 ACPI_UINT32_MAX);
283 AcpiExDumpObjectDescriptor (ObjPtr, 1);
284 break;
285
286 case ACPI_DESC_TYPE_PARSER:
287
288 /* This is a Parser Op object */
289
290 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
291 {
292 AcpiOsPrintf (
293 "Cannot read entire Parser object at address %p\n", ObjPtr);
294 return;
295 }
296
297 AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display,
298 ACPI_UINT32_MAX);
299 AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
300 break;
301
302 default:
303
304 /* Is not a recognizeable object */
305
306 Size = 16;
307 if (AcpiOsReadable (ObjPtr, 64))
308 {
309 Size = 64;
310 }
311
312 /* Just dump some memory */
313
314 AcpiUtDebugDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
315 break;
316 }
317
318 return;
319 }
320
321 /* The parameter is a name string that must be resolved to a Named obj */
322
323 Node = AcpiDbLocalNsLookup (Target);
324 if (!Node)
325 {
326 return;
327 }
328
329
330 DumpNode:
331 /* Now dump the NS node */
332
333 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
334 if (ACPI_FAILURE (Status))
335 {
336 AcpiOsPrintf ("Could not convert name to pathname\n");
337 }
338
339 else
340 {
341 AcpiOsPrintf ("Object (%p) Pathname: %s\n",
342 Node, (char *) RetBuf.Pointer);
343 }
344
345 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
346 {
347 AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
348 return;
349 }
350
351 AcpiUtDebugDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
352 Display, ACPI_UINT32_MAX);
353 AcpiExDumpNamespaceNode (Node, 1);
354
355 ObjDesc = AcpiNsGetAttachedObject (Node);
356 if (ObjDesc)
357 {
358 AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
359 if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
360 {
361 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
362 ObjDesc);
363 return;
364 }
365
366 AcpiUtDebugDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT),
367 Display, ACPI_UINT32_MAX);
368 AcpiExDumpObjectDescriptor (ObjDesc, 1);
369 }
370 }
371
372
373 /*******************************************************************************
374 *
375 * FUNCTION: AcpiDbDisplayMethodInfo
376 *
377 * PARAMETERS: StartOp - Root of the control method parse tree
378 *
379 * RETURN: None
380 *
381 * DESCRIPTION: Display information about the current method
382 *
383 ******************************************************************************/
384
385 void
386 AcpiDbDisplayMethodInfo (
428
429 while (Op)
430 {
431 if (Op == StartOp)
432 {
433 CountRemaining = TRUE;
434 }
435
436 NumOps++;
437 if (CountRemaining)
438 {
439 NumRemainingOps++;
440 }
441
442 /* Decode the opcode */
443
444 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
445 switch (OpInfo->Class)
446 {
447 case AML_CLASS_ARGUMENT:
448
449 if (CountRemaining)
450 {
451 NumRemainingOperands++;
452 }
453
454 NumOperands++;
455 break;
456
457 case AML_CLASS_UNKNOWN:
458
459 /* Bad opcode or ASCII character */
460
461 continue;
462
463 default:
464
465 if (CountRemaining)
466 {
467 NumRemainingOperators++;
468 }
469
470 NumOperators++;
471 break;
472 }
473
474 Op = AcpiPsGetDepthNext (StartOp, Op);
475 }
476
477 AcpiOsPrintf (
478 "Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
479 NumOps, NumOperators, NumOperands);
480
481 AcpiOsPrintf (
482 "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
483 NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
484 }
635 }
636
637 Node = WalkState->MethodNode;
638 AcpiOsPrintf ("Current Control Method Call Tree\n");
639
640 while (WalkState)
641 {
642 Node = WalkState->MethodNode;
643
644 AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node));
645
646 WalkState = WalkState->Next;
647 }
648 }
649
650
651 /*******************************************************************************
652 *
653 * FUNCTION: AcpiDbDisplayObjectType
654 *
655 * PARAMETERS: Name - User entered NS node handle or name
656 *
657 * RETURN: None
658 *
659 * DESCRIPTION: Display type of an arbitrary NS node
660 *
661 ******************************************************************************/
662
663 void
664 AcpiDbDisplayObjectType (
665 char *Name)
666 {
667 ACPI_NAMESPACE_NODE *Node;
668 ACPI_DEVICE_INFO *Info;
669 ACPI_STATUS Status;
670 UINT32 i;
671
672
673 Node = AcpiDbConvertToNode (Name);
674 if (!Node)
675 {
676 return;
677 }
678
679 Status = AcpiGetObjectInfo (ACPI_CAST_PTR (ACPI_HANDLE, Node), &Info);
680 if (ACPI_FAILURE (Status))
681 {
682 AcpiOsPrintf ("Could not get object info, %s\n",
683 AcpiFormatException (Status));
684 return;
685 }
686
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 }
706
707 if (Info->Valid & ACPI_VALID_HID)
708 {
709 AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String);
710 }
711 if (Info->Valid & ACPI_VALID_UID)
712 {
713 AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String);
714 }
715 if (Info->Valid & ACPI_VALID_SUB)
716 {
717 AcpiOsPrintf ("SUB: %s\n", Info->SubsystemId.String);
718 }
719 if (Info->Valid & ACPI_VALID_CID)
720 {
721 for (i = 0; i < Info->CompatibleIdList.Count; i++)
722 {
723 AcpiOsPrintf ("CID %u: %s\n", i,
724 Info->CompatibleIdList.Ids[i].String);
725 }
726 }
727
728 ACPI_FREE (Info);
729 }
730
731
732 /*******************************************************************************
733 *
734 * FUNCTION: AcpiDbDisplayResultObject
735 *
736 * PARAMETERS: ObjDesc - Object to be displayed
737 * WalkState - Current walk state
738 *
777 * DESCRIPTION: Display the result of an AML opcode
778 *
779 ******************************************************************************/
780
781 void
782 AcpiDbDisplayArgumentObject (
783 ACPI_OPERAND_OBJECT *ObjDesc,
784 ACPI_WALK_STATE *WalkState)
785 {
786
787 if (!AcpiGbl_CmSingleStep)
788 {
789 return;
790 }
791
792 AcpiOsPrintf ("ArgObj: ");
793 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
794 }
795
796
797 #if (!ACPI_REDUCED_HARDWARE)
798 /*******************************************************************************
799 *
800 * FUNCTION: AcpiDbDisplayGpes
801 *
802 * PARAMETERS: None
803 *
804 * RETURN: None
805 *
806 * DESCRIPTION: Display the current GPE structures
807 *
808 ******************************************************************************/
809
810 void
811 AcpiDbDisplayGpes (
812 void)
813 {
814 ACPI_GPE_BLOCK_INFO *GpeBlock;
815 ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
816 ACPI_GPE_EVENT_INFO *GpeEventInfo;
817 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
818 char *GpeType;
819 ACPI_GPE_NOTIFY_INFO *Notify;
820 UINT32 GpeIndex;
821 UINT32 Block = 0;
822 UINT32 i;
823 UINT32 j;
824 UINT32 Count;
825 char Buffer[80];
826 ACPI_BUFFER RetBuf;
827 ACPI_STATUS Status;
828
829
830 RetBuf.Length = sizeof (Buffer);
831 RetBuf.Pointer = Buffer;
832
833 Block = 0;
834
835 /* Walk the GPE lists */
836
837 GpeXruptInfo = AcpiGbl_GpeXruptListHead;
838 while (GpeXruptInfo)
839 {
840 GpeBlock = GpeXruptInfo->GpeBlockListHead;
841 while (GpeBlock)
842 {
843 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
844 if (ACPI_FAILURE (Status))
916 {
917 AcpiOsPrintf ("Level, ");
918 }
919 else
920 {
921 AcpiOsPrintf ("Edge, ");
922 }
923
924 if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
925 {
926 AcpiOsPrintf ("CanWake, ");
927 }
928 else
929 {
930 AcpiOsPrintf ("RunOnly, ");
931 }
932
933 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
934 {
935 case ACPI_GPE_DISPATCH_NONE:
936
937 AcpiOsPrintf ("NotUsed");
938 break;
939
940 case ACPI_GPE_DISPATCH_METHOD:
941
942 AcpiOsPrintf ("Method");
943 break;
944 case ACPI_GPE_DISPATCH_HANDLER:
945
946 AcpiOsPrintf ("Handler");
947 break;
948
949 case ACPI_GPE_DISPATCH_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);
959 break;
960
961 default:
962
963 AcpiOsPrintf ("UNKNOWN: %X",
964 GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK);
965 break;
966 }
967
968 AcpiOsPrintf (")\n");
969 }
970 }
971 Block++;
972 GpeBlock = GpeBlock->Next;
973 }
974 GpeXruptInfo = GpeXruptInfo->Next;
975 }
976 }
977 #endif /* !ACPI_REDUCED_HARDWARE */
978
979
980 /*******************************************************************************
981 *
982 * FUNCTION: AcpiDbDisplayHandlers
983 *
984 * PARAMETERS: None
985 *
986 * RETURN: None
987 *
988 * DESCRIPTION: Display the currently installed global handlers
989 *
990 ******************************************************************************/
991
992 void
993 AcpiDbDisplayHandlers (
994 void)
995 {
996 ACPI_OPERAND_OBJECT *ObjDesc;
997 ACPI_OPERAND_OBJECT *HandlerObj;
998 ACPI_ADR_SPACE_TYPE SpaceId;
999 UINT32 i;
1000
1001
1002 /* Operation region handlers */
1003
1004 AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n");
1005
1006 ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
1007 if (ObjDesc)
1008 {
1009 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++)
1010 {
1011 SpaceId = AcpiGbl_SpaceIdList[i];
1012 HandlerObj = ObjDesc->Device.Handler;
1013
1014 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
1015 AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId);
1016
1017 while (HandlerObj)
1018 {
1019 if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId)
1020 {
1021 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
1022 (HandlerObj->AddressSpace.HandlerFlags &
1023 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
1024 HandlerObj->AddressSpace.Handler);
1025 goto FoundHandler;
1026 }
1027
1028 HandlerObj = HandlerObj->AddressSpace.Next;
1029 }
1030
1031 /* There is no handler for this SpaceId */
1032
1033 AcpiOsPrintf ("None\n");
1034
1035 FoundHandler:;
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 }
1055 }
1056
1057 #if (!ACPI_REDUCED_HARDWARE)
1058
1059 /* Fixed event handlers */
1060
1061 AcpiOsPrintf ("\nFixed Event Handlers:\n");
1062
1063 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
1064 {
1065 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i);
1066 if (AcpiGbl_FixedEventHandlers[i].Handler)
1067 {
1068 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1069 AcpiGbl_FixedEventHandlers[i].Handler);
1070 }
1071 else
1072 {
1073 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1074 }
1075 }
1076
1077 #endif /* !ACPI_REDUCED_HARDWARE */
1078
1079 /* Miscellaneous global handlers */
1080
1081 AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
1082
1083 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++)
1084 {
1085 AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name);
1086 if (AcpiGbl_HandlerList[i].Handler)
1087 {
1088 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1089 AcpiGbl_HandlerList[i].Handler);
1090 }
1091 else
1092 {
1093 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1094 }
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);
1105 }
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
1169 #endif /* ACPI_DEBUGGER */
|