exdump.c revision 193259
117683Spst/****************************************************************************** 217683Spst * 317683Spst * Module Name: exdump - Interpreter debug output routines 417683Spst * $Revision: 1.202 $ 517683Spst * 617683Spst *****************************************************************************/ 717683Spst 817683Spst/****************************************************************************** 917683Spst * 1017683Spst * 1. Copyright Notice 1117683Spst * 1217683Spst * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 1317683Spst * All rights reserved. 1417683Spst * 1517683Spst * 2. License 1617683Spst * 1717683Spst * 2.1. This is your license from Intel Corp. under its intellectual property 1817683Spst * rights. You may have additional license terms from the party that provided 1917683Spst * you this software, covering your right to use that party's intellectual 2017683Spst * property rights. 2117683Spst * 2217683Spst * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2317683Spst * copy of the source code appearing in this file ("Covered Code") an 2426175Sfenner * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2526175Sfenner * base code distributed originally by Intel ("Original Intel Code") to copy, 2617683Spst * make derivatives, distribute, use and display any portion of the Covered 2717683Spst * Code in any form, with the right to sublicense such rights; and 2817683Spst * 2917683Spst * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3017683Spst * license (with the right to sublicense), under only those claims of Intel 3117683Spst * patents that are infringed by the Original Intel Code, to make, use, sell, 3217683Spst * offer to sell, and import the Covered Code and derivative works thereof 3317683Spst * solely to the minimum extent necessary to exercise the above copyright 3417683Spst * license, and in no event shall the patent license extend to any additions 3517683Spst * to or modifications of the Original Intel Code. No other license or right 3617683Spst * is granted directly or by implication, estoppel or otherwise; 3717683Spst * 3817683Spst * The above copyright and patent license is granted only if the following 3917683Spst * conditions are met: 4017683Spst * 4117683Spst * 3. Conditions 4217683Spst * 4317683Spst * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4417683Spst * Redistribution of source code of any substantial portion of the Covered 4517683Spst * Code or modification with rights to further distribute source must include 4617683Spst * the above Copyright Notice, the above License, this list of Conditions, 4717683Spst * and the following Disclaimer and Export Compliance provision. In addition, 4817683Spst * Licensee must cause all Covered Code to which Licensee contributes to 4917683Spst * contain a file documenting the changes Licensee made to create that Covered 5017683Spst * Code and the date of any change. Licensee must include in that file the 5117683Spst * documentation of any changes made by any predecessor Licensee. Licensee 5217683Spst * must include a prominent statement that the modification is derived, 5317683Spst * directly or indirectly, from Original Intel Code. 5417683Spst * 5517683Spst * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5617683Spst * Redistribution of source code of any substantial portion of the Covered 5717683Spst * Code or modification without rights to further distribute source must 5817683Spst * include the following Disclaimer and Export Compliance provision in the 5917683Spst * documentation and/or other materials provided with distribution. In 6017683Spst * addition, Licensee may not authorize further sublicense of source of any 6117683Spst * portion of the Covered Code, and must include terms to the effect that the 6217683Spst * license from Licensee to its licensee is limited to the intellectual 6317683Spst * property embodied in the software Licensee provides to its licensee, and 6417683Spst * not to intellectual property embodied in modifications its licensee may 6517683Spst * make. 6617683Spst * 6717683Spst * 3.3. Redistribution of Executable. Redistribution in executable form of any 6817683Spst * substantial portion of the Covered Code or modification must reproduce the 6917683Spst * above Copyright Notice, and the following Disclaimer and Export Compliance 7017683Spst * provision in the documentation and/or other materials provided with the 7117683Spst * distribution. 7217683Spst * 7317683Spst * 3.4. Intel retains all right, title, and interest in and to the Original 7417683Spst * Intel Code. 7517683Spst * 7617683Spst * 3.5. Neither the name Intel nor any other trademark owned or controlled by 7717683Spst * Intel shall be used in advertising or otherwise to promote the sale, use or 7817683Spst * other dealings in products derived from or relating to the Covered Code 7917683Spst * without prior written authorization from Intel. 8017683Spst * 8117683Spst * 4. Disclaimer and Export Compliance 8217683Spst * 8317683Spst * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8417683Spst * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8517683Spst * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 8617683Spst * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 8717683Spst * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 8817683Spst * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 8917683Spst * PARTICULAR PURPOSE. 9017683Spst * 9117683Spst * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9217683Spst * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9317683Spst * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9417683Spst * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9517683Spst * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 9617683Spst * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 9717683Spst * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 9817683Spst * LIMITED REMEDY. 9917683Spst * 10017683Spst * 4.3. Licensee shall not export, either directly or indirectly, any of this 10117683Spst * software or system incorporating such software without first obtaining any 10217683Spst * required license or other approval from the U. S. Department of Commerce or 10317683Spst * any other agency or department of the United States Government. In the 10417683Spst * event Licensee exports any such software from the United States or 10517683Spst * re-exports any such software from a foreign destination, Licensee shall 10617683Spst * ensure that the distribution and export/re-export of the software is in 10717683Spst * compliance with all laws, regulations, orders, or other restrictions of the 10817683Spst * U.S. Export Administration Regulations. Licensee agrees that neither it nor 10917683Spst * any of its subsidiaries will export/re-export any technical data, process, 11017683Spst * software, or service, directly or indirectly, to any country for which the 11117683Spst * United States government or any agency thereof requires an export license, 11217683Spst * other governmental approval, or letter of assurance, without first obtaining 11317683Spst * such license, approval or letter. 11417683Spst * 11517683Spst *****************************************************************************/ 11617683Spst 11717683Spst#define __EXDUMP_C__ 11817683Spst 11917683Spst#include "acpi.h" 12017683Spst#include "acinterp.h" 12117683Spst#include "amlcode.h" 12217683Spst#include "acnamesp.h" 12317683Spst#include "acparser.h" 12417683Spst 12517683Spst#define _COMPONENT ACPI_EXECUTER 12617683Spst ACPI_MODULE_NAME ("exdump") 12717683Spst 12817683Spst/* 12917683Spst * The following routines are used for debug output only 13017683Spst */ 13117683Spst#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 13217683Spst 13317683Spst/* Local prototypes */ 13417683Spst 13517683Spststatic void 13617683SpstAcpiExOutString ( 13717683Spst char *Title, 13817683Spst char *Value); 13917683Spst 14017683Spststatic void 14117683SpstAcpiExOutPointer ( 14217683Spst char *Title, 14317683Spst void *Value); 14417683Spst 14517683Spststatic void 14617683SpstAcpiExDumpObject ( 14717683Spst ACPI_OPERAND_OBJECT *ObjDesc, 14817683Spst ACPI_EXDUMP_INFO *Info); 14917683Spst 15017683Spststatic void 15117683SpstAcpiExDumpReferenceObj ( 15217683Spst ACPI_OPERAND_OBJECT *ObjDesc); 15317683Spst 15417683Spststatic void 15517683SpstAcpiExDumpPackageObj ( 15617683Spst ACPI_OPERAND_OBJECT *ObjDesc, 15717683Spst UINT32 Level, 15817683Spst UINT32 Index); 15917683Spst 16017683Spst 16117683Spst/******************************************************************************* 16217683Spst * 16317683Spst * Object Descriptor info tables 16417683Spst * 16517683Spst * Note: The first table entry must be an INIT opcode and must contain 16617683Spst * the table length (number of table entries) 16717683Spst * 16817683Spst ******************************************************************************/ 16917683Spst 17017683Spststatic ACPI_EXDUMP_INFO AcpiExDumpInteger[2] = 17117683Spst{ 17217683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger), NULL}, 17317683Spst {ACPI_EXD_UINT64, ACPI_EXD_OFFSET (Integer.Value), "Value"} 17417683Spst}; 17517683Spst 17617683Spststatic ACPI_EXDUMP_INFO AcpiExDumpString[4] = 17717683Spst{ 17817683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpString), NULL}, 17917683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (String.Length), "Length"}, 18017683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (String.Pointer), "Pointer"}, 18117683Spst {ACPI_EXD_STRING, 0, NULL} 18217683Spst}; 18317683Spst 18417683Spststatic ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] = 18517683Spst{ 18617683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL}, 18717683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"}, 18817683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"}, 18917683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"}, 19017683Spst {ACPI_EXD_BUFFER, 0, NULL} 19117683Spst}; 19217683Spst 19317683Spststatic ACPI_EXDUMP_INFO AcpiExDumpPackage[5] = 19417683Spst{ 19517683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL}, 19617683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"}, 19717683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Elements"}, 19817683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"}, 19917683Spst {ACPI_EXD_PACKAGE, 0, NULL} 20017683Spst}; 20117683Spst 20217683Spststatic ACPI_EXDUMP_INFO AcpiExDumpDevice[4] = 20317683Spst{ 20417683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL}, 20517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"}, 20617683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"}, 20717683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"} 20817683Spst}; 20917683Spst 21017683Spststatic ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = 21117683Spst{ 21217683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent), NULL}, 21317683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"} 21417683Spst}; 21517683Spst 21617683Spststatic ACPI_EXDUMP_INFO AcpiExDumpMethod[8] = 21717683Spst{ 21817683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL}, 21917683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "ParamCount"}, 22017683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"}, 22117683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"}, 22217683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"}, 22317683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ThreadCount), "Thread Count"}, 22417683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Method.AmlLength), "Aml Length"}, 22517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"} 22617683Spst}; 22717683Spst 22817683Spststatic ACPI_EXDUMP_INFO AcpiExDumpMutex[5] = 22917683Spst{ 23017683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL}, 23117683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"}, 23217683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"}, 23317683Spst {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"}, 23417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"} 23517683Spst}; 23617683Spst 23717683Spststatic ACPI_EXDUMP_INFO AcpiExDumpRegion[7] = 23817683Spst{ 23917683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL}, 24017683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"}, 24117683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"}, 24217683Spst {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"}, 24317683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"}, 24417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Handler), "Handler"}, 24517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"} 24617683Spst}; 24717683Spst 24817683Spststatic ACPI_EXDUMP_INFO AcpiExDumpPower[5] = 24917683Spst{ 25017683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL}, 25117683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"}, 25217683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"}, 25317683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"}, 25417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"} 25517683Spst}; 25617683Spst 25717683Spststatic ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] = 25817683Spst{ 25917683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor), NULL}, 26017683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"}, 26117683Spst {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"}, 26217683Spst {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"}, 26317683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"}, 26417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"}, 26517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"} 26617683Spst}; 26717683Spst 26817683Spststatic ACPI_EXDUMP_INFO AcpiExDumpThermal[4] = 26917683Spst{ 27017683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL}, 27117683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"}, 27217683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"}, 27317683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"} 27417683Spst}; 27517683Spst 27617683Spststatic ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] = 27717683Spst{ 27817683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField), NULL}, 27917683Spst {ACPI_EXD_FIELD, 0, NULL}, 28017683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"} 28117683Spst}; 28217683Spst 28317683Spststatic ACPI_EXDUMP_INFO AcpiExDumpRegionField[3] = 28417683Spst{ 28517683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL}, 28617683Spst {ACPI_EXD_FIELD, 0, NULL}, 28717683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"} 28817683Spst}; 28917683Spst 29017683Spststatic ACPI_EXDUMP_INFO AcpiExDumpBankField[5] = 29117683Spst{ 29217683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL}, 29317683Spst {ACPI_EXD_FIELD, 0, NULL}, 29417683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"}, 29517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"}, 29617683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"} 29717683Spst}; 29817683Spst 29917683Spststatic ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] = 30017683Spst{ 30117683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL}, 30217683Spst {ACPI_EXD_FIELD, 0, NULL}, 30317683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"}, 30417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"}, 30517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"} 30617683Spst}; 30717683Spst 30817683Spst 30917683Spststatic ACPI_EXDUMP_INFO AcpiExDumpReference[7] = 31017683Spst{ 31117683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL}, 31217683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"}, 31317683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"}, 31417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, 31517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"}, 31617683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, 31717683Spst {ACPI_EXD_REFERENCE,0, NULL} 31817683Spst}; 31917683Spst 32017683Spststatic ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] = 32117683Spst{ 32217683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL}, 32317683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"}, 32417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"}, 32517683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"}, 32617683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"}, 32717683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"} 32817683Spst}; 32917683Spst 33017683Spststatic ACPI_EXDUMP_INFO AcpiExDumpNotify[3] = 33117683Spst{ 33217683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL}, 33317683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"}, 33417683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"} 33517683Spst}; 33617683Spst 33717683Spst 33817683Spst/* Miscellaneous tables */ 33917683Spst 34017683Spststatic ACPI_EXDUMP_INFO AcpiExDumpCommon[4] = 34117683Spst{ 34217683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL}, 34317683Spst {ACPI_EXD_TYPE , 0, NULL}, 34417683Spst {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"}, 34517683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"} 34617683Spst}; 34717683Spst 34817683Spst 34917683Spststatic ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = 35017683Spst{ 35117683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL}, 35217683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"}, 35317683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"}, 35417683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"}, 35517683Spst {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"}, 35617683Spst {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"}, 35717683Spst {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"} 35817683Spst}; 35917683Spst 36017683Spststatic ACPI_EXDUMP_INFO AcpiExDumpNode[5] = 36117683Spst{ 36217683Spst {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL}, 36317683Spst {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"}, 36417683Spst {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"}, 36517683Spst {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"}, 36617683Spst {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"} 36717683Spst}; 36817683Spst 36917683Spst 37017683Spst/* Dispatch table, indexed by object type */ 37117683Spst 37217683Spststatic ACPI_EXDUMP_INFO *AcpiExDumpInfo[] = 37317683Spst{ 37417683Spst NULL, 37517683Spst AcpiExDumpInteger, 37617683Spst AcpiExDumpString, 37717683Spst AcpiExDumpBuffer, 37817683Spst AcpiExDumpPackage, 37917683Spst NULL, 38017683Spst AcpiExDumpDevice, 38117683Spst AcpiExDumpEvent, 38217683Spst AcpiExDumpMethod, 38317683Spst AcpiExDumpMutex, 38417683Spst AcpiExDumpRegion, 38517683Spst AcpiExDumpPower, 38617683Spst AcpiExDumpProcessor, 38717683Spst AcpiExDumpThermal, 38817683Spst AcpiExDumpBufferField, 38917683Spst NULL, 39017683Spst NULL, 39117683Spst AcpiExDumpRegionField, 39217683Spst AcpiExDumpBankField, 39317683Spst AcpiExDumpIndexField, 39417683Spst AcpiExDumpReference, 39517683Spst NULL, 39617683Spst NULL, 39717683Spst AcpiExDumpNotify, 39817683Spst AcpiExDumpAddressHandler, 39917683Spst NULL, 40017683Spst NULL, 40117683Spst NULL 40217683Spst}; 40317683Spst 40417683Spst 40517683Spst/******************************************************************************* 40617683Spst * 40717683Spst * FUNCTION: AcpiExDumpObject 40817683Spst * 40917683Spst * PARAMETERS: ObjDesc - Descriptor to dump 41017683Spst * Info - Info table corresponding to this object 41117683Spst * type 41217683Spst * 41317683Spst * RETURN: None 41417683Spst * 41517683Spst * DESCRIPTION: Walk the info table for this object 41617683Spst * 41717683Spst ******************************************************************************/ 41817683Spst 41917683Spststatic void 42017683SpstAcpiExDumpObject ( 42117683Spst ACPI_OPERAND_OBJECT *ObjDesc, 42217683Spst ACPI_EXDUMP_INFO *Info) 42317683Spst{ 42417683Spst UINT8 *Target; 42517683Spst char *Name; 42617683Spst UINT8 Count; 42717683Spst 42817683Spst 42917683Spst if (!Info) 43017683Spst { 43117683Spst AcpiOsPrintf ( 43217683Spst "ExDumpObject: Display not implemented for object type %s\n", 43317683Spst AcpiUtGetObjectTypeName (ObjDesc)); 43417683Spst return; 43517683Spst } 43617683Spst 43717683Spst /* First table entry must contain the table length (# of table entries) */ 43817683Spst 43917683Spst Count = Info->Offset; 44017683Spst 44117683Spst while (Count) 44217683Spst { 44317683Spst Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset); 44417683Spst Name = Info->Name; 44517683Spst 44617683Spst switch (Info->Opcode) 44717683Spst { 44817683Spst case ACPI_EXD_INIT: 44917683Spst break; 45017683Spst 45117683Spst case ACPI_EXD_TYPE: 45217683Spst AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc)); 45317683Spst break; 45417683Spst 45517683Spst case ACPI_EXD_UINT8: 45617683Spst 45717683Spst AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target); 45817683Spst break; 45917683Spst 46017683Spst case ACPI_EXD_UINT16: 46117683Spst 46217683Spst AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target)); 46317683Spst break; 46417683Spst 46517683Spst case ACPI_EXD_UINT32: 46617683Spst 46717683Spst AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target)); 46817683Spst break; 46917683Spst 47017683Spst case ACPI_EXD_UINT64: 47117683Spst 47217683Spst AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value", 47317683Spst ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); 47417683Spst break; 47517683Spst 47617683Spst case ACPI_EXD_POINTER: 47717683Spst case ACPI_EXD_ADDRESS: 47817683Spst 47917683Spst AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target)); 48017683Spst break; 48117683Spst 48217683Spst case ACPI_EXD_STRING: 48317683Spst 48417683Spst AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); 48517683Spst AcpiOsPrintf ("\n"); 48617683Spst break; 48717683Spst 48817683Spst case ACPI_EXD_BUFFER: 48917683Spst 49017683Spst ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length); 49117683Spst break; 49217683Spst 49317683Spst case ACPI_EXD_PACKAGE: 49417683Spst 49517683Spst /* Dump the package contents */ 49617683Spst 49717683Spst AcpiOsPrintf ("\nPackage Contents:\n"); 49817683Spst AcpiExDumpPackageObj (ObjDesc, 0, 0); 49917683Spst break; 50017683Spst 50117683Spst case ACPI_EXD_FIELD: 50217683Spst 50317683Spst AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon); 50417683Spst break; 50517683Spst 50617683Spst case ACPI_EXD_REFERENCE: 50717683Spst 50817683Spst AcpiExOutString ("Opcode", 50917683Spst (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name); 51017683Spst AcpiExDumpReferenceObj (ObjDesc); 51117683Spst break; 51217683Spst 51317683Spst default: 51417683Spst AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode); 51517683Spst return; 51617683Spst } 51717683Spst 51817683Spst Info++; 51917683Spst Count--; 52017683Spst } 52117683Spst} 52217683Spst 52317683Spst 52417683Spst/******************************************************************************* 52517683Spst * 52617683Spst * FUNCTION: AcpiExDumpOperand 52717683Spst * 52817683Spst * PARAMETERS: *ObjDesc - Pointer to entry to be dumped 52917683Spst * Depth - Current nesting depth 53017683Spst * 53117683Spst * RETURN: None 53217683Spst * 53317683Spst * DESCRIPTION: Dump an operand object 53417683Spst * 53517683Spst ******************************************************************************/ 53617683Spst 53717683Spstvoid 53817683SpstAcpiExDumpOperand ( 53917683Spst ACPI_OPERAND_OBJECT *ObjDesc, 54017683Spst UINT32 Depth) 54117683Spst{ 54217683Spst UINT32 Length; 54317683Spst UINT32 Index; 54417683Spst 54517683Spst 54617683Spst ACPI_FUNCTION_NAME (ExDumpOperand) 54717683Spst 54817683Spst 54917683Spst if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) 55017683Spst { 55117683Spst return; 55217683Spst } 55317683Spst 55417683Spst if (!ObjDesc) 55517683Spst { 55617683Spst /* This could be a null element of a package */ 55717683Spst 55817683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); 55917683Spst return; 56017683Spst } 56117683Spst 56217683Spst if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) 56317683Spst { 56417683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc)); 56517683Spst ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC); 56617683Spst return; 56717683Spst } 56817683Spst 56917683Spst if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 57017683Spst { 57117683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 57217683Spst "%p is not a node or operand object: [%s]\n", 57317683Spst ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); 57417683Spst ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)); 57517683Spst return; 57617683Spst } 57717683Spst 57817683Spst /* ObjDesc is a valid object */ 57917683Spst 58017683Spst if (Depth > 0) 58117683Spst { 58217683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ", 58317683Spst Depth, " ", Depth, ObjDesc)); 58417683Spst } 58517683Spst else 58617683Spst { 58717683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc)); 58817683Spst } 58917683Spst 59017683Spst /* Decode object type */ 59117683Spst 59217683Spst switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 59317683Spst { 59417683Spst case ACPI_TYPE_LOCAL_REFERENCE: 59517683Spst 59617683Spst switch (ObjDesc->Reference.Opcode) 59717683Spst { 59817683Spst case AML_DEBUG_OP: 59917683Spst 60017683Spst AcpiOsPrintf ("Reference: Debug\n"); 60117683Spst break; 60217683Spst 60317683Spst 60417683Spst case AML_INDEX_OP: 60517683Spst 60617683Spst AcpiOsPrintf ("Reference: Index %p\n", 60717683Spst ObjDesc->Reference.Object); 60817683Spst break; 60917683Spst 61017683Spst 61117683Spst case AML_REF_OF_OP: 61217683Spst 61317683Spst AcpiOsPrintf ("Reference: (RefOf) %p\n", 61417683Spst ObjDesc->Reference.Object); 61517683Spst break; 61617683Spst 61717683Spst 61817683Spst case AML_ARG_OP: 61917683Spst 62017683Spst AcpiOsPrintf ("Reference: Arg%d", 62117683Spst ObjDesc->Reference.Offset); 62217683Spst 62317683Spst if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) 62417683Spst { 62517683Spst /* Value is an Integer */ 62617683Spst 62717683Spst AcpiOsPrintf (" value is [%8.8X%8.8x]", 62817683Spst ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 62917683Spst } 63017683Spst 63117683Spst AcpiOsPrintf ("\n"); 63217683Spst break; 63317683Spst 63417683Spst 63517683Spst case AML_LOCAL_OP: 63617683Spst 63717683Spst AcpiOsPrintf ("Reference: Local%d", 63817683Spst ObjDesc->Reference.Offset); 63917683Spst 64017683Spst if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) 64117683Spst { 64217683Spst 64317683Spst /* Value is an Integer */ 64417683Spst 64517683Spst AcpiOsPrintf (" value is [%8.8X%8.8x]", 64617683Spst ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 64717683Spst } 64817683Spst 64917683Spst AcpiOsPrintf ("\n"); 65017683Spst break; 65117683Spst 65217683Spst 65317683Spst case AML_INT_NAMEPATH_OP: 65417683Spst 65517683Spst AcpiOsPrintf ("Reference.Node->Name %X\n", 65617683Spst ObjDesc->Reference.Node->Name.Integer); 65717683Spst break; 65817683Spst 65917683Spst 66017683Spst default: 66117683Spst 66217683Spst /* Unknown opcode */ 66317683Spst 66417683Spst AcpiOsPrintf ("Unknown Reference opcode=%X\n", 66517683Spst ObjDesc->Reference.Opcode); 66617683Spst break; 66717683Spst 66817683Spst } 66917683Spst break; 67017683Spst 67117683Spst 67217683Spst case ACPI_TYPE_BUFFER: 67317683Spst 67417683Spst AcpiOsPrintf ("Buffer len %X @ %p\n", 67517683Spst ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer); 67617683Spst 67717683Spst Length = ObjDesc->Buffer.Length; 67817683Spst if (Length > 64) 67917683Spst { 68017683Spst Length = 64; 68117683Spst } 68217683Spst 68317683Spst /* Debug only -- dump the buffer contents */ 68417683Spst 68517683Spst if (ObjDesc->Buffer.Pointer) 68617683Spst { 68717683Spst AcpiOsPrintf ("Buffer Contents: "); 68817683Spst 68917683Spst for (Index = 0; Index < Length; Index++) 69017683Spst { 69117683Spst AcpiOsPrintf (" %02x", ObjDesc->Buffer.Pointer[Index]); 69217683Spst } 69317683Spst AcpiOsPrintf ("\n"); 69417683Spst } 69517683Spst break; 69617683Spst 69717683Spst 69817683Spst case ACPI_TYPE_INTEGER: 69917683Spst 70017683Spst AcpiOsPrintf ("Integer %8.8X%8.8X\n", 70117683Spst ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 70217683Spst break; 70317683Spst 70417683Spst 70517683Spst case ACPI_TYPE_PACKAGE: 70617683Spst 70717683Spst AcpiOsPrintf ("Package [Len %X] ElementArray %p\n", 70817683Spst ObjDesc->Package.Count, ObjDesc->Package.Elements); 70917683Spst 71017683Spst /* 71117683Spst * If elements exist, package element pointer is valid, 71217683Spst * and debug_level exceeds 1, dump package's elements. 71317683Spst */ 71417683Spst if (ObjDesc->Package.Count && 71517683Spst ObjDesc->Package.Elements && 71617683Spst AcpiDbgLevel > 1) 71717683Spst { 71817683Spst for (Index = 0; Index < ObjDesc->Package.Count; Index++) 71917683Spst { 72017683Spst AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1); 72117683Spst } 72217683Spst } 72317683Spst break; 72417683Spst 72517683Spst 72617683Spst case ACPI_TYPE_REGION: 72717683Spst 72817683Spst AcpiOsPrintf ("Region %s (%X)", 72917683Spst AcpiUtGetRegionName (ObjDesc->Region.SpaceId), 73017683Spst ObjDesc->Region.SpaceId); 73117683Spst 73217683Spst /* 73317683Spst * If the address and length have not been evaluated, 73417683Spst * don't print them. 73517683Spst */ 73617683Spst if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)) 73717683Spst { 73817683Spst AcpiOsPrintf ("\n"); 73917683Spst } 74017683Spst else 74117683Spst { 74217683Spst AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", 74317683Spst ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), 74417683Spst ObjDesc->Region.Length); 74517683Spst } 74617683Spst break; 74717683Spst 74817683Spst 74917683Spst case ACPI_TYPE_STRING: 75017683Spst 75117683Spst AcpiOsPrintf ("String length %X @ %p ", 75217683Spst ObjDesc->String.Length, 75317683Spst ObjDesc->String.Pointer); 75417683Spst 75517683Spst AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); 75617683Spst AcpiOsPrintf ("\n"); 75717683Spst break; 75817683Spst 75917683Spst 76017683Spst case ACPI_TYPE_LOCAL_BANK_FIELD: 76117683Spst 76217683Spst AcpiOsPrintf ("BankField\n"); 76317683Spst break; 76417683Spst 76517683Spst 76617683Spst case ACPI_TYPE_LOCAL_REGION_FIELD: 76717683Spst 76817683Spst AcpiOsPrintf ( 76917683Spst "RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", 77017683Spst ObjDesc->Field.BitLength, 77117683Spst ObjDesc->Field.AccessByteWidth, 77217683Spst ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK, 77317683Spst ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK, 77417683Spst ObjDesc->Field.BaseByteOffset, 77517683Spst ObjDesc->Field.StartFieldBitOffset); 77617683Spst 77717683Spst AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1); 77817683Spst break; 77917683Spst 78017683Spst 78117683Spst case ACPI_TYPE_LOCAL_INDEX_FIELD: 78217683Spst 78317683Spst AcpiOsPrintf ("IndexField\n"); 78417683Spst break; 78517683Spst 78617683Spst 78717683Spst case ACPI_TYPE_BUFFER_FIELD: 78817683Spst 78917683Spst AcpiOsPrintf ( 79017683Spst "BufferField: %X bits at byte %X bit %X of\n", 79117683Spst ObjDesc->BufferField.BitLength, 79217683Spst ObjDesc->BufferField.BaseByteOffset, 79317683Spst ObjDesc->BufferField.StartFieldBitOffset); 79417683Spst 79517683Spst if (!ObjDesc->BufferField.BufferObj) 79617683Spst { 79717683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n")); 79817683Spst } 79917683Spst else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) != 80017683Spst ACPI_TYPE_BUFFER) 80117683Spst { 80217683Spst AcpiOsPrintf ("*not a Buffer*\n"); 80317683Spst } 80417683Spst else 80517683Spst { 80617683Spst AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1); 80717683Spst } 80817683Spst break; 80917683Spst 81017683Spst 81117683Spst case ACPI_TYPE_EVENT: 81217683Spst 81317683Spst AcpiOsPrintf ("Event\n"); 81417683Spst break; 81517683Spst 81617683Spst 81717683Spst case ACPI_TYPE_METHOD: 81817683Spst 81917683Spst AcpiOsPrintf ("Method(%X) @ %p:%X\n", 82017683Spst ObjDesc->Method.ParamCount, 82117683Spst ObjDesc->Method.AmlStart, 82217683Spst ObjDesc->Method.AmlLength); 82317683Spst break; 82417683Spst 82517683Spst 82617683Spst case ACPI_TYPE_MUTEX: 82717683Spst 82817683Spst AcpiOsPrintf ("Mutex\n"); 82917683Spst break; 83017683Spst 83117683Spst 83217683Spst case ACPI_TYPE_DEVICE: 83317683Spst 83417683Spst AcpiOsPrintf ("Device\n"); 83517683Spst break; 83617683Spst 83717683Spst 83817683Spst case ACPI_TYPE_POWER: 83917683Spst 84017683Spst AcpiOsPrintf ("Power\n"); 84117683Spst break; 84217683Spst 84317683Spst 84417683Spst case ACPI_TYPE_PROCESSOR: 84517683Spst 84617683Spst AcpiOsPrintf ("Processor\n"); 84717683Spst break; 84817683Spst 84917683Spst 85017683Spst case ACPI_TYPE_THERMAL: 85117683Spst 85217683Spst AcpiOsPrintf ("Thermal\n"); 85317683Spst break; 85417683Spst 85517683Spst 85617683Spst default: 85717683Spst /* Unknown Type */ 85817683Spst 85917683Spst AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc)); 86017683Spst break; 86117683Spst } 86217683Spst 86317683Spst return; 86417683Spst} 86517683Spst 86617683Spst 86717683Spst/******************************************************************************* 86817683Spst * 86917683Spst * FUNCTION: AcpiExDumpOperands 87017683Spst * 87117683Spst * PARAMETERS: Operands - Operand list 87217683Spst * InterpreterMode - Load or Exec 87317683Spst * Ident - Identification 87417683Spst * NumLevels - # of stack entries to dump above line 87517683Spst * Note - Output notation 87617683Spst * ModuleName - Caller's module name 87717683Spst * LineNumber - Caller's invocation line number 87817683Spst * 87917683Spst * DESCRIPTION: Dump the object stack 88017683Spst * 88117683Spst ******************************************************************************/ 88217683Spst 88317683Spstvoid 88417683SpstAcpiExDumpOperands ( 88517683Spst ACPI_OPERAND_OBJECT **Operands, 88617683Spst ACPI_INTERPRETER_MODE InterpreterMode, 88717683Spst char *Ident, 88817683Spst UINT32 NumLevels, 88917683Spst char *Note, 89017683Spst char *ModuleName, 89117683Spst UINT32 LineNumber) 89217683Spst{ 89317683Spst ACPI_NATIVE_UINT i; 89417683Spst 89517683Spst 89617683Spst ACPI_FUNCTION_NAME (ExDumpOperands); 89717683Spst 89817683Spst 89917683Spst if (!Ident) 90017683Spst { 90117683Spst Ident = "?"; 90217683Spst } 90317683Spst 90417683Spst if (!Note) 90517683Spst { 90617683Spst Note = "?"; 90717683Spst } 90817683Spst 90917683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 91017683Spst "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", 91117683Spst Ident, NumLevels)); 91217683Spst 91317683Spst if (NumLevels == 0) 91417683Spst { 91517683Spst NumLevels = 1; 91617683Spst } 91717683Spst 91817683Spst /* Dump the operand stack starting at the top */ 91917683Spst 92017683Spst for (i = 0; NumLevels > 0; i--, NumLevels--) 92117683Spst { 92217683Spst AcpiExDumpOperand (Operands[i], 0); 92317683Spst } 92417683Spst 92517683Spst ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 92617683Spst "************* Operand Stack dump from %s(%d), %s\n", 92717683Spst ModuleName, LineNumber, Note)); 92817683Spst return; 92917683Spst} 93017683Spst 93117683Spst 93217683Spst/******************************************************************************* 93317683Spst * 93417683Spst * FUNCTION: AcpiExOut* functions 93517683Spst * 93617683Spst * PARAMETERS: Title - Descriptive text 93717683Spst * Value - Value to be displayed 93817683Spst * 93917683Spst * DESCRIPTION: Object dump output formatting functions. These functions 94017683Spst * reduce the number of format strings required and keeps them 94117683Spst * all in one place for easy modification. 94217683Spst * 94317683Spst ******************************************************************************/ 94417683Spst 94517683Spststatic void 94617683SpstAcpiExOutString ( 94717683Spst char *Title, 94817683Spst char *Value) 94917683Spst{ 95017683Spst AcpiOsPrintf ("%20s : %s\n", Title, Value); 95117683Spst} 95217683Spst 95317683Spststatic void 95417683SpstAcpiExOutPointer ( 95517683Spst char *Title, 95617683Spst void *Value) 95717683Spst{ 95817683Spst AcpiOsPrintf ("%20s : %p\n", Title, Value); 95917683Spst} 96017683Spst 96117683Spst 96217683Spst/******************************************************************************* 96317683Spst * 96417683Spst * FUNCTION: AcpiExDumpNamespaceNode 96517683Spst * 96617683Spst * PARAMETERS: Node - Descriptor to dump 96717683Spst * Flags - Force display if TRUE 96817683Spst * 96917683Spst * DESCRIPTION: Dumps the members of the given.Node 97017683Spst * 97117683Spst ******************************************************************************/ 97217683Spst 97317683Spstvoid 97417683SpstAcpiExDumpNamespaceNode ( 97517683Spst ACPI_NAMESPACE_NODE *Node, 97617683Spst UINT32 Flags) 97717683Spst{ 97817683Spst 97917683Spst ACPI_FUNCTION_ENTRY (); 98017683Spst 98117683Spst 98217683Spst if (!Flags) 98317683Spst { 98417683Spst if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) 98517683Spst { 98617683Spst return; 98717683Spst } 98817683Spst } 98917683Spst 99017683Spst AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); 99117683Spst AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); 99217683Spst AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); 99317683Spst AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node)); 99417683Spst 99517683Spst AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node), 99617683Spst AcpiExDumpNode); 99717683Spst} 99817683Spst 99917683Spst 100017683Spst/******************************************************************************* 100117683Spst * 100217683Spst * FUNCTION: AcpiExDumpReferenceObj 100317683Spst * 100417683Spst * PARAMETERS: Object - Descriptor to dump 100517683Spst * 100617683Spst * DESCRIPTION: Dumps a reference object 100717683Spst * 100817683Spst ******************************************************************************/ 100917683Spst 101017683Spststatic void 101117683SpstAcpiExDumpReferenceObj ( 101217683Spst ACPI_OPERAND_OBJECT *ObjDesc) 101317683Spst{ 101417683Spst ACPI_BUFFER RetBuf; 101517683Spst ACPI_STATUS Status; 101617683Spst 101717683Spst 101817683Spst RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 101917683Spst 102017683Spst if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP) 102117683Spst { 102217683Spst AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node); 102317683Spst 102417683Spst Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf); 102517683Spst if (ACPI_FAILURE (Status)) 102617683Spst { 102717683Spst AcpiOsPrintf ("Could not convert name to pathname\n"); 102817683Spst } 102917683Spst else 103017683Spst { 103117683Spst AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer); 103217683Spst ACPI_FREE (RetBuf.Pointer); 103317683Spst } 103417683Spst } 103517683Spst else if (ObjDesc->Reference.Object) 103617683Spst { 103717683Spst AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object); 103817683Spst } 103917683Spst} 104017683Spst 104117683Spst 104217683Spst/******************************************************************************* 104317683Spst * 104417683Spst * FUNCTION: AcpiExDumpPackageObj 104517683Spst * 104617683Spst * PARAMETERS: ObjDesc - Descriptor to dump 104717683Spst * Level - Indentation Level 104817683Spst * Index - Package index for this object 104917683Spst * 105017683Spst * DESCRIPTION: Dumps the elements of the package 105117683Spst * 105217683Spst ******************************************************************************/ 105317683Spst 105417683Spststatic void 105517683SpstAcpiExDumpPackageObj ( 105617683Spst ACPI_OPERAND_OBJECT *ObjDesc, 105717683Spst UINT32 Level, 105817683Spst UINT32 Index) 105917683Spst{ 106017683Spst UINT32 i; 106117683Spst 106217683Spst 106317683Spst /* Indentation and index output */ 106417683Spst 106517683Spst if (Level > 0) 106617683Spst { 106717683Spst for (i = 0; i < Level; i++) 106817683Spst { 106917683Spst AcpiOsPrintf (" "); 107017683Spst } 107117683Spst 107217683Spst AcpiOsPrintf ("[%.2d] ", Index); 107317683Spst } 107417683Spst 107517683Spst AcpiOsPrintf ("%p ", ObjDesc); 107617683Spst 107717683Spst /* Null package elements are allowed */ 107817683Spst 107917683Spst if (!ObjDesc) 108017683Spst { 108117683Spst AcpiOsPrintf ("[Null Object]\n"); 108217683Spst return; 108317683Spst } 108417683Spst 108517683Spst /* Packages may only contain a few object types */ 108617683Spst 108717683Spst switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 108817683Spst { 108917683Spst case ACPI_TYPE_INTEGER: 109017683Spst 109117683Spst AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", 109217683Spst ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 109317683Spst break; 109417683Spst 109517683Spst 109617683Spst case ACPI_TYPE_STRING: 109717683Spst 109817683Spst AcpiOsPrintf ("[String] Value: "); 109917683Spst for (i = 0; i < ObjDesc->String.Length; i++) 110017683Spst { 110117683Spst AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]); 110217683Spst } 110317683Spst AcpiOsPrintf ("\n"); 110417683Spst break; 110517683Spst 110617683Spst 110717683Spst case ACPI_TYPE_BUFFER: 110817683Spst 110917683Spst AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); 111017683Spst if (ObjDesc->Buffer.Length) 111117683Spst { 111217683Spst AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), 111317683Spst ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); 111417683Spst } 111517683Spst else 111617683Spst { 111717683Spst AcpiOsPrintf ("\n"); 111817683Spst } 111917683Spst break; 112017683Spst 112117683Spst 112217683Spst case ACPI_TYPE_PACKAGE: 112317683Spst 112417683Spst AcpiOsPrintf ("[Package] Contains %d Elements:\n", 112517683Spst ObjDesc->Package.Count); 112617683Spst 112717683Spst for (i = 0; i < ObjDesc->Package.Count; i++) 112817683Spst { 112917683Spst AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i); 113017683Spst } 113117683Spst break; 113217683Spst 113317683Spst 113417683Spst case ACPI_TYPE_LOCAL_REFERENCE: 113517683Spst 113617683Spst AcpiOsPrintf ("[Object Reference] "); 113717683Spst AcpiExDumpReferenceObj (ObjDesc); 113817683Spst break; 113917683Spst 114017683Spst 114117683Spst default: 114217683Spst 114317683Spst AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc)); 114417683Spst break; 114517683Spst } 114617683Spst} 114717683Spst 114817683Spst 114917683Spst/******************************************************************************* 115017683Spst * 115117683Spst * FUNCTION: AcpiExDumpObjectDescriptor 115217683Spst * 115317683Spst * PARAMETERS: ObjDesc - Descriptor to dump 115417683Spst * Flags - Force display if TRUE 115517683Spst * 115617683Spst * DESCRIPTION: Dumps the members of the object descriptor given. 115717683Spst * 115817683Spst ******************************************************************************/ 115917683Spst 116017683Spstvoid 116117683SpstAcpiExDumpObjectDescriptor ( 116217683Spst ACPI_OPERAND_OBJECT *ObjDesc, 116317683Spst UINT32 Flags) 116417683Spst{ 116517683Spst ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor); 116617683Spst 116717683Spst 116817683Spst if (!ObjDesc) 116917683Spst { 117017683Spst return_VOID; 117117683Spst } 117217683Spst 117317683Spst if (!Flags) 117417683Spst { 117517683Spst if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) 117617683Spst { 117717683Spst return_VOID; 117817683Spst } 117917683Spst } 118017683Spst 118117683Spst if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) 118217683Spst { 118317683Spst AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags); 118417683Spst 118517683Spst AcpiOsPrintf ("\nAttached Object (%p):\n", 118617683Spst ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object); 118717683Spst 118817683Spst AcpiExDumpObjectDescriptor ( 118917683Spst ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags); 119017683Spst return_VOID; 119117683Spst } 119217683Spst 119317683Spst if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 119417683Spst { 119517683Spst AcpiOsPrintf ( 119617683Spst "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", 119717683Spst ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); 119817683Spst return_VOID; 119917683Spst } 120017683Spst 120117683Spst if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX) 120217683Spst { 120317683Spst return_VOID; 120417683Spst } 120517683Spst 120617683Spst /* Common Fields */ 120717683Spst 120817683Spst AcpiExDumpObject (ObjDesc, AcpiExDumpCommon); 120917683Spst 121017683Spst /* Object-specific fields */ 121117683Spst 121217683Spst AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]); 121317683Spst return_VOID; 121417683Spst} 121517683Spst 121617683Spst#endif 121717683Spst 121817683Spst