nsdump.c revision 87031
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Module Name: nsdump - table dumping routines for debug 487031Smsmith * $Revision: 116 $ 567754Smsmith * 667754Smsmith *****************************************************************************/ 767754Smsmith 867754Smsmith/****************************************************************************** 967754Smsmith * 1067754Smsmith * 1. Copyright Notice 1167754Smsmith * 1271867Smsmith * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. 1370243Smsmith * All rights reserved. 1467754Smsmith * 1567754Smsmith * 2. License 1667754Smsmith * 1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property 1867754Smsmith * rights. You may have additional license terms from the party that provided 1967754Smsmith * you this software, covering your right to use that party's intellectual 2067754Smsmith * property rights. 2167754Smsmith * 2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an 2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy, 2667754Smsmith 2767754Smsmith * make derivatives, distribute, use and display any portion of the Covered 2867754Smsmith * Code in any form, with the right to sublicense such rights; and 2967754Smsmith * 3067754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3167754Smsmith * license (with the right to sublicense), under only those claims of Intel 3267754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell, 3367754Smsmith * offer to sell, and import the Covered Code and derivative works thereof 3467754Smsmith * solely to the minimum extent necessary to exercise the above copyright 3567754Smsmith * license, and in no event shall the patent license extend to any additions 3667754Smsmith * to or modifications of the Original Intel Code. No other license or right 3767754Smsmith * is granted directly or by implication, estoppel or otherwise; 3867754Smsmith * 3967754Smsmith * The above copyright and patent license is granted only if the following 4067754Smsmith * conditions are met: 4167754Smsmith * 4267754Smsmith * 3. Conditions 4367754Smsmith * 4467754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4567754Smsmith * Redistribution of source code of any substantial portion of the Covered 4667754Smsmith * Code or modification with rights to further distribute source must include 4767754Smsmith * the above Copyright Notice, the above License, this list of Conditions, 4867754Smsmith * and the following Disclaimer and Export Compliance provision. In addition, 4967754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to 5067754Smsmith * contain a file documenting the changes Licensee made to create that Covered 5167754Smsmith * Code and the date of any change. Licensee must include in that file the 5267754Smsmith * documentation of any changes made by any predecessor Licensee. Licensee 5367754Smsmith * must include a prominent statement that the modification is derived, 5467754Smsmith * directly or indirectly, from Original Intel Code. 5567754Smsmith * 5667754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5767754Smsmith * Redistribution of source code of any substantial portion of the Covered 5867754Smsmith * Code or modification without rights to further distribute source must 5967754Smsmith * include the following Disclaimer and Export Compliance provision in the 6067754Smsmith * documentation and/or other materials provided with distribution. In 6167754Smsmith * addition, Licensee may not authorize further sublicense of source of any 6267754Smsmith * portion of the Covered Code, and must include terms to the effect that the 6367754Smsmith * license from Licensee to its licensee is limited to the intellectual 6467754Smsmith * property embodied in the software Licensee provides to its licensee, and 6567754Smsmith * not to intellectual property embodied in modifications its licensee may 6667754Smsmith * make. 6767754Smsmith * 6867754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any 6967754Smsmith * substantial portion of the Covered Code or modification must reproduce the 7067754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance 7167754Smsmith * provision in the documentation and/or other materials provided with the 7267754Smsmith * distribution. 7367754Smsmith * 7467754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original 7567754Smsmith * Intel Code. 7667754Smsmith * 7767754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by 7867754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or 7967754Smsmith * other dealings in products derived from or relating to the Covered Code 8067754Smsmith * without prior written authorization from Intel. 8167754Smsmith * 8267754Smsmith * 4. Disclaimer and Export Compliance 8367754Smsmith * 8467754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8567754Smsmith * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8667754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 8767754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 8867754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 8967754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 9067754Smsmith * PARTICULAR PURPOSE. 9167754Smsmith * 9267754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9367754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9467754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9567754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9667754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 9767754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 9867754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 9967754Smsmith * LIMITED REMEDY. 10067754Smsmith * 10167754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this 10267754Smsmith * software or system incorporating such software without first obtaining any 10367754Smsmith * required license or other approval from the U. S. Department of Commerce or 10467754Smsmith * any other agency or department of the United States Government. In the 10567754Smsmith * event Licensee exports any such software from the United States or 10667754Smsmith * re-exports any such software from a foreign destination, Licensee shall 10767754Smsmith * ensure that the distribution and export/re-export of the software is in 10867754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the 10967754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor 11067754Smsmith * any of its subsidiaries will export/re-export any technical data, process, 11167754Smsmith * software, or service, directly or indirectly, to any country for which the 11267754Smsmith * United States government or any agency thereof requires an export license, 11367754Smsmith * other governmental approval, or letter of assurance, without first obtaining 11467754Smsmith * such license, approval or letter. 11567754Smsmith * 11667754Smsmith *****************************************************************************/ 11767754Smsmith 11867754Smsmith#define __NSDUMP_C__ 11967754Smsmith 12067754Smsmith#include "acpi.h" 12167754Smsmith#include "acinterp.h" 12267754Smsmith#include "acnamesp.h" 12367754Smsmith#include "actables.h" 12485756Smsmith#include "acparser.h" 12567754Smsmith 12667754Smsmith 12777424Smsmith#define _COMPONENT ACPI_NAMESPACE 12867754Smsmith MODULE_NAME ("nsdump") 12967754Smsmith 13071867Smsmith#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) 13167754Smsmith 13287031Smsmith 13377424Smsmith/******************************************************************************* 13467754Smsmith * 13587031Smsmith * FUNCTION: AcpiNsPrintPathname 13687031Smsmith * 13787031Smsmith * PARAMETERS: NumSegment - Number of ACPI name segments 13887031Smsmith * Pathname - The compressed (internal) path 13987031Smsmith * 14087031Smsmith * DESCRIPTION: Print an object's full namespace pathname 14187031Smsmith * 14287031Smsmith ******************************************************************************/ 14387031Smsmith 14487031Smsmithvoid 14587031SmsmithAcpiNsPrintPathname ( 14687031Smsmith UINT32 NumSegments, 14787031Smsmith char *Pathname) 14887031Smsmith{ 14987031Smsmith UINT32 i; 15087031Smsmith 15187031Smsmith PROC_NAME ("AcpiNsPrintPathname"); 15287031Smsmith 15387031Smsmith 15487031Smsmith if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) 15587031Smsmith { 15687031Smsmith return; 15787031Smsmith } 15887031Smsmith 15987031Smsmith /* Print the entire name */ 16087031Smsmith 16187031Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); 16287031Smsmith 16387031Smsmith for (i = 0; i < NumSegments; i++) 16487031Smsmith { 16587031Smsmith AcpiOsPrintf ("%4.4s.", (char *) &Pathname[i * 4]); 16687031Smsmith } 16787031Smsmith 16887031Smsmith AcpiOsPrintf ("]\n"); 16987031Smsmith} 17087031Smsmith 17187031Smsmith 17287031Smsmith/******************************************************************************* 17387031Smsmith * 17467754Smsmith * FUNCTION: AcpiNsDumpPathname 17567754Smsmith * 17667754Smsmith * PARAMETERS: Handle - Object 17767754Smsmith * Msg - Prefix message 17867754Smsmith * Level - Desired debug level 17967754Smsmith * Component - Caller's component ID 18067754Smsmith * 18167754Smsmith * DESCRIPTION: Print an object's full namespace pathname 18267754Smsmith * Manages allocation/freeing of a pathname buffer 18367754Smsmith * 18477424Smsmith ******************************************************************************/ 18567754Smsmith 18667754SmsmithACPI_STATUS 18767754SmsmithAcpiNsDumpPathname ( 18867754Smsmith ACPI_HANDLE Handle, 18967754Smsmith NATIVE_CHAR *Msg, 19067754Smsmith UINT32 Level, 19167754Smsmith UINT32 Component) 19267754Smsmith{ 19367754Smsmith NATIVE_CHAR *Buffer; 19467754Smsmith UINT32 Length; 19567754Smsmith 19667754Smsmith 19767754Smsmith FUNCTION_TRACE ("NsDumpPathname"); 19867754Smsmith 19983174Smsmith 20067754Smsmith /* Do this only if the requested debug level and component are enabled */ 20167754Smsmith 20267754Smsmith if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) 20367754Smsmith { 20467754Smsmith return_ACPI_STATUS (AE_OK); 20567754Smsmith } 20667754Smsmith 20780062Smsmith Buffer = ACPI_MEM_ALLOCATE (PATHNAME_MAX); 20867754Smsmith if (!Buffer) 20967754Smsmith { 21067754Smsmith return_ACPI_STATUS (AE_NO_MEMORY); 21167754Smsmith } 21267754Smsmith 21367754Smsmith /* Convert handle to a full pathname and print it (with supplied message) */ 21467754Smsmith 21567754Smsmith Length = PATHNAME_MAX; 21667754Smsmith if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer))) 21767754Smsmith { 21887031Smsmith AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer, Handle); 21967754Smsmith } 22067754Smsmith 22180062Smsmith ACPI_MEM_FREE (Buffer); 22267754Smsmith 22367754Smsmith return_ACPI_STATUS (AE_OK); 22467754Smsmith} 22567754Smsmith 22667754Smsmith 22777424Smsmith/******************************************************************************* 22867754Smsmith * 22967754Smsmith * FUNCTION: AcpiNsDumpOneObject 23067754Smsmith * 23167754Smsmith * PARAMETERS: Handle - Node to be dumped 23267754Smsmith * Level - Nesting level of the handle 23367754Smsmith * Context - Passed into WalkNamespace 23467754Smsmith * 23567754Smsmith * DESCRIPTION: Dump a single Node 23667754Smsmith * This procedure is a UserFunction called by AcpiNsWalkNamespace. 23767754Smsmith * 23877424Smsmith ******************************************************************************/ 23967754Smsmith 24067754SmsmithACPI_STATUS 24167754SmsmithAcpiNsDumpOneObject ( 24267754Smsmith ACPI_HANDLE ObjHandle, 24367754Smsmith UINT32 Level, 24467754Smsmith void *Context, 24567754Smsmith void **ReturnValue) 24667754Smsmith{ 24767754Smsmith ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 24867754Smsmith ACPI_NAMESPACE_NODE *ThisNode; 24967754Smsmith ACPI_OPERAND_OBJECT *ObjDesc = NULL; 25077424Smsmith ACPI_OBJECT_TYPE8 ObjType; 25177424Smsmith ACPI_OBJECT_TYPE8 Type; 25267754Smsmith UINT32 BytesToDump; 25367754Smsmith UINT32 DownstreamSiblingMask = 0; 25467754Smsmith UINT32 LevelTmp; 25567754Smsmith UINT32 WhichBit; 25685756Smsmith UINT32 i; 25767754Smsmith 25867754Smsmith 25983174Smsmith PROC_NAME ("NsDumpOneObject"); 26082367Smsmith 26182367Smsmith 26285756Smsmith ThisNode = AcpiNsMapHandleToNode (ObjHandle); 26367754Smsmith 26467754Smsmith LevelTmp = Level; 26567754Smsmith Type = ThisNode->Type; 26667754Smsmith WhichBit = 1; 26767754Smsmith 26867754Smsmith 26967754Smsmith if (!(AcpiDbgLevel & Info->DebugLevel)) 27067754Smsmith { 27167754Smsmith return (AE_OK); 27267754Smsmith } 27367754Smsmith 27487031Smsmith if (!((ACPI_LV_TABLES & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) 27587031Smsmith { 27687031Smsmith return (AE_OK); 27787031Smsmith } 27887031Smsmith 27967754Smsmith if (!ObjHandle) 28067754Smsmith { 28182367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); 28267754Smsmith return (AE_OK); 28367754Smsmith } 28467754Smsmith 28567754Smsmith /* Check if the owner matches */ 28667754Smsmith 28767754Smsmith if ((Info->OwnerId != ACPI_UINT32_MAX) && 28867754Smsmith (Info->OwnerId != ThisNode->OwnerId)) 28967754Smsmith { 29067754Smsmith return (AE_OK); 29167754Smsmith } 29267754Smsmith 29367754Smsmith /* Indent the object according to the level */ 29467754Smsmith 29567754Smsmith while (LevelTmp--) 29667754Smsmith { 29767754Smsmith /* Print appropriate characters to form tree structure */ 29867754Smsmith 29967754Smsmith if (LevelTmp) 30067754Smsmith { 30167754Smsmith if (DownstreamSiblingMask & WhichBit) 30267754Smsmith { 30387031Smsmith AcpiOsPrintf ("|"); 30467754Smsmith } 30567754Smsmith else 30667754Smsmith { 30787031Smsmith AcpiOsPrintf (" "); 30867754Smsmith } 30967754Smsmith 31067754Smsmith WhichBit <<= 1; 31167754Smsmith } 31267754Smsmith else 31367754Smsmith { 31467754Smsmith if (AcpiNsExistDownstreamSibling (ThisNode + 1)) 31567754Smsmith { 31667754Smsmith DownstreamSiblingMask |= (1 << (Level - 1)); 31787031Smsmith AcpiOsPrintf ("+"); 31867754Smsmith } 31967754Smsmith else 32067754Smsmith { 32167754Smsmith DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1)); 32287031Smsmith AcpiOsPrintf ("+"); 32367754Smsmith } 32467754Smsmith 32567754Smsmith if (ThisNode->Child == NULL) 32667754Smsmith { 32787031Smsmith AcpiOsPrintf ("-"); 32867754Smsmith } 32967754Smsmith else if (AcpiNsExistDownstreamSibling (ThisNode->Child)) 33067754Smsmith { 33187031Smsmith AcpiOsPrintf ("+"); 33267754Smsmith } 33367754Smsmith else 33467754Smsmith { 33587031Smsmith AcpiOsPrintf ("-"); 33667754Smsmith } 33767754Smsmith } 33867754Smsmith } 33967754Smsmith 34067754Smsmith /* Check the integrity of our data */ 34167754Smsmith 34267754Smsmith if (Type > INTERNAL_TYPE_MAX) 34367754Smsmith { 34487031Smsmith Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */ 34567754Smsmith } 34667754Smsmith 34777424Smsmith if (!AcpiUtValidAcpiName (ThisNode->Name)) 34867754Smsmith { 34969746Smsmith REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); 35067754Smsmith } 35167754Smsmith 35267754Smsmith /* 35367754Smsmith * Now we can print out the pertinent information 35467754Smsmith */ 35587031Smsmith AcpiOsPrintf (" %4.4s %-12s %p", 35687031Smsmith (char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode); 35767754Smsmith 35887031Smsmith ObjDesc = AcpiNsGetAttachedObject (ThisNode); 35967754Smsmith 36085756Smsmith switch (Info->DisplayType) 36167754Smsmith { 36285756Smsmith case ACPI_DISPLAY_SUMMARY: 36367754Smsmith 36485756Smsmith if (!ObjDesc) 36585756Smsmith { 36685756Smsmith /* No attached object, we are done */ 36767754Smsmith 36887031Smsmith AcpiOsPrintf ("\n"); 36985756Smsmith return (AE_OK); 37085756Smsmith } 37167754Smsmith 37285756Smsmith switch (Type) 37385756Smsmith { 37485756Smsmith case ACPI_TYPE_PROCESSOR: 37587031Smsmith AcpiOsPrintf (" ID %d Addr %.4X Len %.4X\n", 37685756Smsmith ObjDesc->Processor.ProcId, 37785756Smsmith ObjDesc->Processor.Address, 37887031Smsmith ObjDesc->Processor.Length); 37985756Smsmith break; 38067754Smsmith 38185756Smsmith case ACPI_TYPE_DEVICE: 38287031Smsmith AcpiOsPrintf (" Notification object: %p", ObjDesc); 38385756Smsmith break; 38467754Smsmith 38585756Smsmith case ACPI_TYPE_METHOD: 38687031Smsmith AcpiOsPrintf (" Args %d Len %.4X Aml %p \n", 38785756Smsmith ObjDesc->Method.ParamCount, 38885756Smsmith ObjDesc->Method.AmlLength, 38987031Smsmith ObjDesc->Method.AmlStart); 39085756Smsmith break; 39167754Smsmith 39285756Smsmith case ACPI_TYPE_INTEGER: 39387031Smsmith AcpiOsPrintf (" = %8.8X%8.8X\n", 39485756Smsmith HIDWORD (ObjDesc->Integer.Value), 39587031Smsmith LODWORD (ObjDesc->Integer.Value)); 39685756Smsmith break; 39767754Smsmith 39885756Smsmith case ACPI_TYPE_PACKAGE: 39987031Smsmith AcpiOsPrintf (" Elements %.2X\n", 40087031Smsmith ObjDesc->Package.Count); 40185756Smsmith break; 40267754Smsmith 40385756Smsmith case ACPI_TYPE_BUFFER: 40487031Smsmith AcpiOsPrintf (" Len %.2X", 40587031Smsmith ObjDesc->Buffer.Length); 40667754Smsmith 40785756Smsmith /* Dump some of the buffer */ 40867754Smsmith 40985756Smsmith if (ObjDesc->Buffer.Length > 0) 41085756Smsmith { 41187031Smsmith AcpiOsPrintf (" ="); 41285756Smsmith for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) 41385756Smsmith { 41487031Smsmith AcpiOsPrintf (" %.2X", ObjDesc->Buffer.Pointer[i]); 41585756Smsmith } 41685756Smsmith } 41787031Smsmith AcpiOsPrintf ("\n"); 41885756Smsmith break; 41967754Smsmith 42085756Smsmith case ACPI_TYPE_STRING: 42187031Smsmith AcpiOsPrintf (" Len %.2X", ObjDesc->String.Length); 42287031Smsmith 42385756Smsmith if (ObjDesc->String.Length > 0) 42485756Smsmith { 42587031Smsmith AcpiOsPrintf (" = \"%.32s\"...", ObjDesc->String.Pointer); 42685756Smsmith } 42787031Smsmith AcpiOsPrintf ("\n"); 42885756Smsmith break; 42967754Smsmith 43085756Smsmith case ACPI_TYPE_REGION: 43187031Smsmith AcpiOsPrintf (" [%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); 43285756Smsmith if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) 43385756Smsmith { 43487031Smsmith AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", 43585756Smsmith HIDWORD(ObjDesc->Region.Address), 43685756Smsmith LODWORD(ObjDesc->Region.Address), 43787031Smsmith ObjDesc->Region.Length); 43885756Smsmith } 43985756Smsmith else 44085756Smsmith { 44187031Smsmith AcpiOsPrintf (" [Address/Length not evaluated]\n"); 44285756Smsmith } 44385756Smsmith break; 44467754Smsmith 44585756Smsmith case INTERNAL_TYPE_REFERENCE: 44687031Smsmith AcpiOsPrintf (" [%s]\n", 44787031Smsmith AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); 44885756Smsmith break; 44967754Smsmith 45085756Smsmith case ACPI_TYPE_BUFFER_FIELD: 45187031Smsmith if (ObjDesc->BufferField.BufferObj && 45287031Smsmith ObjDesc->BufferField.BufferObj->Buffer.Node) 45387031Smsmith { 45487031Smsmith AcpiOsPrintf (" Buf [%4.4s]", 45587031Smsmith (char *) &ObjDesc->BufferField.BufferObj->Buffer.Node->Name); 45687031Smsmith } 45785756Smsmith break; 45885756Smsmith 45985756Smsmith case INTERNAL_TYPE_REGION_FIELD: 46087031Smsmith AcpiOsPrintf (" Rgn [%4.4s]", 46187031Smsmith (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name); 46285756Smsmith break; 46385756Smsmith 46485756Smsmith case INTERNAL_TYPE_BANK_FIELD: 46587031Smsmith AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]", 46687031Smsmith (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name, 46787031Smsmith (char *) &ObjDesc->BankField.BankObj->CommonField.Node->Name); 46885756Smsmith break; 46985756Smsmith 47085756Smsmith case INTERNAL_TYPE_INDEX_FIELD: 47187031Smsmith AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]", 47287031Smsmith (char *) &ObjDesc->IndexField.IndexObj->CommonField.Node->Name, 47387031Smsmith (char *) &ObjDesc->IndexField.DataObj->CommonField.Node->Name); 47485756Smsmith break; 47585756Smsmith 47685756Smsmith default: 47787031Smsmith AcpiOsPrintf (" Object %p\n", ObjDesc); 47885756Smsmith break; 47985756Smsmith } 48085756Smsmith 48185756Smsmith /* Common field handling */ 48285756Smsmith 48385756Smsmith switch (Type) 48485756Smsmith { 48585756Smsmith case ACPI_TYPE_BUFFER_FIELD: 48685756Smsmith case INTERNAL_TYPE_REGION_FIELD: 48785756Smsmith case INTERNAL_TYPE_BANK_FIELD: 48885756Smsmith case INTERNAL_TYPE_INDEX_FIELD: 48987031Smsmith AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2d\n", 49087031Smsmith (ObjDesc->CommonField.BaseByteOffset * 8) 49187031Smsmith + ObjDesc->CommonField.StartFieldBitOffset, 49287031Smsmith ObjDesc->CommonField.BitLength, 49387031Smsmith ObjDesc->CommonField.AccessBitWidth); 49485756Smsmith break; 49585756Smsmith } 49685756Smsmith 49767754Smsmith break; 49867754Smsmith 49967754Smsmith 50085756Smsmith case ACPI_DISPLAY_OBJECTS: 50167754Smsmith 50287031Smsmith AcpiOsPrintf ("%p O:%p", 50387031Smsmith ThisNode, ObjDesc); 50485756Smsmith 50585756Smsmith if (!ObjDesc) 50685756Smsmith { 50785756Smsmith /* No attached object, we are done */ 50885756Smsmith 50987031Smsmith AcpiOsPrintf ("\n"); 51085756Smsmith return (AE_OK); 51185756Smsmith } 51285756Smsmith 51387031Smsmith AcpiOsPrintf ("(R%d)", 51487031Smsmith ObjDesc->Common.ReferenceCount); 51585756Smsmith 51685756Smsmith switch (Type) 51785756Smsmith { 51885756Smsmith case ACPI_TYPE_METHOD: 51985756Smsmith 52085756Smsmith /* Name is a Method and its AML offset/length are set */ 52185756Smsmith 52287031Smsmith AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, 52387031Smsmith ObjDesc->Method.AmlLength); 52485756Smsmith break; 52585756Smsmith 52685756Smsmith case ACPI_TYPE_INTEGER: 52785756Smsmith 52887031Smsmith AcpiOsPrintf (" N:%X%X\n", HIDWORD(ObjDesc->Integer.Value), 52987031Smsmith LODWORD(ObjDesc->Integer.Value)); 53085756Smsmith break; 53185756Smsmith 53285756Smsmith case ACPI_TYPE_STRING: 53385756Smsmith 53487031Smsmith AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, 53587031Smsmith ObjDesc->String.Length); 53685756Smsmith break; 53785756Smsmith 53885756Smsmith case ACPI_TYPE_BUFFER: 53985756Smsmith 54087031Smsmith AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, 54187031Smsmith ObjDesc->Buffer.Length); 54285756Smsmith break; 54385756Smsmith 54485756Smsmith default: 54585756Smsmith 54687031Smsmith AcpiOsPrintf ("\n"); 54785756Smsmith break; 54885756Smsmith } 54967754Smsmith break; 55087031Smsmith 55187031Smsmith 55287031Smsmith default: 55387031Smsmith AcpiOsPrintf ("\n"); 55487031Smsmith break; 55567754Smsmith } 55667754Smsmith 55767754Smsmith /* If debug turned off, done */ 55867754Smsmith 55982367Smsmith if (!(AcpiDbgLevel & ACPI_LV_VALUES)) 56067754Smsmith { 56167754Smsmith return (AE_OK); 56267754Smsmith } 56367754Smsmith 56467754Smsmith 56567754Smsmith /* If there is an attached object, display it */ 56667754Smsmith 56787031Smsmith ObjDesc = AcpiNsGetAttachedObject (ThisNode); 56867754Smsmith 56967754Smsmith /* Dump attached objects */ 57067754Smsmith 57185756Smsmith while (ObjDesc) 57267754Smsmith { 57367754Smsmith ObjType = INTERNAL_TYPE_INVALID; 57467754Smsmith 57567754Smsmith /* Decode the type of attached object and dump the contents */ 57667754Smsmith 57787031Smsmith AcpiOsPrintf (" Attached Object %p: ", ObjDesc); 57867754Smsmith 57985756Smsmith if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) 58067754Smsmith { 58187031Smsmith AcpiOsPrintf ("(Ptr to Node)\n"); 58267754Smsmith BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 58367754Smsmith } 58467754Smsmith 58585756Smsmith else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) 58667754Smsmith { 58767754Smsmith ObjType = ObjDesc->Common.Type; 58867754Smsmith 58967754Smsmith if (ObjType > INTERNAL_TYPE_MAX) 59067754Smsmith { 59187031Smsmith AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType); 59267754Smsmith BytesToDump = 32; 59367754Smsmith } 59467754Smsmith else 59567754Smsmith { 59687031Smsmith AcpiOsPrintf ("(Ptr to ACPI Object type %2.2X [%s])\n", 59787031Smsmith ObjType, AcpiUtGetTypeName (ObjType)); 59867754Smsmith BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 59967754Smsmith } 60067754Smsmith } 60167754Smsmith else 60267754Smsmith { 60387031Smsmith AcpiOsPrintf ("(String or Buffer - not descriptor)\n"); 60467754Smsmith BytesToDump = 16; 60567754Smsmith } 60667754Smsmith 60785756Smsmith DUMP_BUFFER (ObjDesc, BytesToDump); 60867754Smsmith 60967754Smsmith /* If value is NOT an internal object, we are done */ 61067754Smsmith 61185756Smsmith if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) 61267754Smsmith { 61367754Smsmith goto Cleanup; 61467754Smsmith } 61567754Smsmith 61667754Smsmith /* 61767754Smsmith * Valid object, get the pointer to next level, if any 61867754Smsmith */ 61967754Smsmith switch (ObjType) 62067754Smsmith { 62167754Smsmith case ACPI_TYPE_STRING: 62285756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->String.Pointer; 62367754Smsmith break; 62467754Smsmith 62567754Smsmith case ACPI_TYPE_BUFFER: 62685756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Buffer.Pointer; 62767754Smsmith break; 62867754Smsmith 62977424Smsmith case ACPI_TYPE_BUFFER_FIELD: 63085756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; 63177424Smsmith break; 63277424Smsmith 63367754Smsmith case ACPI_TYPE_PACKAGE: 63485756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Package.Elements; 63567754Smsmith break; 63667754Smsmith 63767754Smsmith case ACPI_TYPE_METHOD: 63885756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Method.AmlStart; 63967754Smsmith break; 64067754Smsmith 64177424Smsmith case INTERNAL_TYPE_REGION_FIELD: 64285756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Field.RegionObj; 64367754Smsmith break; 64467754Smsmith 64567754Smsmith case INTERNAL_TYPE_BANK_FIELD: 64685756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BankField.RegionObj; 64767754Smsmith break; 64867754Smsmith 64967754Smsmith case INTERNAL_TYPE_INDEX_FIELD: 65085756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->IndexField.IndexObj; 65167754Smsmith break; 65267754Smsmith 65367754Smsmith default: 65467754Smsmith goto Cleanup; 65567754Smsmith } 65667754Smsmith 65787031Smsmith ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */ 65867754Smsmith } 65967754Smsmith 66067754SmsmithCleanup: 66187031Smsmith AcpiOsPrintf ("\n"); 66267754Smsmith return (AE_OK); 66367754Smsmith} 66467754Smsmith 66567754Smsmith 66677424Smsmith/******************************************************************************* 66767754Smsmith * 66867754Smsmith * FUNCTION: AcpiNsDumpObjects 66967754Smsmith * 67067754Smsmith * PARAMETERS: Type - Object type to be dumped 67167754Smsmith * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 67267754Smsmith * for an effectively unlimited depth. 67367754Smsmith * OwnerId - Dump only objects owned by this ID. Use 67467754Smsmith * ACPI_UINT32_MAX to match all owners. 67567754Smsmith * StartHandle - Where in namespace to start/end search 67667754Smsmith * 67767754Smsmith * DESCRIPTION: Dump typed objects within the loaded namespace. 67867754Smsmith * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 67967754Smsmith * 68077424Smsmith ******************************************************************************/ 68167754Smsmith 68267754Smsmithvoid 68367754SmsmithAcpiNsDumpObjects ( 68477424Smsmith ACPI_OBJECT_TYPE8 Type, 68585756Smsmith UINT8 DisplayType, 68667754Smsmith UINT32 MaxDepth, 68767754Smsmith UINT32 OwnerId, 68867754Smsmith ACPI_HANDLE StartHandle) 68967754Smsmith{ 69067754Smsmith ACPI_WALK_INFO Info; 69167754Smsmith 69267754Smsmith 69383174Smsmith FUNCTION_ENTRY (); 69483174Smsmith 69583174Smsmith 69682367Smsmith Info.DebugLevel = ACPI_LV_TABLES; 69767754Smsmith Info.OwnerId = OwnerId; 69885756Smsmith Info.DisplayType = DisplayType; 69967754Smsmith 70085756Smsmith 70167754Smsmith AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, 70267754Smsmith (void *) &Info, NULL); 70367754Smsmith} 70467754Smsmith 70567754Smsmith 70669450Smsmith#ifndef _ACPI_ASL_COMPILER 70777424Smsmith/******************************************************************************* 70867754Smsmith * 70967754Smsmith * FUNCTION: AcpiNsDumpOneDevice 71067754Smsmith * 71167754Smsmith * PARAMETERS: Handle - Node to be dumped 71267754Smsmith * Level - Nesting level of the handle 71367754Smsmith * Context - Passed into WalkNamespace 71467754Smsmith * 71567754Smsmith * DESCRIPTION: Dump a single Node that represents a device 71667754Smsmith * This procedure is a UserFunction called by AcpiNsWalkNamespace. 71767754Smsmith * 71877424Smsmith ******************************************************************************/ 71967754Smsmith 72067754SmsmithACPI_STATUS 72167754SmsmithAcpiNsDumpOneDevice ( 72267754Smsmith ACPI_HANDLE ObjHandle, 72367754Smsmith UINT32 Level, 72467754Smsmith void *Context, 72567754Smsmith void **ReturnValue) 72667754Smsmith{ 72767754Smsmith ACPI_DEVICE_INFO Info; 72867754Smsmith ACPI_STATUS Status; 72967754Smsmith UINT32 i; 73067754Smsmith 73167754Smsmith 73283174Smsmith PROC_NAME ("NsDumpOneDevice"); 73382367Smsmith 73483174Smsmith 73567754Smsmith Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue); 73667754Smsmith 73767754Smsmith Status = AcpiGetObjectInfo (ObjHandle, &Info); 73867754Smsmith if (ACPI_SUCCESS (Status)) 73967754Smsmith { 74067754Smsmith for (i = 0; i < Level; i++) 74167754Smsmith { 74282367Smsmith ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); 74367754Smsmith } 74467754Smsmith 74585756Smsmith ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n", 74685756Smsmith Info.HardwareId, HIDWORD(Info.Address), LODWORD(Info.Address), Info.CurrentStatus)); 74767754Smsmith } 74867754Smsmith 74967754Smsmith return (Status); 75067754Smsmith} 75167754Smsmith 75267754Smsmith 75377424Smsmith/******************************************************************************* 75467754Smsmith * 75567754Smsmith * FUNCTION: AcpiNsDumpRootDevices 75667754Smsmith * 75767754Smsmith * PARAMETERS: None 75867754Smsmith * 75967754Smsmith * DESCRIPTION: Dump all objects of type "device" 76067754Smsmith * 76177424Smsmith ******************************************************************************/ 76267754Smsmith 76367754Smsmithvoid 76467754SmsmithAcpiNsDumpRootDevices (void) 76567754Smsmith{ 76667754Smsmith ACPI_HANDLE SysBusHandle; 76767754Smsmith 76867754Smsmith 76983174Smsmith PROC_NAME ("NsDumpRootDevices"); 77082367Smsmith 77183174Smsmith 77267754Smsmith /* Only dump the table if tracing is enabled */ 77367754Smsmith 77483174Smsmith if (!(ACPI_LV_TABLES & AcpiDbgLevel)) 77567754Smsmith { 77667754Smsmith return; 77767754Smsmith } 77867754Smsmith 77967754Smsmith AcpiGetHandle (0, NS_SYSTEM_BUS, &SysBusHandle); 78067754Smsmith 78182367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n")); 78267754Smsmith AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK, 78367754Smsmith AcpiNsDumpOneDevice, NULL, NULL); 78467754Smsmith} 78567754Smsmith 78669450Smsmith#endif 78767754Smsmith 78877424Smsmith/******************************************************************************* 78967754Smsmith * 79067754Smsmith * FUNCTION: AcpiNsDumpTables 79167754Smsmith * 79267754Smsmith * PARAMETERS: SearchBase - Root of subtree to be dumped, or 79367754Smsmith * NS_ALL to dump the entire namespace 79467754Smsmith * MaxDepth - Maximum depth of dump. Use INT_MAX 79567754Smsmith * for an effectively unlimited depth. 79667754Smsmith * 79767754Smsmith * DESCRIPTION: Dump the name space, or a portion of it. 79867754Smsmith * 79977424Smsmith ******************************************************************************/ 80067754Smsmith 80167754Smsmithvoid 80267754SmsmithAcpiNsDumpTables ( 80367754Smsmith ACPI_HANDLE SearchBase, 80467754Smsmith UINT32 MaxDepth) 80567754Smsmith{ 80667754Smsmith ACPI_HANDLE SearchHandle = SearchBase; 80767754Smsmith 80867754Smsmith 80967754Smsmith FUNCTION_TRACE ("NsDumpTables"); 81067754Smsmith 81167754Smsmith 81267754Smsmith if (!AcpiGbl_RootNode) 81367754Smsmith { 81467754Smsmith /* 81567754Smsmith * If the name space has not been initialized, 81667754Smsmith * there is nothing to dump. 81767754Smsmith */ 81882367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "name space not initialized!\n")); 81967754Smsmith return_VOID; 82067754Smsmith } 82167754Smsmith 82267754Smsmith if (NS_ALL == SearchBase) 82367754Smsmith { 82467754Smsmith /* entire namespace */ 82567754Smsmith 82667754Smsmith SearchHandle = AcpiGbl_RootNode; 82782367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 82867754Smsmith } 82967754Smsmith 83067754Smsmith 83187031Smsmith AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, 83285756Smsmith ACPI_UINT32_MAX, SearchHandle); 83367754Smsmith return_VOID; 83467754Smsmith} 83567754Smsmith 83667754Smsmith 83777424Smsmith/******************************************************************************* 83867754Smsmith * 83967754Smsmith * FUNCTION: AcpiNsDumpEntry 84067754Smsmith * 84167754Smsmith * PARAMETERS: Handle - Node to be dumped 84267754Smsmith * DebugLevel - Output level 84367754Smsmith * 84467754Smsmith * DESCRIPTION: Dump a single Node 84567754Smsmith * 84677424Smsmith ******************************************************************************/ 84767754Smsmith 84867754Smsmithvoid 84967754SmsmithAcpiNsDumpEntry ( 85067754Smsmith ACPI_HANDLE Handle, 85167754Smsmith UINT32 DebugLevel) 85267754Smsmith{ 85367754Smsmith ACPI_WALK_INFO Info; 85467754Smsmith 85567754Smsmith 85683174Smsmith FUNCTION_ENTRY (); 85767754Smsmith 85883174Smsmith 85967754Smsmith Info.DebugLevel = DebugLevel; 86067754Smsmith Info.OwnerId = ACPI_UINT32_MAX; 86187031Smsmith Info.DisplayType = ACPI_DISPLAY_SUMMARY; 86267754Smsmith 86367754Smsmith AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 86467754Smsmith} 86567754Smsmith 86667754Smsmith#endif 86767754Smsmith 868