Merge from vendor branch INTEL_ACPICA:
[dragonfly.git] / sys / contrib / dev / acpica-unix-20061109 / debugger / dbdisply.c
1 /*******************************************************************************
2  *
3  * Module Name: dbdisply - debug display commands
4  *              $Revision: 1.117 $
5  *
6  ******************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2006, 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 #define _COMPONENT          ACPI_CA_DEBUGGER
131         ACPI_MODULE_NAME    ("dbdisply")
132
133 /* Local prototypes */
134
135 static void
136 AcpiDbDumpParserDescriptor (
137     ACPI_PARSE_OBJECT       *Op);
138
139 static void *
140 AcpiDbGetPointer (
141     void                    *Target);
142
143
144 /*******************************************************************************
145  *
146  * FUNCTION:    AcpiDbGetPointer
147  *
148  * PARAMETERS:  Target          - Pointer to string to be converted
149  *
150  * RETURN:      Converted pointer
151  *
152  * DESCRIPTION: Convert an ascii pointer value to a real value
153  *
154  ******************************************************************************/
155
156 static void *
157 AcpiDbGetPointer (
158     void                    *Target)
159 {
160     void                    *ObjPtr;
161
162
163 #if ACPI_MACHINE_WIDTH == 16
164 #include <stdio.h>
165
166     /* Have to handle 16-bit pointers of the form segment:offset */
167
168     if (!sscanf (Target, "%p", &ObjPtr))
169     {
170         AcpiOsPrintf ("Invalid pointer: %s\n", Target);
171         return (NULL);
172     }
173
174 #else
175
176     /* Simple flat pointer */
177
178     ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
179 #endif
180
181     return (ObjPtr);
182 }
183
184
185 /*******************************************************************************
186  *
187  * FUNCTION:    AcpiDbDumpParserDescriptor
188  *
189  * PARAMETERS:  Op              - A parser Op descriptor
190  *
191  * RETURN:      None
192  *
193  * DESCRIPTION: Display a formatted parser object
194  *
195  ******************************************************************************/
196
197 static void
198 AcpiDbDumpParserDescriptor (
199     ACPI_PARSE_OBJECT       *Op)
200 {
201     const ACPI_OPCODE_INFO  *Info;
202
203
204     Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
205
206     AcpiOsPrintf ("Parser Op Descriptor:\n");
207     AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
208
209     ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name",
210         Info->Name));
211
212     AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
213     AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
214     AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next);
215 }
216
217
218 /*******************************************************************************
219  *
220  * FUNCTION:    AcpiDbDecodeAndDisplayObject
221  *
222  * PARAMETERS:  Target          - String with object to be displayed.  Names
223  *                                and hex pointers are supported.
224  *              OutputType      - Byte, Word, Dword, or Qword (B|W|D|Q)
225  *
226  * RETURN:      None
227  *
228  * DESCRIPTION: Display a formatted ACPI object
229  *
230  ******************************************************************************/
231
232 void
233 AcpiDbDecodeAndDisplayObject (
234     char                    *Target,
235     char                    *OutputType)
236 {
237     void                    *ObjPtr;
238     ACPI_NAMESPACE_NODE     *Node;
239     ACPI_OPERAND_OBJECT     *ObjDesc;
240     UINT32                  Display = DB_BYTE_DISPLAY;
241     char                    Buffer[80];
242     ACPI_BUFFER             RetBuf;
243     ACPI_STATUS             Status;
244     UINT32                  Size;
245
246
247     if (!Target)
248     {
249         return;
250     }
251
252     /* Decode the output type */
253
254     if (OutputType)
255     {
256         AcpiUtStrupr (OutputType);
257         if (OutputType[0] == 'W')
258         {
259             Display = DB_WORD_DISPLAY;
260         }
261         else if (OutputType[0] == 'D')
262         {
263             Display = DB_DWORD_DISPLAY;
264         }
265         else if (OutputType[0] == 'Q')
266         {
267             Display = DB_QWORD_DISPLAY;
268         }
269     }
270
271     RetBuf.Length = sizeof (Buffer);
272     RetBuf.Pointer = Buffer;
273
274     /* Differentiate between a number and a name */
275
276     if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
277     {
278         ObjPtr = AcpiDbGetPointer (Target);
279         if (!AcpiOsReadable (ObjPtr, 16))
280         {
281             AcpiOsPrintf ("Address %p is invalid in this address space\n",
282                 ObjPtr);
283             return;
284         }
285
286         /* Decode the object type */
287
288         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
289         {
290         case ACPI_DESC_TYPE_NAMED:
291
292             /* This is a namespace Node */
293
294             if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
295             {
296                 AcpiOsPrintf (
297                     "Cannot read entire Named object at address %p\n", ObjPtr);
298                 return;
299             }
300
301             Node = ObjPtr;
302             goto DumpNode;
303
304
305         case ACPI_DESC_TYPE_OPERAND:
306
307             /* This is a ACPI OPERAND OBJECT */
308
309             if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
310             {
311                 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n",
312                     ObjPtr);
313                 return;
314             }
315
316             AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display,
317                 ACPI_UINT32_MAX);
318             AcpiExDumpObjectDescriptor (ObjPtr, 1);
319             break;
320
321
322         case ACPI_DESC_TYPE_PARSER:
323
324             /* This is a Parser Op object */
325
326             if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
327             {
328                 AcpiOsPrintf (
329                     "Cannot read entire Parser object at address %p\n", ObjPtr);
330                 return;
331             }
332
333             AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display,
334                 ACPI_UINT32_MAX);
335             AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
336             break;
337
338
339         default:
340
341             /* Is not a recognizeable object */
342
343             Size = 16;
344             if (AcpiOsReadable (ObjPtr, 64))
345             {
346                 Size = 64;
347             }
348
349             /* Just dump some memory */
350
351             AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
352             break;
353         }
354
355         return;
356     }
357
358     /* The parameter is a name string that must be resolved to a Named obj */
359
360     Node = AcpiDbLocalNsLookup (Target);
361     if (!Node)
362     {
363         return;
364     }
365
366
367 DumpNode:
368     /* Now dump the NS node */
369
370     Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
371     if (ACPI_FAILURE (Status))
372     {
373         AcpiOsPrintf ("Could not convert name to pathname\n");
374     }
375
376     else
377     {
378         AcpiOsPrintf ("Object (%p) Pathname:  %s\n",
379             Node, (char *) RetBuf.Pointer);
380     }
381
382     if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
383     {
384         AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
385         return;
386     }
387
388     AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
389         Display, ACPI_UINT32_MAX);
390     AcpiExDumpNamespaceNode (Node, 1);
391
392     ObjDesc = AcpiNsGetAttachedObject (Node);
393     if (ObjDesc)
394     {
395         AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
396         if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
397         {
398             AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
399                 ObjDesc);
400             return;
401         }
402
403         AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT),
404             Display, ACPI_UINT32_MAX);
405         AcpiExDumpObjectDescriptor (ObjDesc, 1);
406     }
407 }
408
409
410 /*******************************************************************************
411  *
412  * FUNCTION:    AcpiDbDisplayMethodInfo
413  *
414  * PARAMETERS:  StartOp         - Root of the control method parse tree
415  *
416  * RETURN:      None
417  *
418  * DESCRIPTION: Display information about the current method
419  *
420  ******************************************************************************/
421
422 void
423 AcpiDbDisplayMethodInfo (
424     ACPI_PARSE_OBJECT       *StartOp)
425 {
426     ACPI_WALK_STATE         *WalkState;
427     ACPI_OPERAND_OBJECT     *ObjDesc;
428     ACPI_NAMESPACE_NODE     *Node;
429     ACPI_PARSE_OBJECT       *RootOp;
430     ACPI_PARSE_OBJECT       *Op;
431     const ACPI_OPCODE_INFO  *OpInfo;
432     UINT32                  NumOps = 0;
433     UINT32                  NumOperands = 0;
434     UINT32                  NumOperators = 0;
435     UINT32                  NumRemainingOps = 0;
436     UINT32                  NumRemainingOperands = 0;
437     UINT32                  NumRemainingOperators = 0;
438     BOOLEAN                 CountRemaining = FALSE;
439
440
441     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
442     if (!WalkState)
443     {
444         AcpiOsPrintf ("There is no method currently executing\n");
445         return;
446     }
447
448     ObjDesc = WalkState->MethodDesc;
449     Node    = WalkState->MethodNode;
450
451     AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
452             AcpiUtGetNodeName (Node));
453     AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n",
454             (UINT32) ObjDesc->Method.ParamCount,
455             (UINT32) ObjDesc->Method.SyncLevel);
456
457
458     RootOp = StartOp;
459     while (RootOp->Common.Parent)
460     {
461         RootOp = RootOp->Common.Parent;
462     }
463
464     Op = RootOp;
465
466     while (Op)
467     {
468         if (Op == StartOp)
469         {
470             CountRemaining = TRUE;
471         }
472
473         NumOps++;
474         if (CountRemaining)
475         {
476             NumRemainingOps++;
477         }
478
479         /* Decode the opcode */
480
481         OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
482         switch (OpInfo->Class)
483         {
484         case AML_CLASS_ARGUMENT:
485             if (CountRemaining)
486             {
487                 NumRemainingOperands++;
488             }
489
490             NumOperands++;
491             break;
492
493         case AML_CLASS_UNKNOWN:
494             /* Bad opcode or ASCII character */
495
496             continue;
497
498         default:
499             if (CountRemaining)
500             {
501                 NumRemainingOperators++;
502             }
503
504             NumOperators++;
505             break;
506         }
507
508         Op = AcpiPsGetDepthNext (StartOp, Op);
509     }
510
511     AcpiOsPrintf (
512         "Method contains:       %X AML Opcodes - %X Operators, %X Operands\n",
513         NumOps, NumOperators, NumOperands);
514
515     AcpiOsPrintf (
516         "Remaining to execute:  %X AML Opcodes - %X Operators, %X Operands\n",
517         NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
518 }
519
520
521 /*******************************************************************************
522  *
523  * FUNCTION:    AcpiDbDisplayLocals
524  *
525  * PARAMETERS:  None
526  *
527  * RETURN:      None
528  *
529  * DESCRIPTION: Display all locals for the currently running control method
530  *
531  ******************************************************************************/
532
533 void
534 AcpiDbDisplayLocals (
535     void)
536 {
537     ACPI_WALK_STATE         *WalkState;
538
539
540     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
541     if (!WalkState)
542     {
543         AcpiOsPrintf ("There is no method currently executing\n");
544         return;
545     }
546
547     AcpiDmDisplayLocals (WalkState);
548 }
549
550
551 /*******************************************************************************
552  *
553  * FUNCTION:    AcpiDbDisplayArguments
554  *
555  * PARAMETERS:  None
556  *
557  * RETURN:      None
558  *
559  * DESCRIPTION: Display all arguments for the currently running control method
560  *
561  ******************************************************************************/
562
563 void
564 AcpiDbDisplayArguments (
565     void)
566 {
567     ACPI_WALK_STATE         *WalkState;
568
569
570     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
571     if (!WalkState)
572     {
573         AcpiOsPrintf ("There is no method currently executing\n");
574         return;
575     }
576
577     AcpiDmDisplayArguments (WalkState);
578 }
579
580
581 /*******************************************************************************
582  *
583  * FUNCTION:    AcpiDbDisplayResults
584  *
585  * PARAMETERS:  None
586  *
587  * RETURN:      None
588  *
589  * DESCRIPTION: Display current contents of a method result stack
590  *
591  ******************************************************************************/
592
593 void
594 AcpiDbDisplayResults (
595     void)
596 {
597     UINT32                  i;
598     ACPI_WALK_STATE         *WalkState;
599     ACPI_OPERAND_OBJECT     *ObjDesc;
600     UINT32                  NumResults = 0;
601     ACPI_NAMESPACE_NODE     *Node;
602
603
604     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
605     if (!WalkState)
606     {
607         AcpiOsPrintf ("There is no method currently executing\n");
608         return;
609     }
610
611     ObjDesc = WalkState->MethodDesc;
612     Node    = WalkState->MethodNode;
613
614     if (WalkState->Results)
615     {
616         NumResults = WalkState->Results->Results.NumResults;
617     }
618
619     AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
620             AcpiUtGetNodeName (Node), NumResults);
621
622     for (i = 0; i < NumResults; i++)
623     {
624         ObjDesc = WalkState->Results->Results.ObjDesc[i];
625         AcpiOsPrintf ("Result%d: ", i);
626         AcpiDmDisplayInternalObject (ObjDesc, WalkState);
627     }
628 }
629
630
631 /*******************************************************************************
632  *
633  * FUNCTION:    AcpiDbDisplayCallingTree
634  *
635  * PARAMETERS:  None
636  *
637  * RETURN:      None
638  *
639  * DESCRIPTION: Display current calling tree of nested control methods
640  *
641  ******************************************************************************/
642
643 void
644 AcpiDbDisplayCallingTree (
645     void)
646 {
647     ACPI_WALK_STATE         *WalkState;
648     ACPI_NAMESPACE_NODE     *Node;
649
650
651     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
652     if (!WalkState)
653     {
654         AcpiOsPrintf ("There is no method currently executing\n");
655         return;
656     }
657
658     Node = WalkState->MethodNode;
659     AcpiOsPrintf ("Current Control Method Call Tree\n");
660
661     while (WalkState)
662     {
663         Node = WalkState->MethodNode;
664
665         AcpiOsPrintf ("    [%4.4s]\n", AcpiUtGetNodeName (Node));
666
667         WalkState = WalkState->Next;
668     }
669 }
670
671
672 /*******************************************************************************
673  *
674  * FUNCTION:    AcpiDbDisplayObjectType
675  *
676  * PARAMETERS:  ObjectArg       - User entered NS node handle
677  *
678  * RETURN:      None
679  *
680  * DESCRIPTION: Display type of an arbitrary NS node
681  *
682  ******************************************************************************/
683
684 void
685 AcpiDbDisplayObjectType (
686     char                    *ObjectArg)
687 {
688     ACPI_HANDLE             Handle;
689     ACPI_BUFFER             Buffer;
690     ACPI_DEVICE_INFO        *Info;
691     ACPI_STATUS             Status;
692     ACPI_NATIVE_UINT        i;
693
694
695     Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
696     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
697
698     Status = AcpiGetObjectInfo (Handle, &Buffer);
699     if (ACPI_SUCCESS (Status))
700     {
701         Info = Buffer.Pointer;
702         AcpiOsPrintf (
703             "S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X    HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
704             Info->HighestDstates[0], Info->HighestDstates[1],
705             Info->HighestDstates[2], Info->HighestDstates[3],
706             Info->HardwareId.Value,
707             ACPI_FORMAT_UINT64 (Info->Address),
708             Info->CurrentStatus);
709
710         if (Info->Valid & ACPI_VALID_CID)
711         {
712             for (i = 0; i < Info->CompatibilityId.Count; i++)
713             {
714                 AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i,
715                     Info->CompatibilityId.Id[i].Value);
716             }
717         }
718
719         ACPI_FREE (Info);
720     }
721     else
722     {
723         AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
724     }
725 }
726
727
728 /*******************************************************************************
729  *
730  * FUNCTION:    AcpiDbDisplayResultObject
731  *
732  * PARAMETERS:  ObjDesc         - Object to be displayed
733  *              WalkState       - Current walk state
734  *
735  * RETURN:      None
736  *
737  * DESCRIPTION: Display the result of an AML opcode
738  *
739  * Note: Curently only displays the result object if we are single stepping.
740  * However, this output may be useful in other contexts and could be enabled
741  * to do so if needed.
742  *
743  ******************************************************************************/
744
745 void
746 AcpiDbDisplayResultObject (
747     ACPI_OPERAND_OBJECT     *ObjDesc,
748     ACPI_WALK_STATE         *WalkState)
749 {
750
751     /* Only display if single stepping */
752
753     if (!AcpiGbl_CmSingleStep)
754     {
755         return;
756     }
757
758     AcpiOsPrintf ("ResultObj: ");
759     AcpiDmDisplayInternalObject (ObjDesc, WalkState);
760     AcpiOsPrintf ("\n");
761 }
762
763
764 /*******************************************************************************
765  *
766  * FUNCTION:    AcpiDbDisplayArgumentObject
767  *
768  * PARAMETERS:  ObjDesc         - Object to be displayed
769  *              WalkState       - Current walk state
770  *
771  * RETURN:      None
772  *
773  * DESCRIPTION: Display the result of an AML opcode
774  *
775  ******************************************************************************/
776
777 void
778 AcpiDbDisplayArgumentObject (
779     ACPI_OPERAND_OBJECT     *ObjDesc,
780     ACPI_WALK_STATE         *WalkState)
781 {
782
783     if (!AcpiGbl_CmSingleStep)
784     {
785         return;
786     }
787
788     AcpiOsPrintf ("ArgObj:    ");
789     AcpiDmDisplayInternalObject (ObjDesc, WalkState);
790 }
791
792
793 /*******************************************************************************
794  *
795  * FUNCTION:    AcpiDbDisplayGpes
796  *
797  * PARAMETERS:  None
798  *
799  * RETURN:      None
800  *
801  * DESCRIPTION: Display the current GPE structures
802  *
803  ******************************************************************************/
804
805 void
806 AcpiDbDisplayGpes (
807     void)
808 {
809     ACPI_GPE_BLOCK_INFO     *GpeBlock;
810     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo;
811     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
812     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
813     UINT32                  GpeIndex;
814     UINT32                  Block = 0;
815     UINT32                  i;
816     UINT32                  j;
817     char                    Buffer[80];
818     ACPI_BUFFER             RetBuf;
819     ACPI_STATUS             Status;
820
821
822     RetBuf.Length = sizeof (Buffer);
823     RetBuf.Pointer = Buffer;
824
825     Block = 0;
826
827     /* Walk the GPE lists */
828
829     GpeXruptInfo = AcpiGbl_GpeXruptListHead;
830     while (GpeXruptInfo)
831     {
832         GpeBlock = GpeXruptInfo->GpeBlockListHead;
833         while (GpeBlock)
834         {
835             Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
836             if (ACPI_FAILURE (Status))
837             {
838                 AcpiOsPrintf ("Could not convert name to pathname\n");
839             }
840
841             AcpiOsPrintf ("\nBlock %d - Info %p  DeviceNode %p [%s]\n",
842                 Block, GpeBlock, GpeBlock->Node, Buffer);
843
844             AcpiOsPrintf ("    Registers:    %u (%u GPEs)\n",
845                 GpeBlock->RegisterCount,
846                 ACPI_MUL_8 (GpeBlock->RegisterCount));
847
848             AcpiOsPrintf ("    GPE range:    0x%X to 0x%X\n",
849                 GpeBlock->BlockBaseNumber,
850                 GpeBlock->BlockBaseNumber +
851                     (GpeBlock->RegisterCount * 8) -1);
852
853             AcpiOsPrintf (
854                 "    RegisterInfo: %p  Status %8.8X%8.8X Enable %8.8X%8.8X\n",
855                 GpeBlock->RegisterInfo,
856                 ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->StatusAddress.Address)),
857                 ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->EnableAddress.Address)));
858
859             AcpiOsPrintf ("    EventInfo:    %p\n", GpeBlock->EventInfo);
860
861             /* Examine each GPE Register within the block */
862
863             for (i = 0; i < GpeBlock->RegisterCount; i++)
864             {
865                 GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
866
867                 AcpiOsPrintf (
868                     "    Reg %u:  WakeEnable %2.2X, RunEnable %2.2X  Status %8.8X%8.8X Enable %8.8X%8.8X\n",
869                     i, GpeRegisterInfo->EnableForWake,
870                     GpeRegisterInfo->EnableForRun,
871                     ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
872                     ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)));
873
874                 /* Now look at the individual GPEs in this byte register */
875
876                 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
877                 {
878                     GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
879                     GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
880
881                     if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
882                     {
883                         /* This GPE is not used (no method or handler) */
884
885                         continue;
886                     }
887
888                     AcpiOsPrintf (
889                         "        GPE %.3X: %p Flags %2.2X: ",
890                         GpeBlock->BlockBaseNumber + GpeIndex,
891                         GpeEventInfo,
892                         GpeEventInfo->Flags);
893
894                     if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
895                     {
896                         AcpiOsPrintf ("Level, ");
897                     }
898                     else
899                     {
900                         AcpiOsPrintf ("Edge,  ");
901                     }
902
903                     switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
904                     {
905                     case ACPI_GPE_TYPE_WAKE:
906                         AcpiOsPrintf ("WakeOnly: ");
907                         break;
908                     case ACPI_GPE_TYPE_RUNTIME:
909                         AcpiOsPrintf (" RunOnly: ");
910                         break;
911                     case ACPI_GPE_TYPE_WAKE_RUN:
912                         AcpiOsPrintf (" WakeRun: ");
913                         break;
914                     default:
915                         AcpiOsPrintf (" NotUsed: ");
916                         break;
917                     }
918
919                     if (GpeEventInfo->Flags & ACPI_GPE_WAKE_ENABLED)
920                     {
921                         AcpiOsPrintf ("[Wake 1 ");
922                     }
923                     else
924                     {
925                         AcpiOsPrintf ("[Wake 0 ");
926                     }
927
928                     if (GpeEventInfo->Flags & ACPI_GPE_RUN_ENABLED)
929                     {
930                         AcpiOsPrintf ("Run 1], ");
931                     }
932                     else
933                     {
934                         AcpiOsPrintf ("Run 0], ");
935                     }
936
937                     switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
938                     {
939                     case ACPI_GPE_DISPATCH_NOT_USED:
940                         AcpiOsPrintf ("NotUsed");
941                         break;
942                     case ACPI_GPE_DISPATCH_HANDLER:
943                         AcpiOsPrintf ("Handler");
944                         break;
945                     case ACPI_GPE_DISPATCH_METHOD:
946                         AcpiOsPrintf ("Method");
947                         break;
948                     default:
949                         AcpiOsPrintf ("UNKNOWN: %X",
950                             GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK);
951                         break;
952                     }
953
954                     AcpiOsPrintf ("\n");
955                 }
956             }
957             Block++;
958             GpeBlock = GpeBlock->Next;
959         }
960         GpeXruptInfo = GpeXruptInfo->Next;
961     }
962 }
963
964 #endif /* ACPI_DEBUGGER */
965