Subversion Repositories Kolibri OS

Rev

Rev 1498 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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