Deleted Added
full compact
dbdisply.c (129684) dbdisply.c (131440)
1/*******************************************************************************
2 *
3 * Module Name: dbdisply - debug display commands
1/*******************************************************************************
2 *
3 * Module Name: dbdisply - debug display commands
4 * $Revision: 105 $
4 * $Revision: 106 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117
118#include "acpi.h"
119#include "amlcode.h"
120#include "acdispat.h"
121#include "acnamesp.h"
122#include "acparser.h"
123#include "acinterp.h"
124#include "acdebug.h"
125#include "acdisasm.h"
126
127
128#ifdef ACPI_DEBUGGER
129
130
131#define _COMPONENT ACPI_CA_DEBUGGER
132 ACPI_MODULE_NAME ("dbdisply")
133
134
135/******************************************************************************
136 *
137 * FUNCTION: AcpiDbGetPointer
138 *
139 * PARAMETERS: Target - Pointer to string to be converted
140 *
141 * RETURN: Converted pointer
142 *
143 * DESCRIPTION: Convert an ascii pointer value to a real value
144 *
145 *****************************************************************************/
146
147void *
148AcpiDbGetPointer (
149 void *Target)
150{
151 void *ObjPtr;
152
153
154#if ACPI_MACHINE_WIDTH == 16
155#include <stdio.h>
156
157 /* Have to handle 16-bit pointers of the form segment:offset */
158
159 if (!sscanf (Target, "%p", &ObjPtr))
160 {
161 AcpiOsPrintf ("Invalid pointer: %s\n", Target);
162 return (NULL);
163 }
164
165#else
166
167 /* Simple flat pointer */
168
169 ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
170#endif
171
172 return (ObjPtr);
173}
174
175
176/*******************************************************************************
177 *
178 * FUNCTION: AcpiDbDumpParserDescriptor
179 *
180 * PARAMETERS: Op - A parser Op descriptor
181 *
182 * RETURN: None
183 *
184 * DESCRIPTION: Display a formatted parser object
185 *
186 ******************************************************************************/
187
188void
189AcpiDbDumpParserDescriptor (
190 ACPI_PARSE_OBJECT *Op)
191{
192 const ACPI_OPCODE_INFO *Info;
193
194
195 Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
196
197 AcpiOsPrintf ("Parser Op Descriptor:\n");
198 AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
199
200 ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
201
202 AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
203 AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
204 AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next);
205}
206
207
208/*******************************************************************************
209 *
210 * FUNCTION: AcpiDbDecodeAndDisplayObject
211 *
212 * PARAMETERS: Target - String with object to be displayed. Names
213 * and hex pointers are supported.
214 * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q)
215 *
216 * RETURN: None
217 *
218 * DESCRIPTION: Display a formatted ACPI object
219 *
220 ******************************************************************************/
221
222void
223AcpiDbDecodeAndDisplayObject (
224 char *Target,
225 char *OutputType)
226{
227 void *ObjPtr;
228 ACPI_NAMESPACE_NODE *Node;
229 ACPI_OPERAND_OBJECT *ObjDesc;
230 UINT32 Display = DB_BYTE_DISPLAY;
231 char Buffer[80];
232 ACPI_BUFFER RetBuf;
233 ACPI_STATUS Status;
234 UINT32 Size;
235
236
237 if (!Target)
238 {
239 return;
240 }
241
242 /* Decode the output type */
243
244 if (OutputType)
245 {
246 ACPI_STRUPR (OutputType);
247 if (OutputType[0] == 'W')
248 {
249 Display = DB_WORD_DISPLAY;
250 }
251 else if (OutputType[0] == 'D')
252 {
253 Display = DB_DWORD_DISPLAY;
254 }
255 else if (OutputType[0] == 'Q')
256 {
257 Display = DB_QWORD_DISPLAY;
258 }
259 }
260
261 RetBuf.Length = sizeof (Buffer);
262 RetBuf.Pointer = Buffer;
263
264 /* Differentiate between a number and a name */
265
266 if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
267 {
268 ObjPtr = AcpiDbGetPointer (Target);
269 if (!AcpiOsReadable (ObjPtr, 16))
270 {
271 AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr);
272 return;
273 }
274
275 /* Decode the object type */
276
277 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
278 {
279 case ACPI_DESC_TYPE_NAMED:
280
281 /* This is a namespace Node */
282
283 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
284 {
285 AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr);
286 return;
287 }
288
289 Node = ObjPtr;
290 goto DumpNte;
291
292
293 case ACPI_DESC_TYPE_OPERAND:
294
295 /* This is a ACPI OPERAND OBJECT */
296
297 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
298 {
299 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr);
300 return;
301 }
302
303 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
304 AcpiExDumpObjectDescriptor (ObjPtr, 1);
305 break;
306
307
308 case ACPI_DESC_TYPE_PARSER:
309
310 /* This is a Parser Op object */
311
312 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
313 {
314 AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr);
315 return;
316 }
317
318 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX);
319 AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
320 break;
321
322
323 default:
324
325 /* Is not a recognizeable object */
326
327 Size = 16;
328 if (AcpiOsReadable (ObjPtr, 64))
329 {
330 Size = 64;
331 }
332
333 /* Just dump some memory */
334
335 AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
336 break;
337 }
338
339 return;
340 }
341
342 /* The parameter is a name string that must be resolved to a Named obj */
343
344 Node = AcpiDbLocalNsLookup (Target);
345 if (!Node)
346 {
347 return;
348 }
349
350
351DumpNte:
352 /* Now dump the Named obj */
353
354 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
355 if (ACPI_FAILURE (Status))
356 {
357 AcpiOsPrintf ("Could not convert name to pathname\n");
358 }
359
360 else
361 {
362 AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, (char *) RetBuf.Pointer);
363 }
364
365 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
366 {
367 AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
368 return;
369 }
370
371 AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX);
372 AcpiExDumpNode (Node, 1);
373
374 ObjDesc = AcpiNsGetAttachedObject (Node);
375 if (ObjDesc)
376 {
377 AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
378 if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
379 {
380 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc);
381 return;
382 }
383
384 AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
385 AcpiExDumpObjectDescriptor (ObjDesc, 1);
386 }
387}
388
389
390/*******************************************************************************
391 *
392 * FUNCTION: AcpiDbDisplayMethodInfo
393 *
394 * PARAMETERS: StartOp - Root of the control method parse tree
395 *
396 * RETURN: None
397 *
398 * DESCRIPTION: Display information about the current method
399 *
400 ******************************************************************************/
401
402void
403AcpiDbDisplayMethodInfo (
404 ACPI_PARSE_OBJECT *StartOp)
405{
406 ACPI_WALK_STATE *WalkState;
407 ACPI_OPERAND_OBJECT *ObjDesc;
408 ACPI_NAMESPACE_NODE *Node;
409 ACPI_PARSE_OBJECT *RootOp;
410 ACPI_PARSE_OBJECT *Op;
411 const ACPI_OPCODE_INFO *OpInfo;
412 UINT32 NumOps = 0;
413 UINT32 NumOperands = 0;
414 UINT32 NumOperators = 0;
415 UINT32 NumRemainingOps = 0;
416 UINT32 NumRemainingOperands = 0;
417 UINT32 NumRemainingOperators = 0;
418 UINT32 NumArgs;
419 UINT32 Concurrency;
420 BOOLEAN CountRemaining = FALSE;
421
422
423 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
424 if (!WalkState)
425 {
426 AcpiOsPrintf ("There is no method currently executing\n");
427 return;
428 }
429
430 ObjDesc = WalkState->MethodDesc;
431 Node = WalkState->MethodNode;
432
433 NumArgs = ObjDesc->Method.ParamCount;
434 Concurrency = ObjDesc->Method.Concurrency;
435
436 AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
437 AcpiUtGetNodeName (Node));
438 AcpiOsPrintf ("%X arguments, max concurrency = %X\n",
439 NumArgs, Concurrency);
440
441
442 RootOp = StartOp;
443 while (RootOp->Common.Parent)
444 {
445 RootOp = RootOp->Common.Parent;
446 }
447
448 Op = RootOp;
449
450 while (Op)
451 {
452 if (Op == StartOp)
453 {
454 CountRemaining = TRUE;
455 }
456
457 NumOps++;
458 if (CountRemaining)
459 {
460 NumRemainingOps++;
461 }
462
463 /* Decode the opcode */
464
465 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
466 switch (OpInfo->Class)
467 {
468 case AML_CLASS_ARGUMENT:
469 if (CountRemaining)
470 {
471 NumRemainingOperands++;
472 }
473
474 NumOperands++;
475 break;
476
477 case AML_CLASS_UNKNOWN:
478 /* Bad opcode or ASCII character */
479
480 continue;
481
482 default:
483 if (CountRemaining)
484 {
485 NumRemainingOperators++;
486 }
487
488 NumOperators++;
489 break;
490 }
491
492 Op = AcpiPsGetDepthNext (StartOp, Op);
493 }
494
495 AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
496 NumOps, NumOperators, NumOperands);
497
498 AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
499 NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
500}
501
502
503/*******************************************************************************
504 *
505 * FUNCTION: AcpiDbDisplayLocals
506 *
507 * PARAMETERS: None
508 *
509 * RETURN: None
510 *
511 * DESCRIPTION: Display all locals for the currently running control method
512 *
513 ******************************************************************************/
514
515void
516AcpiDbDisplayLocals (void)
517{
518 ACPI_WALK_STATE *WalkState;
519
520
521 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
522 if (!WalkState)
523 {
524 AcpiOsPrintf ("There is no method currently executing\n");
525 return;
526 }
527
528 AcpiDmDisplayLocals (WalkState);
529}
530
531
532/*******************************************************************************
533 *
534 * FUNCTION: AcpiDbDisplayArguments
535 *
536 * PARAMETERS: None
537 *
538 * RETURN: None
539 *
540 * DESCRIPTION: Display all arguments for the currently running control method
541 *
542 ******************************************************************************/
543
544void
545AcpiDbDisplayArguments (void)
546{
547 ACPI_WALK_STATE *WalkState;
548
549
550 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
551 if (!WalkState)
552 {
553 AcpiOsPrintf ("There is no method currently executing\n");
554 return;
555 }
556
557 AcpiDmDisplayArguments (WalkState);
558}
559
560
561/*******************************************************************************
562 *
563 * FUNCTION: AcpiDbDisplayResults
564 *
565 * PARAMETERS: None
566 *
567 * RETURN: None
568 *
569 * DESCRIPTION: Display current contents of a method result stack
570 *
571 ******************************************************************************/
572
573void
574AcpiDbDisplayResults (void)
575{
576 UINT32 i;
577 ACPI_WALK_STATE *WalkState;
578 ACPI_OPERAND_OBJECT *ObjDesc;
579 UINT32 NumResults = 0;
580 ACPI_NAMESPACE_NODE *Node;
581
582
583 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
584 if (!WalkState)
585 {
586 AcpiOsPrintf ("There is no method currently executing\n");
587 return;
588 }
589
590 ObjDesc = WalkState->MethodDesc;
591 Node = WalkState->MethodNode;
592
593 if (WalkState->Results)
594 {
595 NumResults = WalkState->Results->Results.NumResults;
596 }
597
598 AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
599 AcpiUtGetNodeName (Node), NumResults);
600
601 for (i = 0; i < NumResults; i++)
602 {
603 ObjDesc = WalkState->Results->Results.ObjDesc[i];
604 AcpiOsPrintf ("Result%d: ", i);
605 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
606 }
607}
608
609
610/*******************************************************************************
611 *
612 * FUNCTION: AcpiDbDisplayCallingTree
613 *
614 * PARAMETERS: None
615 *
616 * RETURN: None
617 *
618 * DESCRIPTION: Display current calling tree of nested control methods
619 *
620 ******************************************************************************/
621
622void
623AcpiDbDisplayCallingTree (void)
624{
625 ACPI_WALK_STATE *WalkState;
626 ACPI_NAMESPACE_NODE *Node;
627
628
629 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
630 if (!WalkState)
631 {
632 AcpiOsPrintf ("There is no method currently executing\n");
633 return;
634 }
635
636 Node = WalkState->MethodNode;
637 AcpiOsPrintf ("Current Control Method Call Tree\n");
638
639 while (WalkState)
640 {
641 Node = WalkState->MethodNode;
642
643 AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node));
644
645 WalkState = WalkState->Next;
646 }
647}
648
649
650/*******************************************************************************
651 *
652 * FUNCTION: AcpiDbDisplayObjectType
653 *
654 * PARAMETERS: ObjectArg - User entered NS node handle
655 *
656 * RETURN: None
657 *
658 * DESCRIPTION: Display type of an arbitrary NS node
659 *
660 ******************************************************************************/
661
662void
663AcpiDbDisplayObjectType (
664 char *ObjectArg)
665{
666 ACPI_HANDLE Handle;
667 ACPI_BUFFER Buffer;
668 ACPI_DEVICE_INFO *Info;
669 ACPI_STATUS Status;
670 ACPI_NATIVE_UINT i;
671
672
673 Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
674 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
675
676 Status = AcpiGetObjectInfo (Handle, &Buffer);
677 if (ACPI_SUCCESS (Status))
678 {
679 Info = Buffer.Pointer;
680 AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
681 Info->HighestDstates[0], Info->HighestDstates[1],
682 Info->HighestDstates[2], Info->HighestDstates[3],
683 Info->HardwareId.Value,
684 ACPI_FORMAT_UINT64 (Info->Address),
685 Info->CurrentStatus);
686
687 if (Info->Valid & ACPI_VALID_CID)
688 {
689 for (i = 0; i < Info->CompatibilityId.Count; i++)
690 {
691 AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i, Info->CompatibilityId.Id[i].Value);
692 }
693 }
694
695 ACPI_MEM_FREE (Info);
696 }
697 else
698 {
699 AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
700 }
701}
702
703
704/*******************************************************************************
705 *
706 * FUNCTION: AcpiDbDisplayResultObject
707 *
708 * PARAMETERS: ObjDesc - Object to be displayed
709 * WalkState - Current walk state
710 *
711 * RETURN: None
712 *
713 * DESCRIPTION: Display the result of an AML opcode
714 *
715 * Note: Curently only displays the result object if we are single stepping.
716 * However, this output may be useful in other contexts and could be enabled
717 * to do so if needed.
718 *
719 ******************************************************************************/
720
721void
722AcpiDbDisplayResultObject (
723 ACPI_OPERAND_OBJECT *ObjDesc,
724 ACPI_WALK_STATE *WalkState)
725{
726
727 /* Only display if single stepping */
728
729 if (!AcpiGbl_CmSingleStep)
730 {
731 return;
732 }
733
734 AcpiOsPrintf ("ResultObj: ");
735 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
736 AcpiOsPrintf ("\n");
737}
738
739
740/*******************************************************************************
741 *
742 * FUNCTION: AcpiDbDisplayArgumentObject
743 *
744 * PARAMETERS: ObjDesc - Object to be displayed
745 * WalkState - Current walk state
746 *
747 * RETURN: None
748 *
749 * DESCRIPTION: Display the result of an AML opcode
750 *
751 ******************************************************************************/
752
753void
754AcpiDbDisplayArgumentObject (
755 ACPI_OPERAND_OBJECT *ObjDesc,
756 ACPI_WALK_STATE *WalkState)
757{
758
759 if (!AcpiGbl_CmSingleStep)
760 {
761 return;
762 }
763
764 AcpiOsPrintf ("ArgObj: ");
765 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
766}
767
768
769/*******************************************************************************
770 *
771 * FUNCTION: AcpiDbDisplayGpes
772 *
773 * PARAMETERS: None
774 *
775 * RETURN: None
776 *
777 * DESCRIPTION: Display the current GPE structures
778 *
779 ******************************************************************************/
780
781void
782AcpiDbDisplayGpes (void)
783{
784 ACPI_GPE_BLOCK_INFO *GpeBlock;
785 ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
786 ACPI_GPE_EVENT_INFO *GpeEventInfo;
787 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
788 UINT32 GpeIndex;
789 UINT32 Block = 0;
790 UINT32 i;
791 UINT32 j;
792 char Buffer[80];
793 ACPI_BUFFER RetBuf;
794 ACPI_STATUS Status;
795
796
797 RetBuf.Length = sizeof (Buffer);
798 RetBuf.Pointer = Buffer;
799
800 Block = 0;
801
802 /* Walk the GPE lists */
803
804 GpeXruptInfo = AcpiGbl_GpeXruptListHead;
805 while (GpeXruptInfo)
806 {
807 GpeBlock = GpeXruptInfo->GpeBlockListHead;
808 while (GpeBlock)
809 {
810 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
811 if (ACPI_FAILURE (Status))
812 {
813 AcpiOsPrintf ("Could not convert name to pathname\n");
814 }
815
816 AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n",
817 Block, GpeBlock, GpeBlock->Node, Buffer);
818 AcpiOsPrintf (" Registers: %u (%u GPEs) \n",
819 GpeBlock->RegisterCount,
820 ACPI_MUL_8 (GpeBlock->RegisterCount));
821 AcpiOsPrintf (" GPE range: 0x%X to 0x%X\n",
822 GpeBlock->BlockBaseNumber,
823 GpeBlock->BlockBaseNumber +
824 (GpeBlock->RegisterCount * 8) -1);
825 AcpiOsPrintf (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
826 GpeBlock->RegisterInfo,
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117
118#include "acpi.h"
119#include "amlcode.h"
120#include "acdispat.h"
121#include "acnamesp.h"
122#include "acparser.h"
123#include "acinterp.h"
124#include "acdebug.h"
125#include "acdisasm.h"
126
127
128#ifdef ACPI_DEBUGGER
129
130
131#define _COMPONENT ACPI_CA_DEBUGGER
132 ACPI_MODULE_NAME ("dbdisply")
133
134
135/******************************************************************************
136 *
137 * FUNCTION: AcpiDbGetPointer
138 *
139 * PARAMETERS: Target - Pointer to string to be converted
140 *
141 * RETURN: Converted pointer
142 *
143 * DESCRIPTION: Convert an ascii pointer value to a real value
144 *
145 *****************************************************************************/
146
147void *
148AcpiDbGetPointer (
149 void *Target)
150{
151 void *ObjPtr;
152
153
154#if ACPI_MACHINE_WIDTH == 16
155#include <stdio.h>
156
157 /* Have to handle 16-bit pointers of the form segment:offset */
158
159 if (!sscanf (Target, "%p", &ObjPtr))
160 {
161 AcpiOsPrintf ("Invalid pointer: %s\n", Target);
162 return (NULL);
163 }
164
165#else
166
167 /* Simple flat pointer */
168
169 ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
170#endif
171
172 return (ObjPtr);
173}
174
175
176/*******************************************************************************
177 *
178 * FUNCTION: AcpiDbDumpParserDescriptor
179 *
180 * PARAMETERS: Op - A parser Op descriptor
181 *
182 * RETURN: None
183 *
184 * DESCRIPTION: Display a formatted parser object
185 *
186 ******************************************************************************/
187
188void
189AcpiDbDumpParserDescriptor (
190 ACPI_PARSE_OBJECT *Op)
191{
192 const ACPI_OPCODE_INFO *Info;
193
194
195 Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
196
197 AcpiOsPrintf ("Parser Op Descriptor:\n");
198 AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
199
200 ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
201
202 AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
203 AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
204 AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next);
205}
206
207
208/*******************************************************************************
209 *
210 * FUNCTION: AcpiDbDecodeAndDisplayObject
211 *
212 * PARAMETERS: Target - String with object to be displayed. Names
213 * and hex pointers are supported.
214 * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q)
215 *
216 * RETURN: None
217 *
218 * DESCRIPTION: Display a formatted ACPI object
219 *
220 ******************************************************************************/
221
222void
223AcpiDbDecodeAndDisplayObject (
224 char *Target,
225 char *OutputType)
226{
227 void *ObjPtr;
228 ACPI_NAMESPACE_NODE *Node;
229 ACPI_OPERAND_OBJECT *ObjDesc;
230 UINT32 Display = DB_BYTE_DISPLAY;
231 char Buffer[80];
232 ACPI_BUFFER RetBuf;
233 ACPI_STATUS Status;
234 UINT32 Size;
235
236
237 if (!Target)
238 {
239 return;
240 }
241
242 /* Decode the output type */
243
244 if (OutputType)
245 {
246 ACPI_STRUPR (OutputType);
247 if (OutputType[0] == 'W')
248 {
249 Display = DB_WORD_DISPLAY;
250 }
251 else if (OutputType[0] == 'D')
252 {
253 Display = DB_DWORD_DISPLAY;
254 }
255 else if (OutputType[0] == 'Q')
256 {
257 Display = DB_QWORD_DISPLAY;
258 }
259 }
260
261 RetBuf.Length = sizeof (Buffer);
262 RetBuf.Pointer = Buffer;
263
264 /* Differentiate between a number and a name */
265
266 if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
267 {
268 ObjPtr = AcpiDbGetPointer (Target);
269 if (!AcpiOsReadable (ObjPtr, 16))
270 {
271 AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr);
272 return;
273 }
274
275 /* Decode the object type */
276
277 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
278 {
279 case ACPI_DESC_TYPE_NAMED:
280
281 /* This is a namespace Node */
282
283 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
284 {
285 AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr);
286 return;
287 }
288
289 Node = ObjPtr;
290 goto DumpNte;
291
292
293 case ACPI_DESC_TYPE_OPERAND:
294
295 /* This is a ACPI OPERAND OBJECT */
296
297 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
298 {
299 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr);
300 return;
301 }
302
303 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
304 AcpiExDumpObjectDescriptor (ObjPtr, 1);
305 break;
306
307
308 case ACPI_DESC_TYPE_PARSER:
309
310 /* This is a Parser Op object */
311
312 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
313 {
314 AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr);
315 return;
316 }
317
318 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX);
319 AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
320 break;
321
322
323 default:
324
325 /* Is not a recognizeable object */
326
327 Size = 16;
328 if (AcpiOsReadable (ObjPtr, 64))
329 {
330 Size = 64;
331 }
332
333 /* Just dump some memory */
334
335 AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
336 break;
337 }
338
339 return;
340 }
341
342 /* The parameter is a name string that must be resolved to a Named obj */
343
344 Node = AcpiDbLocalNsLookup (Target);
345 if (!Node)
346 {
347 return;
348 }
349
350
351DumpNte:
352 /* Now dump the Named obj */
353
354 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
355 if (ACPI_FAILURE (Status))
356 {
357 AcpiOsPrintf ("Could not convert name to pathname\n");
358 }
359
360 else
361 {
362 AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, (char *) RetBuf.Pointer);
363 }
364
365 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
366 {
367 AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
368 return;
369 }
370
371 AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX);
372 AcpiExDumpNode (Node, 1);
373
374 ObjDesc = AcpiNsGetAttachedObject (Node);
375 if (ObjDesc)
376 {
377 AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
378 if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
379 {
380 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc);
381 return;
382 }
383
384 AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
385 AcpiExDumpObjectDescriptor (ObjDesc, 1);
386 }
387}
388
389
390/*******************************************************************************
391 *
392 * FUNCTION: AcpiDbDisplayMethodInfo
393 *
394 * PARAMETERS: StartOp - Root of the control method parse tree
395 *
396 * RETURN: None
397 *
398 * DESCRIPTION: Display information about the current method
399 *
400 ******************************************************************************/
401
402void
403AcpiDbDisplayMethodInfo (
404 ACPI_PARSE_OBJECT *StartOp)
405{
406 ACPI_WALK_STATE *WalkState;
407 ACPI_OPERAND_OBJECT *ObjDesc;
408 ACPI_NAMESPACE_NODE *Node;
409 ACPI_PARSE_OBJECT *RootOp;
410 ACPI_PARSE_OBJECT *Op;
411 const ACPI_OPCODE_INFO *OpInfo;
412 UINT32 NumOps = 0;
413 UINT32 NumOperands = 0;
414 UINT32 NumOperators = 0;
415 UINT32 NumRemainingOps = 0;
416 UINT32 NumRemainingOperands = 0;
417 UINT32 NumRemainingOperators = 0;
418 UINT32 NumArgs;
419 UINT32 Concurrency;
420 BOOLEAN CountRemaining = FALSE;
421
422
423 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
424 if (!WalkState)
425 {
426 AcpiOsPrintf ("There is no method currently executing\n");
427 return;
428 }
429
430 ObjDesc = WalkState->MethodDesc;
431 Node = WalkState->MethodNode;
432
433 NumArgs = ObjDesc->Method.ParamCount;
434 Concurrency = ObjDesc->Method.Concurrency;
435
436 AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
437 AcpiUtGetNodeName (Node));
438 AcpiOsPrintf ("%X arguments, max concurrency = %X\n",
439 NumArgs, Concurrency);
440
441
442 RootOp = StartOp;
443 while (RootOp->Common.Parent)
444 {
445 RootOp = RootOp->Common.Parent;
446 }
447
448 Op = RootOp;
449
450 while (Op)
451 {
452 if (Op == StartOp)
453 {
454 CountRemaining = TRUE;
455 }
456
457 NumOps++;
458 if (CountRemaining)
459 {
460 NumRemainingOps++;
461 }
462
463 /* Decode the opcode */
464
465 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
466 switch (OpInfo->Class)
467 {
468 case AML_CLASS_ARGUMENT:
469 if (CountRemaining)
470 {
471 NumRemainingOperands++;
472 }
473
474 NumOperands++;
475 break;
476
477 case AML_CLASS_UNKNOWN:
478 /* Bad opcode or ASCII character */
479
480 continue;
481
482 default:
483 if (CountRemaining)
484 {
485 NumRemainingOperators++;
486 }
487
488 NumOperators++;
489 break;
490 }
491
492 Op = AcpiPsGetDepthNext (StartOp, Op);
493 }
494
495 AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
496 NumOps, NumOperators, NumOperands);
497
498 AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
499 NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
500}
501
502
503/*******************************************************************************
504 *
505 * FUNCTION: AcpiDbDisplayLocals
506 *
507 * PARAMETERS: None
508 *
509 * RETURN: None
510 *
511 * DESCRIPTION: Display all locals for the currently running control method
512 *
513 ******************************************************************************/
514
515void
516AcpiDbDisplayLocals (void)
517{
518 ACPI_WALK_STATE *WalkState;
519
520
521 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
522 if (!WalkState)
523 {
524 AcpiOsPrintf ("There is no method currently executing\n");
525 return;
526 }
527
528 AcpiDmDisplayLocals (WalkState);
529}
530
531
532/*******************************************************************************
533 *
534 * FUNCTION: AcpiDbDisplayArguments
535 *
536 * PARAMETERS: None
537 *
538 * RETURN: None
539 *
540 * DESCRIPTION: Display all arguments for the currently running control method
541 *
542 ******************************************************************************/
543
544void
545AcpiDbDisplayArguments (void)
546{
547 ACPI_WALK_STATE *WalkState;
548
549
550 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
551 if (!WalkState)
552 {
553 AcpiOsPrintf ("There is no method currently executing\n");
554 return;
555 }
556
557 AcpiDmDisplayArguments (WalkState);
558}
559
560
561/*******************************************************************************
562 *
563 * FUNCTION: AcpiDbDisplayResults
564 *
565 * PARAMETERS: None
566 *
567 * RETURN: None
568 *
569 * DESCRIPTION: Display current contents of a method result stack
570 *
571 ******************************************************************************/
572
573void
574AcpiDbDisplayResults (void)
575{
576 UINT32 i;
577 ACPI_WALK_STATE *WalkState;
578 ACPI_OPERAND_OBJECT *ObjDesc;
579 UINT32 NumResults = 0;
580 ACPI_NAMESPACE_NODE *Node;
581
582
583 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
584 if (!WalkState)
585 {
586 AcpiOsPrintf ("There is no method currently executing\n");
587 return;
588 }
589
590 ObjDesc = WalkState->MethodDesc;
591 Node = WalkState->MethodNode;
592
593 if (WalkState->Results)
594 {
595 NumResults = WalkState->Results->Results.NumResults;
596 }
597
598 AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
599 AcpiUtGetNodeName (Node), NumResults);
600
601 for (i = 0; i < NumResults; i++)
602 {
603 ObjDesc = WalkState->Results->Results.ObjDesc[i];
604 AcpiOsPrintf ("Result%d: ", i);
605 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
606 }
607}
608
609
610/*******************************************************************************
611 *
612 * FUNCTION: AcpiDbDisplayCallingTree
613 *
614 * PARAMETERS: None
615 *
616 * RETURN: None
617 *
618 * DESCRIPTION: Display current calling tree of nested control methods
619 *
620 ******************************************************************************/
621
622void
623AcpiDbDisplayCallingTree (void)
624{
625 ACPI_WALK_STATE *WalkState;
626 ACPI_NAMESPACE_NODE *Node;
627
628
629 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
630 if (!WalkState)
631 {
632 AcpiOsPrintf ("There is no method currently executing\n");
633 return;
634 }
635
636 Node = WalkState->MethodNode;
637 AcpiOsPrintf ("Current Control Method Call Tree\n");
638
639 while (WalkState)
640 {
641 Node = WalkState->MethodNode;
642
643 AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node));
644
645 WalkState = WalkState->Next;
646 }
647}
648
649
650/*******************************************************************************
651 *
652 * FUNCTION: AcpiDbDisplayObjectType
653 *
654 * PARAMETERS: ObjectArg - User entered NS node handle
655 *
656 * RETURN: None
657 *
658 * DESCRIPTION: Display type of an arbitrary NS node
659 *
660 ******************************************************************************/
661
662void
663AcpiDbDisplayObjectType (
664 char *ObjectArg)
665{
666 ACPI_HANDLE Handle;
667 ACPI_BUFFER Buffer;
668 ACPI_DEVICE_INFO *Info;
669 ACPI_STATUS Status;
670 ACPI_NATIVE_UINT i;
671
672
673 Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
674 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
675
676 Status = AcpiGetObjectInfo (Handle, &Buffer);
677 if (ACPI_SUCCESS (Status))
678 {
679 Info = Buffer.Pointer;
680 AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
681 Info->HighestDstates[0], Info->HighestDstates[1],
682 Info->HighestDstates[2], Info->HighestDstates[3],
683 Info->HardwareId.Value,
684 ACPI_FORMAT_UINT64 (Info->Address),
685 Info->CurrentStatus);
686
687 if (Info->Valid & ACPI_VALID_CID)
688 {
689 for (i = 0; i < Info->CompatibilityId.Count; i++)
690 {
691 AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i, Info->CompatibilityId.Id[i].Value);
692 }
693 }
694
695 ACPI_MEM_FREE (Info);
696 }
697 else
698 {
699 AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
700 }
701}
702
703
704/*******************************************************************************
705 *
706 * FUNCTION: AcpiDbDisplayResultObject
707 *
708 * PARAMETERS: ObjDesc - Object to be displayed
709 * WalkState - Current walk state
710 *
711 * RETURN: None
712 *
713 * DESCRIPTION: Display the result of an AML opcode
714 *
715 * Note: Curently only displays the result object if we are single stepping.
716 * However, this output may be useful in other contexts and could be enabled
717 * to do so if needed.
718 *
719 ******************************************************************************/
720
721void
722AcpiDbDisplayResultObject (
723 ACPI_OPERAND_OBJECT *ObjDesc,
724 ACPI_WALK_STATE *WalkState)
725{
726
727 /* Only display if single stepping */
728
729 if (!AcpiGbl_CmSingleStep)
730 {
731 return;
732 }
733
734 AcpiOsPrintf ("ResultObj: ");
735 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
736 AcpiOsPrintf ("\n");
737}
738
739
740/*******************************************************************************
741 *
742 * FUNCTION: AcpiDbDisplayArgumentObject
743 *
744 * PARAMETERS: ObjDesc - Object to be displayed
745 * WalkState - Current walk state
746 *
747 * RETURN: None
748 *
749 * DESCRIPTION: Display the result of an AML opcode
750 *
751 ******************************************************************************/
752
753void
754AcpiDbDisplayArgumentObject (
755 ACPI_OPERAND_OBJECT *ObjDesc,
756 ACPI_WALK_STATE *WalkState)
757{
758
759 if (!AcpiGbl_CmSingleStep)
760 {
761 return;
762 }
763
764 AcpiOsPrintf ("ArgObj: ");
765 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
766}
767
768
769/*******************************************************************************
770 *
771 * FUNCTION: AcpiDbDisplayGpes
772 *
773 * PARAMETERS: None
774 *
775 * RETURN: None
776 *
777 * DESCRIPTION: Display the current GPE structures
778 *
779 ******************************************************************************/
780
781void
782AcpiDbDisplayGpes (void)
783{
784 ACPI_GPE_BLOCK_INFO *GpeBlock;
785 ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
786 ACPI_GPE_EVENT_INFO *GpeEventInfo;
787 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
788 UINT32 GpeIndex;
789 UINT32 Block = 0;
790 UINT32 i;
791 UINT32 j;
792 char Buffer[80];
793 ACPI_BUFFER RetBuf;
794 ACPI_STATUS Status;
795
796
797 RetBuf.Length = sizeof (Buffer);
798 RetBuf.Pointer = Buffer;
799
800 Block = 0;
801
802 /* Walk the GPE lists */
803
804 GpeXruptInfo = AcpiGbl_GpeXruptListHead;
805 while (GpeXruptInfo)
806 {
807 GpeBlock = GpeXruptInfo->GpeBlockListHead;
808 while (GpeBlock)
809 {
810 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
811 if (ACPI_FAILURE (Status))
812 {
813 AcpiOsPrintf ("Could not convert name to pathname\n");
814 }
815
816 AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n",
817 Block, GpeBlock, GpeBlock->Node, Buffer);
818 AcpiOsPrintf (" Registers: %u (%u GPEs) \n",
819 GpeBlock->RegisterCount,
820 ACPI_MUL_8 (GpeBlock->RegisterCount));
821 AcpiOsPrintf (" GPE range: 0x%X to 0x%X\n",
822 GpeBlock->BlockBaseNumber,
823 GpeBlock->BlockBaseNumber +
824 (GpeBlock->RegisterCount * 8) -1);
825 AcpiOsPrintf (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
826 GpeBlock->RegisterInfo,
827 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address),
828 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address));
827 ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->StatusAddress.Address)),
828 ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->EnableAddress.Address)));
829 AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
830
831 /* Examine each GPE Register within the block */
832
833 for (i = 0; i < GpeBlock->RegisterCount; i++)
834 {
835 GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
836
837 AcpiOsPrintf (
838 " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n",
839 i, GpeRegisterInfo->EnableForWake,
840 GpeRegisterInfo->EnableForRun,
829 AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
830
831 /* Examine each GPE Register within the block */
832
833 for (i = 0; i < GpeBlock->RegisterCount; i++)
834 {
835 GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
836
837 AcpiOsPrintf (
838 " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n",
839 i, GpeRegisterInfo->EnableForWake,
840 GpeRegisterInfo->EnableForRun,
841 ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address),
842 ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address));
841 ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
842 ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)));
843
844 /* Now look at the individual GPEs in this byte register */
845
846 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
847 {
848 GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
849 GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
850
851 if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
852 {
853 /* This GPE is not used (no method or handler) */
854
855 continue;
856 }
857
858 AcpiOsPrintf (
859 " GPE %.3X: %p Bit %2.2X Flags %2.2X: ",
860 GpeBlock->BlockBaseNumber + GpeIndex,
861 GpeEventInfo, GpeEventInfo->RegisterBit,
862 GpeEventInfo->Flags);
863
864 if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
865 {
866 AcpiOsPrintf ("Level, ");
867 }
868 else
869 {
870 AcpiOsPrintf ("Edge, ");
871 }
872
873 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
874 {
875 case ACPI_GPE_TYPE_WAKE:
876 AcpiOsPrintf ("WakeOnly: ");
877 break;
878 case ACPI_GPE_TYPE_RUNTIME:
879 AcpiOsPrintf (" RunOnly: ");
880 break;
881 case ACPI_GPE_TYPE_WAKE_RUN:
882 AcpiOsPrintf (" WakeRun: ");
883 break;
884 default:
885 AcpiOsPrintf (" NotUsed: ");
886 break;
887 }
888
889 if (GpeEventInfo->Flags & ACPI_GPE_WAKE_ENABLED)
890 {
891 AcpiOsPrintf ("[Wake 1 ");
892 }
893 else
894 {
895 AcpiOsPrintf ("[Wake 0 ");
896 }
897
898 if (GpeEventInfo->Flags & ACPI_GPE_RUN_ENABLED)
899 {
900 AcpiOsPrintf ("Run 1], ");
901 }
902 else
903 {
904 AcpiOsPrintf ("Run 0], ");
905 }
906
907 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
908 {
909 case ACPI_GPE_DISPATCH_NOT_USED:
910 AcpiOsPrintf ("NotUsed");
911 break;
912 case ACPI_GPE_DISPATCH_HANDLER:
913 AcpiOsPrintf ("Handler");
914 break;
915 case ACPI_GPE_DISPATCH_METHOD:
916 AcpiOsPrintf ("Method");
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#endif /* ACPI_DEBUGGER */
936
843
844 /* Now look at the individual GPEs in this byte register */
845
846 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
847 {
848 GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
849 GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
850
851 if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
852 {
853 /* This GPE is not used (no method or handler) */
854
855 continue;
856 }
857
858 AcpiOsPrintf (
859 " GPE %.3X: %p Bit %2.2X Flags %2.2X: ",
860 GpeBlock->BlockBaseNumber + GpeIndex,
861 GpeEventInfo, GpeEventInfo->RegisterBit,
862 GpeEventInfo->Flags);
863
864 if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
865 {
866 AcpiOsPrintf ("Level, ");
867 }
868 else
869 {
870 AcpiOsPrintf ("Edge, ");
871 }
872
873 switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
874 {
875 case ACPI_GPE_TYPE_WAKE:
876 AcpiOsPrintf ("WakeOnly: ");
877 break;
878 case ACPI_GPE_TYPE_RUNTIME:
879 AcpiOsPrintf (" RunOnly: ");
880 break;
881 case ACPI_GPE_TYPE_WAKE_RUN:
882 AcpiOsPrintf (" WakeRun: ");
883 break;
884 default:
885 AcpiOsPrintf (" NotUsed: ");
886 break;
887 }
888
889 if (GpeEventInfo->Flags & ACPI_GPE_WAKE_ENABLED)
890 {
891 AcpiOsPrintf ("[Wake 1 ");
892 }
893 else
894 {
895 AcpiOsPrintf ("[Wake 0 ");
896 }
897
898 if (GpeEventInfo->Flags & ACPI_GPE_RUN_ENABLED)
899 {
900 AcpiOsPrintf ("Run 1], ");
901 }
902 else
903 {
904 AcpiOsPrintf ("Run 0], ");
905 }
906
907 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
908 {
909 case ACPI_GPE_DISPATCH_NOT_USED:
910 AcpiOsPrintf ("NotUsed");
911 break;
912 case ACPI_GPE_DISPATCH_HANDLER:
913 AcpiOsPrintf ("Handler");
914 break;
915 case ACPI_GPE_DISPATCH_METHOD:
916 AcpiOsPrintf ("Method");
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#endif /* ACPI_DEBUGGER */
936