nsdump.c revision 71867
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Module Name: nsdump - table dumping routines for debug 471867Smsmith * $Revision: 85 $ 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" 12467754Smsmith 12567754Smsmith 12667754Smsmith#define _COMPONENT NAMESPACE 12767754Smsmith MODULE_NAME ("nsdump") 12867754Smsmith 12967754Smsmith 13071867Smsmith#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) 13167754Smsmith 13267754Smsmith/**************************************************************************** 13367754Smsmith * 13467754Smsmith * FUNCTION: AcpiNsDumpPathname 13567754Smsmith * 13667754Smsmith * PARAMETERS: Handle - Object 13767754Smsmith * Msg - Prefix message 13867754Smsmith * Level - Desired debug level 13967754Smsmith * Component - Caller's component ID 14067754Smsmith * 14167754Smsmith * DESCRIPTION: Print an object's full namespace pathname 14267754Smsmith * Manages allocation/freeing of a pathname buffer 14367754Smsmith * 14467754Smsmith ***************************************************************************/ 14567754Smsmith 14667754SmsmithACPI_STATUS 14767754SmsmithAcpiNsDumpPathname ( 14867754Smsmith ACPI_HANDLE Handle, 14967754Smsmith NATIVE_CHAR *Msg, 15067754Smsmith UINT32 Level, 15167754Smsmith UINT32 Component) 15267754Smsmith{ 15367754Smsmith NATIVE_CHAR *Buffer; 15467754Smsmith UINT32 Length; 15567754Smsmith 15667754Smsmith 15767754Smsmith FUNCTION_TRACE ("NsDumpPathname"); 15867754Smsmith 15967754Smsmith /* Do this only if the requested debug level and component are enabled */ 16067754Smsmith 16167754Smsmith if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) 16267754Smsmith { 16367754Smsmith return_ACPI_STATUS (AE_OK); 16467754Smsmith } 16567754Smsmith 16667754Smsmith Buffer = AcpiCmAllocate (PATHNAME_MAX); 16767754Smsmith if (!Buffer) 16867754Smsmith { 16967754Smsmith return_ACPI_STATUS (AE_NO_MEMORY); 17067754Smsmith } 17167754Smsmith 17267754Smsmith /* Convert handle to a full pathname and print it (with supplied message) */ 17367754Smsmith 17467754Smsmith Length = PATHNAME_MAX; 17567754Smsmith if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer))) 17667754Smsmith { 17767754Smsmith AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle); 17867754Smsmith } 17967754Smsmith 18067754Smsmith AcpiCmFree (Buffer); 18167754Smsmith 18267754Smsmith return_ACPI_STATUS (AE_OK); 18367754Smsmith} 18467754Smsmith 18567754Smsmith 18667754Smsmith/**************************************************************************** 18767754Smsmith * 18867754Smsmith * FUNCTION: AcpiNsDumpOneObject 18967754Smsmith * 19067754Smsmith * PARAMETERS: Handle - Node to be dumped 19167754Smsmith * Level - Nesting level of the handle 19267754Smsmith * Context - Passed into WalkNamespace 19367754Smsmith * 19467754Smsmith * DESCRIPTION: Dump a single Node 19567754Smsmith * This procedure is a UserFunction called by AcpiNsWalkNamespace. 19667754Smsmith * 19767754Smsmith ***************************************************************************/ 19867754Smsmith 19967754SmsmithACPI_STATUS 20067754SmsmithAcpiNsDumpOneObject ( 20167754Smsmith ACPI_HANDLE ObjHandle, 20267754Smsmith UINT32 Level, 20367754Smsmith void *Context, 20467754Smsmith void **ReturnValue) 20567754Smsmith{ 20667754Smsmith ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 20767754Smsmith ACPI_NAMESPACE_NODE *ThisNode; 20867754Smsmith UINT8 *Value; 20967754Smsmith ACPI_OPERAND_OBJECT *ObjDesc = NULL; 21067754Smsmith OBJECT_TYPE_INTERNAL ObjType; 21167754Smsmith OBJECT_TYPE_INTERNAL Type; 21267754Smsmith UINT32 BytesToDump; 21367754Smsmith UINT32 DownstreamSiblingMask = 0; 21467754Smsmith UINT32 LevelTmp; 21567754Smsmith UINT32 WhichBit; 21667754Smsmith 21767754Smsmith 21867754Smsmith ThisNode = AcpiNsConvertHandleToEntry (ObjHandle); 21967754Smsmith 22067754Smsmith LevelTmp = Level; 22167754Smsmith Type = ThisNode->Type; 22267754Smsmith WhichBit = 1; 22367754Smsmith 22467754Smsmith 22567754Smsmith if (!(AcpiDbgLevel & Info->DebugLevel)) 22667754Smsmith { 22767754Smsmith return (AE_OK); 22867754Smsmith } 22967754Smsmith 23067754Smsmith if (!ObjHandle) 23167754Smsmith { 23267754Smsmith DEBUG_PRINT (ACPI_INFO, ("Null object handle\n")); 23367754Smsmith return (AE_OK); 23467754Smsmith } 23567754Smsmith 23667754Smsmith /* Check if the owner matches */ 23767754Smsmith 23867754Smsmith if ((Info->OwnerId != ACPI_UINT32_MAX) && 23967754Smsmith (Info->OwnerId != ThisNode->OwnerId)) 24067754Smsmith { 24167754Smsmith return (AE_OK); 24267754Smsmith } 24367754Smsmith 24467754Smsmith 24567754Smsmith /* Indent the object according to the level */ 24667754Smsmith 24767754Smsmith while (LevelTmp--) 24867754Smsmith { 24967754Smsmith 25067754Smsmith /* Print appropriate characters to form tree structure */ 25167754Smsmith 25267754Smsmith if (LevelTmp) 25367754Smsmith { 25467754Smsmith if (DownstreamSiblingMask & WhichBit) 25567754Smsmith { 25667754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("|")); 25767754Smsmith } 25867754Smsmith 25967754Smsmith else 26067754Smsmith { 26167754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" ")); 26267754Smsmith } 26367754Smsmith 26467754Smsmith WhichBit <<= 1; 26567754Smsmith } 26667754Smsmith 26767754Smsmith else 26867754Smsmith { 26967754Smsmith if (AcpiNsExistDownstreamSibling (ThisNode + 1)) 27067754Smsmith { 27167754Smsmith DownstreamSiblingMask |= (1 << (Level - 1)); 27267754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("+")); 27367754Smsmith } 27467754Smsmith 27567754Smsmith else 27667754Smsmith { 27767754Smsmith DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1)); 27867754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("+")); 27967754Smsmith } 28067754Smsmith 28167754Smsmith if (ThisNode->Child == NULL) 28267754Smsmith { 28367754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("-")); 28467754Smsmith } 28567754Smsmith 28667754Smsmith else if (AcpiNsExistDownstreamSibling (ThisNode->Child)) 28767754Smsmith { 28867754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("+")); 28967754Smsmith } 29067754Smsmith 29167754Smsmith else 29267754Smsmith { 29367754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("-")); 29467754Smsmith } 29567754Smsmith } 29667754Smsmith } 29767754Smsmith 29867754Smsmith 29967754Smsmith /* Check the integrity of our data */ 30067754Smsmith 30167754Smsmith if (Type > INTERNAL_TYPE_MAX) 30267754Smsmith { 30367754Smsmith Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */ 30467754Smsmith } 30567754Smsmith 30667754Smsmith if (!AcpiCmValidAcpiName (ThisNode->Name)) 30767754Smsmith { 30869746Smsmith REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); 30967754Smsmith } 31067754Smsmith 31167754Smsmith /* 31267754Smsmith * Now we can print out the pertinent information 31367754Smsmith */ 31467754Smsmith 31567754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" %4.4s %-9s ", &ThisNode->Name, AcpiCmGetTypeName (Type))); 31667754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("%p S:%p O:%p", ThisNode, ThisNode->Child, ThisNode->Object)); 31767754Smsmith 31867754Smsmith 31967754Smsmith if (!ThisNode->Object) 32067754Smsmith { 32167754Smsmith /* No attached object, we are done */ 32267754Smsmith 32367754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("\n")); 32467754Smsmith return (AE_OK); 32567754Smsmith } 32667754Smsmith 32767754Smsmith switch (Type) 32867754Smsmith { 32967754Smsmith 33067754Smsmith case ACPI_TYPE_METHOD: 33167754Smsmith 33267754Smsmith /* Name is a Method and its AML offset/length are set */ 33367754Smsmith 33467754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" M:%p-%X\n", 33567754Smsmith ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.Pcode, 33667754Smsmith ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.PcodeLength)); 33767754Smsmith 33867754Smsmith break; 33967754Smsmith 34067754Smsmith 34171867Smsmith case ACPI_TYPE_INTEGER: 34267754Smsmith 34367754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" N:%X\n", 34471867Smsmith ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Integer.Value)); 34567754Smsmith break; 34667754Smsmith 34767754Smsmith 34867754Smsmith case ACPI_TYPE_STRING: 34967754Smsmith 35067754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" S:%p-%X\n", 35167754Smsmith ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->String.Pointer, 35267754Smsmith ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->String.Length)); 35367754Smsmith break; 35467754Smsmith 35567754Smsmith 35667754Smsmith case ACPI_TYPE_BUFFER: 35767754Smsmith 35867754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" B:%p-%X\n", 35967754Smsmith ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Buffer.Pointer, 36067754Smsmith ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Buffer.Length)); 36167754Smsmith break; 36267754Smsmith 36367754Smsmith 36467754Smsmith default: 36567754Smsmith 36667754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("\n")); 36767754Smsmith break; 36867754Smsmith } 36967754Smsmith 37067754Smsmith /* If debug turned off, done */ 37167754Smsmith 37267754Smsmith if (!(AcpiDbgLevel & TRACE_VALUES)) 37367754Smsmith { 37467754Smsmith return (AE_OK); 37567754Smsmith } 37667754Smsmith 37767754Smsmith 37867754Smsmith /* If there is an attached object, display it */ 37967754Smsmith 38067754Smsmith Value = ThisNode->Object; 38167754Smsmith 38267754Smsmith /* Dump attached objects */ 38367754Smsmith 38467754Smsmith while (Value) 38567754Smsmith { 38667754Smsmith ObjType = INTERNAL_TYPE_INVALID; 38767754Smsmith 38867754Smsmith /* Decode the type of attached object and dump the contents */ 38967754Smsmith 39067754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" Attached Object %p: ", Value)); 39167754Smsmith 39267754Smsmith if (AcpiTbSystemTablePointer (Value)) 39367754Smsmith { 39467754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to AML Code)\n")); 39567754Smsmith BytesToDump = 16; 39667754Smsmith } 39767754Smsmith 39867754Smsmith else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED)) 39967754Smsmith { 40067754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to Node)\n")); 40167754Smsmith BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 40267754Smsmith } 40367754Smsmith 40467754Smsmith 40567754Smsmith else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_INTERNAL)) 40667754Smsmith { 40767754Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) Value; 40867754Smsmith ObjType = ObjDesc->Common.Type; 40967754Smsmith 41067754Smsmith if (ObjType > INTERNAL_TYPE_MAX) 41167754Smsmith { 41269746Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType)); 41367754Smsmith BytesToDump = 32; 41467754Smsmith } 41567754Smsmith 41667754Smsmith else 41767754Smsmith { 41869746Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to ACPI Object type %X [%s])\n", 41967754Smsmith ObjType, AcpiCmGetTypeName (ObjType))); 42067754Smsmith BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 42167754Smsmith } 42267754Smsmith } 42367754Smsmith 42467754Smsmith else 42567754Smsmith { 42667754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("(String or Buffer - not descriptor)\n", Value)); 42767754Smsmith BytesToDump = 16; 42867754Smsmith } 42967754Smsmith 43067754Smsmith DUMP_BUFFER (Value, BytesToDump); 43167754Smsmith 43267754Smsmith /* If value is NOT an internal object, we are done */ 43367754Smsmith 43467754Smsmith if ((AcpiTbSystemTablePointer (Value)) || 43567754Smsmith (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED))) 43667754Smsmith { 43767754Smsmith goto Cleanup; 43867754Smsmith } 43967754Smsmith 44067754Smsmith /* 44167754Smsmith * Valid object, get the pointer to next level, if any 44267754Smsmith */ 44367754Smsmith switch (ObjType) 44467754Smsmith { 44567754Smsmith case ACPI_TYPE_STRING: 44667754Smsmith Value = (UINT8 *) ObjDesc->String.Pointer; 44767754Smsmith break; 44867754Smsmith 44967754Smsmith case ACPI_TYPE_BUFFER: 45067754Smsmith Value = (UINT8 *) ObjDesc->Buffer.Pointer; 45167754Smsmith break; 45267754Smsmith 45367754Smsmith case ACPI_TYPE_PACKAGE: 45467754Smsmith Value = (UINT8 *) ObjDesc->Package.Elements; 45567754Smsmith break; 45667754Smsmith 45767754Smsmith case ACPI_TYPE_METHOD: 45867754Smsmith Value = (UINT8 *) ObjDesc->Method.Pcode; 45967754Smsmith break; 46067754Smsmith 46167754Smsmith case ACPI_TYPE_FIELD_UNIT: 46267754Smsmith Value = (UINT8 *) ObjDesc->FieldUnit.Container; 46367754Smsmith break; 46467754Smsmith 46567754Smsmith case INTERNAL_TYPE_DEF_FIELD: 46667754Smsmith Value = (UINT8 *) ObjDesc->Field.Container; 46767754Smsmith break; 46867754Smsmith 46967754Smsmith case INTERNAL_TYPE_BANK_FIELD: 47067754Smsmith Value = (UINT8 *) ObjDesc->BankField.Container; 47167754Smsmith break; 47267754Smsmith 47367754Smsmith case INTERNAL_TYPE_INDEX_FIELD: 47467754Smsmith Value = (UINT8 *) ObjDesc->IndexField.Index; 47567754Smsmith break; 47667754Smsmith 47767754Smsmith default: 47867754Smsmith goto Cleanup; 47967754Smsmith } 48067754Smsmith 48167754Smsmith ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */ 48267754Smsmith } 48367754Smsmith 48467754SmsmithCleanup: 48567754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, ("\n")); 48667754Smsmith return (AE_OK); 48767754Smsmith} 48867754Smsmith 48967754Smsmith 49067754Smsmith/**************************************************************************** 49167754Smsmith * 49267754Smsmith * FUNCTION: AcpiNsDumpObjects 49367754Smsmith * 49467754Smsmith * PARAMETERS: Type - Object type to be dumped 49567754Smsmith * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 49667754Smsmith * for an effectively unlimited depth. 49767754Smsmith * OwnerId - Dump only objects owned by this ID. Use 49867754Smsmith * ACPI_UINT32_MAX to match all owners. 49967754Smsmith * StartHandle - Where in namespace to start/end search 50067754Smsmith * 50167754Smsmith * DESCRIPTION: Dump typed objects within the loaded namespace. 50267754Smsmith * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 50367754Smsmith * 50467754Smsmith ***************************************************************************/ 50567754Smsmith 50667754Smsmithvoid 50767754SmsmithAcpiNsDumpObjects ( 50867754Smsmith OBJECT_TYPE_INTERNAL Type, 50967754Smsmith UINT32 MaxDepth, 51067754Smsmith UINT32 OwnerId, 51167754Smsmith ACPI_HANDLE StartHandle) 51267754Smsmith{ 51367754Smsmith ACPI_WALK_INFO Info; 51467754Smsmith 51567754Smsmith 51667754Smsmith Info.DebugLevel = TRACE_TABLES; 51767754Smsmith Info.OwnerId = OwnerId; 51867754Smsmith 51967754Smsmith AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, 52067754Smsmith (void *) &Info, NULL); 52167754Smsmith} 52267754Smsmith 52367754Smsmith 52469450Smsmith#ifndef _ACPI_ASL_COMPILER 52567754Smsmith/**************************************************************************** 52667754Smsmith * 52767754Smsmith * FUNCTION: AcpiNsDumpOneDevice 52867754Smsmith * 52967754Smsmith * PARAMETERS: Handle - Node to be dumped 53067754Smsmith * Level - Nesting level of the handle 53167754Smsmith * Context - Passed into WalkNamespace 53267754Smsmith * 53367754Smsmith * DESCRIPTION: Dump a single Node that represents a device 53467754Smsmith * This procedure is a UserFunction called by AcpiNsWalkNamespace. 53567754Smsmith * 53667754Smsmith ***************************************************************************/ 53767754Smsmith 53867754SmsmithACPI_STATUS 53967754SmsmithAcpiNsDumpOneDevice ( 54067754Smsmith ACPI_HANDLE ObjHandle, 54167754Smsmith UINT32 Level, 54267754Smsmith void *Context, 54367754Smsmith void **ReturnValue) 54467754Smsmith{ 54567754Smsmith ACPI_DEVICE_INFO Info; 54667754Smsmith ACPI_STATUS Status; 54767754Smsmith UINT32 i; 54867754Smsmith 54967754Smsmith 55067754Smsmith Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue); 55167754Smsmith 55267754Smsmith Status = AcpiGetObjectInfo (ObjHandle, &Info); 55367754Smsmith if (ACPI_SUCCESS (Status)) 55467754Smsmith { 55567754Smsmith for (i = 0; i < Level; i++) 55667754Smsmith { 55767754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" ")); 55867754Smsmith } 55967754Smsmith 56067754Smsmith DEBUG_PRINT_RAW (TRACE_TABLES, (" HID: %.8X, ADR: %.8X, Status: %x\n", 56167754Smsmith Info.HardwareId, Info.Address, Info.CurrentStatus)); 56267754Smsmith } 56367754Smsmith 56467754Smsmith return (Status); 56567754Smsmith} 56667754Smsmith 56767754Smsmith 56867754Smsmith/**************************************************************************** 56967754Smsmith * 57067754Smsmith * FUNCTION: AcpiNsDumpRootDevices 57167754Smsmith * 57267754Smsmith * PARAMETERS: None 57367754Smsmith * 57467754Smsmith * DESCRIPTION: Dump all objects of type "device" 57567754Smsmith * 57667754Smsmith ***************************************************************************/ 57767754Smsmith 57867754Smsmithvoid 57967754SmsmithAcpiNsDumpRootDevices (void) 58067754Smsmith{ 58167754Smsmith ACPI_HANDLE SysBusHandle; 58267754Smsmith 58367754Smsmith 58467754Smsmith /* Only dump the table if tracing is enabled */ 58567754Smsmith 58667754Smsmith if (!(TRACE_TABLES & AcpiDbgLevel)) 58767754Smsmith { 58867754Smsmith return; 58967754Smsmith } 59067754Smsmith 59167754Smsmith AcpiGetHandle (0, NS_SYSTEM_BUS, &SysBusHandle); 59267754Smsmith 59367754Smsmith DEBUG_PRINT (TRACE_TABLES, ("Display of all devices in the namespace:\n")); 59467754Smsmith AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK, 59567754Smsmith AcpiNsDumpOneDevice, NULL, NULL); 59667754Smsmith} 59767754Smsmith 59869450Smsmith#endif 59967754Smsmith 60067754Smsmith/**************************************************************************** 60167754Smsmith * 60267754Smsmith * FUNCTION: AcpiNsDumpTables 60367754Smsmith * 60467754Smsmith * PARAMETERS: SearchBase - Root of subtree to be dumped, or 60567754Smsmith * NS_ALL to dump the entire namespace 60667754Smsmith * MaxDepth - Maximum depth of dump. Use INT_MAX 60767754Smsmith * for an effectively unlimited depth. 60867754Smsmith * 60967754Smsmith * DESCRIPTION: Dump the name space, or a portion of it. 61067754Smsmith * 61167754Smsmith ***************************************************************************/ 61267754Smsmith 61367754Smsmithvoid 61467754SmsmithAcpiNsDumpTables ( 61567754Smsmith ACPI_HANDLE SearchBase, 61667754Smsmith UINT32 MaxDepth) 61767754Smsmith{ 61867754Smsmith ACPI_HANDLE SearchHandle = SearchBase; 61967754Smsmith 62067754Smsmith 62167754Smsmith FUNCTION_TRACE ("NsDumpTables"); 62267754Smsmith 62367754Smsmith 62467754Smsmith if (!AcpiGbl_RootNode) 62567754Smsmith { 62667754Smsmith /* 62767754Smsmith * If the name space has not been initialized, 62867754Smsmith * there is nothing to dump. 62967754Smsmith */ 63067754Smsmith DEBUG_PRINT (TRACE_TABLES, ("NsDumpTables: name space not initialized!\n")); 63167754Smsmith return_VOID; 63267754Smsmith } 63367754Smsmith 63467754Smsmith if (NS_ALL == SearchBase) 63567754Smsmith { 63667754Smsmith /* entire namespace */ 63767754Smsmith 63867754Smsmith SearchHandle = AcpiGbl_RootNode; 63967754Smsmith DEBUG_PRINT (TRACE_TABLES, ("\\\n")); 64067754Smsmith } 64167754Smsmith 64267754Smsmith 64367754Smsmith AcpiNsDumpObjects (ACPI_TYPE_ANY, MaxDepth, ACPI_UINT32_MAX, SearchHandle); 64467754Smsmith return_VOID; 64567754Smsmith} 64667754Smsmith 64767754Smsmith 64867754Smsmith/**************************************************************************** 64967754Smsmith * 65067754Smsmith * FUNCTION: AcpiNsDumpEntry 65167754Smsmith * 65267754Smsmith * PARAMETERS: Handle - Node to be dumped 65367754Smsmith * DebugLevel - Output level 65467754Smsmith * 65567754Smsmith * DESCRIPTION: Dump a single Node 65667754Smsmith * 65767754Smsmith ***************************************************************************/ 65867754Smsmith 65967754Smsmithvoid 66067754SmsmithAcpiNsDumpEntry ( 66167754Smsmith ACPI_HANDLE Handle, 66267754Smsmith UINT32 DebugLevel) 66367754Smsmith{ 66467754Smsmith ACPI_WALK_INFO Info; 66567754Smsmith 66667754Smsmith 66767754Smsmith FUNCTION_TRACE_PTR ("NsDumpEntry", Handle); 66867754Smsmith 66967754Smsmith Info.DebugLevel = DebugLevel; 67067754Smsmith Info.OwnerId = ACPI_UINT32_MAX; 67167754Smsmith 67267754Smsmith AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 67367754Smsmith 67467754Smsmith DEBUG_PRINT (TRACE_EXEC, ("leave AcpiNsDumpEntry %p\n", Handle)); 67567754Smsmith return_VOID; 67667754Smsmith} 67767754Smsmith 67867754Smsmith#endif 67967754Smsmith 680