xref: /netbsd-src/sys/external/bsd/acpica/dist/namespace/nsdump.c (revision 2c7d7e3ca2e4f0b675c6c58e614f6aede66c678e)
128c506b8Sjruoho /******************************************************************************
228c506b8Sjruoho  *
328c506b8Sjruoho  * Module Name: nsdump - table dumping routines for debug
428c506b8Sjruoho  *
528c506b8Sjruoho  *****************************************************************************/
628c506b8Sjruoho 
7159c4e26Sjruoho /*
8*2c7d7e3cSchristos  * Copyright (C) 2000 - 2023, Intel Corp.
928c506b8Sjruoho  * All rights reserved.
1028c506b8Sjruoho  *
11159c4e26Sjruoho  * Redistribution and use in source and binary forms, with or without
12159c4e26Sjruoho  * modification, are permitted provided that the following conditions
13159c4e26Sjruoho  * are met:
14159c4e26Sjruoho  * 1. Redistributions of source code must retain the above copyright
15159c4e26Sjruoho  *    notice, this list of conditions, and the following disclaimer,
16159c4e26Sjruoho  *    without modification.
17159c4e26Sjruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18159c4e26Sjruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
19159c4e26Sjruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
20159c4e26Sjruoho  *    including a substantially similar Disclaimer requirement for further
21159c4e26Sjruoho  *    binary redistribution.
22159c4e26Sjruoho  * 3. Neither the names of the above-listed copyright holders nor the names
23159c4e26Sjruoho  *    of any contributors may be used to endorse or promote products derived
24159c4e26Sjruoho  *    from this software without specific prior written permission.
2528c506b8Sjruoho  *
26159c4e26Sjruoho  * Alternatively, this software may be distributed under the terms of the
27159c4e26Sjruoho  * GNU General Public License ("GPL") version 2 as published by the Free
28159c4e26Sjruoho  * Software Foundation.
2928c506b8Sjruoho  *
30159c4e26Sjruoho  * NO WARRANTY
31159c4e26Sjruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32159c4e26Sjruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3398244dcfSchristos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34159c4e26Sjruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35159c4e26Sjruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36159c4e26Sjruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37159c4e26Sjruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38159c4e26Sjruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39159c4e26Sjruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40159c4e26Sjruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41159c4e26Sjruoho  * POSSIBILITY OF SUCH DAMAGES.
42159c4e26Sjruoho  */
4328c506b8Sjruoho 
4428c506b8Sjruoho #include "acpi.h"
4528c506b8Sjruoho #include "accommon.h"
4628c506b8Sjruoho #include "acnamesp.h"
47a2c051a9Schristos #include "acoutput.h"
4828c506b8Sjruoho 
4928c506b8Sjruoho 
5028c506b8Sjruoho #define _COMPONENT          ACPI_NAMESPACE
5128c506b8Sjruoho         ACPI_MODULE_NAME    ("nsdump")
5228c506b8Sjruoho 
5328c506b8Sjruoho /* Local prototypes */
5428c506b8Sjruoho 
5528c506b8Sjruoho #ifdef ACPI_OBSOLETE_FUNCTIONS
5628c506b8Sjruoho void
5728c506b8Sjruoho AcpiNsDumpRootDevices (
5828c506b8Sjruoho     void);
5928c506b8Sjruoho 
6028c506b8Sjruoho static ACPI_STATUS
6128c506b8Sjruoho AcpiNsDumpOneDevice (
6228c506b8Sjruoho     ACPI_HANDLE             ObjHandle,
6328c506b8Sjruoho     UINT32                  Level,
6428c506b8Sjruoho     void                    *Context,
6528c506b8Sjruoho     void                    **ReturnValue);
6628c506b8Sjruoho #endif
6728c506b8Sjruoho 
6828c506b8Sjruoho 
6928c506b8Sjruoho #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
70a2c051a9Schristos 
71a2c051a9Schristos static ACPI_STATUS
72a2c051a9Schristos AcpiNsDumpOneObjectPath (
73a2c051a9Schristos     ACPI_HANDLE             ObjHandle,
74a2c051a9Schristos     UINT32                  Level,
75a2c051a9Schristos     void                    *Context,
76a2c051a9Schristos     void                    **ReturnValue);
77a2c051a9Schristos 
78a2c051a9Schristos static ACPI_STATUS
79a2c051a9Schristos AcpiNsGetMaxDepth (
80a2c051a9Schristos     ACPI_HANDLE             ObjHandle,
81a2c051a9Schristos     UINT32                  Level,
82a2c051a9Schristos     void                    *Context,
83a2c051a9Schristos     void                    **ReturnValue);
84a2c051a9Schristos 
85a2c051a9Schristos 
8628c506b8Sjruoho /*******************************************************************************
8728c506b8Sjruoho  *
8828c506b8Sjruoho  * FUNCTION:    AcpiNsPrintPathname
8928c506b8Sjruoho  *
9028c506b8Sjruoho  * PARAMETERS:  NumSegments         - Number of ACPI name segments
9128c506b8Sjruoho  *              Pathname            - The compressed (internal) path
9228c506b8Sjruoho  *
9328c506b8Sjruoho  * RETURN:      None
9428c506b8Sjruoho  *
9528c506b8Sjruoho  * DESCRIPTION: Print an object's full namespace pathname
9628c506b8Sjruoho  *
9728c506b8Sjruoho  ******************************************************************************/
9828c506b8Sjruoho 
9928c506b8Sjruoho void
AcpiNsPrintPathname(UINT32 NumSegments,const char * Pathname)10028c506b8Sjruoho AcpiNsPrintPathname (
10128c506b8Sjruoho     UINT32                  NumSegments,
10249c2f1f4Schristos     const char              *Pathname)
10328c506b8Sjruoho {
10428c506b8Sjruoho     UINT32                  i;
10528c506b8Sjruoho 
10628c506b8Sjruoho 
10728c506b8Sjruoho     ACPI_FUNCTION_NAME (NsPrintPathname);
10828c506b8Sjruoho 
10928c506b8Sjruoho 
110a2c051a9Schristos     /* Check if debug output enabled */
111a2c051a9Schristos 
112a2c051a9Schristos     if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
11328c506b8Sjruoho     {
11428c506b8Sjruoho         return;
11528c506b8Sjruoho     }
11628c506b8Sjruoho 
11728c506b8Sjruoho     /* Print the entire name */
11828c506b8Sjruoho 
11928c506b8Sjruoho     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
12028c506b8Sjruoho 
12128c506b8Sjruoho     while (NumSegments)
12228c506b8Sjruoho     {
12328c506b8Sjruoho         for (i = 0; i < 4; i++)
12428c506b8Sjruoho         {
1259b9ee194Schristos             isprint ((int) Pathname[i]) ?
12628c506b8Sjruoho                 AcpiOsPrintf ("%c", Pathname[i]) :
12728c506b8Sjruoho                 AcpiOsPrintf ("?");
12828c506b8Sjruoho         }
12928c506b8Sjruoho 
1305b948c02Schristos         Pathname += ACPI_NAMESEG_SIZE;
13128c506b8Sjruoho         NumSegments--;
13228c506b8Sjruoho         if (NumSegments)
13328c506b8Sjruoho         {
13428c506b8Sjruoho             AcpiOsPrintf (".");
13528c506b8Sjruoho         }
13628c506b8Sjruoho     }
13728c506b8Sjruoho 
13828c506b8Sjruoho     AcpiOsPrintf ("]\n");
13928c506b8Sjruoho }
14028c506b8Sjruoho 
14128c506b8Sjruoho 
14249c2f1f4Schristos #ifdef ACPI_OBSOLETE_FUNCTIONS
14349c2f1f4Schristos /* Not used at this time, perhaps later */
14449c2f1f4Schristos 
14528c506b8Sjruoho /*******************************************************************************
14628c506b8Sjruoho  *
14728c506b8Sjruoho  * FUNCTION:    AcpiNsDumpPathname
14828c506b8Sjruoho  *
14928c506b8Sjruoho  * PARAMETERS:  Handle              - Object
15028c506b8Sjruoho  *              Msg                 - Prefix message
15128c506b8Sjruoho  *              Level               - Desired debug level
15228c506b8Sjruoho  *              Component           - Caller's component ID
15328c506b8Sjruoho  *
15428c506b8Sjruoho  * RETURN:      None
15528c506b8Sjruoho  *
15628c506b8Sjruoho  * DESCRIPTION: Print an object's full namespace pathname
15728c506b8Sjruoho  *              Manages allocation/freeing of a pathname buffer
15828c506b8Sjruoho  *
15928c506b8Sjruoho  ******************************************************************************/
16028c506b8Sjruoho 
16128c506b8Sjruoho void
AcpiNsDumpPathname(ACPI_HANDLE Handle,const char * Msg,UINT32 Level,UINT32 Component)16228c506b8Sjruoho AcpiNsDumpPathname (
16328c506b8Sjruoho     ACPI_HANDLE             Handle,
164716c1ee0Sjruoho     const char              *Msg,
16528c506b8Sjruoho     UINT32                  Level,
16628c506b8Sjruoho     UINT32                  Component)
16728c506b8Sjruoho {
16828c506b8Sjruoho 
16928c506b8Sjruoho     ACPI_FUNCTION_TRACE (NsDumpPathname);
17028c506b8Sjruoho 
17128c506b8Sjruoho 
17228c506b8Sjruoho     /* Do this only if the requested debug level and component are enabled */
17328c506b8Sjruoho 
174a2c051a9Schristos     if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
17528c506b8Sjruoho     {
17628c506b8Sjruoho         return_VOID;
17728c506b8Sjruoho     }
17828c506b8Sjruoho 
17928c506b8Sjruoho     /* Convert handle to a full pathname and print it (with supplied message) */
18028c506b8Sjruoho 
18128c506b8Sjruoho     AcpiNsPrintNodePathname (Handle, Msg);
18228c506b8Sjruoho     AcpiOsPrintf ("\n");
18328c506b8Sjruoho     return_VOID;
18428c506b8Sjruoho }
18549c2f1f4Schristos #endif
18628c506b8Sjruoho 
187a147b75fSchristos 
18828c506b8Sjruoho /*******************************************************************************
18928c506b8Sjruoho  *
19028c506b8Sjruoho  * FUNCTION:    AcpiNsDumpOneObject
19128c506b8Sjruoho  *
19228c506b8Sjruoho  * PARAMETERS:  ObjHandle           - Node to be dumped
19328c506b8Sjruoho  *              Level               - Nesting level of the handle
19428c506b8Sjruoho  *              Context             - Passed into WalkNamespace
19528c506b8Sjruoho  *              ReturnValue         - Not used
19628c506b8Sjruoho  *
19728c506b8Sjruoho  * RETURN:      Status
19828c506b8Sjruoho  *
19928c506b8Sjruoho  * DESCRIPTION: Dump a single Node
20028c506b8Sjruoho  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
20128c506b8Sjruoho  *
20228c506b8Sjruoho  ******************************************************************************/
20328c506b8Sjruoho 
20428c506b8Sjruoho ACPI_STATUS
AcpiNsDumpOneObject(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)20528c506b8Sjruoho AcpiNsDumpOneObject (
20628c506b8Sjruoho     ACPI_HANDLE             ObjHandle,
20728c506b8Sjruoho     UINT32                  Level,
20828c506b8Sjruoho     void                    *Context,
20928c506b8Sjruoho     void                    **ReturnValue)
21028c506b8Sjruoho {
21128c506b8Sjruoho     ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
21228c506b8Sjruoho     ACPI_NAMESPACE_NODE     *ThisNode;
21328c506b8Sjruoho     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
21428c506b8Sjruoho     ACPI_OBJECT_TYPE        ObjType;
21528c506b8Sjruoho     ACPI_OBJECT_TYPE        Type;
21628c506b8Sjruoho     UINT32                  BytesToDump;
21728c506b8Sjruoho     UINT32                  DbgLevel;
21828c506b8Sjruoho     UINT32                  i;
21928c506b8Sjruoho 
22028c506b8Sjruoho 
22128c506b8Sjruoho     ACPI_FUNCTION_NAME (NsDumpOneObject);
22228c506b8Sjruoho 
22328c506b8Sjruoho 
22428c506b8Sjruoho     /* Is output enabled? */
22528c506b8Sjruoho 
22628c506b8Sjruoho     if (!(AcpiDbgLevel & Info->DebugLevel))
22728c506b8Sjruoho     {
22828c506b8Sjruoho         return (AE_OK);
22928c506b8Sjruoho     }
23028c506b8Sjruoho 
23128c506b8Sjruoho     if (!ObjHandle)
23228c506b8Sjruoho     {
23328c506b8Sjruoho         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
23428c506b8Sjruoho         return (AE_OK);
23528c506b8Sjruoho     }
23628c506b8Sjruoho 
23728c506b8Sjruoho     ThisNode = AcpiNsValidateHandle (ObjHandle);
23828c506b8Sjruoho     if (!ThisNode)
23928c506b8Sjruoho     {
24028c506b8Sjruoho         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
24128c506b8Sjruoho             ObjHandle));
24228c506b8Sjruoho         return (AE_OK);
24328c506b8Sjruoho     }
24428c506b8Sjruoho 
24528c506b8Sjruoho     Type = ThisNode->Type;
246a147b75fSchristos     Info->Count++;
24728c506b8Sjruoho 
24828c506b8Sjruoho     /* Check if the owner matches */
24928c506b8Sjruoho 
25028c506b8Sjruoho     if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
25128c506b8Sjruoho         (Info->OwnerId != ThisNode->OwnerId))
25228c506b8Sjruoho     {
25328c506b8Sjruoho         return (AE_OK);
25428c506b8Sjruoho     }
25528c506b8Sjruoho 
25628c506b8Sjruoho     if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
25728c506b8Sjruoho     {
25828c506b8Sjruoho         /* Indent the object according to the level */
25928c506b8Sjruoho 
26028c506b8Sjruoho         AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
26128c506b8Sjruoho 
26228c506b8Sjruoho         /* Check the node type and name */
26328c506b8Sjruoho 
26428c506b8Sjruoho         if (Type > ACPI_TYPE_LOCAL_MAX)
26528c506b8Sjruoho         {
26681bd9c9cSchristos             ACPI_WARNING ((AE_INFO,
26781bd9c9cSchristos                 "Invalid ACPI Object Type 0x%08X", Type));
26828c506b8Sjruoho         }
26928c506b8Sjruoho 
27028c506b8Sjruoho         AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
27128c506b8Sjruoho     }
27228c506b8Sjruoho 
27328c506b8Sjruoho     /* Now we can print out the pertinent information */
27428c506b8Sjruoho 
2757ab6b89bSchristos     AcpiOsPrintf (" %-12s %p %3.3X ",
27628c506b8Sjruoho         AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
27728c506b8Sjruoho 
27828c506b8Sjruoho     DbgLevel = AcpiDbgLevel;
27928c506b8Sjruoho     AcpiDbgLevel = 0;
28028c506b8Sjruoho     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
28128c506b8Sjruoho     AcpiDbgLevel = DbgLevel;
28228c506b8Sjruoho 
28328c506b8Sjruoho     /* Temp nodes are those nodes created by a control method */
28428c506b8Sjruoho 
28528c506b8Sjruoho     if (ThisNode->Flags & ANOBJ_TEMPORARY)
28628c506b8Sjruoho     {
28728c506b8Sjruoho         AcpiOsPrintf ("(T) ");
28828c506b8Sjruoho     }
28928c506b8Sjruoho 
29028c506b8Sjruoho     switch (Info->DisplayType & ACPI_DISPLAY_MASK)
29128c506b8Sjruoho     {
29228c506b8Sjruoho     case ACPI_DISPLAY_SUMMARY:
29328c506b8Sjruoho 
29428c506b8Sjruoho         if (!ObjDesc)
29528c506b8Sjruoho         {
296a2c051a9Schristos             /* No attached object. Some types should always have an object */
297a2c051a9Schristos 
298a2c051a9Schristos             switch (Type)
299a2c051a9Schristos             {
300a2c051a9Schristos             case ACPI_TYPE_INTEGER:
301a2c051a9Schristos             case ACPI_TYPE_PACKAGE:
302a2c051a9Schristos             case ACPI_TYPE_BUFFER:
303a2c051a9Schristos             case ACPI_TYPE_STRING:
304a2c051a9Schristos             case ACPI_TYPE_METHOD:
305a2c051a9Schristos 
306a2c051a9Schristos                 AcpiOsPrintf ("<No attached object>");
307a2c051a9Schristos                 break;
308a2c051a9Schristos 
309a2c051a9Schristos             default:
310a2c051a9Schristos 
311a2c051a9Schristos                 break;
312a2c051a9Schristos             }
31328c506b8Sjruoho 
31428c506b8Sjruoho             AcpiOsPrintf ("\n");
31528c506b8Sjruoho             return (AE_OK);
31628c506b8Sjruoho         }
31728c506b8Sjruoho 
31828c506b8Sjruoho         switch (Type)
31928c506b8Sjruoho         {
32028c506b8Sjruoho         case ACPI_TYPE_PROCESSOR:
32128c506b8Sjruoho 
322cb2bd8f0Schristos             AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
32328c506b8Sjruoho                 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
324cb2bd8f0Schristos                 ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address));
32528c506b8Sjruoho             break;
32628c506b8Sjruoho 
32728c506b8Sjruoho         case ACPI_TYPE_DEVICE:
32828c506b8Sjruoho 
32928c506b8Sjruoho             AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
33028c506b8Sjruoho             break;
33128c506b8Sjruoho 
33228c506b8Sjruoho         case ACPI_TYPE_METHOD:
33328c506b8Sjruoho 
33428c506b8Sjruoho             AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
33528c506b8Sjruoho                 (UINT32) ObjDesc->Method.ParamCount,
33628c506b8Sjruoho                 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
33728c506b8Sjruoho             break;
33828c506b8Sjruoho 
33928c506b8Sjruoho         case ACPI_TYPE_INTEGER:
34028c506b8Sjruoho 
34128c506b8Sjruoho             AcpiOsPrintf ("= %8.8X%8.8X\n",
34228c506b8Sjruoho                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
34328c506b8Sjruoho             break;
34428c506b8Sjruoho 
34528c506b8Sjruoho         case ACPI_TYPE_PACKAGE:
34628c506b8Sjruoho 
34728c506b8Sjruoho             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
34828c506b8Sjruoho             {
34928c506b8Sjruoho                 AcpiOsPrintf ("Elements %.2X\n",
35028c506b8Sjruoho                     ObjDesc->Package.Count);
35128c506b8Sjruoho             }
35228c506b8Sjruoho             else
35328c506b8Sjruoho             {
35428c506b8Sjruoho                 AcpiOsPrintf ("[Length not yet evaluated]\n");
35528c506b8Sjruoho             }
35628c506b8Sjruoho             break;
35728c506b8Sjruoho 
35828c506b8Sjruoho         case ACPI_TYPE_BUFFER:
35928c506b8Sjruoho 
36028c506b8Sjruoho             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
36128c506b8Sjruoho             {
36228c506b8Sjruoho                 AcpiOsPrintf ("Len %.2X",
36328c506b8Sjruoho                     ObjDesc->Buffer.Length);
36428c506b8Sjruoho 
36528c506b8Sjruoho                 /* Dump some of the buffer */
36628c506b8Sjruoho 
36728c506b8Sjruoho                 if (ObjDesc->Buffer.Length > 0)
36828c506b8Sjruoho                 {
36928c506b8Sjruoho                     AcpiOsPrintf (" =");
37028c506b8Sjruoho                     for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
37128c506b8Sjruoho                     {
3721c663068Schristos                         AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
37328c506b8Sjruoho                     }
37428c506b8Sjruoho                 }
37528c506b8Sjruoho                 AcpiOsPrintf ("\n");
37628c506b8Sjruoho             }
37728c506b8Sjruoho             else
37828c506b8Sjruoho             {
37928c506b8Sjruoho                 AcpiOsPrintf ("[Length not yet evaluated]\n");
38028c506b8Sjruoho             }
38128c506b8Sjruoho             break;
38228c506b8Sjruoho 
38328c506b8Sjruoho         case ACPI_TYPE_STRING:
38428c506b8Sjruoho 
38528c506b8Sjruoho             AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
38672abab0cSchristos             AcpiUtPrintString (ObjDesc->String.Pointer, 80);
38728c506b8Sjruoho             AcpiOsPrintf ("\n");
38828c506b8Sjruoho             break;
38928c506b8Sjruoho 
39028c506b8Sjruoho         case ACPI_TYPE_REGION:
39128c506b8Sjruoho 
39228c506b8Sjruoho             AcpiOsPrintf ("[%s]",
39328c506b8Sjruoho                 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
39428c506b8Sjruoho             if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
39528c506b8Sjruoho             {
39628c506b8Sjruoho                 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
397cb2bd8f0Schristos                     ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
39828c506b8Sjruoho                     ObjDesc->Region.Length);
39928c506b8Sjruoho             }
40028c506b8Sjruoho             else
40128c506b8Sjruoho             {
40228c506b8Sjruoho                 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
40328c506b8Sjruoho             }
40428c506b8Sjruoho             break;
40528c506b8Sjruoho 
40628c506b8Sjruoho         case ACPI_TYPE_LOCAL_REFERENCE:
40728c506b8Sjruoho 
40828c506b8Sjruoho             AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
40928c506b8Sjruoho             break;
41028c506b8Sjruoho 
41128c506b8Sjruoho         case ACPI_TYPE_BUFFER_FIELD:
41228c506b8Sjruoho 
41328c506b8Sjruoho             if (ObjDesc->BufferField.BufferObj &&
41428c506b8Sjruoho                 ObjDesc->BufferField.BufferObj->Buffer.Node)
41528c506b8Sjruoho             {
41628c506b8Sjruoho                 AcpiOsPrintf ("Buf [%4.4s]",
41728c506b8Sjruoho                     AcpiUtGetNodeName (
41828c506b8Sjruoho                         ObjDesc->BufferField.BufferObj->Buffer.Node));
41928c506b8Sjruoho             }
42028c506b8Sjruoho             break;
42128c506b8Sjruoho 
42228c506b8Sjruoho         case ACPI_TYPE_LOCAL_REGION_FIELD:
42328c506b8Sjruoho 
42428c506b8Sjruoho             AcpiOsPrintf ("Rgn [%4.4s]",
42528c506b8Sjruoho                 AcpiUtGetNodeName (
42628c506b8Sjruoho                     ObjDesc->CommonField.RegionObj->Region.Node));
42728c506b8Sjruoho             break;
42828c506b8Sjruoho 
42928c506b8Sjruoho         case ACPI_TYPE_LOCAL_BANK_FIELD:
43028c506b8Sjruoho 
43128c506b8Sjruoho             AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
43228c506b8Sjruoho                 AcpiUtGetNodeName (
43328c506b8Sjruoho                     ObjDesc->CommonField.RegionObj->Region.Node),
43428c506b8Sjruoho                 AcpiUtGetNodeName (
43528c506b8Sjruoho                     ObjDesc->BankField.BankObj->CommonField.Node));
43628c506b8Sjruoho             break;
43728c506b8Sjruoho 
43828c506b8Sjruoho         case ACPI_TYPE_LOCAL_INDEX_FIELD:
43928c506b8Sjruoho 
44028c506b8Sjruoho             AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
44128c506b8Sjruoho                 AcpiUtGetNodeName (
44228c506b8Sjruoho                     ObjDesc->IndexField.IndexObj->CommonField.Node),
44328c506b8Sjruoho                 AcpiUtGetNodeName (
44428c506b8Sjruoho                     ObjDesc->IndexField.DataObj->CommonField.Node));
44528c506b8Sjruoho             break;
44628c506b8Sjruoho 
44728c506b8Sjruoho         case ACPI_TYPE_LOCAL_ALIAS:
44828c506b8Sjruoho         case ACPI_TYPE_LOCAL_METHOD_ALIAS:
44928c506b8Sjruoho 
45028c506b8Sjruoho             AcpiOsPrintf ("Target %4.4s (%p)\n",
45128c506b8Sjruoho                 AcpiUtGetNodeName (ObjDesc), ObjDesc);
45228c506b8Sjruoho             break;
45328c506b8Sjruoho 
45428c506b8Sjruoho         default:
45528c506b8Sjruoho 
45628c506b8Sjruoho             AcpiOsPrintf ("Object %p\n", ObjDesc);
45728c506b8Sjruoho             break;
45828c506b8Sjruoho         }
45928c506b8Sjruoho 
46028c506b8Sjruoho         /* Common field handling */
46128c506b8Sjruoho 
46228c506b8Sjruoho         switch (Type)
46328c506b8Sjruoho         {
46428c506b8Sjruoho         case ACPI_TYPE_BUFFER_FIELD:
46528c506b8Sjruoho         case ACPI_TYPE_LOCAL_REGION_FIELD:
46628c506b8Sjruoho         case ACPI_TYPE_LOCAL_BANK_FIELD:
46728c506b8Sjruoho         case ACPI_TYPE_LOCAL_INDEX_FIELD:
46828c506b8Sjruoho 
4691c663068Schristos             AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2X\n",
47028c506b8Sjruoho                 (ObjDesc->CommonField.BaseByteOffset * 8)
47128c506b8Sjruoho                     + ObjDesc->CommonField.StartFieldBitOffset,
47228c506b8Sjruoho                 ObjDesc->CommonField.BitLength,
47328c506b8Sjruoho                 ObjDesc->CommonField.AccessByteWidth);
47428c506b8Sjruoho             break;
47528c506b8Sjruoho 
47628c506b8Sjruoho         default:
477a2c051a9Schristos 
47828c506b8Sjruoho             break;
47928c506b8Sjruoho         }
48028c506b8Sjruoho         break;
48128c506b8Sjruoho 
48228c506b8Sjruoho     case ACPI_DISPLAY_OBJECTS:
48328c506b8Sjruoho 
48428c506b8Sjruoho         AcpiOsPrintf ("O:%p", ObjDesc);
48528c506b8Sjruoho         if (!ObjDesc)
48628c506b8Sjruoho         {
48728c506b8Sjruoho             /* No attached object, we are done */
48828c506b8Sjruoho 
48928c506b8Sjruoho             AcpiOsPrintf ("\n");
49028c506b8Sjruoho             return (AE_OK);
49128c506b8Sjruoho         }
49228c506b8Sjruoho 
49328c506b8Sjruoho         AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
49428c506b8Sjruoho 
49528c506b8Sjruoho         switch (Type)
49628c506b8Sjruoho         {
49728c506b8Sjruoho         case ACPI_TYPE_METHOD:
49828c506b8Sjruoho 
49928c506b8Sjruoho             /* Name is a Method and its AML offset/length are set */
50028c506b8Sjruoho 
50128c506b8Sjruoho             AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
50228c506b8Sjruoho                 ObjDesc->Method.AmlLength);
50328c506b8Sjruoho             break;
50428c506b8Sjruoho 
50528c506b8Sjruoho         case ACPI_TYPE_INTEGER:
50628c506b8Sjruoho 
50728c506b8Sjruoho             AcpiOsPrintf (" I:%8.8X8.8%X\n",
50828c506b8Sjruoho                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
50928c506b8Sjruoho             break;
51028c506b8Sjruoho 
51128c506b8Sjruoho         case ACPI_TYPE_STRING:
51228c506b8Sjruoho 
51328c506b8Sjruoho             AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
51428c506b8Sjruoho                 ObjDesc->String.Length);
51528c506b8Sjruoho             break;
51628c506b8Sjruoho 
51728c506b8Sjruoho         case ACPI_TYPE_BUFFER:
51828c506b8Sjruoho 
51928c506b8Sjruoho             AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
52028c506b8Sjruoho                 ObjDesc->Buffer.Length);
52128c506b8Sjruoho             break;
52228c506b8Sjruoho 
52328c506b8Sjruoho         default:
52428c506b8Sjruoho 
52528c506b8Sjruoho             AcpiOsPrintf ("\n");
52628c506b8Sjruoho             break;
52728c506b8Sjruoho         }
52828c506b8Sjruoho         break;
52928c506b8Sjruoho 
53028c506b8Sjruoho     default:
53128c506b8Sjruoho         AcpiOsPrintf ("\n");
53228c506b8Sjruoho         break;
53328c506b8Sjruoho     }
53428c506b8Sjruoho 
53528c506b8Sjruoho     /* If debug turned off, done */
53628c506b8Sjruoho 
53728c506b8Sjruoho     if (!(AcpiDbgLevel & ACPI_LV_VALUES))
53828c506b8Sjruoho     {
53928c506b8Sjruoho         return (AE_OK);
54028c506b8Sjruoho     }
54128c506b8Sjruoho 
54228c506b8Sjruoho     /* If there is an attached object, display it */
54328c506b8Sjruoho 
54428c506b8Sjruoho     DbgLevel = AcpiDbgLevel;
54528c506b8Sjruoho     AcpiDbgLevel = 0;
54628c506b8Sjruoho     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
54728c506b8Sjruoho     AcpiDbgLevel = DbgLevel;
54828c506b8Sjruoho 
54928c506b8Sjruoho     /* Dump attached objects */
55028c506b8Sjruoho 
55128c506b8Sjruoho     while (ObjDesc)
55228c506b8Sjruoho     {
55328c506b8Sjruoho         ObjType = ACPI_TYPE_INVALID;
55428c506b8Sjruoho         AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
55528c506b8Sjruoho 
55628c506b8Sjruoho         /* Decode the type of attached object and dump the contents */
55728c506b8Sjruoho 
55828c506b8Sjruoho         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
55928c506b8Sjruoho         {
56028c506b8Sjruoho         case ACPI_DESC_TYPE_NAMED:
56128c506b8Sjruoho 
56228c506b8Sjruoho             AcpiOsPrintf ("(Ptr to Node)\n");
56328c506b8Sjruoho             BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
56428c506b8Sjruoho             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
56528c506b8Sjruoho             break;
56628c506b8Sjruoho 
56728c506b8Sjruoho         case ACPI_DESC_TYPE_OPERAND:
56828c506b8Sjruoho 
56928c506b8Sjruoho             ObjType = ObjDesc->Common.Type;
57028c506b8Sjruoho 
57128c506b8Sjruoho             if (ObjType > ACPI_TYPE_LOCAL_MAX)
57228c506b8Sjruoho             {
57381bd9c9cSchristos                 AcpiOsPrintf (
57481bd9c9cSchristos                     "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
57528c506b8Sjruoho                     ObjType);
57681bd9c9cSchristos 
57728c506b8Sjruoho                 BytesToDump = 32;
57828c506b8Sjruoho             }
57928c506b8Sjruoho             else
58028c506b8Sjruoho             {
58181bd9c9cSchristos                 AcpiOsPrintf (
58281bd9c9cSchristos                     "(Pointer to ACPI Object type %.2X [%s])\n",
58328c506b8Sjruoho                     ObjType, AcpiUtGetTypeName (ObjType));
58481bd9c9cSchristos 
58528c506b8Sjruoho                 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
58628c506b8Sjruoho             }
58728c506b8Sjruoho 
58828c506b8Sjruoho             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
58928c506b8Sjruoho             break;
59028c506b8Sjruoho 
59128c506b8Sjruoho         default:
59228c506b8Sjruoho 
59328c506b8Sjruoho             break;
59428c506b8Sjruoho         }
59528c506b8Sjruoho 
59628c506b8Sjruoho         /* If value is NOT an internal object, we are done */
59728c506b8Sjruoho 
59828c506b8Sjruoho         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
59928c506b8Sjruoho         {
60028c506b8Sjruoho             goto Cleanup;
60128c506b8Sjruoho         }
60228c506b8Sjruoho 
60328c506b8Sjruoho         /* Valid object, get the pointer to next level, if any */
60428c506b8Sjruoho 
60528c506b8Sjruoho         switch (ObjType)
60628c506b8Sjruoho         {
60728c506b8Sjruoho         case ACPI_TYPE_BUFFER:
60828c506b8Sjruoho         case ACPI_TYPE_STRING:
60928c506b8Sjruoho             /*
61028c506b8Sjruoho              * NOTE: takes advantage of common fields between string/buffer
61128c506b8Sjruoho              */
61228c506b8Sjruoho             BytesToDump = ObjDesc->String.Length;
61328c506b8Sjruoho             ObjDesc = (void *) ObjDesc->String.Pointer;
61481bd9c9cSchristos 
61528c506b8Sjruoho             AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n",
61628c506b8Sjruoho                 ObjDesc, BytesToDump);
61728c506b8Sjruoho             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
61828c506b8Sjruoho             goto Cleanup;
61928c506b8Sjruoho 
62028c506b8Sjruoho         case ACPI_TYPE_BUFFER_FIELD:
621a2c051a9Schristos 
62228c506b8Sjruoho             ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
62328c506b8Sjruoho             break;
62428c506b8Sjruoho 
62528c506b8Sjruoho         case ACPI_TYPE_PACKAGE:
626a2c051a9Schristos 
62728c506b8Sjruoho             ObjDesc = (void *) ObjDesc->Package.Elements;
62828c506b8Sjruoho             break;
62928c506b8Sjruoho 
63028c506b8Sjruoho         case ACPI_TYPE_METHOD:
631a2c051a9Schristos 
63228c506b8Sjruoho             ObjDesc = (void *) ObjDesc->Method.AmlStart;
63328c506b8Sjruoho             break;
63428c506b8Sjruoho 
63528c506b8Sjruoho         case ACPI_TYPE_LOCAL_REGION_FIELD:
636a2c051a9Schristos 
63728c506b8Sjruoho             ObjDesc = (void *) ObjDesc->Field.RegionObj;
63828c506b8Sjruoho             break;
63928c506b8Sjruoho 
64028c506b8Sjruoho         case ACPI_TYPE_LOCAL_BANK_FIELD:
641a2c051a9Schristos 
64228c506b8Sjruoho             ObjDesc = (void *) ObjDesc->BankField.RegionObj;
64328c506b8Sjruoho             break;
64428c506b8Sjruoho 
64528c506b8Sjruoho         case ACPI_TYPE_LOCAL_INDEX_FIELD:
646a2c051a9Schristos 
64728c506b8Sjruoho             ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
64828c506b8Sjruoho             break;
64928c506b8Sjruoho 
65028c506b8Sjruoho         default:
651a2c051a9Schristos 
65228c506b8Sjruoho             goto Cleanup;
65328c506b8Sjruoho         }
65428c506b8Sjruoho     }
65528c506b8Sjruoho 
65628c506b8Sjruoho Cleanup:
65728c506b8Sjruoho     AcpiOsPrintf ("\n");
65828c506b8Sjruoho     return (AE_OK);
65928c506b8Sjruoho }
66028c506b8Sjruoho 
66128c506b8Sjruoho 
66228c506b8Sjruoho /*******************************************************************************
66328c506b8Sjruoho  *
66428c506b8Sjruoho  * FUNCTION:    AcpiNsDumpObjects
66528c506b8Sjruoho  *
66628c506b8Sjruoho  * PARAMETERS:  Type                - Object type to be dumped
66728c506b8Sjruoho  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
66828c506b8Sjruoho  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
66928c506b8Sjruoho  *                                    for an effectively unlimited depth.
67028c506b8Sjruoho  *              OwnerId             - Dump only objects owned by this ID. Use
67128c506b8Sjruoho  *                                    ACPI_UINT32_MAX to match all owners.
67228c506b8Sjruoho  *              StartHandle         - Where in namespace to start/end search
67328c506b8Sjruoho  *
67428c506b8Sjruoho  * RETURN:      None
67528c506b8Sjruoho  *
67628c506b8Sjruoho  * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
67728c506b8Sjruoho  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
67828c506b8Sjruoho  *
67928c506b8Sjruoho  ******************************************************************************/
68028c506b8Sjruoho 
68128c506b8Sjruoho void
AcpiNsDumpObjects(ACPI_OBJECT_TYPE Type,UINT8 DisplayType,UINT32 MaxDepth,ACPI_OWNER_ID OwnerId,ACPI_HANDLE StartHandle)68228c506b8Sjruoho AcpiNsDumpObjects (
68328c506b8Sjruoho     ACPI_OBJECT_TYPE        Type,
68428c506b8Sjruoho     UINT8                   DisplayType,
68528c506b8Sjruoho     UINT32                  MaxDepth,
68628c506b8Sjruoho     ACPI_OWNER_ID           OwnerId,
68728c506b8Sjruoho     ACPI_HANDLE             StartHandle)
68828c506b8Sjruoho {
68928c506b8Sjruoho     ACPI_WALK_INFO          Info;
690159c4e26Sjruoho     ACPI_STATUS             Status;
69128c506b8Sjruoho 
69228c506b8Sjruoho 
69328c506b8Sjruoho     ACPI_FUNCTION_ENTRY ();
69428c506b8Sjruoho 
69528c506b8Sjruoho 
696159c4e26Sjruoho     /*
697159c4e26Sjruoho      * Just lock the entire namespace for the duration of the dump.
698159c4e26Sjruoho      * We don't want any changes to the namespace during this time,
699159c4e26Sjruoho      * especially the temporary nodes since we are going to display
700159c4e26Sjruoho      * them also.
701159c4e26Sjruoho      */
702159c4e26Sjruoho     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
703159c4e26Sjruoho     if (ACPI_FAILURE (Status))
704159c4e26Sjruoho     {
705159c4e26Sjruoho         AcpiOsPrintf ("Could not acquire namespace mutex\n");
706159c4e26Sjruoho         return;
707159c4e26Sjruoho     }
708159c4e26Sjruoho 
709a147b75fSchristos     Info.Count = 0;
71028c506b8Sjruoho     Info.DebugLevel = ACPI_LV_TABLES;
71128c506b8Sjruoho     Info.OwnerId = OwnerId;
71228c506b8Sjruoho     Info.DisplayType = DisplayType;
71328c506b8Sjruoho 
71428c506b8Sjruoho     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
71528c506b8Sjruoho         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
71628c506b8Sjruoho         AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
717159c4e26Sjruoho 
718a147b75fSchristos     AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count);
719159c4e26Sjruoho     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
72028c506b8Sjruoho }
72128c506b8Sjruoho 
72228c506b8Sjruoho 
72328c506b8Sjruoho /*******************************************************************************
72428c506b8Sjruoho  *
725a2c051a9Schristos  * FUNCTION:    AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
726a2c051a9Schristos  *
727a2c051a9Schristos  * PARAMETERS:  ObjHandle           - Node to be dumped
728a2c051a9Schristos  *              Level               - Nesting level of the handle
729a2c051a9Schristos  *              Context             - Passed into WalkNamespace
730a2c051a9Schristos  *              ReturnValue         - Not used
731a2c051a9Schristos  *
732a2c051a9Schristos  * RETURN:      Status
733a2c051a9Schristos  *
734a2c051a9Schristos  * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
735a2c051a9Schristos  *              computes the maximum nesting depth in the namespace tree, in
736a2c051a9Schristos  *              order to simplify formatting in AcpiNsDumpOneObjectPath.
737a2c051a9Schristos  *              These procedures are UserFunctions called by AcpiNsWalkNamespace.
738a2c051a9Schristos  *
739a2c051a9Schristos  ******************************************************************************/
740a2c051a9Schristos 
741a2c051a9Schristos static ACPI_STATUS
AcpiNsDumpOneObjectPath(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)742a2c051a9Schristos AcpiNsDumpOneObjectPath (
743a2c051a9Schristos     ACPI_HANDLE             ObjHandle,
744a2c051a9Schristos     UINT32                  Level,
745a2c051a9Schristos     void                    *Context,
746a2c051a9Schristos     void                    **ReturnValue)
747a2c051a9Schristos {
748a2c051a9Schristos     UINT32                  MaxLevel = *((UINT32 *) Context);
749a2c051a9Schristos     char                    *Pathname;
750a2c051a9Schristos     ACPI_NAMESPACE_NODE     *Node;
751a2c051a9Schristos     int                     PathIndent;
752a2c051a9Schristos 
753a2c051a9Schristos 
754a2c051a9Schristos     if (!ObjHandle)
755a2c051a9Schristos     {
756a2c051a9Schristos         return (AE_OK);
757a2c051a9Schristos     }
758a2c051a9Schristos 
759a2c051a9Schristos     Node = AcpiNsValidateHandle (ObjHandle);
760a2c051a9Schristos     if (!Node)
761a2c051a9Schristos     {
762a2c051a9Schristos         /* Ignore bad node during namespace walk */
763a2c051a9Schristos 
764a2c051a9Schristos         return (AE_OK);
765a2c051a9Schristos     }
766a2c051a9Schristos 
76781bd9c9cSchristos     Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
768a2c051a9Schristos 
769a2c051a9Schristos     PathIndent = 1;
770a2c051a9Schristos     if (Level <= MaxLevel)
771a2c051a9Schristos     {
772a2c051a9Schristos         PathIndent = MaxLevel - Level + 1;
773a2c051a9Schristos     }
774a2c051a9Schristos 
775a2c051a9Schristos     AcpiOsPrintf ("%2d%*s%-12s%*s",
776a2c051a9Schristos         Level, Level, " ", AcpiUtGetTypeName (Node->Type),
777a2c051a9Schristos         PathIndent, " ");
778a2c051a9Schristos 
779a2c051a9Schristos     AcpiOsPrintf ("%s\n", &Pathname[1]);
780a2c051a9Schristos     ACPI_FREE (Pathname);
781a2c051a9Schristos     return (AE_OK);
782a2c051a9Schristos }
783a2c051a9Schristos 
784a2c051a9Schristos 
785a2c051a9Schristos static ACPI_STATUS
AcpiNsGetMaxDepth(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)786a2c051a9Schristos AcpiNsGetMaxDepth (
787a2c051a9Schristos     ACPI_HANDLE             ObjHandle,
788a2c051a9Schristos     UINT32                  Level,
789a2c051a9Schristos     void                    *Context,
790a2c051a9Schristos     void                    **ReturnValue)
791a2c051a9Schristos {
792a2c051a9Schristos     UINT32                  *MaxLevel = (UINT32 *) Context;
793a2c051a9Schristos 
794a2c051a9Schristos 
795a2c051a9Schristos     if (Level > *MaxLevel)
796a2c051a9Schristos     {
797a2c051a9Schristos         *MaxLevel = Level;
798a2c051a9Schristos     }
799a2c051a9Schristos     return (AE_OK);
800a2c051a9Schristos }
801a2c051a9Schristos 
802a2c051a9Schristos 
803a2c051a9Schristos /*******************************************************************************
804a2c051a9Schristos  *
805a2c051a9Schristos  * FUNCTION:    AcpiNsDumpObjectPaths
806a2c051a9Schristos  *
807a2c051a9Schristos  * PARAMETERS:  Type                - Object type to be dumped
808a2c051a9Schristos  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
809a2c051a9Schristos  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
810a2c051a9Schristos  *                                    for an effectively unlimited depth.
811a2c051a9Schristos  *              OwnerId             - Dump only objects owned by this ID. Use
812a2c051a9Schristos  *                                    ACPI_UINT32_MAX to match all owners.
813a2c051a9Schristos  *              StartHandle         - Where in namespace to start/end search
814a2c051a9Schristos  *
815a2c051a9Schristos  * RETURN:      None
816a2c051a9Schristos  *
817a2c051a9Schristos  * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
818a2c051a9Schristos  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
819a2c051a9Schristos  *
820a2c051a9Schristos  ******************************************************************************/
821a2c051a9Schristos 
822a2c051a9Schristos void
AcpiNsDumpObjectPaths(ACPI_OBJECT_TYPE Type,UINT8 DisplayType,UINT32 MaxDepth,ACPI_OWNER_ID OwnerId,ACPI_HANDLE StartHandle)823a2c051a9Schristos AcpiNsDumpObjectPaths (
824a2c051a9Schristos     ACPI_OBJECT_TYPE        Type,
825a2c051a9Schristos     UINT8                   DisplayType,
826a2c051a9Schristos     UINT32                  MaxDepth,
827a2c051a9Schristos     ACPI_OWNER_ID           OwnerId,
828a2c051a9Schristos     ACPI_HANDLE             StartHandle)
829a2c051a9Schristos {
830a2c051a9Schristos     ACPI_STATUS             Status;
831a2c051a9Schristos     UINT32                  MaxLevel = 0;
832a2c051a9Schristos 
833a2c051a9Schristos 
834a2c051a9Schristos     ACPI_FUNCTION_ENTRY ();
835a2c051a9Schristos 
836a2c051a9Schristos 
837a2c051a9Schristos     /*
838a2c051a9Schristos      * Just lock the entire namespace for the duration of the dump.
839a2c051a9Schristos      * We don't want any changes to the namespace during this time,
840a2c051a9Schristos      * especially the temporary nodes since we are going to display
841a2c051a9Schristos      * them also.
842a2c051a9Schristos      */
843a2c051a9Schristos     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
844a2c051a9Schristos     if (ACPI_FAILURE (Status))
845a2c051a9Schristos     {
846a2c051a9Schristos         AcpiOsPrintf ("Could not acquire namespace mutex\n");
847a2c051a9Schristos         return;
848a2c051a9Schristos     }
849a2c051a9Schristos 
850a2c051a9Schristos     /* Get the max depth of the namespace tree, for formatting later */
851a2c051a9Schristos 
852a2c051a9Schristos     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
853a2c051a9Schristos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
854a2c051a9Schristos         AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
855a2c051a9Schristos 
856a2c051a9Schristos     /* Now dump the entire namespace */
857a2c051a9Schristos 
858a2c051a9Schristos     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
859a2c051a9Schristos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
860a2c051a9Schristos         AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
861a2c051a9Schristos 
862a2c051a9Schristos     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
863a2c051a9Schristos }
864a2c051a9Schristos 
865a2c051a9Schristos 
866a2c051a9Schristos /*******************************************************************************
867a2c051a9Schristos  *
86828c506b8Sjruoho  * FUNCTION:    AcpiNsDumpEntry
86928c506b8Sjruoho  *
87028c506b8Sjruoho  * PARAMETERS:  Handle              - Node to be dumped
87128c506b8Sjruoho  *              DebugLevel          - Output level
87228c506b8Sjruoho  *
87328c506b8Sjruoho  * RETURN:      None
87428c506b8Sjruoho  *
87528c506b8Sjruoho  * DESCRIPTION: Dump a single Node
87628c506b8Sjruoho  *
87728c506b8Sjruoho  ******************************************************************************/
87828c506b8Sjruoho 
87928c506b8Sjruoho void
AcpiNsDumpEntry(ACPI_HANDLE Handle,UINT32 DebugLevel)88028c506b8Sjruoho AcpiNsDumpEntry (
88128c506b8Sjruoho     ACPI_HANDLE             Handle,
88228c506b8Sjruoho     UINT32                  DebugLevel)
88328c506b8Sjruoho {
88428c506b8Sjruoho     ACPI_WALK_INFO          Info;
88528c506b8Sjruoho 
88628c506b8Sjruoho 
88728c506b8Sjruoho     ACPI_FUNCTION_ENTRY ();
88828c506b8Sjruoho 
88928c506b8Sjruoho 
89028c506b8Sjruoho     Info.DebugLevel = DebugLevel;
89128c506b8Sjruoho     Info.OwnerId = ACPI_OWNER_ID_MAX;
89228c506b8Sjruoho     Info.DisplayType = ACPI_DISPLAY_SUMMARY;
89328c506b8Sjruoho 
89428c506b8Sjruoho     (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
89528c506b8Sjruoho }
89628c506b8Sjruoho 
89728c506b8Sjruoho 
89828c506b8Sjruoho #ifdef ACPI_ASL_COMPILER
89928c506b8Sjruoho /*******************************************************************************
90028c506b8Sjruoho  *
90128c506b8Sjruoho  * FUNCTION:    AcpiNsDumpTables
90228c506b8Sjruoho  *
90328c506b8Sjruoho  * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
90428c506b8Sjruoho  *                                    NS_ALL to dump the entire namespace
90528c506b8Sjruoho  *              MaxDepth            - Maximum depth of dump. Use INT_MAX
90628c506b8Sjruoho  *                                    for an effectively unlimited depth.
90728c506b8Sjruoho  *
90828c506b8Sjruoho  * RETURN:      None
90928c506b8Sjruoho  *
91028c506b8Sjruoho  * DESCRIPTION: Dump the name space, or a portion of it.
91128c506b8Sjruoho  *
91228c506b8Sjruoho  ******************************************************************************/
91328c506b8Sjruoho 
91428c506b8Sjruoho void
AcpiNsDumpTables(ACPI_HANDLE SearchBase,UINT32 MaxDepth)91528c506b8Sjruoho AcpiNsDumpTables (
91628c506b8Sjruoho     ACPI_HANDLE             SearchBase,
91728c506b8Sjruoho     UINT32                  MaxDepth)
91828c506b8Sjruoho {
91928c506b8Sjruoho     ACPI_HANDLE             SearchHandle = SearchBase;
92028c506b8Sjruoho 
92128c506b8Sjruoho 
92228c506b8Sjruoho     ACPI_FUNCTION_TRACE (NsDumpTables);
92328c506b8Sjruoho 
92428c506b8Sjruoho 
92528c506b8Sjruoho     if (!AcpiGbl_RootNode)
92628c506b8Sjruoho     {
92728c506b8Sjruoho         /*
92828c506b8Sjruoho          * If the name space has not been initialized,
92928c506b8Sjruoho          * there is nothing to dump.
93028c506b8Sjruoho          */
93181bd9c9cSchristos         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
93281bd9c9cSchristos             "namespace not initialized!\n"));
93328c506b8Sjruoho         return_VOID;
93428c506b8Sjruoho     }
93528c506b8Sjruoho 
93628c506b8Sjruoho     if (ACPI_NS_ALL == SearchBase)
93728c506b8Sjruoho     {
93828c506b8Sjruoho         /* Entire namespace */
93928c506b8Sjruoho 
94028c506b8Sjruoho         SearchHandle = AcpiGbl_RootNode;
94128c506b8Sjruoho         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
94228c506b8Sjruoho     }
94328c506b8Sjruoho 
94428c506b8Sjruoho     AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
94528c506b8Sjruoho         ACPI_OWNER_ID_MAX, SearchHandle);
94628c506b8Sjruoho     return_VOID;
94728c506b8Sjruoho }
94828c506b8Sjruoho #endif
94928c506b8Sjruoho #endif
950