dbdisply.c revision 237412
167754Smsmith/*******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: dbdisply - debug display commands
467754Smsmith *
567754Smsmith ******************************************************************************/
667754Smsmith
7217365Sjkim/*
8229989Sjkim * Copyright (C) 2000 - 2012, Intel Corp.
970243Smsmith * All rights reserved.
1067754Smsmith *
11217365Sjkim * Redistribution and use in source and binary forms, with or without
12217365Sjkim * modification, are permitted provided that the following conditions
13217365Sjkim * are met:
14217365Sjkim * 1. Redistributions of source code must retain the above copyright
15217365Sjkim *    notice, this list of conditions, and the following disclaimer,
16217365Sjkim *    without modification.
17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20217365Sjkim *    including a substantially similar Disclaimer requirement for further
21217365Sjkim *    binary redistribution.
22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23217365Sjkim *    of any contributors may be used to endorse or promote products derived
24217365Sjkim *    from this software without specific prior written permission.
2567754Smsmith *
26217365Sjkim * Alternatively, this software may be distributed under the terms of the
27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28217365Sjkim * Software Foundation.
2967754Smsmith *
30217365Sjkim * NO WARRANTY
31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
42217365Sjkim */
4367754Smsmith
4467754Smsmith
45193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
46193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
47193341Sjkim#include <contrib/dev/acpica/include/amlcode.h>
48193341Sjkim#include <contrib/dev/acpica/include/acdispat.h>
49193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
50193341Sjkim#include <contrib/dev/acpica/include/acparser.h>
51193341Sjkim#include <contrib/dev/acpica/include/acinterp.h>
52193341Sjkim#include <contrib/dev/acpica/include/acdebug.h>
53193341Sjkim#include <contrib/dev/acpica/include/acdisasm.h>
5467754Smsmith
5567754Smsmith
56102550Siwasaki#ifdef ACPI_DEBUGGER
5767754Smsmith
58102550Siwasaki#define _COMPONENT          ACPI_CA_DEBUGGER
5991116Smsmith        ACPI_MODULE_NAME    ("dbdisply")
6067754Smsmith
61151937Sjkim/* Local prototypes */
6267754Smsmith
63151937Sjkimstatic void
64151937SjkimAcpiDbDumpParserDescriptor (
65151937Sjkim    ACPI_PARSE_OBJECT       *Op);
66151937Sjkim
67151937Sjkimstatic void *
68151937SjkimAcpiDbGetPointer (
69151937Sjkim    void                    *Target);
70151937Sjkim
71151937Sjkim
72220663Sjkim/*
73220663Sjkim * System handler information.
74220663Sjkim * Used for Handlers command, in AcpiDbDisplayHandlers.
75220663Sjkim */
76220663Sjkim#define ACPI_PREDEFINED_PREFIX          "%25s (%.2X) : "
77220663Sjkim#define ACPI_HANDLER_NAME_STRING               "%30s : "
78220663Sjkim#define ACPI_HANDLER_PRESENT_STRING                    "%-9s (%p)\n"
79220663Sjkim#define ACPI_HANDLER_NOT_PRESENT_STRING                "%-9s\n"
80220663Sjkim
81220663Sjkim/* All predefined Address Space IDs */
82220663Sjkim
83220663Sjkimstatic ACPI_ADR_SPACE_TYPE  AcpiGbl_SpaceIdList[] =
84220663Sjkim{
85220663Sjkim    ACPI_ADR_SPACE_SYSTEM_MEMORY,
86220663Sjkim    ACPI_ADR_SPACE_SYSTEM_IO,
87220663Sjkim    ACPI_ADR_SPACE_PCI_CONFIG,
88220663Sjkim    ACPI_ADR_SPACE_EC,
89220663Sjkim    ACPI_ADR_SPACE_SMBUS,
90220663Sjkim    ACPI_ADR_SPACE_CMOS,
91220663Sjkim    ACPI_ADR_SPACE_PCI_BAR_TARGET,
92220663Sjkim    ACPI_ADR_SPACE_IPMI,
93228110Sjkim    ACPI_ADR_SPACE_GPIO,
94228110Sjkim    ACPI_ADR_SPACE_GSBUS,
95220663Sjkim    ACPI_ADR_SPACE_DATA_TABLE,
96220663Sjkim    ACPI_ADR_SPACE_FIXED_HARDWARE
97220663Sjkim};
98220663Sjkim
99220663Sjkim/* Global handler information */
100220663Sjkim
101220663Sjkimtypedef struct acpi_handler_info
102220663Sjkim{
103220663Sjkim    void                    *Handler;
104220663Sjkim    char                    *Name;
105220663Sjkim
106220663Sjkim} ACPI_HANDLER_INFO;
107220663Sjkim
108220663Sjkimstatic ACPI_HANDLER_INFO    AcpiGbl_HandlerList[] =
109220663Sjkim{
110234623Sjkim    {&AcpiGbl_GlobalNotify[0].Handler,  "System Notifications"},
111234623Sjkim    {&AcpiGbl_GlobalNotify[1].Handler,  "Device Notifications"},
112220663Sjkim    {&AcpiGbl_TableHandler,             "ACPI Table Events"},
113220663Sjkim    {&AcpiGbl_ExceptionHandler,         "Control Method Exceptions"},
114220663Sjkim    {&AcpiGbl_InterfaceHandler,         "OSI Invocations"}
115220663Sjkim};
116220663Sjkim
117220663Sjkim
118151937Sjkim/*******************************************************************************
11967754Smsmith *
12067754Smsmith * FUNCTION:    AcpiDbGetPointer
12167754Smsmith *
12267754Smsmith * PARAMETERS:  Target          - Pointer to string to be converted
12367754Smsmith *
12467754Smsmith * RETURN:      Converted pointer
12567754Smsmith *
12667754Smsmith * DESCRIPTION: Convert an ascii pointer value to a real value
12767754Smsmith *
128151937Sjkim ******************************************************************************/
12967754Smsmith
130151937Sjkimstatic void *
13167754SmsmithAcpiDbGetPointer (
13267754Smsmith    void                    *Target)
13367754Smsmith{
13467754Smsmith    void                    *ObjPtr;
13567754Smsmith
13667754Smsmith
13791116Smsmith    ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
13867754Smsmith    return (ObjPtr);
13967754Smsmith}
14067754Smsmith
14167754Smsmith
14267754Smsmith/*******************************************************************************
14367754Smsmith *
14467754Smsmith * FUNCTION:    AcpiDbDumpParserDescriptor
14567754Smsmith *
14667754Smsmith * PARAMETERS:  Op              - A parser Op descriptor
14767754Smsmith *
14867754Smsmith * RETURN:      None
14967754Smsmith *
15067754Smsmith * DESCRIPTION: Display a formatted parser object
15167754Smsmith *
15267754Smsmith ******************************************************************************/
15367754Smsmith
154151937Sjkimstatic void
15567754SmsmithAcpiDbDumpParserDescriptor (
15667754Smsmith    ACPI_PARSE_OBJECT       *Op)
15767754Smsmith{
15883174Smsmith    const ACPI_OPCODE_INFO  *Info;
15967754Smsmith
16067754Smsmith
16199679Siwasaki    Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
16267754Smsmith
16367754Smsmith    AcpiOsPrintf ("Parser Op Descriptor:\n");
16499679Siwasaki    AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
16567754Smsmith
166151937Sjkim    ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name",
167151937Sjkim        Info->Name));
16867754Smsmith
16999679Siwasaki    AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
17099679Siwasaki    AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
17199679Siwasaki    AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next);
17267754Smsmith}
17367754Smsmith
17467754Smsmith
17567754Smsmith/*******************************************************************************
17667754Smsmith *
17767754Smsmith * FUNCTION:    AcpiDbDecodeAndDisplayObject
17867754Smsmith *
17967754Smsmith * PARAMETERS:  Target          - String with object to be displayed.  Names
18067754Smsmith *                                and hex pointers are supported.
18167754Smsmith *              OutputType      - Byte, Word, Dword, or Qword (B|W|D|Q)
18267754Smsmith *
18367754Smsmith * RETURN:      None
18467754Smsmith *
18567754Smsmith * DESCRIPTION: Display a formatted ACPI object
18667754Smsmith *
18767754Smsmith ******************************************************************************/
18867754Smsmith
18967754Smsmithvoid
19067754SmsmithAcpiDbDecodeAndDisplayObject (
191114237Snjl    char                    *Target,
192114237Snjl    char                    *OutputType)
19367754Smsmith{
19467754Smsmith    void                    *ObjPtr;
19567754Smsmith    ACPI_NAMESPACE_NODE     *Node;
19687031Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
19767754Smsmith    UINT32                  Display = DB_BYTE_DISPLAY;
198114237Snjl    char                    Buffer[80];
19967754Smsmith    ACPI_BUFFER             RetBuf;
20067754Smsmith    ACPI_STATUS             Status;
20167754Smsmith    UINT32                  Size;
20267754Smsmith
20367754Smsmith
20467754Smsmith    if (!Target)
20567754Smsmith    {
20667754Smsmith        return;
20767754Smsmith    }
20867754Smsmith
20967754Smsmith    /* Decode the output type */
21067754Smsmith
21167754Smsmith    if (OutputType)
21267754Smsmith    {
213151937Sjkim        AcpiUtStrupr (OutputType);
21467754Smsmith        if (OutputType[0] == 'W')
21567754Smsmith        {
21667754Smsmith            Display = DB_WORD_DISPLAY;
21767754Smsmith        }
21867754Smsmith        else if (OutputType[0] == 'D')
21967754Smsmith        {
22067754Smsmith            Display = DB_DWORD_DISPLAY;
22167754Smsmith        }
22267754Smsmith        else if (OutputType[0] == 'Q')
22367754Smsmith        {
22467754Smsmith            Display = DB_QWORD_DISPLAY;
22567754Smsmith        }
22667754Smsmith    }
22767754Smsmith
22867754Smsmith    RetBuf.Length = sizeof (Buffer);
22967754Smsmith    RetBuf.Pointer = Buffer;
23067754Smsmith
23167754Smsmith    /* Differentiate between a number and a name */
23267754Smsmith
23367754Smsmith    if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
23467754Smsmith    {
23567754Smsmith        ObjPtr = AcpiDbGetPointer (Target);
23667754Smsmith        if (!AcpiOsReadable (ObjPtr, 16))
23767754Smsmith        {
238151937Sjkim            AcpiOsPrintf ("Address %p is invalid in this address space\n",
239151937Sjkim                ObjPtr);
24067754Smsmith            return;
24167754Smsmith        }
24267754Smsmith
24367754Smsmith        /* Decode the object type */
24467754Smsmith
24591116Smsmith        switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
24667754Smsmith        {
24791116Smsmith        case ACPI_DESC_TYPE_NAMED:
24867754Smsmith
24991116Smsmith            /* This is a namespace Node */
25091116Smsmith
25167754Smsmith            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
25267754Smsmith            {
253151937Sjkim                AcpiOsPrintf (
254151937Sjkim                    "Cannot read entire Named object at address %p\n", ObjPtr);
25567754Smsmith                return;
25667754Smsmith            }
25767754Smsmith
25867754Smsmith            Node = ObjPtr;
259151937Sjkim            goto DumpNode;
26067754Smsmith
26167754Smsmith
26299679Siwasaki        case ACPI_DESC_TYPE_OPERAND:
26391116Smsmith
26491116Smsmith            /* This is a ACPI OPERAND OBJECT */
26591116Smsmith
26667754Smsmith            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
26767754Smsmith            {
268151937Sjkim                AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n",
269151937Sjkim                    ObjPtr);
27067754Smsmith                return;
27167754Smsmith            }
27267754Smsmith
273151937Sjkim            AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display,
274151937Sjkim                ACPI_UINT32_MAX);
27577424Smsmith            AcpiExDumpObjectDescriptor (ObjPtr, 1);
27691116Smsmith            break;
27767754Smsmith
27867754Smsmith
27991116Smsmith        case ACPI_DESC_TYPE_PARSER:
28091116Smsmith
28191116Smsmith            /* This is a Parser Op object */
28291116Smsmith
28367754Smsmith            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
28467754Smsmith            {
285151937Sjkim                AcpiOsPrintf (
286151937Sjkim                    "Cannot read entire Parser object at address %p\n", ObjPtr);
28767754Smsmith                return;
28867754Smsmith            }
28967754Smsmith
290151937Sjkim            AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display,
291151937Sjkim                ACPI_UINT32_MAX);
29267754Smsmith            AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
29391116Smsmith            break;
29467754Smsmith
29591116Smsmith
29691116Smsmith        default:
29791116Smsmith
29891116Smsmith            /* Is not a recognizeable object */
29991116Smsmith
30067754Smsmith            Size = 16;
30167754Smsmith            if (AcpiOsReadable (ObjPtr, 64))
30267754Smsmith            {
30367754Smsmith                Size = 64;
30467754Smsmith            }
30567754Smsmith
30667754Smsmith            /* Just dump some memory */
30767754Smsmith
30877424Smsmith            AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
30991116Smsmith            break;
31067754Smsmith        }
31167754Smsmith
31267754Smsmith        return;
31367754Smsmith    }
31467754Smsmith
31567754Smsmith    /* The parameter is a name string that must be resolved to a Named obj */
31667754Smsmith
31767754Smsmith    Node = AcpiDbLocalNsLookup (Target);
31867754Smsmith    if (!Node)
31967754Smsmith    {
32067754Smsmith        return;
32167754Smsmith    }
32267754Smsmith
32367754Smsmith
324151937SjkimDumpNode:
325151937Sjkim    /* Now dump the NS node */
32667754Smsmith
32767754Smsmith    Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
32867754Smsmith    if (ACPI_FAILURE (Status))
32967754Smsmith    {
33067754Smsmith        AcpiOsPrintf ("Could not convert name to pathname\n");
33167754Smsmith    }
33267754Smsmith
33369746Smsmith    else
33469746Smsmith    {
335151937Sjkim        AcpiOsPrintf ("Object (%p) Pathname:  %s\n",
336151937Sjkim            Node, (char *) RetBuf.Pointer);
33769746Smsmith    }
33869746Smsmith
33967754Smsmith    if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
34067754Smsmith    {
34167754Smsmith        AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
34267754Smsmith        return;
34367754Smsmith    }
34467754Smsmith
345151937Sjkim    AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
346151937Sjkim        Display, ACPI_UINT32_MAX);
347167802Sjkim    AcpiExDumpNamespaceNode (Node, 1);
34867754Smsmith
34987031Smsmith    ObjDesc = AcpiNsGetAttachedObject (Node);
35087031Smsmith    if (ObjDesc)
35167754Smsmith    {
35287031Smsmith        AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
35387031Smsmith        if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
35467754Smsmith        {
355151937Sjkim            AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
356151937Sjkim                ObjDesc);
35767754Smsmith            return;
35867754Smsmith        }
35967754Smsmith
360151937Sjkim        AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT),
361151937Sjkim            Display, ACPI_UINT32_MAX);
36287031Smsmith        AcpiExDumpObjectDescriptor (ObjDesc, 1);
36367754Smsmith    }
36467754Smsmith}
36567754Smsmith
36667754Smsmith
36767754Smsmith/*******************************************************************************
36867754Smsmith *
36967754Smsmith * FUNCTION:    AcpiDbDisplayMethodInfo
37067754Smsmith *
37167754Smsmith * PARAMETERS:  StartOp         - Root of the control method parse tree
37267754Smsmith *
37367754Smsmith * RETURN:      None
37467754Smsmith *
37567754Smsmith * DESCRIPTION: Display information about the current method
37667754Smsmith *
37767754Smsmith ******************************************************************************/
37867754Smsmith
37967754Smsmithvoid
38067754SmsmithAcpiDbDisplayMethodInfo (
38167754Smsmith    ACPI_PARSE_OBJECT       *StartOp)
38267754Smsmith{
38367754Smsmith    ACPI_WALK_STATE         *WalkState;
38467754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
38567754Smsmith    ACPI_NAMESPACE_NODE     *Node;
38667754Smsmith    ACPI_PARSE_OBJECT       *RootOp;
38767754Smsmith    ACPI_PARSE_OBJECT       *Op;
38883174Smsmith    const ACPI_OPCODE_INFO  *OpInfo;
38967754Smsmith    UINT32                  NumOps = 0;
39067754Smsmith    UINT32                  NumOperands = 0;
39167754Smsmith    UINT32                  NumOperators = 0;
39267754Smsmith    UINT32                  NumRemainingOps = 0;
39367754Smsmith    UINT32                  NumRemainingOperands = 0;
39467754Smsmith    UINT32                  NumRemainingOperators = 0;
39567754Smsmith    BOOLEAN                 CountRemaining = FALSE;
39667754Smsmith
39767754Smsmith
39867754Smsmith    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
39967754Smsmith    if (!WalkState)
40067754Smsmith    {
40167754Smsmith        AcpiOsPrintf ("There is no method currently executing\n");
40267754Smsmith        return;
40367754Smsmith    }
40467754Smsmith
40567754Smsmith    ObjDesc = WalkState->MethodDesc;
40687031Smsmith    Node    = WalkState->MethodNode;
40767754Smsmith
408123315Snjl    AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
409123315Snjl            AcpiUtGetNodeName (Node));
410167802Sjkim    AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n",
411167802Sjkim            (UINT32) ObjDesc->Method.ParamCount,
412167802Sjkim            (UINT32) ObjDesc->Method.SyncLevel);
41367754Smsmith
41467754Smsmith
41567754Smsmith    RootOp = StartOp;
41699679Siwasaki    while (RootOp->Common.Parent)
41767754Smsmith    {
41899679Siwasaki        RootOp = RootOp->Common.Parent;
41967754Smsmith    }
42067754Smsmith
42167754Smsmith    Op = RootOp;
42267754Smsmith
42367754Smsmith    while (Op)
42467754Smsmith    {
42567754Smsmith        if (Op == StartOp)
42667754Smsmith        {
42767754Smsmith            CountRemaining = TRUE;
42867754Smsmith        }
42967754Smsmith
43067754Smsmith        NumOps++;
43167754Smsmith        if (CountRemaining)
43267754Smsmith        {
43367754Smsmith            NumRemainingOps++;
43467754Smsmith        }
43567754Smsmith
43667754Smsmith        /* Decode the opcode */
43767754Smsmith
43899679Siwasaki        OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
43985756Smsmith        switch (OpInfo->Class)
44067754Smsmith        {
44185756Smsmith        case AML_CLASS_ARGUMENT:
44267754Smsmith            if (CountRemaining)
44367754Smsmith            {
44467754Smsmith                NumRemainingOperands++;
44567754Smsmith            }
44667754Smsmith
44767754Smsmith            NumOperands++;
44867754Smsmith            break;
44967754Smsmith
45085756Smsmith        case AML_CLASS_UNKNOWN:
45185756Smsmith            /* Bad opcode or ASCII character */
45285756Smsmith
45385756Smsmith            continue;
45485756Smsmith
45567754Smsmith        default:
45667754Smsmith            if (CountRemaining)
45767754Smsmith            {
45867754Smsmith                NumRemainingOperators++;
45967754Smsmith            }
46067754Smsmith
46167754Smsmith            NumOperators++;
46267754Smsmith            break;
46367754Smsmith        }
46467754Smsmith
46567754Smsmith        Op = AcpiPsGetDepthNext (StartOp, Op);
46667754Smsmith    }
46767754Smsmith
468151937Sjkim    AcpiOsPrintf (
469151937Sjkim        "Method contains:       %X AML Opcodes - %X Operators, %X Operands\n",
470151937Sjkim        NumOps, NumOperators, NumOperands);
47167754Smsmith
472151937Sjkim    AcpiOsPrintf (
473151937Sjkim        "Remaining to execute:  %X AML Opcodes - %X Operators, %X Operands\n",
474151937Sjkim        NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
47567754Smsmith}
47667754Smsmith
47767754Smsmith
47867754Smsmith/*******************************************************************************
47967754Smsmith *
48067754Smsmith * FUNCTION:    AcpiDbDisplayLocals
48167754Smsmith *
48267754Smsmith * PARAMETERS:  None
48367754Smsmith *
48467754Smsmith * RETURN:      None
48567754Smsmith *
48667754Smsmith * DESCRIPTION: Display all locals for the currently running control method
48767754Smsmith *
48867754Smsmith ******************************************************************************/
48967754Smsmith
49067754Smsmithvoid
491151937SjkimAcpiDbDisplayLocals (
492151937Sjkim    void)
49367754Smsmith{
49467754Smsmith    ACPI_WALK_STATE         *WalkState;
49567754Smsmith
49667754Smsmith
49767754Smsmith    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
49867754Smsmith    if (!WalkState)
49967754Smsmith    {
50067754Smsmith        AcpiOsPrintf ("There is no method currently executing\n");
50167754Smsmith        return;
50267754Smsmith    }
50367754Smsmith
504117521Snjl    AcpiDmDisplayLocals (WalkState);
50567754Smsmith}
50667754Smsmith
50767754Smsmith
50867754Smsmith/*******************************************************************************
50967754Smsmith *
51067754Smsmith * FUNCTION:    AcpiDbDisplayArguments
51167754Smsmith *
51267754Smsmith * PARAMETERS:  None
51367754Smsmith *
51467754Smsmith * RETURN:      None
51567754Smsmith *
51667754Smsmith * DESCRIPTION: Display all arguments for the currently running control method
51767754Smsmith *
51867754Smsmith ******************************************************************************/
51967754Smsmith
52067754Smsmithvoid
521151937SjkimAcpiDbDisplayArguments (
522151937Sjkim    void)
52367754Smsmith{
52467754Smsmith    ACPI_WALK_STATE         *WalkState;
52567754Smsmith
52667754Smsmith
52767754Smsmith    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
52867754Smsmith    if (!WalkState)
52967754Smsmith    {
53067754Smsmith        AcpiOsPrintf ("There is no method currently executing\n");
53167754Smsmith        return;
53267754Smsmith    }
53367754Smsmith
534117521Snjl    AcpiDmDisplayArguments (WalkState);
53567754Smsmith}
53667754Smsmith
53767754Smsmith
53867754Smsmith/*******************************************************************************
53967754Smsmith *
54067754Smsmith * FUNCTION:    AcpiDbDisplayResults
54167754Smsmith *
54267754Smsmith * PARAMETERS:  None
54367754Smsmith *
54467754Smsmith * RETURN:      None
54567754Smsmith *
54667754Smsmith * DESCRIPTION: Display current contents of a method result stack
54767754Smsmith *
54867754Smsmith ******************************************************************************/
54967754Smsmith
55067754Smsmithvoid
551151937SjkimAcpiDbDisplayResults (
552151937Sjkim    void)
55367754Smsmith{
55467754Smsmith    UINT32                  i;
55567754Smsmith    ACPI_WALK_STATE         *WalkState;
55667754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
557167802Sjkim    UINT32                  ResultCount = 0;
55867754Smsmith    ACPI_NAMESPACE_NODE     *Node;
559167802Sjkim    ACPI_GENERIC_STATE      *Frame;
560167802Sjkim    UINT32                  Index; /* Index onto current frame */
56167754Smsmith
56267754Smsmith
56367754Smsmith    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
56467754Smsmith    if (!WalkState)
56567754Smsmith    {
56667754Smsmith        AcpiOsPrintf ("There is no method currently executing\n");
56767754Smsmith        return;
56867754Smsmith    }
56967754Smsmith
57067754Smsmith    ObjDesc = WalkState->MethodDesc;
571123315Snjl    Node    = WalkState->MethodNode;
57267754Smsmith
57369746Smsmith    if (WalkState->Results)
57469746Smsmith    {
575167802Sjkim        ResultCount = WalkState->ResultCount;
57669746Smsmith    }
57767754Smsmith
57887031Smsmith    AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
579167802Sjkim            AcpiUtGetNodeName (Node), ResultCount);
58069746Smsmith
581167802Sjkim    /* From the top element of result stack */
582167802Sjkim
583167802Sjkim    Frame = WalkState->Results;
584167802Sjkim    Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
585167802Sjkim
586167802Sjkim    for (i = 0; i < ResultCount; i++)
58767754Smsmith    {
588167802Sjkim        ObjDesc = Frame->Results.ObjDesc[Index];
589209746Sjkim        AcpiOsPrintf ("Result%u: ", i);
590117521Snjl        AcpiDmDisplayInternalObject (ObjDesc, WalkState);
591167802Sjkim        if (Index == 0)
592167802Sjkim        {
593167802Sjkim            Frame = Frame->Results.Next;
594167802Sjkim            Index = ACPI_RESULTS_FRAME_OBJ_NUM;
595167802Sjkim        }
596167802Sjkim        Index--;
59767754Smsmith    }
59867754Smsmith}
59967754Smsmith
60067754Smsmith
60167754Smsmith/*******************************************************************************
60267754Smsmith *
60367754Smsmith * FUNCTION:    AcpiDbDisplayCallingTree
60467754Smsmith *
60567754Smsmith * PARAMETERS:  None
60667754Smsmith *
60767754Smsmith * RETURN:      None
60867754Smsmith *
60967754Smsmith * DESCRIPTION: Display current calling tree of nested control methods
61067754Smsmith *
61167754Smsmith ******************************************************************************/
61267754Smsmith
61367754Smsmithvoid
614151937SjkimAcpiDbDisplayCallingTree (
615151937Sjkim    void)
61667754Smsmith{
61767754Smsmith    ACPI_WALK_STATE         *WalkState;
61867754Smsmith    ACPI_NAMESPACE_NODE     *Node;
61967754Smsmith
62067754Smsmith
62167754Smsmith    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
62267754Smsmith    if (!WalkState)
62367754Smsmith    {
62467754Smsmith        AcpiOsPrintf ("There is no method currently executing\n");
62567754Smsmith        return;
62667754Smsmith    }
62767754Smsmith
62869450Smsmith    Node = WalkState->MethodNode;
62967754Smsmith    AcpiOsPrintf ("Current Control Method Call Tree\n");
63067754Smsmith
63199679Siwasaki    while (WalkState)
63267754Smsmith    {
63369450Smsmith        Node = WalkState->MethodNode;
63467754Smsmith
635123315Snjl        AcpiOsPrintf ("    [%4.4s]\n", AcpiUtGetNodeName (Node));
63667754Smsmith
63767754Smsmith        WalkState = WalkState->Next;
63867754Smsmith    }
63967754Smsmith}
64067754Smsmith
64167754Smsmith
64267754Smsmith/*******************************************************************************
64367754Smsmith *
644117521Snjl * FUNCTION:    AcpiDbDisplayObjectType
645117521Snjl *
646123315Snjl * PARAMETERS:  ObjectArg       - User entered NS node handle
647117521Snjl *
648117521Snjl * RETURN:      None
649117521Snjl *
650123315Snjl * DESCRIPTION: Display type of an arbitrary NS node
651117521Snjl *
652117521Snjl ******************************************************************************/
653117521Snjl
654117521Snjlvoid
655117521SnjlAcpiDbDisplayObjectType (
656117521Snjl    char                    *ObjectArg)
657117521Snjl{
658117521Snjl    ACPI_HANDLE             Handle;
659117521Snjl    ACPI_DEVICE_INFO        *Info;
660117521Snjl    ACPI_STATUS             Status;
661193267Sjkim    UINT32                  i;
662117521Snjl
663117521Snjl
664117521Snjl    Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
665117521Snjl
666197104Sjkim    Status = AcpiGetObjectInfo (Handle, &Info);
667197104Sjkim    if (ACPI_FAILURE (Status))
668117521Snjl    {
669197104Sjkim        AcpiOsPrintf ("Could not get object info, %s\n",
670197104Sjkim            AcpiFormatException (Status));
671197104Sjkim        return;
672197104Sjkim    }
673117521Snjl
674197104Sjkim    AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
675197104Sjkim        ACPI_FORMAT_UINT64 (Info->Address),
676197104Sjkim        Info->CurrentStatus, Info->Flags);
677117521Snjl
678197104Sjkim    AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
679197104Sjkim        Info->HighestDstates[0], Info->HighestDstates[1],
680197104Sjkim        Info->HighestDstates[2], Info->HighestDstates[3]);
681197104Sjkim
682197104Sjkim    AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
683197104Sjkim        Info->LowestDstates[0], Info->LowestDstates[1],
684197104Sjkim        Info->LowestDstates[2], Info->LowestDstates[3],
685197104Sjkim        Info->LowestDstates[4]);
686197104Sjkim
687197104Sjkim    if (Info->Valid & ACPI_VALID_HID)
688197104Sjkim    {
689197104Sjkim        AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String);
690117521Snjl    }
691197104Sjkim    if (Info->Valid & ACPI_VALID_UID)
692117521Snjl    {
693197104Sjkim        AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String);
694117521Snjl    }
695197104Sjkim    if (Info->Valid & ACPI_VALID_CID)
696197104Sjkim    {
697197104Sjkim        for (i = 0; i < Info->CompatibleIdList.Count; i++)
698197104Sjkim        {
699209746Sjkim            AcpiOsPrintf ("CID %u: %s\n", i,
700197104Sjkim                Info->CompatibleIdList.Ids[i].String);
701197104Sjkim        }
702197104Sjkim    }
703197104Sjkim
704197104Sjkim    ACPI_FREE (Info);
705117521Snjl}
706117521Snjl
707117521Snjl
708117521Snjl/*******************************************************************************
709117521Snjl *
71067754Smsmith * FUNCTION:    AcpiDbDisplayResultObject
71167754Smsmith *
71267754Smsmith * PARAMETERS:  ObjDesc         - Object to be displayed
71367754Smsmith *              WalkState       - Current walk state
71467754Smsmith *
71567754Smsmith * RETURN:      None
71667754Smsmith *
71767754Smsmith * DESCRIPTION: Display the result of an AML opcode
71867754Smsmith *
71991116Smsmith * Note: Curently only displays the result object if we are single stepping.
72091116Smsmith * However, this output may be useful in other contexts and could be enabled
72191116Smsmith * to do so if needed.
72291116Smsmith *
72367754Smsmith ******************************************************************************/
72467754Smsmith
72567754Smsmithvoid
72667754SmsmithAcpiDbDisplayResultObject (
72767754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc,
72867754Smsmith    ACPI_WALK_STATE         *WalkState)
72967754Smsmith{
73067754Smsmith
73191116Smsmith    /* Only display if single stepping */
73291116Smsmith
73367754Smsmith    if (!AcpiGbl_CmSingleStep)
73467754Smsmith    {
73567754Smsmith        return;
73667754Smsmith    }
73767754Smsmith
73867754Smsmith    AcpiOsPrintf ("ResultObj: ");
739117521Snjl    AcpiDmDisplayInternalObject (ObjDesc, WalkState);
74067754Smsmith    AcpiOsPrintf ("\n");
74167754Smsmith}
74267754Smsmith
74367754Smsmith
74467754Smsmith/*******************************************************************************
74567754Smsmith *
74667754Smsmith * FUNCTION:    AcpiDbDisplayArgumentObject
74767754Smsmith *
74867754Smsmith * PARAMETERS:  ObjDesc         - Object to be displayed
74967754Smsmith *              WalkState       - Current walk state
75067754Smsmith *
75167754Smsmith * RETURN:      None
75267754Smsmith *
75367754Smsmith * DESCRIPTION: Display the result of an AML opcode
75467754Smsmith *
75567754Smsmith ******************************************************************************/
75667754Smsmith
75767754Smsmithvoid
75867754SmsmithAcpiDbDisplayArgumentObject (
75967754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc,
76067754Smsmith    ACPI_WALK_STATE         *WalkState)
76167754Smsmith{
76267754Smsmith
76367754Smsmith    if (!AcpiGbl_CmSingleStep)
76467754Smsmith    {
76567754Smsmith        return;
76667754Smsmith    }
76767754Smsmith
76867754Smsmith    AcpiOsPrintf ("ArgObj:    ");
769117521Snjl    AcpiDmDisplayInternalObject (ObjDesc, WalkState);
77067754Smsmith}
77167754Smsmith
772114237Snjl
773231844Sjkim#if (!ACPI_REDUCED_HARDWARE)
774114237Snjl/*******************************************************************************
775114237Snjl *
776114237Snjl * FUNCTION:    AcpiDbDisplayGpes
777114237Snjl *
778123315Snjl * PARAMETERS:  None
779114237Snjl *
780114237Snjl * RETURN:      None
781114237Snjl *
782123315Snjl * DESCRIPTION: Display the current GPE structures
783114237Snjl *
784114237Snjl ******************************************************************************/
785114237Snjl
786114237Snjlvoid
787151937SjkimAcpiDbDisplayGpes (
788151937Sjkim    void)
789114237Snjl{
790114237Snjl    ACPI_GPE_BLOCK_INFO     *GpeBlock;
791117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo;
792129684Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo;
793129684Snjl    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
794207344Sjkim    char                    *GpeType;
795237412Sjkim    ACPI_GPE_NOTIFY_INFO    *Notify;
796129684Snjl    UINT32                  GpeIndex;
797129684Snjl    UINT32                  Block = 0;
798129684Snjl    UINT32                  i;
799129684Snjl    UINT32                  j;
800237412Sjkim    UINT32                  Count;
801129684Snjl    char                    Buffer[80];
802129684Snjl    ACPI_BUFFER             RetBuf;
803129684Snjl    ACPI_STATUS             Status;
804114237Snjl
805114237Snjl
806129684Snjl    RetBuf.Length = sizeof (Buffer);
807129684Snjl    RetBuf.Pointer = Buffer;
808129684Snjl
809129684Snjl    Block = 0;
810129684Snjl
811129684Snjl    /* Walk the GPE lists */
812129684Snjl
813117521Snjl    GpeXruptInfo = AcpiGbl_GpeXruptListHead;
814117521Snjl    while (GpeXruptInfo)
815114237Snjl    {
816117521Snjl        GpeBlock = GpeXruptInfo->GpeBlockListHead;
817117521Snjl        while (GpeBlock)
818117521Snjl        {
819129684Snjl            Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf);
820129684Snjl            if (ACPI_FAILURE (Status))
821129684Snjl            {
822129684Snjl                AcpiOsPrintf ("Could not convert name to pathname\n");
823129684Snjl            }
824129684Snjl
825207344Sjkim            if (GpeBlock->Node == AcpiGbl_FadtGpeDevice)
826207344Sjkim            {
827207344Sjkim                GpeType = "FADT-defined GPE block";
828207344Sjkim            }
829207344Sjkim            else
830207344Sjkim            {
831207344Sjkim                GpeType = "GPE Block Device";
832207344Sjkim            }
833151937Sjkim
834209746Sjkim            AcpiOsPrintf ("\nBlock %u - Info %p  DeviceNode %p [%s] - %s\n",
835207344Sjkim                Block, GpeBlock, GpeBlock->Node, Buffer, GpeType);
836207344Sjkim
837151937Sjkim            AcpiOsPrintf ("    Registers:    %u (%u GPEs)\n",
838206117Sjkim                GpeBlock->RegisterCount, GpeBlock->GpeCount);
839151937Sjkim
840206117Sjkim            AcpiOsPrintf ("    GPE range:    0x%X to 0x%X on interrupt %u\n",
841151937Sjkim                GpeBlock->BlockBaseNumber,
842206117Sjkim                GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1),
843206117Sjkim                GpeXruptInfo->InterruptNumber);
844151937Sjkim
845151937Sjkim            AcpiOsPrintf (
846151937Sjkim                "    RegisterInfo: %p  Status %8.8X%8.8X Enable %8.8X%8.8X\n",
847151937Sjkim                GpeBlock->RegisterInfo,
848167802Sjkim                ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address),
849167802Sjkim                ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address));
850151937Sjkim
851117521Snjl            AcpiOsPrintf ("    EventInfo:    %p\n", GpeBlock->EventInfo);
852114237Snjl
853129684Snjl            /* Examine each GPE Register within the block */
854129684Snjl
855129684Snjl            for (i = 0; i < GpeBlock->RegisterCount; i++)
856129684Snjl            {
857129684Snjl                GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
858129684Snjl
859129684Snjl                AcpiOsPrintf (
860206117Sjkim                    "    Reg %u: (GPE %.2X-%.2X)  RunEnable %2.2X WakeEnable %2.2X"
861206117Sjkim                    " Status %8.8X%8.8X Enable %8.8X%8.8X\n",
862206117Sjkim                    i, GpeRegisterInfo->BaseGpeNumber,
863206117Sjkim                    GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
864151937Sjkim                    GpeRegisterInfo->EnableForRun,
865206117Sjkim                    GpeRegisterInfo->EnableForWake,
866167802Sjkim                    ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address),
867167802Sjkim                    ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address));
868129684Snjl
869129684Snjl                /* Now look at the individual GPEs in this byte register */
870129684Snjl
871129684Snjl                for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
872129684Snjl                {
873129684Snjl                    GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
874129684Snjl                    GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
875129684Snjl
876216471Sjkim                    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
877216471Sjkim                        ACPI_GPE_DISPATCH_NONE)
878129684Snjl                    {
879206117Sjkim                        /* This GPE is not used (no method or handler), ignore it */
880129684Snjl
881129684Snjl                        continue;
882129684Snjl                    }
883129684Snjl
884129684Snjl                    AcpiOsPrintf (
885209746Sjkim                        "        GPE %.2X: %p  RunRefs %2.2X Flags %2.2X (",
886206117Sjkim                        GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo,
887216471Sjkim                        GpeEventInfo->RuntimeCount, GpeEventInfo->Flags);
888129684Snjl
889206117Sjkim                    /* Decode the flags byte */
890206117Sjkim
891129684Snjl                    if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
892129684Snjl                    {
893129684Snjl                        AcpiOsPrintf ("Level, ");
894129684Snjl                    }
895129684Snjl                    else
896129684Snjl                    {
897129684Snjl                        AcpiOsPrintf ("Edge,  ");
898129684Snjl                    }
899129684Snjl
900206117Sjkim                    if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
901129684Snjl                    {
902206117Sjkim                        AcpiOsPrintf ("CanWake, ");
903129684Snjl                    }
904129684Snjl                    else
905129684Snjl                    {
906206117Sjkim                        AcpiOsPrintf ("RunOnly, ");
907129684Snjl                    }
908129684Snjl
909129684Snjl                    switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
910129684Snjl                    {
911216471Sjkim                    case ACPI_GPE_DISPATCH_NONE:
912129684Snjl                        AcpiOsPrintf ("NotUsed");
913129684Snjl                        break;
914216471Sjkim                    case ACPI_GPE_DISPATCH_METHOD:
915216471Sjkim                        AcpiOsPrintf ("Method");
916216471Sjkim                        break;
917129684Snjl                    case ACPI_GPE_DISPATCH_HANDLER:
918129684Snjl                        AcpiOsPrintf ("Handler");
919129684Snjl                        break;
920216471Sjkim                    case ACPI_GPE_DISPATCH_NOTIFY:
921237412Sjkim                        Count = 0;
922237412Sjkim                        Notify = GpeEventInfo->Dispatch.NotifyList;
923237412Sjkim                        while (Notify)
924237412Sjkim                        {
925237412Sjkim                            Count++;
926237412Sjkim                            Notify = Notify->Next;
927237412Sjkim                        }
928237412Sjkim                        AcpiOsPrintf ("Implicit Notify on %u devices", Count);
929129684Snjl                        break;
930129684Snjl                    default:
931129684Snjl                        AcpiOsPrintf ("UNKNOWN: %X",
932129684Snjl                            GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK);
933129684Snjl                        break;
934129684Snjl                    }
935129684Snjl
936206117Sjkim                    AcpiOsPrintf (")\n");
937129684Snjl                }
938129684Snjl            }
939129684Snjl            Block++;
940117521Snjl            GpeBlock = GpeBlock->Next;
941117521Snjl        }
942117521Snjl        GpeXruptInfo = GpeXruptInfo->Next;
943114237Snjl    }
944114237Snjl}
945231844Sjkim#endif /* !ACPI_REDUCED_HARDWARE */
946114237Snjl
947220663Sjkim
948218590Sjkim/*******************************************************************************
949218590Sjkim *
950218590Sjkim * FUNCTION:    AcpiDbDisplayHandlers
951218590Sjkim *
952218590Sjkim * PARAMETERS:  None
953218590Sjkim *
954218590Sjkim * RETURN:      None
955218590Sjkim *
956218590Sjkim * DESCRIPTION: Display the currently installed global handlers
957218590Sjkim *
958218590Sjkim ******************************************************************************/
959218590Sjkim
960218590Sjkimvoid
961218590SjkimAcpiDbDisplayHandlers (
962218590Sjkim    void)
963218590Sjkim{
964218590Sjkim    ACPI_OPERAND_OBJECT     *ObjDesc;
965218590Sjkim    ACPI_OPERAND_OBJECT     *HandlerObj;
966218590Sjkim    ACPI_ADR_SPACE_TYPE     SpaceId;
967218590Sjkim    UINT32                  i;
968218590Sjkim
969218590Sjkim
970218590Sjkim    /* Operation region handlers */
971218590Sjkim
972218590Sjkim    AcpiOsPrintf ("\nOperation Region Handlers:\n");
973218590Sjkim
974218590Sjkim    ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
975218590Sjkim    if (ObjDesc)
976218590Sjkim    {
977220663Sjkim        for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++)
978218590Sjkim        {
979220663Sjkim            SpaceId = AcpiGbl_SpaceIdList[i];
980218590Sjkim            HandlerObj = ObjDesc->Device.Handler;
981218590Sjkim
982218590Sjkim            AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
983218590Sjkim                AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId);
984218590Sjkim
985218590Sjkim            while (HandlerObj)
986218590Sjkim            {
987228110Sjkim                if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId)
988218590Sjkim                {
989218590Sjkim                    AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
990218590Sjkim                        (HandlerObj->AddressSpace.HandlerFlags &
991218590Sjkim                            ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
992218590Sjkim                        HandlerObj->AddressSpace.Handler);
993218590Sjkim                    goto FoundHandler;
994218590Sjkim                }
995218590Sjkim
996218590Sjkim                HandlerObj = HandlerObj->AddressSpace.Next;
997218590Sjkim            }
998218590Sjkim
999218590Sjkim            /* There is no handler for this SpaceId */
1000218590Sjkim
1001218590Sjkim            AcpiOsPrintf ("None\n");
1002218590Sjkim
1003218590Sjkim        FoundHandler:;
1004218590Sjkim        }
1005228110Sjkim
1006228110Sjkim        /* Find all handlers for user-defined SpaceIDs */
1007228110Sjkim
1008228110Sjkim        HandlerObj = ObjDesc->Device.Handler;
1009228110Sjkim        while (HandlerObj)
1010228110Sjkim        {
1011228110Sjkim            if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN)
1012228110Sjkim            {
1013228110Sjkim                AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
1014228110Sjkim                    "User-defined ID", HandlerObj->AddressSpace.SpaceId);
1015228110Sjkim                AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
1016228110Sjkim                    (HandlerObj->AddressSpace.HandlerFlags &
1017228110Sjkim                        ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
1018228110Sjkim                    HandlerObj->AddressSpace.Handler);
1019228110Sjkim            }
1020228110Sjkim
1021228110Sjkim            HandlerObj = HandlerObj->AddressSpace.Next;
1022228110Sjkim        }
1023218590Sjkim    }
1024218590Sjkim
1025231844Sjkim#if (!ACPI_REDUCED_HARDWARE)
1026231844Sjkim
1027218590Sjkim    /* Fixed event handlers */
1028218590Sjkim
1029218590Sjkim    AcpiOsPrintf ("\nFixed Event Handlers:\n");
1030218590Sjkim
1031218590Sjkim    for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
1032218590Sjkim    {
1033218590Sjkim        AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i);
1034218590Sjkim        if (AcpiGbl_FixedEventHandlers[i].Handler)
1035218590Sjkim        {
1036218590Sjkim            AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1037218590Sjkim                AcpiGbl_FixedEventHandlers[i].Handler);
1038218590Sjkim        }
1039218590Sjkim        else
1040218590Sjkim        {
1041218590Sjkim            AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1042218590Sjkim        }
1043218590Sjkim    }
1044218590Sjkim
1045231844Sjkim#endif /* !ACPI_REDUCED_HARDWARE */
1046231844Sjkim
1047218590Sjkim    /* Miscellaneous global handlers */
1048218590Sjkim
1049218590Sjkim    AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
1050218590Sjkim
1051220663Sjkim    for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++)
1052218590Sjkim    {
1053220663Sjkim        AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name);
1054220663Sjkim        if (AcpiGbl_HandlerList[i].Handler)
1055218590Sjkim        {
1056218590Sjkim            AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1057220663Sjkim                AcpiGbl_HandlerList[i].Handler);
1058218590Sjkim        }
1059218590Sjkim        else
1060218590Sjkim        {
1061218590Sjkim            AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1062218590Sjkim        }
1063218590Sjkim    }
1064218590Sjkim}
1065218590Sjkim
1066102550Siwasaki#endif /* ACPI_DEBUGGER */
1067