nsdump.c revision 85756
167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: nsdump - table dumping routines for debug
485756Smsmith *              $Revision: 105 $
567754Smsmith *
667754Smsmith *****************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
1271867Smsmith * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
1370243Smsmith * All rights reserved.
1467754Smsmith *
1567754Smsmith * 2. License
1667754Smsmith *
1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1867754Smsmith * rights.  You may have additional license terms from the party that provided
1967754Smsmith * you this software, covering your right to use that party's intellectual
2067754Smsmith * property rights.
2167754Smsmith *
2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2667754Smsmith
2767754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2867754Smsmith * Code in any form, with the right to sublicense such rights; and
2967754Smsmith *
3067754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3167754Smsmith * license (with the right to sublicense), under only those claims of Intel
3267754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3367754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3467754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3567754Smsmith * license, and in no event shall the patent license extend to any additions
3667754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3767754Smsmith * is granted directly or by implication, estoppel or otherwise;
3867754Smsmith *
3967754Smsmith * The above copyright and patent license is granted only if the following
4067754Smsmith * conditions are met:
4167754Smsmith *
4267754Smsmith * 3. Conditions
4367754Smsmith *
4467754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4567754Smsmith * Redistribution of source code of any substantial portion of the Covered
4667754Smsmith * Code or modification with rights to further distribute source must include
4767754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4867754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4967754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
5067754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5167754Smsmith * Code and the date of any change.  Licensee must include in that file the
5267754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5367754Smsmith * must include a prominent statement that the modification is derived,
5467754Smsmith * directly or indirectly, from Original Intel Code.
5567754Smsmith *
5667754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5767754Smsmith * Redistribution of source code of any substantial portion of the Covered
5867754Smsmith * Code or modification without rights to further distribute source must
5967754Smsmith * include the following Disclaimer and Export Compliance provision in the
6067754Smsmith * documentation and/or other materials provided with distribution.  In
6167754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6267754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6367754Smsmith * license from Licensee to its licensee is limited to the intellectual
6467754Smsmith * property embodied in the software Licensee provides to its licensee, and
6567754Smsmith * not to intellectual property embodied in modifications its licensee may
6667754Smsmith * make.
6767754Smsmith *
6867754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6967754Smsmith * substantial portion of the Covered Code or modification must reproduce the
7067754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7167754Smsmith * provision in the documentation and/or other materials provided with the
7267754Smsmith * distribution.
7367754Smsmith *
7467754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7567754Smsmith * Intel Code.
7667754Smsmith *
7767754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7867754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7967754Smsmith * other dealings in products derived from or relating to the Covered Code
8067754Smsmith * without prior written authorization from Intel.
8167754Smsmith *
8267754Smsmith * 4. Disclaimer and Export Compliance
8367754Smsmith *
8467754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8567754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8667754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8767754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8867754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8967754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
9067754Smsmith * PARTICULAR PURPOSE.
9167754Smsmith *
9267754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9367754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9467754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9567754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9667754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9767754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9867754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9967754Smsmith * LIMITED REMEDY.
10067754Smsmith *
10167754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10267754Smsmith * software or system incorporating such software without first obtaining any
10367754Smsmith * required license or other approval from the U. S. Department of Commerce or
10467754Smsmith * any other agency or department of the United States Government.  In the
10567754Smsmith * event Licensee exports any such software from the United States or
10667754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10767754Smsmith * ensure that the distribution and export/re-export of the software is in
10867754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10967754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
11067754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11167754Smsmith * software, or service, directly or indirectly, to any country for which the
11267754Smsmith * United States government or any agency thereof requires an export license,
11367754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11467754Smsmith * such license, approval or letter.
11567754Smsmith *
11667754Smsmith *****************************************************************************/
11767754Smsmith
11867754Smsmith#define __NSDUMP_C__
11967754Smsmith
12067754Smsmith#include "acpi.h"
12167754Smsmith#include "acinterp.h"
12267754Smsmith#include "acnamesp.h"
12367754Smsmith#include "actables.h"
12485756Smsmith#include "acparser.h"
12567754Smsmith
12667754Smsmith
12777424Smsmith#define _COMPONENT          ACPI_NAMESPACE
12867754Smsmith        MODULE_NAME         ("nsdump")
12967754Smsmith
13067754Smsmith
13171867Smsmith#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
13267754Smsmith
13377424Smsmith/*******************************************************************************
13467754Smsmith *
13567754Smsmith * FUNCTION:    AcpiNsDumpPathname
13667754Smsmith *
13767754Smsmith * PARAMETERS:  Handle              - Object
13867754Smsmith *              Msg                 - Prefix message
13967754Smsmith *              Level               - Desired debug level
14067754Smsmith *              Component           - Caller's component ID
14167754Smsmith *
14267754Smsmith * DESCRIPTION: Print an object's full namespace pathname
14367754Smsmith *              Manages allocation/freeing of a pathname buffer
14467754Smsmith *
14577424Smsmith ******************************************************************************/
14667754Smsmith
14767754SmsmithACPI_STATUS
14867754SmsmithAcpiNsDumpPathname (
14967754Smsmith    ACPI_HANDLE             Handle,
15067754Smsmith    NATIVE_CHAR             *Msg,
15167754Smsmith    UINT32                  Level,
15267754Smsmith    UINT32                  Component)
15367754Smsmith{
15467754Smsmith    NATIVE_CHAR             *Buffer;
15567754Smsmith    UINT32                  Length;
15667754Smsmith
15767754Smsmith
15867754Smsmith    FUNCTION_TRACE ("NsDumpPathname");
15967754Smsmith
16083174Smsmith
16167754Smsmith    /* Do this only if the requested debug level and component are enabled */
16267754Smsmith
16367754Smsmith    if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
16467754Smsmith    {
16567754Smsmith        return_ACPI_STATUS (AE_OK);
16667754Smsmith    }
16767754Smsmith
16880062Smsmith    Buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX);
16967754Smsmith    if (!Buffer)
17067754Smsmith    {
17167754Smsmith        return_ACPI_STATUS (AE_NO_MEMORY);
17267754Smsmith    }
17367754Smsmith
17467754Smsmith    /* Convert handle to a full pathname and print it (with supplied message) */
17567754Smsmith
17667754Smsmith    Length = PATHNAME_MAX;
17767754Smsmith    if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer)))
17867754Smsmith    {
17967754Smsmith        AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle);
18067754Smsmith    }
18167754Smsmith
18280062Smsmith    ACPI_MEM_FREE (Buffer);
18367754Smsmith
18467754Smsmith    return_ACPI_STATUS (AE_OK);
18567754Smsmith}
18667754Smsmith
18767754Smsmith
18877424Smsmith/*******************************************************************************
18967754Smsmith *
19067754Smsmith * FUNCTION:    AcpiNsDumpOneObject
19167754Smsmith *
19267754Smsmith * PARAMETERS:  Handle              - Node to be dumped
19367754Smsmith *              Level               - Nesting level of the handle
19467754Smsmith *              Context             - Passed into WalkNamespace
19567754Smsmith *
19667754Smsmith * DESCRIPTION: Dump a single Node
19767754Smsmith *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
19867754Smsmith *
19977424Smsmith ******************************************************************************/
20067754Smsmith
20167754SmsmithACPI_STATUS
20267754SmsmithAcpiNsDumpOneObject (
20367754Smsmith    ACPI_HANDLE             ObjHandle,
20467754Smsmith    UINT32                  Level,
20567754Smsmith    void                    *Context,
20667754Smsmith    void                    **ReturnValue)
20767754Smsmith{
20867754Smsmith    ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
20967754Smsmith    ACPI_NAMESPACE_NODE     *ThisNode;
21067754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
21177424Smsmith    ACPI_OBJECT_TYPE8       ObjType;
21277424Smsmith    ACPI_OBJECT_TYPE8       Type;
21367754Smsmith    UINT32                  BytesToDump;
21467754Smsmith    UINT32                  DownstreamSiblingMask = 0;
21567754Smsmith    UINT32                  LevelTmp;
21667754Smsmith    UINT32                  WhichBit;
21785756Smsmith    UINT32                  i;
21867754Smsmith
21967754Smsmith
22083174Smsmith    PROC_NAME ("NsDumpOneObject");
22182367Smsmith
22282367Smsmith
22385756Smsmith    ThisNode = AcpiNsMapHandleToNode (ObjHandle);
22467754Smsmith
22567754Smsmith    LevelTmp    = Level;
22667754Smsmith    Type        = ThisNode->Type;
22767754Smsmith    WhichBit    = 1;
22867754Smsmith
22967754Smsmith
23067754Smsmith    if (!(AcpiDbgLevel & Info->DebugLevel))
23167754Smsmith    {
23267754Smsmith        return (AE_OK);
23367754Smsmith    }
23467754Smsmith
23567754Smsmith    if (!ObjHandle)
23667754Smsmith    {
23782367Smsmith        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
23867754Smsmith        return (AE_OK);
23967754Smsmith    }
24067754Smsmith
24167754Smsmith    /* Check if the owner matches */
24267754Smsmith
24367754Smsmith    if ((Info->OwnerId != ACPI_UINT32_MAX) &&
24467754Smsmith        (Info->OwnerId != ThisNode->OwnerId))
24567754Smsmith    {
24667754Smsmith        return (AE_OK);
24767754Smsmith    }
24867754Smsmith
24967754Smsmith
25067754Smsmith    /* Indent the object according to the level */
25167754Smsmith
25267754Smsmith    while (LevelTmp--)
25367754Smsmith    {
25467754Smsmith
25567754Smsmith        /* Print appropriate characters to form tree structure */
25667754Smsmith
25767754Smsmith        if (LevelTmp)
25867754Smsmith        {
25967754Smsmith            if (DownstreamSiblingMask & WhichBit)
26067754Smsmith            {
26182367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "|"));
26267754Smsmith            }
26367754Smsmith
26467754Smsmith            else
26567754Smsmith            {
26682367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
26767754Smsmith            }
26867754Smsmith
26967754Smsmith            WhichBit <<= 1;
27067754Smsmith        }
27167754Smsmith
27267754Smsmith        else
27367754Smsmith        {
27467754Smsmith            if (AcpiNsExistDownstreamSibling (ThisNode + 1))
27567754Smsmith            {
27667754Smsmith                DownstreamSiblingMask |= (1 << (Level - 1));
27782367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
27867754Smsmith            }
27967754Smsmith
28067754Smsmith            else
28167754Smsmith            {
28267754Smsmith                DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1));
28382367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
28467754Smsmith            }
28567754Smsmith
28667754Smsmith            if (ThisNode->Child == NULL)
28767754Smsmith            {
28882367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
28967754Smsmith            }
29067754Smsmith
29167754Smsmith            else if (AcpiNsExistDownstreamSibling (ThisNode->Child))
29267754Smsmith            {
29382367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
29467754Smsmith            }
29567754Smsmith
29667754Smsmith            else
29767754Smsmith            {
29882367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
29967754Smsmith            }
30067754Smsmith        }
30167754Smsmith    }
30267754Smsmith
30367754Smsmith
30467754Smsmith    /* Check the integrity of our data */
30567754Smsmith
30667754Smsmith    if (Type > INTERNAL_TYPE_MAX)
30767754Smsmith    {
30867754Smsmith        Type = INTERNAL_TYPE_DEF_ANY;                                /* prints as *ERROR* */
30967754Smsmith    }
31067754Smsmith
31177424Smsmith    if (!AcpiUtValidAcpiName (ThisNode->Name))
31267754Smsmith    {
31369746Smsmith        REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name));
31467754Smsmith    }
31567754Smsmith
31667754Smsmith    /*
31767754Smsmith     * Now we can print out the pertinent information
31867754Smsmith     */
31985756Smsmith    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-12s %p",
32085756Smsmith            (char*)&ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode));
32167754Smsmith
32285756Smsmith    ObjDesc = ThisNode->Object;
32367754Smsmith
32485756Smsmith    switch (Info->DisplayType)
32567754Smsmith    {
32685756Smsmith    case ACPI_DISPLAY_SUMMARY:
32767754Smsmith
32885756Smsmith        if (!ObjDesc)
32985756Smsmith        {
33085756Smsmith            /* No attached object, we are done */
33167754Smsmith
33285756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
33385756Smsmith            return (AE_OK);
33485756Smsmith        }
33567754Smsmith
33667754Smsmith
33785756Smsmith        switch (Type)
33885756Smsmith        {
33985756Smsmith        case ACPI_TYPE_PROCESSOR:
34085756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ID %d Addr %.4X Len %.4X\n",
34185756Smsmith                        ObjDesc->Processor.ProcId,
34285756Smsmith                        ObjDesc->Processor.Address,
34385756Smsmith                        ObjDesc->Processor.Length));
34485756Smsmith            break;
34567754Smsmith
34685756Smsmith        case ACPI_TYPE_DEVICE:
34785756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Notification object: %p", ObjDesc));
34885756Smsmith            break;
34967754Smsmith
35085756Smsmith        case ACPI_TYPE_METHOD:
35185756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Args %d Len %.4X Aml %p \n",
35285756Smsmith                        ObjDesc->Method.ParamCount,
35385756Smsmith                        ObjDesc->Method.AmlLength,
35485756Smsmith                        ObjDesc->Method.AmlStart));
35585756Smsmith            break;
35667754Smsmith
35785756Smsmith        case ACPI_TYPE_INTEGER:
35885756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = %8.8X%8.8X\n",
35985756Smsmith                        HIDWORD (ObjDesc->Integer.Value),
36085756Smsmith                        LODWORD (ObjDesc->Integer.Value)));
36185756Smsmith            break;
36267754Smsmith
36385756Smsmith        case ACPI_TYPE_PACKAGE:
36485756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Elements %.2X\n",
36585756Smsmith                        ObjDesc->Package.Count));
36685756Smsmith            break;
36767754Smsmith
36885756Smsmith        case ACPI_TYPE_BUFFER:
36985756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
37085756Smsmith                        ObjDesc->Buffer.Length));
37167754Smsmith
37285756Smsmith            /* Dump some of the buffer */
37367754Smsmith
37485756Smsmith            if (ObjDesc->Buffer.Length > 0)
37585756Smsmith            {
37685756Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ="));
37785756Smsmith                for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
37885756Smsmith                {
37985756Smsmith                    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %.2X",
38085756Smsmith                            ObjDesc->Buffer.Pointer[i]));
38185756Smsmith                }
38285756Smsmith            }
38385756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
38485756Smsmith            break;
38567754Smsmith
38685756Smsmith        case ACPI_TYPE_STRING:
38785756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
38885756Smsmith                        ObjDesc->String.Length));
38985756Smsmith
39085756Smsmith            if (ObjDesc->String.Length > 0)
39185756Smsmith            {
39285756Smsmith                 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = \"%.32s\"...",
39385756Smsmith                            ObjDesc->String.Pointer));
39485756Smsmith            }
39585756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
39685756Smsmith            break;
39767754Smsmith
39885756Smsmith        case ACPI_TYPE_REGION:
39985756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]",
40085756Smsmith                        AcpiUtGetRegionName (ObjDesc->Region.SpaceId)));
40185756Smsmith            if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
40285756Smsmith            {
40385756Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Addr %8.8X%8.8X Len %.4X\n",
40485756Smsmith                            HIDWORD(ObjDesc->Region.Address),
40585756Smsmith                            LODWORD(ObjDesc->Region.Address),
40685756Smsmith                            ObjDesc->Region.Length));
40785756Smsmith            }
40885756Smsmith            else
40985756Smsmith            {
41085756Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [Address/Length not evaluated]\n"));
41185756Smsmith            }
41285756Smsmith            break;
41367754Smsmith
41485756Smsmith        case INTERNAL_TYPE_REFERENCE:
41585756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]\n",
41685756Smsmith                        AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)));
41785756Smsmith            break;
41867754Smsmith
41985756Smsmith        case ACPI_TYPE_BUFFER_FIELD:
42085756Smsmith
42185756Smsmith            /* TBD: print Buffer name when we can easily get it */
42285756Smsmith            break;
42385756Smsmith
42485756Smsmith        case INTERNAL_TYPE_REGION_FIELD:
42585756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
42685756Smsmith                        (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name));
42785756Smsmith            break;
42885756Smsmith
42985756Smsmith        case INTERNAL_TYPE_BANK_FIELD:
43085756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
43185756Smsmith                        (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name));
43285756Smsmith            break;
43385756Smsmith
43485756Smsmith        case INTERNAL_TYPE_INDEX_FIELD:
43585756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
43685756Smsmith                        (char *) &ObjDesc->IndexField.IndexObj->CommonField.RegionObj->Region.Node->Name));
43785756Smsmith            break;
43885756Smsmith
43985756Smsmith        default:
44085756Smsmith
44185756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Object %p\n", ObjDesc));
44285756Smsmith            break;
44385756Smsmith        }
44485756Smsmith
44585756Smsmith        /* Common field handling */
44685756Smsmith
44785756Smsmith        switch (Type)
44885756Smsmith        {
44985756Smsmith        case ACPI_TYPE_BUFFER_FIELD:
45085756Smsmith        case INTERNAL_TYPE_REGION_FIELD:
45185756Smsmith        case INTERNAL_TYPE_BANK_FIELD:
45285756Smsmith        case INTERNAL_TYPE_INDEX_FIELD:
45385756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Off %.2X Len %.2X Acc %.2d\n",
45485756Smsmith                        (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset,
45585756Smsmith                        ObjDesc->CommonField.BitLength,
45685756Smsmith                        ObjDesc->CommonField.AccessBitWidth));
45785756Smsmith            break;
45885756Smsmith        }
45985756Smsmith
46067754Smsmith        break;
46167754Smsmith
46267754Smsmith
46385756Smsmith    case ACPI_DISPLAY_OBJECTS:
46467754Smsmith
46585756Smsmith        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p O:%p",
46685756Smsmith                ThisNode, ObjDesc));
46785756Smsmith
46885756Smsmith        if (!ObjDesc)
46985756Smsmith        {
47085756Smsmith            /* No attached object, we are done */
47185756Smsmith
47285756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
47385756Smsmith            return (AE_OK);
47485756Smsmith        }
47585756Smsmith
47685756Smsmith        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(R%d)",
47785756Smsmith                ObjDesc->Common.ReferenceCount));
47885756Smsmith
47985756Smsmith        switch (Type)
48085756Smsmith        {
48185756Smsmith
48285756Smsmith        case ACPI_TYPE_METHOD:
48385756Smsmith
48485756Smsmith            /* Name is a Method and its AML offset/length are set */
48585756Smsmith
48685756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n",
48785756Smsmith                        ObjDesc->Method.AmlStart,
48885756Smsmith                        ObjDesc->Method.AmlLength));
48985756Smsmith
49085756Smsmith            break;
49185756Smsmith
49285756Smsmith
49385756Smsmith        case ACPI_TYPE_INTEGER:
49485756Smsmith
49585756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X%X\n",
49685756Smsmith                        HIDWORD(ObjDesc->Integer.Value),
49785756Smsmith                        LODWORD(ObjDesc->Integer.Value)));
49885756Smsmith            break;
49985756Smsmith
50085756Smsmith
50185756Smsmith        case ACPI_TYPE_STRING:
50285756Smsmith
50385756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n",
50485756Smsmith                        ObjDesc->String.Pointer,
50585756Smsmith                        ObjDesc->String.Length));
50685756Smsmith            break;
50785756Smsmith
50885756Smsmith
50985756Smsmith        case ACPI_TYPE_BUFFER:
51085756Smsmith
51185756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n",
51285756Smsmith                        ObjDesc->Buffer.Pointer,
51385756Smsmith                        ObjDesc->Buffer.Length));
51485756Smsmith            break;
51585756Smsmith
51685756Smsmith
51785756Smsmith        default:
51885756Smsmith
51985756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
52085756Smsmith            break;
52185756Smsmith        }
52267754Smsmith        break;
52367754Smsmith    }
52467754Smsmith
52567754Smsmith    /* If debug turned off, done */
52667754Smsmith
52782367Smsmith    if (!(AcpiDbgLevel & ACPI_LV_VALUES))
52867754Smsmith    {
52967754Smsmith        return (AE_OK);
53067754Smsmith    }
53167754Smsmith
53267754Smsmith
53367754Smsmith    /* If there is an attached object, display it */
53467754Smsmith
53585756Smsmith    ObjDesc = ThisNode->Object;
53667754Smsmith
53767754Smsmith    /* Dump attached objects */
53867754Smsmith
53985756Smsmith    while (ObjDesc)
54067754Smsmith    {
54167754Smsmith        ObjType = INTERNAL_TYPE_INVALID;
54267754Smsmith
54367754Smsmith        /* Decode the type of attached object and dump the contents */
54467754Smsmith
54585756Smsmith        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "        Attached Object %p: ", ObjDesc));
54667754Smsmith
54785756Smsmith        if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
54867754Smsmith        {
54982367Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to Node)\n"));
55067754Smsmith            BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
55167754Smsmith        }
55267754Smsmith
55367754Smsmith
55485756Smsmith        else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
55567754Smsmith        {
55667754Smsmith            ObjType = ObjDesc->Common.Type;
55767754Smsmith
55867754Smsmith            if (ObjType > INTERNAL_TYPE_MAX)
55967754Smsmith            {
56082367Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType));
56167754Smsmith                BytesToDump = 32;
56267754Smsmith            }
56367754Smsmith
56467754Smsmith            else
56567754Smsmith            {
56685756Smsmith                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %2.2X [%s])\n",
56777424Smsmith                                    ObjType, AcpiUtGetTypeName (ObjType)));
56867754Smsmith                BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
56967754Smsmith            }
57067754Smsmith        }
57167754Smsmith
57267754Smsmith        else
57367754Smsmith        {
57485756Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n"));
57567754Smsmith            BytesToDump = 16;
57667754Smsmith        }
57767754Smsmith
57885756Smsmith        DUMP_BUFFER (ObjDesc, BytesToDump);
57967754Smsmith
58067754Smsmith        /* If value is NOT an internal object, we are done */
58167754Smsmith
58285756Smsmith        if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
58367754Smsmith        {
58467754Smsmith            goto Cleanup;
58567754Smsmith        }
58667754Smsmith
58767754Smsmith        /*
58867754Smsmith         * Valid object, get the pointer to next level, if any
58967754Smsmith         */
59067754Smsmith        switch (ObjType)
59167754Smsmith        {
59267754Smsmith        case ACPI_TYPE_STRING:
59385756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->String.Pointer;
59467754Smsmith            break;
59567754Smsmith
59667754Smsmith        case ACPI_TYPE_BUFFER:
59785756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Buffer.Pointer;
59867754Smsmith            break;
59967754Smsmith
60077424Smsmith        case ACPI_TYPE_BUFFER_FIELD:
60185756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
60277424Smsmith            break;
60377424Smsmith
60467754Smsmith        case ACPI_TYPE_PACKAGE:
60585756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Package.Elements;
60667754Smsmith            break;
60767754Smsmith
60867754Smsmith        case ACPI_TYPE_METHOD:
60985756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Method.AmlStart;
61067754Smsmith            break;
61167754Smsmith
61277424Smsmith        case INTERNAL_TYPE_REGION_FIELD:
61385756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Field.RegionObj;
61467754Smsmith            break;
61567754Smsmith
61667754Smsmith        case INTERNAL_TYPE_BANK_FIELD:
61785756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BankField.RegionObj;
61867754Smsmith            break;
61967754Smsmith
62067754Smsmith        case INTERNAL_TYPE_INDEX_FIELD:
62185756Smsmith            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->IndexField.IndexObj;
62267754Smsmith            break;
62367754Smsmith
62467754Smsmith       default:
62567754Smsmith            goto Cleanup;
62667754Smsmith        }
62767754Smsmith
62867754Smsmith        ObjType = INTERNAL_TYPE_INVALID;     /* Terminate loop after next pass */
62967754Smsmith    }
63067754Smsmith
63167754SmsmithCleanup:
63282367Smsmith    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
63367754Smsmith    return (AE_OK);
63467754Smsmith}
63567754Smsmith
63667754Smsmith
63777424Smsmith/*******************************************************************************
63867754Smsmith *
63967754Smsmith * FUNCTION:    AcpiNsDumpObjects
64067754Smsmith *
64167754Smsmith * PARAMETERS:  Type                - Object type to be dumped
64267754Smsmith *              MaxDepth            - Maximum depth of dump.  Use ACPI_UINT32_MAX
64367754Smsmith *                                    for an effectively unlimited depth.
64467754Smsmith *              OwnerId             - Dump only objects owned by this ID.  Use
64567754Smsmith *                                    ACPI_UINT32_MAX to match all owners.
64667754Smsmith *              StartHandle         - Where in namespace to start/end search
64767754Smsmith *
64867754Smsmith * DESCRIPTION: Dump typed objects within the loaded namespace.
64967754Smsmith *              Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
65067754Smsmith *
65177424Smsmith ******************************************************************************/
65267754Smsmith
65367754Smsmithvoid
65467754SmsmithAcpiNsDumpObjects (
65577424Smsmith    ACPI_OBJECT_TYPE8       Type,
65685756Smsmith    UINT8                   DisplayType,
65767754Smsmith    UINT32                  MaxDepth,
65867754Smsmith    UINT32                  OwnerId,
65967754Smsmith    ACPI_HANDLE             StartHandle)
66067754Smsmith{
66167754Smsmith    ACPI_WALK_INFO          Info;
66267754Smsmith
66367754Smsmith
66483174Smsmith    FUNCTION_ENTRY ();
66583174Smsmith
66683174Smsmith
66782367Smsmith    Info.DebugLevel = ACPI_LV_TABLES;
66867754Smsmith    Info.OwnerId = OwnerId;
66985756Smsmith    Info.DisplayType = DisplayType;
67067754Smsmith
67185756Smsmith
67267754Smsmith    AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
67367754Smsmith                        (void *) &Info, NULL);
67467754Smsmith}
67567754Smsmith
67667754Smsmith
67769450Smsmith#ifndef _ACPI_ASL_COMPILER
67877424Smsmith/*******************************************************************************
67967754Smsmith *
68067754Smsmith * FUNCTION:    AcpiNsDumpOneDevice
68167754Smsmith *
68267754Smsmith * PARAMETERS:  Handle              - Node to be dumped
68367754Smsmith *              Level               - Nesting level of the handle
68467754Smsmith *              Context             - Passed into WalkNamespace
68567754Smsmith *
68667754Smsmith * DESCRIPTION: Dump a single Node that represents a device
68767754Smsmith *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
68867754Smsmith *
68977424Smsmith ******************************************************************************/
69067754Smsmith
69167754SmsmithACPI_STATUS
69267754SmsmithAcpiNsDumpOneDevice (
69367754Smsmith    ACPI_HANDLE             ObjHandle,
69467754Smsmith    UINT32                  Level,
69567754Smsmith    void                    *Context,
69667754Smsmith    void                    **ReturnValue)
69767754Smsmith{
69867754Smsmith    ACPI_DEVICE_INFO        Info;
69967754Smsmith    ACPI_STATUS             Status;
70067754Smsmith    UINT32                  i;
70167754Smsmith
70267754Smsmith
70383174Smsmith    PROC_NAME ("NsDumpOneDevice");
70482367Smsmith
70583174Smsmith
70667754Smsmith    Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
70767754Smsmith
70867754Smsmith    Status = AcpiGetObjectInfo (ObjHandle, &Info);
70967754Smsmith    if (ACPI_SUCCESS (Status))
71067754Smsmith    {
71167754Smsmith        for (i = 0; i < Level; i++)
71267754Smsmith        {
71382367Smsmith            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
71467754Smsmith        }
71567754Smsmith
71685756Smsmith        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "    HID: %s, ADR: %8.8X%8.8X, Status: %x\n",
71785756Smsmith                        Info.HardwareId, HIDWORD(Info.Address), LODWORD(Info.Address), Info.CurrentStatus));
71867754Smsmith    }
71967754Smsmith
72067754Smsmith    return (Status);
72167754Smsmith}
72267754Smsmith
72367754Smsmith
72477424Smsmith/*******************************************************************************
72567754Smsmith *
72667754Smsmith * FUNCTION:    AcpiNsDumpRootDevices
72767754Smsmith *
72867754Smsmith * PARAMETERS:  None
72967754Smsmith *
73067754Smsmith * DESCRIPTION: Dump all objects of type "device"
73167754Smsmith *
73277424Smsmith ******************************************************************************/
73367754Smsmith
73467754Smsmithvoid
73567754SmsmithAcpiNsDumpRootDevices (void)
73667754Smsmith{
73767754Smsmith    ACPI_HANDLE             SysBusHandle;
73867754Smsmith
73967754Smsmith
74083174Smsmith    PROC_NAME ("NsDumpRootDevices");
74182367Smsmith
74283174Smsmith
74367754Smsmith    /* Only dump the table if tracing is enabled */
74467754Smsmith
74583174Smsmith    if (!(ACPI_LV_TABLES & AcpiDbgLevel))
74667754Smsmith    {
74767754Smsmith        return;
74867754Smsmith    }
74967754Smsmith
75067754Smsmith    AcpiGetHandle (0, NS_SYSTEM_BUS, &SysBusHandle);
75167754Smsmith
75282367Smsmith    ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
75367754Smsmith    AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK,
75467754Smsmith                        AcpiNsDumpOneDevice, NULL, NULL);
75567754Smsmith}
75667754Smsmith
75769450Smsmith#endif
75867754Smsmith
75977424Smsmith/*******************************************************************************
76067754Smsmith *
76167754Smsmith * FUNCTION:    AcpiNsDumpTables
76267754Smsmith *
76367754Smsmith * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
76467754Smsmith *                                    NS_ALL to dump the entire namespace
76567754Smsmith *              MaxDepth            - Maximum depth of dump.  Use INT_MAX
76667754Smsmith *                                    for an effectively unlimited depth.
76767754Smsmith *
76867754Smsmith * DESCRIPTION: Dump the name space, or a portion of it.
76967754Smsmith *
77077424Smsmith ******************************************************************************/
77167754Smsmith
77267754Smsmithvoid
77367754SmsmithAcpiNsDumpTables (
77467754Smsmith    ACPI_HANDLE             SearchBase,
77567754Smsmith    UINT32                  MaxDepth)
77667754Smsmith{
77767754Smsmith    ACPI_HANDLE             SearchHandle = SearchBase;
77867754Smsmith
77967754Smsmith
78067754Smsmith    FUNCTION_TRACE ("NsDumpTables");
78167754Smsmith
78267754Smsmith
78367754Smsmith    if (!AcpiGbl_RootNode)
78467754Smsmith    {
78567754Smsmith        /*
78667754Smsmith         * If the name space has not been initialized,
78767754Smsmith         * there is nothing to dump.
78867754Smsmith         */
78982367Smsmith        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "name space not initialized!\n"));
79067754Smsmith        return_VOID;
79167754Smsmith    }
79267754Smsmith
79367754Smsmith    if (NS_ALL == SearchBase)
79467754Smsmith    {
79567754Smsmith        /*  entire namespace    */
79667754Smsmith
79767754Smsmith        SearchHandle = AcpiGbl_RootNode;
79882367Smsmith        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
79967754Smsmith    }
80067754Smsmith
80167754Smsmith
80285756Smsmith    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
80385756Smsmith            ACPI_UINT32_MAX, SearchHandle);
80467754Smsmith    return_VOID;
80567754Smsmith}
80667754Smsmith
80767754Smsmith
80877424Smsmith/*******************************************************************************
80967754Smsmith *
81067754Smsmith * FUNCTION:    AcpiNsDumpEntry
81167754Smsmith *
81267754Smsmith * PARAMETERS:  Handle              - Node to be dumped
81367754Smsmith *              DebugLevel          - Output level
81467754Smsmith *
81567754Smsmith * DESCRIPTION: Dump a single Node
81667754Smsmith *
81777424Smsmith ******************************************************************************/
81867754Smsmith
81967754Smsmithvoid
82067754SmsmithAcpiNsDumpEntry (
82167754Smsmith    ACPI_HANDLE             Handle,
82267754Smsmith    UINT32                  DebugLevel)
82367754Smsmith{
82467754Smsmith    ACPI_WALK_INFO          Info;
82567754Smsmith
82667754Smsmith
82783174Smsmith    FUNCTION_ENTRY ();
82867754Smsmith
82983174Smsmith
83067754Smsmith    Info.DebugLevel = DebugLevel;
83167754Smsmith    Info.OwnerId = ACPI_UINT32_MAX;
83267754Smsmith
83367754Smsmith    AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
83467754Smsmith}
83567754Smsmith
83667754Smsmith#endif
83767754Smsmith
838