Home | History | Annotate | Line # | Download | only in namespace
nsdump.c revision 1.1.1.20
      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.1.1.20  christos /******************************************************************************
      8  1.1.1.20  christos  *
      9  1.1.1.20  christos  * 1. Copyright Notice
     10  1.1.1.20  christos  *
     11  1.1.1.20  christos  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
     12       1.1    jruoho  * All rights reserved.
     13       1.1    jruoho  *
     14  1.1.1.20  christos  * 2. License
     15  1.1.1.20  christos  *
     16  1.1.1.20  christos  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.1.1.20  christos  * rights. You may have additional license terms from the party that provided
     18  1.1.1.20  christos  * you this software, covering your right to use that party's intellectual
     19  1.1.1.20  christos  * property rights.
     20  1.1.1.20  christos  *
     21  1.1.1.20  christos  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.1.1.20  christos  * copy of the source code appearing in this file ("Covered Code") an
     23  1.1.1.20  christos  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.1.1.20  christos  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.1.1.20  christos 
     26  1.1.1.20  christos  * make derivatives, distribute, use and display any portion of the Covered
     27  1.1.1.20  christos  * Code in any form, with the right to sublicense such rights; and
     28  1.1.1.20  christos  *
     29  1.1.1.20  christos  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     30  1.1.1.20  christos  * license (with the right to sublicense), under only those claims of Intel
     31  1.1.1.20  christos  * patents that are infringed by the Original Intel Code, to make, use, sell,
     32  1.1.1.20  christos  * offer to sell, and import the Covered Code and derivative works thereof
     33  1.1.1.20  christos  * solely to the minimum extent necessary to exercise the above copyright
     34  1.1.1.20  christos  * license, and in no event shall the patent license extend to any additions
     35  1.1.1.20  christos  * to or modifications of the Original Intel Code. No other license or right
     36  1.1.1.20  christos  * is granted directly or by implication, estoppel or otherwise;
     37  1.1.1.20  christos  *
     38  1.1.1.20  christos  * The above copyright and patent license is granted only if the following
     39  1.1.1.20  christos  * conditions are met:
     40  1.1.1.20  christos  *
     41  1.1.1.20  christos  * 3. Conditions
     42  1.1.1.20  christos  *
     43  1.1.1.20  christos  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     44  1.1.1.20  christos  * Redistribution of source code of any substantial portion of the Covered
     45  1.1.1.20  christos  * Code or modification with rights to further distribute source must include
     46  1.1.1.20  christos  * the above Copyright Notice, the above License, this list of Conditions,
     47  1.1.1.20  christos  * and the following Disclaimer and Export Compliance provision. In addition,
     48  1.1.1.20  christos  * Licensee must cause all Covered Code to which Licensee contributes to
     49  1.1.1.20  christos  * contain a file documenting the changes Licensee made to create that Covered
     50  1.1.1.20  christos  * Code and the date of any change. Licensee must include in that file the
     51  1.1.1.20  christos  * documentation of any changes made by any predecessor Licensee. Licensee
     52  1.1.1.20  christos  * must include a prominent statement that the modification is derived,
     53  1.1.1.20  christos  * directly or indirectly, from Original Intel Code.
     54  1.1.1.20  christos  *
     55  1.1.1.20  christos  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     56  1.1.1.20  christos  * Redistribution of source code of any substantial portion of the Covered
     57  1.1.1.20  christos  * Code or modification without rights to further distribute source must
     58  1.1.1.20  christos  * include the following Disclaimer and Export Compliance provision in the
     59  1.1.1.20  christos  * documentation and/or other materials provided with distribution. In
     60  1.1.1.20  christos  * addition, Licensee may not authorize further sublicense of source of any
     61  1.1.1.20  christos  * portion of the Covered Code, and must include terms to the effect that the
     62  1.1.1.20  christos  * license from Licensee to its licensee is limited to the intellectual
     63  1.1.1.20  christos  * property embodied in the software Licensee provides to its licensee, and
     64  1.1.1.20  christos  * not to intellectual property embodied in modifications its licensee may
     65  1.1.1.20  christos  * make.
     66  1.1.1.20  christos  *
     67  1.1.1.20  christos  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     68  1.1.1.20  christos  * substantial portion of the Covered Code or modification must reproduce the
     69  1.1.1.20  christos  * above Copyright Notice, and the following Disclaimer and Export Compliance
     70  1.1.1.20  christos  * provision in the documentation and/or other materials provided with the
     71  1.1.1.20  christos  * distribution.
     72  1.1.1.20  christos  *
     73  1.1.1.20  christos  * 3.4. Intel retains all right, title, and interest in and to the Original
     74  1.1.1.20  christos  * Intel Code.
     75  1.1.1.20  christos  *
     76  1.1.1.20  christos  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     77  1.1.1.20  christos  * Intel shall be used in advertising or otherwise to promote the sale, use or
     78  1.1.1.20  christos  * other dealings in products derived from or relating to the Covered Code
     79  1.1.1.20  christos  * without prior written authorization from Intel.
     80  1.1.1.20  christos  *
     81  1.1.1.20  christos  * 4. Disclaimer and Export Compliance
     82  1.1.1.20  christos  *
     83  1.1.1.20  christos  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     84  1.1.1.20  christos  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     85  1.1.1.20  christos  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     86  1.1.1.20  christos  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     87  1.1.1.20  christos  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     88  1.1.1.20  christos  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     89  1.1.1.20  christos  * PARTICULAR PURPOSE.
     90  1.1.1.20  christos  *
     91  1.1.1.20  christos  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     92  1.1.1.20  christos  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     93  1.1.1.20  christos  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     94  1.1.1.20  christos  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     95  1.1.1.20  christos  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     96  1.1.1.20  christos  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     97  1.1.1.20  christos  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     98  1.1.1.20  christos  * LIMITED REMEDY.
     99  1.1.1.20  christos  *
    100  1.1.1.20  christos  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    101  1.1.1.20  christos  * software or system incorporating such software without first obtaining any
    102  1.1.1.20  christos  * required license or other approval from the U. S. Department of Commerce or
    103  1.1.1.20  christos  * any other agency or department of the United States Government. In the
    104  1.1.1.20  christos  * event Licensee exports any such software from the United States or
    105  1.1.1.20  christos  * re-exports any such software from a foreign destination, Licensee shall
    106  1.1.1.20  christos  * ensure that the distribution and export/re-export of the software is in
    107  1.1.1.20  christos  * compliance with all laws, regulations, orders, or other restrictions of the
    108  1.1.1.20  christos  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    109  1.1.1.20  christos  * any of its subsidiaries will export/re-export any technical data, process,
    110  1.1.1.20  christos  * software, or service, directly or indirectly, to any country for which the
    111  1.1.1.20  christos  * United States government or any agency thereof requires an export license,
    112  1.1.1.20  christos  * other governmental approval, or letter of assurance, without first obtaining
    113  1.1.1.20  christos  * such license, approval or letter.
    114  1.1.1.20  christos  *
    115  1.1.1.20  christos  *****************************************************************************
    116  1.1.1.20  christos  *
    117  1.1.1.20  christos  * Alternatively, you may choose to be licensed under the terms of the
    118  1.1.1.20  christos  * following license:
    119  1.1.1.20  christos  *
    120   1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
    121   1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
    122   1.1.1.2    jruoho  * are met:
    123   1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
    124   1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
    125   1.1.1.2    jruoho  *    without modification.
    126   1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    127   1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
    128   1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
    129   1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
    130   1.1.1.2    jruoho  *    binary redistribution.
    131   1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
    132   1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
    133   1.1.1.2    jruoho  *    from this software without specific prior written permission.
    134   1.1.1.2    jruoho  *
    135   1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    136   1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    137  1.1.1.17  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    138   1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    139  1.1.1.20  christos  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    140  1.1.1.20  christos  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    141  1.1.1.20  christos  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    142  1.1.1.20  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    143  1.1.1.20  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    144  1.1.1.20  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    145  1.1.1.20  christos  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    146  1.1.1.20  christos  *
    147  1.1.1.20  christos  * Alternatively, you may choose to be licensed under the terms of the
    148  1.1.1.20  christos  * GNU General Public License ("GPL") version 2 as published by the Free
    149  1.1.1.20  christos  * Software Foundation.
    150  1.1.1.20  christos  *
    151  1.1.1.20  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.1.1.3  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.1.1.3  christos 
    180   1.1.1.3  christos static ACPI_STATUS
    181   1.1.1.3  christos AcpiNsDumpOneObjectPath (
    182   1.1.1.3  christos     ACPI_HANDLE             ObjHandle,
    183   1.1.1.3  christos     UINT32                  Level,
    184   1.1.1.3  christos     void                    *Context,
    185   1.1.1.3  christos     void                    **ReturnValue);
    186   1.1.1.3  christos 
    187   1.1.1.3  christos static ACPI_STATUS
    188   1.1.1.3  christos AcpiNsGetMaxDepth (
    189   1.1.1.3  christos     ACPI_HANDLE             ObjHandle,
    190   1.1.1.3  christos     UINT32                  Level,
    191   1.1.1.3  christos     void                    *Context,
    192   1.1.1.3  christos     void                    **ReturnValue);
    193   1.1.1.3  christos 
    194   1.1.1.3  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.1.1.8  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.1.1.3  christos     /* Check if debug output enabled */
    220   1.1.1.3  christos 
    221   1.1.1.3  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.1.1.6  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.1.1.13  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.1.1.8  christos #ifdef ACPI_OBSOLETE_FUNCTIONS
    252   1.1.1.8  christos /* Not used at this time, perhaps later */
    253   1.1.1.8  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.1.1.8  christos     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.1.1.3  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.1.1.8  christos #endif
    295       1.1    jruoho 
    296  1.1.1.12  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.1.1.12  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.1.1.7  christos             ACPI_WARNING ((AE_INFO,
    376   1.1.1.7  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.1.1.14  christos     AcpiOsPrintf (" %-12s %p %3.3X ",
    385   1.1.1.7  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.1.1.3  christos             /* No attached object. Some types should always have an object */
    406   1.1.1.3  christos 
    407   1.1.1.3  christos             switch (Type)
    408   1.1.1.3  christos             {
    409   1.1.1.3  christos             case ACPI_TYPE_INTEGER:
    410   1.1.1.3  christos             case ACPI_TYPE_PACKAGE:
    411   1.1.1.3  christos             case ACPI_TYPE_BUFFER:
    412   1.1.1.3  christos             case ACPI_TYPE_STRING:
    413   1.1.1.3  christos             case ACPI_TYPE_METHOD:
    414   1.1.1.3  christos 
    415   1.1.1.3  christos                 AcpiOsPrintf ("<No attached object>");
    416   1.1.1.3  christos                 break;
    417   1.1.1.3  christos 
    418   1.1.1.3  christos             default:
    419   1.1.1.3  christos 
    420   1.1.1.3  christos                 break;
    421   1.1.1.3  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.1.1.5  christos             AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
    432       1.1    jruoho                 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
    433   1.1.1.5  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.1.1.7  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.1.1.15  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.1.1.9  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.1.1.5  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.1.1.15  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.1.1.3  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.1.1.7  christos     DbgLevel = AcpiDbgLevel;
    654       1.1    jruoho     AcpiDbgLevel = 0;
    655   1.1.1.7  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.1.1.7  christos                 AcpiOsPrintf (
    683   1.1.1.7  christos                     "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
    684       1.1    jruoho                     ObjType);
    685   1.1.1.7  christos 
    686       1.1    jruoho                 BytesToDump = 32;
    687       1.1    jruoho             }
    688       1.1    jruoho             else
    689       1.1    jruoho             {
    690   1.1.1.7  christos                 AcpiOsPrintf (
    691   1.1.1.7  christos                     "(Pointer to ACPI Object type %.2X [%s])\n",
    692       1.1    jruoho                     ObjType, AcpiUtGetTypeName (ObjType));
    693   1.1.1.7  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.1.1.7  christos 
    724   1.1.1.7  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.1.1.3  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.1.1.3  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.1.1.3  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.1.1.3  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.1.1.3  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.1.1.3  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.1.1.3  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.1.1.2    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.1.1.2    jruoho     /*
    806   1.1.1.2    jruoho      * Just lock the entire namespace for the duration of the dump.
    807   1.1.1.2    jruoho      * We don't want any changes to the namespace during this time,
    808   1.1.1.2    jruoho      * especially the temporary nodes since we are going to display
    809   1.1.1.2    jruoho      * them also.
    810   1.1.1.2    jruoho      */
    811   1.1.1.2    jruoho     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    812   1.1.1.2    jruoho     if (ACPI_FAILURE (Status))
    813   1.1.1.2    jruoho     {
    814   1.1.1.2    jruoho         AcpiOsPrintf ("Could not acquire namespace mutex\n");
    815   1.1.1.2    jruoho         return;
    816   1.1.1.2    jruoho     }
    817   1.1.1.2    jruoho 
    818  1.1.1.12  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.1.1.7  christos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
    825   1.1.1.7  christos         AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
    826   1.1.1.2    jruoho 
    827  1.1.1.12  christos     AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count);
    828   1.1.1.2    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.1.1.3  christos  * FUNCTION:    AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
    835   1.1.1.3  christos  *
    836   1.1.1.3  christos  * PARAMETERS:  ObjHandle           - Node to be dumped
    837   1.1.1.3  christos  *              Level               - Nesting level of the handle
    838   1.1.1.3  christos  *              Context             - Passed into WalkNamespace
    839   1.1.1.3  christos  *              ReturnValue         - Not used
    840   1.1.1.3  christos  *
    841   1.1.1.3  christos  * RETURN:      Status
    842   1.1.1.3  christos  *
    843   1.1.1.3  christos  * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
    844   1.1.1.3  christos  *              computes the maximum nesting depth in the namespace tree, in
    845   1.1.1.3  christos  *              order to simplify formatting in AcpiNsDumpOneObjectPath.
    846   1.1.1.3  christos  *              These procedures are UserFunctions called by AcpiNsWalkNamespace.
    847   1.1.1.3  christos  *
    848   1.1.1.3  christos  ******************************************************************************/
    849   1.1.1.3  christos 
    850   1.1.1.3  christos static ACPI_STATUS
    851   1.1.1.3  christos AcpiNsDumpOneObjectPath (
    852   1.1.1.3  christos     ACPI_HANDLE             ObjHandle,
    853   1.1.1.3  christos     UINT32                  Level,
    854   1.1.1.3  christos     void                    *Context,
    855   1.1.1.3  christos     void                    **ReturnValue)
    856   1.1.1.3  christos {
    857   1.1.1.3  christos     UINT32                  MaxLevel = *((UINT32 *) Context);
    858   1.1.1.3  christos     char                    *Pathname;
    859   1.1.1.3  christos     ACPI_NAMESPACE_NODE     *Node;
    860   1.1.1.3  christos     int                     PathIndent;
    861   1.1.1.3  christos 
    862   1.1.1.3  christos 
    863   1.1.1.3  christos     if (!ObjHandle)
    864   1.1.1.3  christos     {
    865   1.1.1.3  christos         return (AE_OK);
    866   1.1.1.3  christos     }
    867   1.1.1.3  christos 
    868   1.1.1.3  christos     Node = AcpiNsValidateHandle (ObjHandle);
    869   1.1.1.3  christos     if (!Node)
    870   1.1.1.3  christos     {
    871   1.1.1.3  christos         /* Ignore bad node during namespace walk */
    872   1.1.1.3  christos 
    873   1.1.1.3  christos         return (AE_OK);
    874   1.1.1.3  christos     }
    875   1.1.1.3  christos 
    876   1.1.1.7  christos     Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
    877   1.1.1.3  christos 
    878   1.1.1.3  christos     PathIndent = 1;
    879   1.1.1.3  christos     if (Level <= MaxLevel)
    880   1.1.1.3  christos     {
    881   1.1.1.3  christos         PathIndent = MaxLevel - Level + 1;
    882   1.1.1.3  christos     }
    883   1.1.1.3  christos 
    884   1.1.1.3  christos     AcpiOsPrintf ("%2d%*s%-12s%*s",
    885   1.1.1.3  christos         Level, Level, " ", AcpiUtGetTypeName (Node->Type),
    886   1.1.1.3  christos         PathIndent, " ");
    887   1.1.1.3  christos 
    888   1.1.1.3  christos     AcpiOsPrintf ("%s\n", &Pathname[1]);
    889   1.1.1.3  christos     ACPI_FREE (Pathname);
    890   1.1.1.3  christos     return (AE_OK);
    891   1.1.1.3  christos }
    892   1.1.1.3  christos 
    893   1.1.1.3  christos 
    894   1.1.1.3  christos static ACPI_STATUS
    895   1.1.1.3  christos AcpiNsGetMaxDepth (
    896   1.1.1.3  christos     ACPI_HANDLE             ObjHandle,
    897   1.1.1.3  christos     UINT32                  Level,
    898   1.1.1.3  christos     void                    *Context,
    899   1.1.1.3  christos     void                    **ReturnValue)
    900   1.1.1.3  christos {
    901   1.1.1.3  christos     UINT32                  *MaxLevel = (UINT32 *) Context;
    902   1.1.1.3  christos 
    903   1.1.1.3  christos 
    904   1.1.1.3  christos     if (Level > *MaxLevel)
    905   1.1.1.3  christos     {
    906   1.1.1.3  christos         *MaxLevel = Level;
    907   1.1.1.3  christos     }
    908   1.1.1.3  christos     return (AE_OK);
    909   1.1.1.3  christos }
    910   1.1.1.3  christos 
    911   1.1.1.3  christos 
    912   1.1.1.3  christos /*******************************************************************************
    913   1.1.1.3  christos  *
    914   1.1.1.3  christos  * FUNCTION:    AcpiNsDumpObjectPaths
    915   1.1.1.3  christos  *
    916   1.1.1.3  christos  * PARAMETERS:  Type                - Object type to be dumped
    917   1.1.1.3  christos  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
    918   1.1.1.3  christos  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
    919   1.1.1.3  christos  *                                    for an effectively unlimited depth.
    920   1.1.1.3  christos  *              OwnerId             - Dump only objects owned by this ID. Use
    921   1.1.1.3  christos  *                                    ACPI_UINT32_MAX to match all owners.
    922   1.1.1.3  christos  *              StartHandle         - Where in namespace to start/end search
    923   1.1.1.3  christos  *
    924   1.1.1.3  christos  * RETURN:      None
    925   1.1.1.3  christos  *
    926   1.1.1.3  christos  * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
    927   1.1.1.3  christos  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
    928   1.1.1.3  christos  *
    929   1.1.1.3  christos  ******************************************************************************/
    930   1.1.1.3  christos 
    931   1.1.1.3  christos void
    932   1.1.1.3  christos AcpiNsDumpObjectPaths (
    933   1.1.1.3  christos     ACPI_OBJECT_TYPE        Type,
    934   1.1.1.3  christos     UINT8                   DisplayType,
    935   1.1.1.3  christos     UINT32                  MaxDepth,
    936   1.1.1.3  christos     ACPI_OWNER_ID           OwnerId,
    937   1.1.1.3  christos     ACPI_HANDLE             StartHandle)
    938   1.1.1.3  christos {
    939   1.1.1.3  christos     ACPI_STATUS             Status;
    940   1.1.1.3  christos     UINT32                  MaxLevel = 0;
    941   1.1.1.3  christos 
    942   1.1.1.3  christos 
    943   1.1.1.3  christos     ACPI_FUNCTION_ENTRY ();
    944   1.1.1.3  christos 
    945   1.1.1.3  christos 
    946   1.1.1.3  christos     /*
    947   1.1.1.3  christos      * Just lock the entire namespace for the duration of the dump.
    948   1.1.1.3  christos      * We don't want any changes to the namespace during this time,
    949   1.1.1.3  christos      * especially the temporary nodes since we are going to display
    950   1.1.1.3  christos      * them also.
    951   1.1.1.3  christos      */
    952   1.1.1.3  christos     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    953   1.1.1.3  christos     if (ACPI_FAILURE (Status))
    954   1.1.1.3  christos     {
    955   1.1.1.3  christos         AcpiOsPrintf ("Could not acquire namespace mutex\n");
    956   1.1.1.3  christos         return;
    957   1.1.1.3  christos     }
    958   1.1.1.3  christos 
    959   1.1.1.3  christos     /* Get the max depth of the namespace tree, for formatting later */
    960   1.1.1.3  christos 
    961   1.1.1.3  christos     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
    962   1.1.1.7  christos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
    963   1.1.1.7  christos         AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
    964   1.1.1.3  christos 
    965   1.1.1.3  christos     /* Now dump the entire namespace */
    966   1.1.1.3  christos 
    967   1.1.1.3  christos     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
    968   1.1.1.7  christos         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
    969   1.1.1.7  christos         AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
    970   1.1.1.3  christos 
    971   1.1.1.3  christos     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
    972   1.1.1.3  christos }
    973   1.1.1.3  christos 
    974   1.1.1.3  christos 
    975   1.1.1.3  christos /*******************************************************************************
    976   1.1.1.3  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.1.1.3  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.1.1.7  christos         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
   1041   1.1.1.7  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.1.1.7  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