Home | History | Annotate | Line # | Download | only in namespace
nsdump.c revision 1.23
      1   1.1    jruoho /******************************************************************************
      2   1.1    jruoho  *
      3   1.1    jruoho  * Module Name: nsdump - table dumping routines for debug
      4   1.1    jruoho  *
      5   1.1    jruoho  *****************************************************************************/
      6   1.1    jruoho 
      7  1.22  christos /******************************************************************************
      8  1.22  christos  *
      9  1.22  christos  * 1. Copyright Notice
     10  1.22  christos  *
     11  1.23  christos  * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
     12   1.1    jruoho  * All rights reserved.
     13   1.1    jruoho  *
     14  1.22  christos  * 2. License
     15  1.22  christos  *
     16  1.22  christos  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.22  christos  * rights. You may have additional license terms from the party that provided
     18  1.22  christos  * you this software, covering your right to use that party's intellectual
     19  1.22  christos  * property rights.
     20  1.22  christos  *
     21  1.22  christos  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.22  christos  * copy of the source code appearing in this file ("Covered Code") an
     23  1.22  christos  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.22  christos  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.22  christos 
     26  1.22  christos  * make derivatives, distribute, use and display any portion of the Covered
     27  1.22  christos  * Code in any form, with the right to sublicense such rights; and
     28  1.22  christos  *
     29  1.22  christos  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     30  1.22  christos  * license (with the right to sublicense), under only those claims of Intel
     31  1.22  christos  * patents that are infringed by the Original Intel Code, to make, use, sell,
     32  1.22  christos  * offer to sell, and import the Covered Code and derivative works thereof
     33  1.22  christos  * solely to the minimum extent necessary to exercise the above copyright
     34  1.22  christos  * license, and in no event shall the patent license extend to any additions
     35  1.22  christos  * to or modifications of the Original Intel Code. No other license or right
     36  1.22  christos  * is granted directly or by implication, estoppel or otherwise;
     37  1.22  christos  *
     38  1.22  christos  * The above copyright and patent license is granted only if the following
     39  1.22  christos  * conditions are met:
     40  1.22  christos  *
     41  1.22  christos  * 3. Conditions
     42  1.22  christos  *
     43  1.22  christos  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     44  1.22  christos  * Redistribution of source code of any substantial portion of the Covered
     45  1.22  christos  * Code or modification with rights to further distribute source must include
     46  1.22  christos  * the above Copyright Notice, the above License, this list of Conditions,
     47  1.22  christos  * and the following Disclaimer and Export Compliance provision. In addition,
     48  1.22  christos  * Licensee must cause all Covered Code to which Licensee contributes to
     49  1.22  christos  * contain a file documenting the changes Licensee made to create that Covered
     50  1.22  christos  * Code and the date of any change. Licensee must include in that file the
     51  1.22  christos  * documentation of any changes made by any predecessor Licensee. Licensee
     52  1.22  christos  * must include a prominent statement that the modification is derived,
     53  1.22  christos  * directly or indirectly, from Original Intel Code.
     54  1.22  christos  *
     55  1.22  christos  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     56  1.22  christos  * Redistribution of source code of any substantial portion of the Covered
     57  1.22  christos  * Code or modification without rights to further distribute source must
     58  1.22  christos  * include the following Disclaimer and Export Compliance provision in the
     59  1.22  christos  * documentation and/or other materials provided with distribution. In
     60  1.22  christos  * addition, Licensee may not authorize further sublicense of source of any
     61  1.22  christos  * portion of the Covered Code, and must include terms to the effect that the
     62  1.22  christos  * license from Licensee to its licensee is limited to the intellectual
     63  1.22  christos  * property embodied in the software Licensee provides to its licensee, and
     64  1.22  christos  * not to intellectual property embodied in modifications its licensee may
     65  1.22  christos  * make.
     66  1.22  christos  *
     67  1.22  christos  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     68  1.22  christos  * substantial portion of the Covered Code or modification must reproduce the
     69  1.22  christos  * above Copyright Notice, and the following Disclaimer and Export Compliance
     70  1.22  christos  * provision in the documentation and/or other materials provided with the
     71  1.22  christos  * distribution.
     72  1.22  christos  *
     73  1.22  christos  * 3.4. Intel retains all right, title, and interest in and to the Original
     74  1.22  christos  * Intel Code.
     75  1.22  christos  *
     76  1.22  christos  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     77  1.22  christos  * Intel shall be used in advertising or otherwise to promote the sale, use or
     78  1.22  christos  * other dealings in products derived from or relating to the Covered Code
     79  1.22  christos  * without prior written authorization from Intel.
     80  1.22  christos  *
     81  1.22  christos  * 4. Disclaimer and Export Compliance
     82  1.22  christos  *
     83  1.22  christos  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     84  1.22  christos  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     85  1.22  christos  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     86  1.22  christos  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     87  1.22  christos  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     88  1.22  christos  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     89  1.22  christos  * PARTICULAR PURPOSE.
     90  1.22  christos  *
     91  1.22  christos  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     92  1.22  christos  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     93  1.22  christos  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     94  1.22  christos  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     95  1.22  christos  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     96  1.22  christos  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     97  1.22  christos  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     98  1.22  christos  * LIMITED REMEDY.
     99  1.22  christos  *
    100  1.22  christos  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    101  1.22  christos  * software or system incorporating such software without first obtaining any
    102  1.22  christos  * required license or other approval from the U. S. Department of Commerce or
    103  1.22  christos  * any other agency or department of the United States Government. In the
    104  1.22  christos  * event Licensee exports any such software from the United States or
    105  1.22  christos  * re-exports any such software from a foreign destination, Licensee shall
    106  1.22  christos  * ensure that the distribution and export/re-export of the software is in
    107  1.22  christos  * compliance with all laws, regulations, orders, or other restrictions of the
    108  1.22  christos  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    109  1.22  christos  * any of its subsidiaries will export/re-export any technical data, process,
    110  1.22  christos  * software, or service, directly or indirectly, to any country for which the
    111  1.22  christos  * United States government or any agency thereof requires an export license,
    112  1.22  christos  * other governmental approval, or letter of assurance, without first obtaining
    113  1.22  christos  * such license, approval or letter.
    114  1.22  christos  *
    115  1.22  christos  *****************************************************************************
    116  1.22  christos  *
    117  1.22  christos  * Alternatively, you may choose to be licensed under the terms of the
    118  1.22  christos  * following license:
    119  1.22  christos  *
    120   1.3    jruoho  * Redistribution and use in source and binary forms, with or without
    121   1.3    jruoho  * modification, are permitted provided that the following conditions
    122   1.3    jruoho  * are met:
    123   1.3    jruoho  * 1. Redistributions of source code must retain the above copyright
    124   1.3    jruoho  *    notice, this list of conditions, and the following disclaimer,
    125   1.3    jruoho  *    without modification.
    126   1.3    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    127   1.3    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
    128   1.3    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
    129   1.3    jruoho  *    including a substantially similar Disclaimer requirement for further
    130   1.3    jruoho  *    binary redistribution.
    131   1.3    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
    132   1.3    jruoho  *    of any contributors may be used to endorse or promote products derived
    133   1.3    jruoho  *    from this software without specific prior written permission.
    134   1.3    jruoho  *
    135   1.3    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    136   1.3    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    137  1.19  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    138   1.3    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    139  1.22  christos  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    140  1.22  christos  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    141  1.22  christos  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    142  1.22  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    143  1.22  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    144  1.22  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    145  1.22  christos  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    146  1.22  christos  *
    147  1.22  christos  * Alternatively, you may choose to be licensed under the terms of the
    148  1.22  christos  * GNU General Public License ("GPL") version 2 as published by the Free
    149  1.22  christos  * Software Foundation.
    150  1.22  christos  *
    151  1.22  christos  *****************************************************************************/
    152   1.1    jruoho 
    153   1.1    jruoho #include "acpi.h"
    154   1.1    jruoho #include "accommon.h"
    155   1.1    jruoho #include "acnamesp.h"
    156   1.4  christos #include "acoutput.h"
    157   1.1    jruoho 
    158   1.1    jruoho 
    159   1.1    jruoho #define _COMPONENT          ACPI_NAMESPACE
    160   1.1    jruoho         ACPI_MODULE_NAME    ("nsdump")
    161   1.1    jruoho 
    162   1.1    jruoho /* Local prototypes */
    163   1.1    jruoho 
    164   1.1    jruoho #ifdef ACPI_OBSOLETE_FUNCTIONS
    165   1.1    jruoho void
    166   1.1    jruoho AcpiNsDumpRootDevices (
    167   1.1    jruoho     void);
    168   1.1    jruoho 
    169   1.1    jruoho static ACPI_STATUS
    170   1.1    jruoho AcpiNsDumpOneDevice (
    171   1.1    jruoho     ACPI_HANDLE             ObjHandle,
    172   1.1    jruoho     UINT32                  Level,
    173   1.1    jruoho     void                    *Context,
    174   1.1    jruoho     void                    **ReturnValue);
    175   1.1    jruoho #endif
    176   1.1    jruoho 
    177   1.1    jruoho 
    178   1.1    jruoho #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
    179   1.4  christos 
    180   1.4  christos static ACPI_STATUS
    181   1.4  christos AcpiNsDumpOneObjectPath (
    182   1.4  christos     ACPI_HANDLE             ObjHandle,
    183   1.4  christos     UINT32                  Level,
    184   1.4  christos     void                    *Context,
    185   1.4  christos     void                    **ReturnValue);
    186   1.4  christos 
    187   1.4  christos static ACPI_STATUS
    188   1.4  christos AcpiNsGetMaxDepth (
    189   1.4  christos     ACPI_HANDLE             ObjHandle,
    190   1.4  christos     UINT32                  Level,
    191   1.4  christos     void                    *Context,
    192   1.4  christos     void                    **ReturnValue);
    193   1.4  christos 
    194   1.4  christos 
    195   1.1    jruoho /*******************************************************************************
    196   1.1    jruoho  *
    197   1.1    jruoho  * FUNCTION:    AcpiNsPrintPathname
    198   1.1    jruoho  *
    199   1.1    jruoho  * PARAMETERS:  NumSegments         - Number of ACPI name segments
    200   1.1    jruoho  *              Pathname            - The compressed (internal) path
    201   1.1    jruoho  *
    202   1.1    jruoho  * RETURN:      None
    203   1.1    jruoho  *
    204   1.1    jruoho  * DESCRIPTION: Print an object's full namespace pathname
    205   1.1    jruoho  *
    206   1.1    jruoho  ******************************************************************************/
    207   1.1    jruoho 
    208   1.1    jruoho void
    209   1.1    jruoho AcpiNsPrintPathname (
    210   1.1    jruoho     UINT32                  NumSegments,
    211   1.9  christos     const char              *Pathname)
    212   1.1    jruoho {
    213   1.1    jruoho     UINT32                  i;
    214   1.1    jruoho 
    215   1.1    jruoho 
    216   1.1    jruoho     ACPI_FUNCTION_NAME (NsPrintPathname);
    217   1.1    jruoho 
    218   1.1    jruoho 
    219   1.4  christos     /* Check if debug output enabled */
    220   1.4  christos 
    221   1.4  christos     if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
    222   1.1    jruoho     {
    223   1.1    jruoho         return;
    224   1.1    jruoho     }
    225   1.1    jruoho 
    226   1.1    jruoho     /* Print the entire name */
    227   1.1    jruoho 
    228   1.1    jruoho     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
    229   1.1    jruoho 
    230   1.1    jruoho     while (NumSegments)
    231   1.1    jruoho     {
    232   1.1    jruoho         for (i = 0; i < 4; i++)
    233   1.1    jruoho         {
    234   1.7  christos             isprint ((int) Pathname[i]) ?
    235   1.1    jruoho                 AcpiOsPrintf ("%c", Pathname[i]) :
    236   1.1    jruoho                 AcpiOsPrintf ("?");
    237   1.1    jruoho         }
    238   1.1    jruoho 
    239  1.14  christos         Pathname += ACPI_NAMESEG_SIZE;
    240   1.1    jruoho         NumSegments--;
    241   1.1    jruoho         if (NumSegments)
    242   1.1    jruoho         {
    243   1.1    jruoho             AcpiOsPrintf (".");
    244   1.1    jruoho         }
    245   1.1    jruoho     }
    246   1.1    jruoho 
    247   1.1    jruoho     AcpiOsPrintf ("]\n");
    248   1.1    jruoho }
    249   1.1    jruoho 
    250   1.1    jruoho 
    251   1.9  christos #ifdef ACPI_OBSOLETE_FUNCTIONS
    252   1.9  christos /* Not used at this time, perhaps later */
    253   1.9  christos 
    254   1.1    jruoho /*******************************************************************************
    255   1.1    jruoho  *
    256   1.1    jruoho  * FUNCTION:    AcpiNsDumpPathname
    257   1.1    jruoho  *
    258   1.1    jruoho  * PARAMETERS:  Handle              - Object
    259   1.1    jruoho  *              Msg                 - Prefix message
    260   1.1    jruoho  *              Level               - Desired debug level
    261   1.1    jruoho  *              Component           - Caller's component ID
    262   1.1    jruoho  *
    263   1.1    jruoho  * RETURN:      None
    264   1.1    jruoho  *
    265   1.1    jruoho  * DESCRIPTION: Print an object's full namespace pathname
    266   1.1    jruoho  *              Manages allocation/freeing of a pathname buffer
    267   1.1    jruoho  *
    268   1.1    jruoho  ******************************************************************************/
    269   1.1    jruoho 
    270   1.1    jruoho void
    271   1.1    jruoho AcpiNsDumpPathname (
    272   1.1    jruoho     ACPI_HANDLE             Handle,
    273   1.2    jruoho     const char              *Msg,
    274   1.1    jruoho     UINT32                  Level,
    275   1.1    jruoho     UINT32                  Component)
    276   1.1    jruoho {
    277   1.1    jruoho 
    278   1.1    jruoho     ACPI_FUNCTION_TRACE (NsDumpPathname);
    279   1.1    jruoho 
    280   1.1    jruoho 
    281   1.1    jruoho     /* Do this only if the requested debug level and component are enabled */
    282   1.1    jruoho 
    283   1.4  christos     if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
    284   1.1    jruoho     {
    285   1.1    jruoho         return_VOID;
    286   1.1    jruoho     }
    287   1.1    jruoho 
    288   1.1    jruoho     /* Convert handle to a full pathname and print it (with supplied message) */
    289   1.1    jruoho 
    290   1.1    jruoho     AcpiNsPrintNodePathname (Handle, Msg);
    291   1.1    jruoho     AcpiOsPrintf ("\n");
    292   1.1    jruoho     return_VOID;
    293   1.1    jruoho }
    294   1.9  christos #endif
    295   1.1    jruoho 
    296  1.13  christos 
    297   1.1    jruoho /*******************************************************************************
    298   1.1    jruoho  *
    299   1.1    jruoho  * FUNCTION:    AcpiNsDumpOneObject
    300   1.1    jruoho  *
    301   1.1    jruoho  * PARAMETERS:  ObjHandle           - Node to be dumped
    302   1.1    jruoho  *              Level               - Nesting level of the handle
    303   1.1    jruoho  *              Context             - Passed into WalkNamespace
    304   1.1    jruoho  *              ReturnValue         - Not used
    305   1.1    jruoho  *
    306   1.1    jruoho  * RETURN:      Status
    307   1.1    jruoho  *
    308   1.1    jruoho  * DESCRIPTION: Dump a single Node
    309   1.1    jruoho  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
    310   1.1    jruoho  *
    311   1.1    jruoho  ******************************************************************************/
    312   1.1    jruoho 
    313   1.1    jruoho ACPI_STATUS
    314   1.1    jruoho AcpiNsDumpOneObject (
    315   1.1    jruoho     ACPI_HANDLE             ObjHandle,
    316   1.1    jruoho     UINT32                  Level,
    317   1.1    jruoho     void                    *Context,
    318   1.1    jruoho     void                    **ReturnValue)
    319   1.1    jruoho {
    320   1.1    jruoho     ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
    321   1.1    jruoho     ACPI_NAMESPACE_NODE     *ThisNode;
    322   1.1    jruoho     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
    323   1.1    jruoho     ACPI_OBJECT_TYPE        ObjType;
    324   1.1    jruoho     ACPI_OBJECT_TYPE        Type;
    325   1.1    jruoho     UINT32                  BytesToDump;
    326   1.1    jruoho     UINT32                  DbgLevel;
    327   1.1    jruoho     UINT32                  i;
    328   1.1    jruoho 
    329   1.1    jruoho 
    330   1.1    jruoho     ACPI_FUNCTION_NAME (NsDumpOneObject);
    331   1.1    jruoho 
    332   1.1    jruoho 
    333   1.1    jruoho     /* Is output enabled? */
    334   1.1    jruoho 
    335   1.1    jruoho     if (!(AcpiDbgLevel & Info->DebugLevel))
    336   1.1    jruoho     {
    337   1.1    jruoho         return (AE_OK);
    338   1.1    jruoho     }
    339   1.1    jruoho 
    340   1.1    jruoho     if (!ObjHandle)
    341   1.1    jruoho     {
    342   1.1    jruoho         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
    343   1.1    jruoho         return (AE_OK);
    344   1.1    jruoho     }
    345   1.1    jruoho 
    346   1.1    jruoho     ThisNode = AcpiNsValidateHandle (ObjHandle);
    347   1.1    jruoho     if (!ThisNode)
    348   1.1    jruoho     {
    349   1.1    jruoho         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
    350   1.1    jruoho             ObjHandle));
    351   1.1    jruoho         return (AE_OK);
    352   1.1    jruoho     }
    353   1.1    jruoho 
    354   1.1    jruoho     Type = ThisNode->Type;
    355  1.13  christos     Info->Count++;
    356   1.1    jruoho 
    357   1.1    jruoho     /* Check if the owner matches */
    358   1.1    jruoho 
    359   1.1    jruoho     if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
    360   1.1    jruoho         (Info->OwnerId != ThisNode->OwnerId))
    361   1.1    jruoho     {
    362   1.1    jruoho         return (AE_OK);
    363   1.1    jruoho     }
    364   1.1    jruoho 
    365   1.1    jruoho     if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
    366   1.1    jruoho     {
    367   1.1    jruoho         /* Indent the object according to the level */
    368   1.1    jruoho 
    369   1.1    jruoho         AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
    370   1.1    jruoho 
    371   1.1    jruoho         /* Check the node type and name */
    372   1.1    jruoho 
    373   1.1    jruoho         if (Type > ACPI_TYPE_LOCAL_MAX)
    374   1.1    jruoho         {
    375   1.8  christos             ACPI_WARNING ((AE_INFO,
    376   1.8  christos                 "Invalid ACPI Object Type 0x%08X", Type));
    377   1.1    jruoho         }
    378   1.1    jruoho 
    379   1.1    jruoho         AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
    380   1.1    jruoho     }
    381   1.1    jruoho 
    382   1.1    jruoho     /* Now we can print out the pertinent information */
    383   1.1    jruoho 
    384  1.15  christos     AcpiOsPrintf (" %-12s %p %3.3X ",
    385   1.8  christos         AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
    386   1.1    jruoho 
    387   1.1    jruoho     DbgLevel = AcpiDbgLevel;
    388   1.1    jruoho     AcpiDbgLevel = 0;
    389   1.1    jruoho     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
    390   1.1    jruoho     AcpiDbgLevel = DbgLevel;
    391   1.1    jruoho 
    392   1.1    jruoho     /* Temp nodes are those nodes created by a control method */
    393   1.1    jruoho 
    394   1.1    jruoho     if (ThisNode->Flags & ANOBJ_TEMPORARY)
    395   1.1    jruoho     {
    396   1.1    jruoho         AcpiOsPrintf ("(T) ");
    397   1.1    jruoho     }
    398   1.1    jruoho 
    399   1.1    jruoho     switch (Info->DisplayType & ACPI_DISPLAY_MASK)
    400   1.1    jruoho     {
    401   1.1    jruoho     case ACPI_DISPLAY_SUMMARY:
    402   1.1    jruoho 
    403   1.1    jruoho         if (!ObjDesc)
    404   1.1    jruoho         {
    405   1.4  christos             /* No attached object. Some types should always have an object */
    406   1.4  christos 
    407   1.4  christos             switch (Type)
    408   1.4  christos             {
    409   1.4  christos             case ACPI_TYPE_INTEGER:
    410   1.4  christos             case ACPI_TYPE_PACKAGE:
    411   1.4  christos             case ACPI_TYPE_BUFFER:
    412   1.4  christos             case ACPI_TYPE_STRING:
    413   1.4  christos             case ACPI_TYPE_METHOD:
    414   1.4  christos 
    415   1.4  christos                 AcpiOsPrintf ("<No attached object>");
    416   1.4  christos                 break;
    417   1.4  christos 
    418   1.4  christos             default:
    419   1.4  christos 
    420   1.4  christos                 break;
    421   1.4  christos             }
    422   1.1    jruoho 
    423   1.1    jruoho             AcpiOsPrintf ("\n");
    424   1.1    jruoho             return (AE_OK);
    425   1.1    jruoho         }
    426   1.1    jruoho 
    427   1.1    jruoho         switch (Type)
    428   1.1    jruoho         {
    429   1.1    jruoho         case ACPI_TYPE_PROCESSOR:
    430   1.1    jruoho 
    431   1.6  christos             AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
    432   1.1    jruoho                 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
    433   1.6  christos                 ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address));
    434   1.1    jruoho             break;
    435   1.1    jruoho 
    436   1.1    jruoho         case ACPI_TYPE_DEVICE:
    437   1.1    jruoho 
    438   1.1    jruoho             AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
    439   1.1    jruoho             break;
    440   1.1    jruoho 
    441   1.1    jruoho         case ACPI_TYPE_METHOD:
    442   1.1    jruoho 
    443   1.1    jruoho             AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
    444   1.1    jruoho                 (UINT32) ObjDesc->Method.ParamCount,
    445   1.1    jruoho                 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
    446   1.1    jruoho             break;
    447   1.1    jruoho 
    448   1.1    jruoho         case ACPI_TYPE_INTEGER:
    449   1.1    jruoho 
    450   1.1    jruoho             AcpiOsPrintf ("= %8.8X%8.8X\n",
    451   1.1    jruoho                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
    452   1.1    jruoho             break;
    453   1.1    jruoho 
    454   1.1    jruoho         case ACPI_TYPE_PACKAGE:
    455   1.1    jruoho 
    456   1.1    jruoho             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
    457   1.1    jruoho             {
    458   1.1    jruoho                 AcpiOsPrintf ("Elements %.2X\n",
    459   1.1    jruoho                     ObjDesc->Package.Count);
    460   1.1    jruoho             }
    461   1.1    jruoho             else
    462   1.1    jruoho             {
    463   1.1    jruoho                 AcpiOsPrintf ("[Length not yet evaluated]\n");
    464   1.1    jruoho             }
    465   1.1    jruoho             break;
    466   1.1    jruoho 
    467   1.1    jruoho         case ACPI_TYPE_BUFFER:
    468   1.1    jruoho 
    469   1.1    jruoho             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
    470   1.1    jruoho             {
    471   1.1    jruoho                 AcpiOsPrintf ("Len %.2X",
    472   1.8  christos                     ObjDesc->Buffer.Length);
    473   1.1    jruoho 
    474   1.1    jruoho                 /* Dump some of the buffer */
    475   1.1    jruoho 
    476   1.1    jruoho                 if (ObjDesc->Buffer.Length > 0)
    477   1.1    jruoho                 {
    478   1.1    jruoho                     AcpiOsPrintf (" =");
    479   1.1    jruoho                     for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
    480   1.1    jruoho                     {
    481  1.17  christos                         AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
    482   1.1    jruoho                     }
    483   1.1    jruoho                 }
    484   1.1    jruoho                 AcpiOsPrintf ("\n");
    485   1.1    jruoho             }
    486   1.1    jruoho             else
    487   1.1    jruoho             {
    488   1.1    jruoho                 AcpiOsPrintf ("[Length not yet evaluated]\n");
    489   1.1    jruoho             }
    490   1.1    jruoho             break;
    491   1.1    jruoho 
    492   1.1    jruoho         case ACPI_TYPE_STRING:
    493   1.1    jruoho 
    494   1.1    jruoho             AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
    495  1.10  christos             AcpiUtPrintString (ObjDesc->String.Pointer, 80);
    496   1.1    jruoho             AcpiOsPrintf ("\n");
    497   1.1    jruoho             break;
    498   1.1    jruoho 
    499   1.1    jruoho         case ACPI_TYPE_REGION:
    500   1.1    jruoho 
    501   1.1    jruoho             AcpiOsPrintf ("[%s]",
    502   1.1    jruoho                 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
    503   1.1    jruoho             if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
    504   1.1    jruoho             {
    505   1.1    jruoho                 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
    506   1.6  christos                     ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
    507   1.1    jruoho                     ObjDesc->Region.Length);
    508   1.1    jruoho             }
    509   1.1    jruoho             else
    510   1.1    jruoho             {
    511   1.1    jruoho                 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
    512   1.1    jruoho             }
    513   1.1    jruoho             break;
    514   1.1    jruoho 
    515   1.1    jruoho         case ACPI_TYPE_LOCAL_REFERENCE:
    516   1.1    jruoho 
    517   1.1    jruoho             AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
    518   1.1    jruoho             break;
    519   1.1    jruoho 
    520   1.1    jruoho         case ACPI_TYPE_BUFFER_FIELD:
    521   1.1    jruoho 
    522   1.1    jruoho             if (ObjDesc->BufferField.BufferObj &&
    523   1.1    jruoho                 ObjDesc->BufferField.BufferObj->Buffer.Node)
    524   1.1    jruoho             {
    525   1.1    jruoho                 AcpiOsPrintf ("Buf [%4.4s]",
    526   1.1    jruoho                     AcpiUtGetNodeName (
    527   1.1    jruoho                         ObjDesc->BufferField.BufferObj->Buffer.Node));
    528   1.1    jruoho             }
    529   1.1    jruoho             break;
    530   1.1    jruoho 
    531   1.1    jruoho         case ACPI_TYPE_LOCAL_REGION_FIELD:
    532   1.1    jruoho 
    533   1.1    jruoho             AcpiOsPrintf ("Rgn [%4.4s]",
    534   1.1    jruoho                 AcpiUtGetNodeName (
    535   1.1    jruoho                     ObjDesc->CommonField.RegionObj->Region.Node));
    536   1.1    jruoho             break;
    537   1.1    jruoho 
    538   1.1    jruoho         case ACPI_TYPE_LOCAL_BANK_FIELD:
    539   1.1    jruoho 
    540   1.1    jruoho             AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
    541   1.1    jruoho                 AcpiUtGetNodeName (
    542   1.1    jruoho                     ObjDesc->CommonField.RegionObj->Region.Node),
    543   1.1    jruoho                 AcpiUtGetNodeName (
    544   1.1    jruoho                     ObjDesc->BankField.BankObj->CommonField.Node));
    545   1.1    jruoho             break;
    546   1.1    jruoho 
    547   1.1    jruoho         case ACPI_TYPE_LOCAL_INDEX_FIELD:
    548   1.1    jruoho 
    549   1.1    jruoho             AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
    550   1.1    jruoho                 AcpiUtGetNodeName (
    551   1.1    jruoho                     ObjDesc->IndexField.IndexObj->CommonField.Node),
    552   1.1    jruoho                 AcpiUtGetNodeName (
    553   1.1    jruoho                     ObjDesc->IndexField.DataObj->CommonField.Node));
    554   1.1    jruoho             break;
    555   1.1    jruoho 
    556   1.1    jruoho         case ACPI_TYPE_LOCAL_ALIAS:
    557   1.1    jruoho         case ACPI_TYPE_LOCAL_METHOD_ALIAS:
    558   1.1    jruoho 
    559   1.1    jruoho             AcpiOsPrintf ("Target %4.4s (%p)\n",
    560   1.1    jruoho                 AcpiUtGetNodeName (ObjDesc), ObjDesc);
    561   1.1    jruoho             break;
    562   1.1    jruoho 
    563   1.1    jruoho         default:
    564   1.1    jruoho 
    565   1.1    jruoho             AcpiOsPrintf ("Object %p\n", ObjDesc);
    566   1.1    jruoho             break;
    567   1.1    jruoho         }
    568   1.1    jruoho 
    569   1.1    jruoho         /* Common field handling */
    570   1.1    jruoho 
    571   1.1    jruoho         switch (Type)
    572   1.1    jruoho         {
    573   1.1    jruoho         case ACPI_TYPE_BUFFER_FIELD:
    574   1.1    jruoho         case ACPI_TYPE_LOCAL_REGION_FIELD:
    575   1.1    jruoho         case ACPI_TYPE_LOCAL_BANK_FIELD:
    576   1.1    jruoho         case ACPI_TYPE_LOCAL_INDEX_FIELD:
    577   1.1    jruoho 
    578  1.17  christos             AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2X\n",
    579   1.1    jruoho                 (ObjDesc->CommonField.BaseByteOffset * 8)
    580   1.1    jruoho                     + ObjDesc->CommonField.StartFieldBitOffset,
    581   1.1    jruoho                 ObjDesc->CommonField.BitLength,
    582   1.1    jruoho                 ObjDesc->CommonField.AccessByteWidth);
    583   1.1    jruoho             break;
    584   1.1    jruoho 
    585   1.1    jruoho         default:
    586   1.4  christos 
    587   1.1    jruoho             break;
    588   1.1    jruoho         }
    589   1.1    jruoho         break;
    590   1.1    jruoho 
    591   1.1    jruoho     case ACPI_DISPLAY_OBJECTS:
    592   1.1    jruoho 
    593   1.1    jruoho         AcpiOsPrintf ("O:%p", ObjDesc);
    594   1.1    jruoho         if (!ObjDesc)
    595   1.1    jruoho         {
    596   1.1    jruoho             /* No attached object, we are done */
    597   1.1    jruoho 
    598   1.1    jruoho             AcpiOsPrintf ("\n");
    599   1.1    jruoho             return (AE_OK);
    600   1.1    jruoho         }
    601   1.1    jruoho 
    602   1.1    jruoho         AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
    603   1.1    jruoho 
    604   1.1    jruoho         switch (Type)
    605   1.1    jruoho         {
    606   1.1    jruoho         case ACPI_TYPE_METHOD:
    607   1.1    jruoho 
    608   1.1    jruoho             /* Name is a Method and its AML offset/length are set */
    609   1.1    jruoho 
    610   1.1    jruoho             AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
    611   1.1    jruoho                 ObjDesc->Method.AmlLength);
    612   1.1    jruoho             break;
    613   1.1    jruoho 
    614   1.1    jruoho         case ACPI_TYPE_INTEGER:
    615   1.1    jruoho 
    616   1.1    jruoho             AcpiOsPrintf (" I:%8.8X8.8%X\n",
    617   1.1    jruoho                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
    618   1.1    jruoho             break;
    619   1.1    jruoho 
    620   1.1    jruoho         case ACPI_TYPE_STRING:
    621   1.1    jruoho 
    622   1.1    jruoho             AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
    623   1.1    jruoho                 ObjDesc->String.Length);
    624   1.1    jruoho             break;
    625   1.1    jruoho 
    626   1.1    jruoho         case ACPI_TYPE_BUFFER:
    627   1.1    jruoho 
    628   1.1    jruoho             AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
    629   1.1    jruoho                 ObjDesc->Buffer.Length);
    630   1.1    jruoho             break;
    631   1.1    jruoho 
    632   1.1    jruoho         default:
    633   1.1    jruoho 
    634   1.1    jruoho             AcpiOsPrintf ("\n");
    635   1.1    jruoho             break;
    636   1.1    jruoho         }
    637   1.1    jruoho         break;
    638   1.1    jruoho 
    639   1.1    jruoho     default:
    640   1.1    jruoho         AcpiOsPrintf ("\n");
    641   1.1    jruoho         break;
    642   1.1    jruoho     }
    643   1.1    jruoho 
    644   1.1    jruoho     /* If debug turned off, done */
    645   1.1    jruoho 
    646   1.1    jruoho     if (!(AcpiDbgLevel & ACPI_LV_VALUES))
    647   1.1    jruoho     {
    648   1.1    jruoho         return (AE_OK);
    649   1.1    jruoho     }
    650   1.1    jruoho 
    651   1.1    jruoho     /* If there is an attached object, display it */
    652   1.1    jruoho 
    653   1.8  christos     DbgLevel = AcpiDbgLevel;
    654   1.1    jruoho     AcpiDbgLevel = 0;
    655   1.8  christos     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
    656   1.1    jruoho     AcpiDbgLevel = DbgLevel;
    657   1.1    jruoho 
    658   1.1    jruoho     /* Dump attached objects */
    659   1.1    jruoho 
    660   1.1    jruoho     while (ObjDesc)
    661   1.1    jruoho     {
    662   1.1    jruoho         ObjType = ACPI_TYPE_INVALID;
    663   1.1    jruoho         AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
    664   1.1    jruoho 
    665   1.1    jruoho         /* Decode the type of attached object and dump the contents */
    666   1.1    jruoho 
    667   1.1    jruoho         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
    668   1.1    jruoho         {
    669   1.1    jruoho         case ACPI_DESC_TYPE_NAMED:
    670   1.1    jruoho 
    671   1.1    jruoho             AcpiOsPrintf ("(Ptr to Node)\n");
    672   1.1    jruoho             BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
    673   1.1    jruoho             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
    674   1.1    jruoho             break;
    675   1.1    jruoho 
    676   1.1    jruoho         case ACPI_DESC_TYPE_OPERAND:
    677   1.1    jruoho 
    678   1.1    jruoho             ObjType = ObjDesc->Common.Type;
    679   1.1    jruoho 
    680   1.1    jruoho             if (ObjType > ACPI_TYPE_LOCAL_MAX)
    681   1.1    jruoho             {
    682   1.8  christos                 AcpiOsPrintf (
    683   1.8  christos                     "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
    684   1.1    jruoho                     ObjType);
    685   1.8  christos 
    686   1.1    jruoho                 BytesToDump = 32;
    687   1.1    jruoho             }
    688   1.1    jruoho             else
    689   1.1    jruoho             {
    690   1.8  christos                 AcpiOsPrintf (
    691   1.8  christos                     "(Pointer to ACPI Object type %.2X [%s])\n",
    692   1.1    jruoho                     ObjType, AcpiUtGetTypeName (ObjType));
    693   1.8  christos 
    694   1.1    jruoho                 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
    695   1.1    jruoho             }
    696   1.1    jruoho 
    697   1.1    jruoho             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
    698   1.1    jruoho             break;
    699   1.1    jruoho 
    700   1.1    jruoho         default:
    701   1.1    jruoho 
    702   1.1    jruoho             break;
    703   1.1    jruoho         }
    704   1.1    jruoho 
    705   1.1    jruoho         /* If value is NOT an internal object, we are done */
    706   1.1    jruoho 
    707   1.1    jruoho         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
    708   1.1    jruoho         {
    709   1.1    jruoho             goto Cleanup;
    710   1.1    jruoho         }
    711   1.1    jruoho 
    712   1.1    jruoho         /* Valid object, get the pointer to next level, if any */
    713   1.1    jruoho 
    714   1.1    jruoho         switch (ObjType)
    715   1.1    jruoho         {
    716   1.1    jruoho         case ACPI_TYPE_BUFFER:
    717   1.1    jruoho         case ACPI_TYPE_STRING:
    718   1.1    jruoho             /*
    719   1.1    jruoho              * NOTE: takes advantage of common fields between string/buffer
    720   1.1    jruoho              */
    721   1.1    jruoho             BytesToDump = ObjDesc->String.Length;
    722   1.1    jruoho             ObjDesc = (void *) ObjDesc->String.Pointer;
    723   1.8  christos 
    724   1.8  christos             AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n",
    725   1.1    jruoho                 ObjDesc, BytesToDump);
    726   1.1    jruoho             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
    727   1.1    jruoho             goto Cleanup;
    728   1.1    jruoho 
    729   1.1    jruoho         case ACPI_TYPE_BUFFER_FIELD:
    730   1.4  christos 
    731   1.1    jruoho             ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
    732   1.1    jruoho             break;
    733   1.1    jruoho 
    734   1.1    jruoho         case ACPI_TYPE_PACKAGE:
    735   1.4  christos 
    736   1.1    jruoho             ObjDesc = (void *) ObjDesc->Package.Elements;
    737   1.1    jruoho             break;
    738   1.1    jruoho 
    739   1.1    jruoho         case ACPI_TYPE_METHOD:
    740   1.4  christos 
    741   1.1    jruoho             ObjDesc = (void *) ObjDesc->Method.AmlStart;
    742   1.1    jruoho             break;
    743   1.1    jruoho 
    744   1.1    jruoho         case ACPI_TYPE_LOCAL_REGION_FIELD:
    745   1.4  christos 
    746   1.1    jruoho             ObjDesc = (void *) ObjDesc->Field.RegionObj;
    747   1.1    jruoho             break;
    748   1.1    jruoho 
    749   1.1    jruoho         case ACPI_TYPE_LOCAL_BANK_FIELD:
    750   1.4  christos 
    751   1.1    jruoho             ObjDesc = (void *) ObjDesc->BankField.RegionObj;
    752   1.1    jruoho             break;
    753   1.1    jruoho 
    754   1.1    jruoho         case ACPI_TYPE_LOCAL_INDEX_FIELD:
    755   1.4  christos 
    756   1.1    jruoho             ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
    757   1.1    jruoho             break;
    758   1.1    jruoho 
    759   1.1    jruoho         default:
    760   1.4  christos 
    761   1.1    jruoho             goto Cleanup;
    762   1.1    jruoho         }
    763   1.1    jruoho     }
    764   1.1    jruoho 
    765   1.1    jruoho Cleanup:
    766   1.1    jruoho     AcpiOsPrintf ("\n");
    767   1.1    jruoho     return (AE_OK);
    768   1.1    jruoho }
    769   1.1    jruoho 
    770   1.1    jruoho 
    771   1.1    jruoho /*******************************************************************************
    772   1.1    jruoho  *
    773   1.1    jruoho  * FUNCTION:    AcpiNsDumpObjects
    774   1.1    jruoho  *
    775   1.1    jruoho  * PARAMETERS:  Type                - Object type to be dumped
    776   1.1    jruoho  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
    777   1.1    jruoho  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
    778   1.1    jruoho  *                                    for an effectively unlimited depth.
    779   1.1    jruoho  *              OwnerId             - Dump only objects owned by this ID. Use
    780   1.1    jruoho  *                                    ACPI_UINT32_MAX to match all owners.
    781   1.1    jruoho  *              StartHandle         - Where in namespace to start/end search
    782   1.1    jruoho  *
    783   1.1    jruoho  * RETURN:      None
    784   1.1    jruoho  *
    785   1.1    jruoho  * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
    786   1.1    jruoho  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
    787   1.1    jruoho  *
    788   1.1    jruoho  ******************************************************************************/
    789   1.1    jruoho 
    790   1.1    jruoho void
    791   1.1    jruoho AcpiNsDumpObjects (
    792   1.1    jruoho     ACPI_OBJECT_TYPE        Type,
    793   1.1    jruoho     UINT8                   DisplayType,
    794   1.1    jruoho     UINT32                  MaxDepth,
    795   1.1    jruoho     ACPI_OWNER_ID           OwnerId,
    796   1.1    jruoho     ACPI_HANDLE             StartHandle)
    797   1.1    jruoho {
    798   1.1    jruoho     ACPI_WALK_INFO          Info;
    799   1.3    jruoho     ACPI_STATUS             Status;
    800   1.1    jruoho 
    801   1.1    jruoho 
    802   1.1    jruoho     ACPI_FUNCTION_ENTRY ();
    803   1.1    jruoho 
    804   1.1    jruoho 
    805   1.3    jruoho     /*
    806   1.3    jruoho      * Just lock the entire namespace for the duration of the dump.
    807   1.3    jruoho      * We don't want any changes to the namespace during this time,
    808   1.3    jruoho      * especially the temporary nodes since we are going to display
    809   1.3    jruoho      * them also.
    810   1.3    jruoho      */
    811   1.3    jruoho     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    812   1.3    jruoho     if (ACPI_FAILURE (Status))
    813   1.3    jruoho     {
    814   1.3    jruoho         AcpiOsPrintf ("Could not acquire namespace mutex\n");
    815   1.3    jruoho         return;
    816   1.3    jruoho     }
    817   1.3    jruoho 
    818  1.13  christos     Info.Count = 0;
    819   1.1    jruoho     Info.DebugLevel = ACPI_LV_TABLES;
    820   1.1    jruoho     Info.OwnerId = OwnerId;
    821   1.1    jruoho     Info.DisplayType = DisplayType;
    822   1.1    jruoho 
    823   1.1    jruoho     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
    824   1.8  christos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
    825   1.8  christos         AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
    826   1.3    jruoho 
    827  1.13  christos     AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count);
    828   1.3    jruoho     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
    829   1.1    jruoho }
    830   1.1    jruoho 
    831   1.1    jruoho 
    832   1.1    jruoho /*******************************************************************************
    833   1.1    jruoho  *
    834   1.4  christos  * FUNCTION:    AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
    835   1.4  christos  *
    836   1.4  christos  * PARAMETERS:  ObjHandle           - Node to be dumped
    837   1.4  christos  *              Level               - Nesting level of the handle
    838   1.4  christos  *              Context             - Passed into WalkNamespace
    839   1.4  christos  *              ReturnValue         - Not used
    840   1.4  christos  *
    841   1.4  christos  * RETURN:      Status
    842   1.4  christos  *
    843   1.4  christos  * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
    844   1.4  christos  *              computes the maximum nesting depth in the namespace tree, in
    845   1.4  christos  *              order to simplify formatting in AcpiNsDumpOneObjectPath.
    846   1.4  christos  *              These procedures are UserFunctions called by AcpiNsWalkNamespace.
    847   1.4  christos  *
    848   1.4  christos  ******************************************************************************/
    849   1.4  christos 
    850   1.4  christos static ACPI_STATUS
    851   1.4  christos AcpiNsDumpOneObjectPath (
    852   1.4  christos     ACPI_HANDLE             ObjHandle,
    853   1.4  christos     UINT32                  Level,
    854   1.4  christos     void                    *Context,
    855   1.4  christos     void                    **ReturnValue)
    856   1.4  christos {
    857   1.4  christos     UINT32                  MaxLevel = *((UINT32 *) Context);
    858   1.4  christos     char                    *Pathname;
    859   1.4  christos     ACPI_NAMESPACE_NODE     *Node;
    860   1.4  christos     int                     PathIndent;
    861   1.4  christos 
    862   1.4  christos 
    863   1.4  christos     if (!ObjHandle)
    864   1.4  christos     {
    865   1.4  christos         return (AE_OK);
    866   1.4  christos     }
    867   1.4  christos 
    868   1.4  christos     Node = AcpiNsValidateHandle (ObjHandle);
    869   1.4  christos     if (!Node)
    870   1.4  christos     {
    871   1.4  christos         /* Ignore bad node during namespace walk */
    872   1.4  christos 
    873   1.4  christos         return (AE_OK);
    874   1.4  christos     }
    875   1.4  christos 
    876   1.8  christos     Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
    877   1.4  christos 
    878   1.4  christos     PathIndent = 1;
    879   1.4  christos     if (Level <= MaxLevel)
    880   1.4  christos     {
    881   1.4  christos         PathIndent = MaxLevel - Level + 1;
    882   1.4  christos     }
    883   1.4  christos 
    884   1.4  christos     AcpiOsPrintf ("%2d%*s%-12s%*s",
    885   1.4  christos         Level, Level, " ", AcpiUtGetTypeName (Node->Type),
    886   1.4  christos         PathIndent, " ");
    887   1.4  christos 
    888   1.4  christos     AcpiOsPrintf ("%s\n", &Pathname[1]);
    889   1.4  christos     ACPI_FREE (Pathname);
    890   1.4  christos     return (AE_OK);
    891   1.4  christos }
    892   1.4  christos 
    893   1.4  christos 
    894   1.4  christos static ACPI_STATUS
    895   1.4  christos AcpiNsGetMaxDepth (
    896   1.4  christos     ACPI_HANDLE             ObjHandle,
    897   1.4  christos     UINT32                  Level,
    898   1.4  christos     void                    *Context,
    899   1.4  christos     void                    **ReturnValue)
    900   1.4  christos {
    901   1.4  christos     UINT32                  *MaxLevel = (UINT32 *) Context;
    902   1.4  christos 
    903   1.4  christos 
    904   1.4  christos     if (Level > *MaxLevel)
    905   1.4  christos     {
    906   1.4  christos         *MaxLevel = Level;
    907   1.4  christos     }
    908   1.4  christos     return (AE_OK);
    909   1.4  christos }
    910   1.4  christos 
    911   1.4  christos 
    912   1.4  christos /*******************************************************************************
    913   1.4  christos  *
    914   1.4  christos  * FUNCTION:    AcpiNsDumpObjectPaths
    915   1.4  christos  *
    916   1.4  christos  * PARAMETERS:  Type                - Object type to be dumped
    917   1.4  christos  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
    918   1.4  christos  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
    919   1.4  christos  *                                    for an effectively unlimited depth.
    920   1.4  christos  *              OwnerId             - Dump only objects owned by this ID. Use
    921   1.4  christos  *                                    ACPI_UINT32_MAX to match all owners.
    922   1.4  christos  *              StartHandle         - Where in namespace to start/end search
    923   1.4  christos  *
    924   1.4  christos  * RETURN:      None
    925   1.4  christos  *
    926   1.4  christos  * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
    927   1.4  christos  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
    928   1.4  christos  *
    929   1.4  christos  ******************************************************************************/
    930   1.4  christos 
    931   1.4  christos void
    932   1.4  christos AcpiNsDumpObjectPaths (
    933   1.4  christos     ACPI_OBJECT_TYPE        Type,
    934   1.4  christos     UINT8                   DisplayType,
    935   1.4  christos     UINT32                  MaxDepth,
    936   1.4  christos     ACPI_OWNER_ID           OwnerId,
    937   1.4  christos     ACPI_HANDLE             StartHandle)
    938   1.4  christos {
    939   1.4  christos     ACPI_STATUS             Status;
    940   1.4  christos     UINT32                  MaxLevel = 0;
    941   1.4  christos 
    942   1.4  christos 
    943   1.4  christos     ACPI_FUNCTION_ENTRY ();
    944   1.4  christos 
    945   1.4  christos 
    946   1.4  christos     /*
    947   1.4  christos      * Just lock the entire namespace for the duration of the dump.
    948   1.4  christos      * We don't want any changes to the namespace during this time,
    949   1.4  christos      * especially the temporary nodes since we are going to display
    950   1.4  christos      * them also.
    951   1.4  christos      */
    952   1.4  christos     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    953   1.4  christos     if (ACPI_FAILURE (Status))
    954   1.4  christos     {
    955   1.4  christos         AcpiOsPrintf ("Could not acquire namespace mutex\n");
    956   1.4  christos         return;
    957   1.4  christos     }
    958   1.4  christos 
    959   1.4  christos     /* Get the max depth of the namespace tree, for formatting later */
    960   1.4  christos 
    961   1.4  christos     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
    962   1.8  christos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
    963   1.8  christos         AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
    964   1.4  christos 
    965   1.4  christos     /* Now dump the entire namespace */
    966   1.4  christos 
    967   1.4  christos     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
    968   1.8  christos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
    969   1.8  christos         AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
    970   1.4  christos 
    971   1.4  christos     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
    972   1.4  christos }
    973   1.4  christos 
    974   1.4  christos 
    975   1.4  christos /*******************************************************************************
    976   1.4  christos  *
    977   1.1    jruoho  * FUNCTION:    AcpiNsDumpEntry
    978   1.1    jruoho  *
    979   1.1    jruoho  * PARAMETERS:  Handle              - Node to be dumped
    980   1.1    jruoho  *              DebugLevel          - Output level
    981   1.1    jruoho  *
    982   1.1    jruoho  * RETURN:      None
    983   1.1    jruoho  *
    984   1.1    jruoho  * DESCRIPTION: Dump a single Node
    985   1.1    jruoho  *
    986   1.1    jruoho  ******************************************************************************/
    987   1.1    jruoho 
    988   1.1    jruoho void
    989   1.1    jruoho AcpiNsDumpEntry (
    990   1.1    jruoho     ACPI_HANDLE             Handle,
    991   1.1    jruoho     UINT32                  DebugLevel)
    992   1.1    jruoho {
    993   1.1    jruoho     ACPI_WALK_INFO          Info;
    994   1.1    jruoho 
    995   1.1    jruoho 
    996   1.1    jruoho     ACPI_FUNCTION_ENTRY ();
    997   1.1    jruoho 
    998   1.1    jruoho 
    999   1.1    jruoho     Info.DebugLevel = DebugLevel;
   1000   1.1    jruoho     Info.OwnerId = ACPI_OWNER_ID_MAX;
   1001   1.1    jruoho     Info.DisplayType = ACPI_DISPLAY_SUMMARY;
   1002   1.1    jruoho 
   1003   1.1    jruoho     (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
   1004   1.1    jruoho }
   1005   1.1    jruoho 
   1006   1.1    jruoho 
   1007   1.1    jruoho #ifdef ACPI_ASL_COMPILER
   1008   1.1    jruoho /*******************************************************************************
   1009   1.1    jruoho  *
   1010   1.1    jruoho  * FUNCTION:    AcpiNsDumpTables
   1011   1.1    jruoho  *
   1012   1.1    jruoho  * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
   1013   1.1    jruoho  *                                    NS_ALL to dump the entire namespace
   1014   1.4  christos  *              MaxDepth            - Maximum depth of dump. Use INT_MAX
   1015   1.1    jruoho  *                                    for an effectively unlimited depth.
   1016   1.1    jruoho  *
   1017   1.1    jruoho  * RETURN:      None
   1018   1.1    jruoho  *
   1019   1.1    jruoho  * DESCRIPTION: Dump the name space, or a portion of it.
   1020   1.1    jruoho  *
   1021   1.1    jruoho  ******************************************************************************/
   1022   1.1    jruoho 
   1023   1.1    jruoho void
   1024   1.1    jruoho AcpiNsDumpTables (
   1025   1.1    jruoho     ACPI_HANDLE             SearchBase,
   1026   1.1    jruoho     UINT32                  MaxDepth)
   1027   1.1    jruoho {
   1028   1.1    jruoho     ACPI_HANDLE             SearchHandle = SearchBase;
   1029   1.1    jruoho 
   1030   1.1    jruoho 
   1031   1.1    jruoho     ACPI_FUNCTION_TRACE (NsDumpTables);
   1032   1.1    jruoho 
   1033   1.1    jruoho 
   1034   1.1    jruoho     if (!AcpiGbl_RootNode)
   1035   1.1    jruoho     {
   1036   1.1    jruoho         /*
   1037   1.1    jruoho          * If the name space has not been initialized,
   1038   1.1    jruoho          * there is nothing to dump.
   1039   1.1    jruoho          */
   1040   1.8  christos         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
   1041   1.8  christos             "namespace not initialized!\n"));
   1042   1.1    jruoho         return_VOID;
   1043   1.1    jruoho     }
   1044   1.1    jruoho 
   1045   1.1    jruoho     if (ACPI_NS_ALL == SearchBase)
   1046   1.1    jruoho     {
   1047   1.1    jruoho         /* Entire namespace */
   1048   1.1    jruoho 
   1049   1.1    jruoho         SearchHandle = AcpiGbl_RootNode;
   1050   1.1    jruoho         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
   1051   1.1    jruoho     }
   1052   1.1    jruoho 
   1053   1.1    jruoho     AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
   1054   1.8  christos         ACPI_OWNER_ID_MAX, SearchHandle);
   1055   1.1    jruoho     return_VOID;
   1056   1.1    jruoho }
   1057   1.1    jruoho #endif
   1058   1.1    jruoho #endif
   1059