nsdump.c revision 91116
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Module Name: nsdump - table dumping routines for debug 491116Smsmith * $Revision: 127 $ 567754Smsmith * 667754Smsmith *****************************************************************************/ 767754Smsmith 867754Smsmith/****************************************************************************** 967754Smsmith * 1067754Smsmith * 1. Copyright Notice 1167754Smsmith * 1291116Smsmith * Some or all of this work - Copyright (c) 1999 - 2002, 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 12891116Smsmith ACPI_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{ 14991116Smsmith ACPI_FUNCTION_NAME ("AcpiNsPrintPathname"); 15087031Smsmith 15187031Smsmith 15287031Smsmith if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) 15387031Smsmith { 15487031Smsmith return; 15587031Smsmith } 15687031Smsmith 15787031Smsmith /* Print the entire name */ 15887031Smsmith 15987031Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); 16087031Smsmith 16191116Smsmith while (NumSegments) 16287031Smsmith { 16391116Smsmith AcpiOsPrintf ("%4.4s", Pathname); 16491116Smsmith Pathname += ACPI_NAME_SIZE; 16591116Smsmith 16691116Smsmith NumSegments--; 16791116Smsmith if (NumSegments) 16891116Smsmith { 16991116Smsmith AcpiOsPrintf ("."); 17091116Smsmith } 17187031Smsmith } 17287031Smsmith 17387031Smsmith AcpiOsPrintf ("]\n"); 17487031Smsmith} 17587031Smsmith 17687031Smsmith 17787031Smsmith/******************************************************************************* 17887031Smsmith * 17967754Smsmith * FUNCTION: AcpiNsDumpPathname 18067754Smsmith * 18167754Smsmith * PARAMETERS: Handle - Object 18267754Smsmith * Msg - Prefix message 18367754Smsmith * Level - Desired debug level 18467754Smsmith * Component - Caller's component ID 18567754Smsmith * 18667754Smsmith * DESCRIPTION: Print an object's full namespace pathname 18767754Smsmith * Manages allocation/freeing of a pathname buffer 18867754Smsmith * 18977424Smsmith ******************************************************************************/ 19067754Smsmith 19167754SmsmithACPI_STATUS 19267754SmsmithAcpiNsDumpPathname ( 19367754Smsmith ACPI_HANDLE Handle, 19467754Smsmith NATIVE_CHAR *Msg, 19567754Smsmith UINT32 Level, 19667754Smsmith UINT32 Component) 19767754Smsmith{ 19891116Smsmith ACPI_BUFFER Buffer; 19991116Smsmith ACPI_STATUS Status; 20067754Smsmith 20167754Smsmith 20291116Smsmith ACPI_FUNCTION_TRACE ("NsDumpPathname"); 20367754Smsmith 20483174Smsmith 20567754Smsmith /* Do this only if the requested debug level and component are enabled */ 20667754Smsmith 20767754Smsmith if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) 20867754Smsmith { 20967754Smsmith return_ACPI_STATUS (AE_OK); 21067754Smsmith } 21167754Smsmith 21267754Smsmith /* Convert handle to a full pathname and print it (with supplied message) */ 21367754Smsmith 21491116Smsmith Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 21591116Smsmith 21691116Smsmith Status = AcpiNsHandleToPathname (Handle, &Buffer); 21791116Smsmith if (ACPI_SUCCESS (Status)) 21867754Smsmith { 21991116Smsmith AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer.Pointer, Handle); 22091116Smsmith ACPI_MEM_FREE (Buffer.Pointer); 22167754Smsmith } 22267754Smsmith 22391116Smsmith return_ACPI_STATUS (Status); 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; 25091116Smsmith ACPI_OBJECT_TYPE ObjType; 25191116Smsmith ACPI_OBJECT_TYPE Type; 25267754Smsmith UINT32 BytesToDump; 25367754Smsmith UINT32 DownstreamSiblingMask = 0; 25467754Smsmith UINT32 LevelTmp; 25567754Smsmith UINT32 WhichBit; 25685756Smsmith UINT32 i; 25791116Smsmith UINT32 DbgLevel; 25867754Smsmith 25967754Smsmith 26091116Smsmith ACPI_FUNCTION_NAME ("NsDumpOneObject"); 26182367Smsmith 26282367Smsmith 26385756Smsmith ThisNode = AcpiNsMapHandleToNode (ObjHandle); 26467754Smsmith 26567754Smsmith LevelTmp = Level; 26667754Smsmith Type = ThisNode->Type; 26767754Smsmith WhichBit = 1; 26867754Smsmith 26967754Smsmith 27067754Smsmith if (!(AcpiDbgLevel & Info->DebugLevel)) 27167754Smsmith { 27267754Smsmith return (AE_OK); 27367754Smsmith } 27467754Smsmith 27567754Smsmith if (!ObjHandle) 27667754Smsmith { 27782367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); 27867754Smsmith return (AE_OK); 27967754Smsmith } 28067754Smsmith 28167754Smsmith /* Check if the owner matches */ 28267754Smsmith 28367754Smsmith if ((Info->OwnerId != ACPI_UINT32_MAX) && 28467754Smsmith (Info->OwnerId != ThisNode->OwnerId)) 28567754Smsmith { 28667754Smsmith return (AE_OK); 28767754Smsmith } 28867754Smsmith 28967754Smsmith /* Indent the object according to the level */ 29067754Smsmith 29167754Smsmith while (LevelTmp--) 29267754Smsmith { 29367754Smsmith /* Print appropriate characters to form tree structure */ 29467754Smsmith 29567754Smsmith if (LevelTmp) 29667754Smsmith { 29767754Smsmith if (DownstreamSiblingMask & WhichBit) 29867754Smsmith { 29987031Smsmith AcpiOsPrintf ("|"); 30067754Smsmith } 30167754Smsmith else 30267754Smsmith { 30387031Smsmith AcpiOsPrintf (" "); 30467754Smsmith } 30567754Smsmith 30667754Smsmith WhichBit <<= 1; 30767754Smsmith } 30867754Smsmith else 30967754Smsmith { 31067754Smsmith if (AcpiNsExistDownstreamSibling (ThisNode + 1)) 31167754Smsmith { 31267754Smsmith DownstreamSiblingMask |= (1 << (Level - 1)); 31387031Smsmith AcpiOsPrintf ("+"); 31467754Smsmith } 31567754Smsmith else 31667754Smsmith { 31767754Smsmith DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1)); 31887031Smsmith AcpiOsPrintf ("+"); 31967754Smsmith } 32067754Smsmith 32167754Smsmith if (ThisNode->Child == NULL) 32267754Smsmith { 32387031Smsmith AcpiOsPrintf ("-"); 32467754Smsmith } 32567754Smsmith else if (AcpiNsExistDownstreamSibling (ThisNode->Child)) 32667754Smsmith { 32787031Smsmith AcpiOsPrintf ("+"); 32867754Smsmith } 32967754Smsmith else 33067754Smsmith { 33187031Smsmith AcpiOsPrintf ("-"); 33267754Smsmith } 33367754Smsmith } 33467754Smsmith } 33567754Smsmith 33667754Smsmith /* Check the integrity of our data */ 33767754Smsmith 33867754Smsmith if (Type > INTERNAL_TYPE_MAX) 33967754Smsmith { 34087031Smsmith Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */ 34167754Smsmith } 34267754Smsmith 34377424Smsmith if (!AcpiUtValidAcpiName (ThisNode->Name)) 34467754Smsmith { 34591116Smsmith ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); 34667754Smsmith } 34767754Smsmith 34867754Smsmith /* 34967754Smsmith * Now we can print out the pertinent information 35067754Smsmith */ 35187031Smsmith AcpiOsPrintf (" %4.4s %-12s %p", 35287031Smsmith (char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode); 35367754Smsmith 35491116Smsmith DbgLevel = AcpiDbgLevel; 35591116Smsmith AcpiDbgLevel = 0; 35687031Smsmith ObjDesc = AcpiNsGetAttachedObject (ThisNode); 35791116Smsmith AcpiDbgLevel = DbgLevel; 35867754Smsmith 35985756Smsmith switch (Info->DisplayType) 36067754Smsmith { 36185756Smsmith case ACPI_DISPLAY_SUMMARY: 36267754Smsmith 36385756Smsmith if (!ObjDesc) 36485756Smsmith { 36585756Smsmith /* No attached object, we are done */ 36667754Smsmith 36787031Smsmith AcpiOsPrintf ("\n"); 36885756Smsmith return (AE_OK); 36985756Smsmith } 37067754Smsmith 37185756Smsmith switch (Type) 37285756Smsmith { 37385756Smsmith case ACPI_TYPE_PROCESSOR: 37487031Smsmith AcpiOsPrintf (" ID %d Addr %.4X Len %.4X\n", 37585756Smsmith ObjDesc->Processor.ProcId, 37685756Smsmith ObjDesc->Processor.Address, 37787031Smsmith ObjDesc->Processor.Length); 37885756Smsmith break; 37967754Smsmith 38085756Smsmith case ACPI_TYPE_DEVICE: 38187031Smsmith AcpiOsPrintf (" Notification object: %p", ObjDesc); 38285756Smsmith break; 38367754Smsmith 38485756Smsmith case ACPI_TYPE_METHOD: 38587031Smsmith AcpiOsPrintf (" Args %d Len %.4X Aml %p \n", 38685756Smsmith ObjDesc->Method.ParamCount, 38785756Smsmith ObjDesc->Method.AmlLength, 38887031Smsmith ObjDesc->Method.AmlStart); 38985756Smsmith break; 39067754Smsmith 39185756Smsmith case ACPI_TYPE_INTEGER: 39287031Smsmith AcpiOsPrintf (" = %8.8X%8.8X\n", 39391116Smsmith ACPI_HIDWORD (ObjDesc->Integer.Value), 39491116Smsmith ACPI_LODWORD (ObjDesc->Integer.Value)); 39585756Smsmith break; 39667754Smsmith 39785756Smsmith case ACPI_TYPE_PACKAGE: 39887031Smsmith AcpiOsPrintf (" Elements %.2X\n", 39987031Smsmith ObjDesc->Package.Count); 40085756Smsmith break; 40167754Smsmith 40285756Smsmith case ACPI_TYPE_BUFFER: 40387031Smsmith AcpiOsPrintf (" Len %.2X", 40487031Smsmith ObjDesc->Buffer.Length); 40567754Smsmith 40685756Smsmith /* Dump some of the buffer */ 40767754Smsmith 40885756Smsmith if (ObjDesc->Buffer.Length > 0) 40985756Smsmith { 41087031Smsmith AcpiOsPrintf (" ="); 41185756Smsmith for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) 41285756Smsmith { 41387031Smsmith AcpiOsPrintf (" %.2X", ObjDesc->Buffer.Pointer[i]); 41485756Smsmith } 41585756Smsmith } 41687031Smsmith AcpiOsPrintf ("\n"); 41785756Smsmith break; 41867754Smsmith 41985756Smsmith case ACPI_TYPE_STRING: 42087031Smsmith AcpiOsPrintf (" Len %.2X", ObjDesc->String.Length); 42187031Smsmith 42285756Smsmith if (ObjDesc->String.Length > 0) 42385756Smsmith { 42487031Smsmith AcpiOsPrintf (" = \"%.32s\"...", ObjDesc->String.Pointer); 42585756Smsmith } 42687031Smsmith AcpiOsPrintf ("\n"); 42785756Smsmith break; 42867754Smsmith 42985756Smsmith case ACPI_TYPE_REGION: 43087031Smsmith AcpiOsPrintf (" [%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); 43185756Smsmith if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) 43285756Smsmith { 43387031Smsmith AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", 43491116Smsmith ACPI_HIDWORD (ObjDesc->Region.Address), 43591116Smsmith ACPI_LODWORD (ObjDesc->Region.Address), 43687031Smsmith ObjDesc->Region.Length); 43785756Smsmith } 43885756Smsmith else 43985756Smsmith { 44087031Smsmith AcpiOsPrintf (" [Address/Length not evaluated]\n"); 44185756Smsmith } 44285756Smsmith break; 44367754Smsmith 44485756Smsmith case INTERNAL_TYPE_REFERENCE: 44587031Smsmith AcpiOsPrintf (" [%s]\n", 44687031Smsmith AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); 44785756Smsmith break; 44867754Smsmith 44985756Smsmith case ACPI_TYPE_BUFFER_FIELD: 45087031Smsmith if (ObjDesc->BufferField.BufferObj && 45187031Smsmith ObjDesc->BufferField.BufferObj->Buffer.Node) 45287031Smsmith { 45387031Smsmith AcpiOsPrintf (" Buf [%4.4s]", 45487031Smsmith (char *) &ObjDesc->BufferField.BufferObj->Buffer.Node->Name); 45587031Smsmith } 45685756Smsmith break; 45785756Smsmith 45885756Smsmith case INTERNAL_TYPE_REGION_FIELD: 45987031Smsmith AcpiOsPrintf (" Rgn [%4.4s]", 46087031Smsmith (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name); 46185756Smsmith break; 46285756Smsmith 46385756Smsmith case INTERNAL_TYPE_BANK_FIELD: 46487031Smsmith AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]", 46587031Smsmith (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name, 46687031Smsmith (char *) &ObjDesc->BankField.BankObj->CommonField.Node->Name); 46785756Smsmith break; 46885756Smsmith 46985756Smsmith case INTERNAL_TYPE_INDEX_FIELD: 47087031Smsmith AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]", 47187031Smsmith (char *) &ObjDesc->IndexField.IndexObj->CommonField.Node->Name, 47287031Smsmith (char *) &ObjDesc->IndexField.DataObj->CommonField.Node->Name); 47385756Smsmith break; 47485756Smsmith 47585756Smsmith default: 47687031Smsmith AcpiOsPrintf (" Object %p\n", ObjDesc); 47785756Smsmith break; 47885756Smsmith } 47985756Smsmith 48085756Smsmith /* Common field handling */ 48185756Smsmith 48285756Smsmith switch (Type) 48385756Smsmith { 48485756Smsmith case ACPI_TYPE_BUFFER_FIELD: 48585756Smsmith case INTERNAL_TYPE_REGION_FIELD: 48685756Smsmith case INTERNAL_TYPE_BANK_FIELD: 48785756Smsmith case INTERNAL_TYPE_INDEX_FIELD: 48887031Smsmith AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2d\n", 48987031Smsmith (ObjDesc->CommonField.BaseByteOffset * 8) 49087031Smsmith + ObjDesc->CommonField.StartFieldBitOffset, 49187031Smsmith ObjDesc->CommonField.BitLength, 49291116Smsmith ObjDesc->CommonField.AccessByteWidth); 49385756Smsmith break; 49485756Smsmith } 49585756Smsmith 49667754Smsmith break; 49767754Smsmith 49867754Smsmith 49985756Smsmith case ACPI_DISPLAY_OBJECTS: 50067754Smsmith 50187031Smsmith AcpiOsPrintf ("%p O:%p", 50287031Smsmith ThisNode, ObjDesc); 50385756Smsmith 50485756Smsmith if (!ObjDesc) 50585756Smsmith { 50685756Smsmith /* No attached object, we are done */ 50785756Smsmith 50887031Smsmith AcpiOsPrintf ("\n"); 50985756Smsmith return (AE_OK); 51085756Smsmith } 51185756Smsmith 51287031Smsmith AcpiOsPrintf ("(R%d)", 51387031Smsmith ObjDesc->Common.ReferenceCount); 51485756Smsmith 51585756Smsmith switch (Type) 51685756Smsmith { 51785756Smsmith case ACPI_TYPE_METHOD: 51885756Smsmith 51985756Smsmith /* Name is a Method and its AML offset/length are set */ 52085756Smsmith 52187031Smsmith AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, 52287031Smsmith ObjDesc->Method.AmlLength); 52385756Smsmith break; 52485756Smsmith 52585756Smsmith case ACPI_TYPE_INTEGER: 52685756Smsmith 52791116Smsmith AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value), 52891116Smsmith ACPI_LODWORD(ObjDesc->Integer.Value)); 52985756Smsmith break; 53085756Smsmith 53185756Smsmith case ACPI_TYPE_STRING: 53285756Smsmith 53387031Smsmith AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, 53487031Smsmith ObjDesc->String.Length); 53585756Smsmith break; 53685756Smsmith 53785756Smsmith case ACPI_TYPE_BUFFER: 53885756Smsmith 53987031Smsmith AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, 54087031Smsmith ObjDesc->Buffer.Length); 54185756Smsmith break; 54285756Smsmith 54385756Smsmith default: 54485756Smsmith 54587031Smsmith AcpiOsPrintf ("\n"); 54685756Smsmith break; 54785756Smsmith } 54867754Smsmith break; 54987031Smsmith 55087031Smsmith 55187031Smsmith default: 55287031Smsmith AcpiOsPrintf ("\n"); 55387031Smsmith break; 55467754Smsmith } 55567754Smsmith 55667754Smsmith /* If debug turned off, done */ 55767754Smsmith 55882367Smsmith if (!(AcpiDbgLevel & ACPI_LV_VALUES)) 55967754Smsmith { 56067754Smsmith return (AE_OK); 56167754Smsmith } 56267754Smsmith 56367754Smsmith 56467754Smsmith /* If there is an attached object, display it */ 56567754Smsmith 56691116Smsmith DbgLevel = AcpiDbgLevel; 56791116Smsmith AcpiDbgLevel = 0; 56887031Smsmith ObjDesc = AcpiNsGetAttachedObject (ThisNode); 56991116Smsmith AcpiDbgLevel = DbgLevel; 57067754Smsmith 57167754Smsmith /* Dump attached objects */ 57267754Smsmith 57385756Smsmith while (ObjDesc) 57467754Smsmith { 57567754Smsmith ObjType = INTERNAL_TYPE_INVALID; 57691116Smsmith AcpiOsPrintf (" Attached Object %p: ", ObjDesc); 57767754Smsmith 57867754Smsmith /* Decode the type of attached object and dump the contents */ 57967754Smsmith 58091116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 58191116Smsmith { 58291116Smsmith case ACPI_DESC_TYPE_NAMED: 58367754Smsmith 58487031Smsmith AcpiOsPrintf ("(Ptr to Node)\n"); 58567754Smsmith BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 58691116Smsmith break; 58767754Smsmith 58891116Smsmith 58991116Smsmith case ACPI_DESC_TYPE_INTERNAL: 59091116Smsmith 59167754Smsmith ObjType = ObjDesc->Common.Type; 59267754Smsmith 59367754Smsmith if (ObjType > INTERNAL_TYPE_MAX) 59467754Smsmith { 59587031Smsmith AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType); 59667754Smsmith BytesToDump = 32; 59767754Smsmith } 59867754Smsmith else 59967754Smsmith { 60087031Smsmith AcpiOsPrintf ("(Ptr to ACPI Object type %2.2X [%s])\n", 60187031Smsmith ObjType, AcpiUtGetTypeName (ObjType)); 60267754Smsmith BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 60367754Smsmith } 60491116Smsmith break; 60591116Smsmith 60691116Smsmith 60791116Smsmith default: 60891116Smsmith 60991116Smsmith AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n"); 61067754Smsmith BytesToDump = 16; 61191116Smsmith break; 61267754Smsmith } 61367754Smsmith 61491116Smsmith ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 61567754Smsmith 61667754Smsmith /* If value is NOT an internal object, we are done */ 61767754Smsmith 61891116Smsmith if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL) 61967754Smsmith { 62067754Smsmith goto Cleanup; 62167754Smsmith } 62267754Smsmith 62367754Smsmith /* 62467754Smsmith * Valid object, get the pointer to next level, if any 62567754Smsmith */ 62667754Smsmith switch (ObjType) 62767754Smsmith { 62867754Smsmith case ACPI_TYPE_STRING: 62985756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->String.Pointer; 63067754Smsmith break; 63167754Smsmith 63267754Smsmith case ACPI_TYPE_BUFFER: 63385756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Buffer.Pointer; 63467754Smsmith break; 63567754Smsmith 63677424Smsmith case ACPI_TYPE_BUFFER_FIELD: 63785756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; 63877424Smsmith break; 63977424Smsmith 64067754Smsmith case ACPI_TYPE_PACKAGE: 64185756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Package.Elements; 64267754Smsmith break; 64367754Smsmith 64467754Smsmith case ACPI_TYPE_METHOD: 64585756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Method.AmlStart; 64667754Smsmith break; 64767754Smsmith 64877424Smsmith case INTERNAL_TYPE_REGION_FIELD: 64985756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Field.RegionObj; 65067754Smsmith break; 65167754Smsmith 65267754Smsmith case INTERNAL_TYPE_BANK_FIELD: 65385756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BankField.RegionObj; 65467754Smsmith break; 65567754Smsmith 65667754Smsmith case INTERNAL_TYPE_INDEX_FIELD: 65785756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->IndexField.IndexObj; 65867754Smsmith break; 65967754Smsmith 66067754Smsmith default: 66167754Smsmith goto Cleanup; 66267754Smsmith } 66367754Smsmith 66487031Smsmith ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */ 66567754Smsmith } 66667754Smsmith 66767754SmsmithCleanup: 66887031Smsmith AcpiOsPrintf ("\n"); 66967754Smsmith return (AE_OK); 67067754Smsmith} 67167754Smsmith 67267754Smsmith 67377424Smsmith/******************************************************************************* 67467754Smsmith * 67567754Smsmith * FUNCTION: AcpiNsDumpObjects 67667754Smsmith * 67767754Smsmith * PARAMETERS: Type - Object type to be dumped 67867754Smsmith * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 67967754Smsmith * for an effectively unlimited depth. 68067754Smsmith * OwnerId - Dump only objects owned by this ID. Use 68167754Smsmith * ACPI_UINT32_MAX to match all owners. 68267754Smsmith * StartHandle - Where in namespace to start/end search 68367754Smsmith * 68467754Smsmith * DESCRIPTION: Dump typed objects within the loaded namespace. 68567754Smsmith * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 68667754Smsmith * 68777424Smsmith ******************************************************************************/ 68867754Smsmith 68967754Smsmithvoid 69067754SmsmithAcpiNsDumpObjects ( 69191116Smsmith ACPI_OBJECT_TYPE Type, 69285756Smsmith UINT8 DisplayType, 69367754Smsmith UINT32 MaxDepth, 69467754Smsmith UINT32 OwnerId, 69567754Smsmith ACPI_HANDLE StartHandle) 69667754Smsmith{ 69767754Smsmith ACPI_WALK_INFO Info; 69867754Smsmith 69967754Smsmith 70091116Smsmith ACPI_FUNCTION_ENTRY (); 70183174Smsmith 70283174Smsmith 70382367Smsmith Info.DebugLevel = ACPI_LV_TABLES; 70467754Smsmith Info.OwnerId = OwnerId; 70585756Smsmith Info.DisplayType = DisplayType; 70667754Smsmith 70785756Smsmith 70891116Smsmith AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, 70967754Smsmith (void *) &Info, NULL); 71067754Smsmith} 71167754Smsmith 71267754Smsmith 71369450Smsmith#ifndef _ACPI_ASL_COMPILER 71477424Smsmith/******************************************************************************* 71567754Smsmith * 71667754Smsmith * FUNCTION: AcpiNsDumpOneDevice 71767754Smsmith * 71867754Smsmith * PARAMETERS: Handle - Node to be dumped 71967754Smsmith * Level - Nesting level of the handle 72067754Smsmith * Context - Passed into WalkNamespace 72167754Smsmith * 72267754Smsmith * DESCRIPTION: Dump a single Node that represents a device 72367754Smsmith * This procedure is a UserFunction called by AcpiNsWalkNamespace. 72467754Smsmith * 72577424Smsmith ******************************************************************************/ 72667754Smsmith 72767754SmsmithACPI_STATUS 72867754SmsmithAcpiNsDumpOneDevice ( 72967754Smsmith ACPI_HANDLE ObjHandle, 73067754Smsmith UINT32 Level, 73167754Smsmith void *Context, 73267754Smsmith void **ReturnValue) 73367754Smsmith{ 73467754Smsmith ACPI_DEVICE_INFO Info; 73567754Smsmith ACPI_STATUS Status; 73667754Smsmith UINT32 i; 73767754Smsmith 73867754Smsmith 73991116Smsmith ACPI_FUNCTION_NAME ("NsDumpOneDevice"); 74082367Smsmith 74183174Smsmith 74267754Smsmith Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue); 74367754Smsmith 74467754Smsmith Status = AcpiGetObjectInfo (ObjHandle, &Info); 74567754Smsmith if (ACPI_SUCCESS (Status)) 74667754Smsmith { 74767754Smsmith for (i = 0; i < Level; i++) 74867754Smsmith { 74982367Smsmith ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); 75067754Smsmith } 75167754Smsmith 75285756Smsmith ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n", 75391116Smsmith Info.HardwareId, 75491116Smsmith ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address), 75591116Smsmith Info.CurrentStatus)); 75667754Smsmith } 75767754Smsmith 75867754Smsmith return (Status); 75967754Smsmith} 76067754Smsmith 76167754Smsmith 76277424Smsmith/******************************************************************************* 76367754Smsmith * 76467754Smsmith * FUNCTION: AcpiNsDumpRootDevices 76567754Smsmith * 76667754Smsmith * PARAMETERS: None 76767754Smsmith * 76867754Smsmith * DESCRIPTION: Dump all objects of type "device" 76967754Smsmith * 77077424Smsmith ******************************************************************************/ 77167754Smsmith 77267754Smsmithvoid 77367754SmsmithAcpiNsDumpRootDevices (void) 77467754Smsmith{ 77567754Smsmith ACPI_HANDLE SysBusHandle; 77667754Smsmith 77767754Smsmith 77891116Smsmith ACPI_FUNCTION_NAME ("NsDumpRootDevices"); 77982367Smsmith 78083174Smsmith 78167754Smsmith /* Only dump the table if tracing is enabled */ 78267754Smsmith 78383174Smsmith if (!(ACPI_LV_TABLES & AcpiDbgLevel)) 78467754Smsmith { 78567754Smsmith return; 78667754Smsmith } 78767754Smsmith 78891116Smsmith AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle); 78967754Smsmith 79082367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n")); 79191116Smsmith AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, 79267754Smsmith AcpiNsDumpOneDevice, NULL, NULL); 79367754Smsmith} 79467754Smsmith 79569450Smsmith#endif 79667754Smsmith 79777424Smsmith/******************************************************************************* 79867754Smsmith * 79967754Smsmith * FUNCTION: AcpiNsDumpTables 80067754Smsmith * 80167754Smsmith * PARAMETERS: SearchBase - Root of subtree to be dumped, or 80267754Smsmith * NS_ALL to dump the entire namespace 80367754Smsmith * MaxDepth - Maximum depth of dump. Use INT_MAX 80467754Smsmith * for an effectively unlimited depth. 80567754Smsmith * 80667754Smsmith * DESCRIPTION: Dump the name space, or a portion of it. 80767754Smsmith * 80877424Smsmith ******************************************************************************/ 80967754Smsmith 81067754Smsmithvoid 81167754SmsmithAcpiNsDumpTables ( 81267754Smsmith ACPI_HANDLE SearchBase, 81367754Smsmith UINT32 MaxDepth) 81467754Smsmith{ 81567754Smsmith ACPI_HANDLE SearchHandle = SearchBase; 81667754Smsmith 81767754Smsmith 81891116Smsmith ACPI_FUNCTION_TRACE ("NsDumpTables"); 81967754Smsmith 82067754Smsmith 82167754Smsmith if (!AcpiGbl_RootNode) 82267754Smsmith { 82367754Smsmith /* 82467754Smsmith * If the name space has not been initialized, 82567754Smsmith * there is nothing to dump. 82667754Smsmith */ 82782367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "name space not initialized!\n")); 82867754Smsmith return_VOID; 82967754Smsmith } 83067754Smsmith 83191116Smsmith if (ACPI_NS_ALL == SearchBase) 83267754Smsmith { 83367754Smsmith /* entire namespace */ 83467754Smsmith 83567754Smsmith SearchHandle = AcpiGbl_RootNode; 83682367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 83767754Smsmith } 83867754Smsmith 83967754Smsmith 84087031Smsmith AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, 84185756Smsmith ACPI_UINT32_MAX, SearchHandle); 84267754Smsmith return_VOID; 84367754Smsmith} 84467754Smsmith 84567754Smsmith 84677424Smsmith/******************************************************************************* 84767754Smsmith * 84867754Smsmith * FUNCTION: AcpiNsDumpEntry 84967754Smsmith * 85067754Smsmith * PARAMETERS: Handle - Node to be dumped 85167754Smsmith * DebugLevel - Output level 85267754Smsmith * 85367754Smsmith * DESCRIPTION: Dump a single Node 85467754Smsmith * 85577424Smsmith ******************************************************************************/ 85667754Smsmith 85767754Smsmithvoid 85867754SmsmithAcpiNsDumpEntry ( 85967754Smsmith ACPI_HANDLE Handle, 86067754Smsmith UINT32 DebugLevel) 86167754Smsmith{ 86267754Smsmith ACPI_WALK_INFO Info; 86367754Smsmith 86467754Smsmith 86591116Smsmith ACPI_FUNCTION_ENTRY (); 86667754Smsmith 86783174Smsmith 86867754Smsmith Info.DebugLevel = DebugLevel; 86967754Smsmith Info.OwnerId = ACPI_UINT32_MAX; 87087031Smsmith Info.DisplayType = ACPI_DISPLAY_SUMMARY; 87167754Smsmith 87267754Smsmith AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 87367754Smsmith} 87467754Smsmith 87567754Smsmith#endif 87667754Smsmith 877