dbdisply.c revision 91116
167754Smsmith/******************************************************************************* 267754Smsmith * 367754Smsmith * Module Name: dbdisply - debug display commands 491116Smsmith * $Revision: 66 $ 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 * make derivatives, distribute, use and display any portion of the Covered 2767754Smsmith * Code in any form, with the right to sublicense such rights; and 2867754Smsmith * 2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3067754Smsmith * license (with the right to sublicense), under only those claims of Intel 3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell, 3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof 3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright 3467754Smsmith * license, and in no event shall the patent license extend to any additions 3567754Smsmith * to or modifications of the Original Intel Code. No other license or right 3667754Smsmith * is granted directly or by implication, estoppel or otherwise; 3767754Smsmith * 3867754Smsmith * The above copyright and patent license is granted only if the following 3967754Smsmith * conditions are met: 4067754Smsmith * 4167754Smsmith * 3. Conditions 4267754Smsmith * 4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4467754Smsmith * Redistribution of source code of any substantial portion of the Covered 4567754Smsmith * Code or modification with rights to further distribute source must include 4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions, 4767754Smsmith * and the following Disclaimer and Export Compliance provision. In addition, 4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to 4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered 5067754Smsmith * Code and the date of any change. Licensee must include in that file the 5167754Smsmith * documentation of any changes made by any predecessor Licensee. Licensee 5267754Smsmith * must include a prominent statement that the modification is derived, 5367754Smsmith * directly or indirectly, from Original Intel Code. 5467754Smsmith * 5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5667754Smsmith * Redistribution of source code of any substantial portion of the Covered 5767754Smsmith * Code or modification without rights to further distribute source must 5867754Smsmith * include the following Disclaimer and Export Compliance provision in the 5967754Smsmith * documentation and/or other materials provided with distribution. In 6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any 6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the 6267754Smsmith * license from Licensee to its licensee is limited to the intellectual 6367754Smsmith * property embodied in the software Licensee provides to its licensee, and 6467754Smsmith * not to intellectual property embodied in modifications its licensee may 6567754Smsmith * make. 6667754Smsmith * 6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any 6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the 6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance 7067754Smsmith * provision in the documentation and/or other materials provided with the 7167754Smsmith * distribution. 7267754Smsmith * 7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original 7467754Smsmith * Intel Code. 7567754Smsmith * 7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by 7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or 7867754Smsmith * other dealings in products derived from or relating to the Covered Code 7967754Smsmith * without prior written authorization from Intel. 8067754Smsmith * 8167754Smsmith * 4. Disclaimer and Export Compliance 8267754Smsmith * 8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8467754Smsmith * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 8967754Smsmith * PARTICULAR PURPOSE. 9067754Smsmith * 9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 9867754Smsmith * LIMITED REMEDY. 9967754Smsmith * 10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this 10167754Smsmith * software or system incorporating such software without first obtaining any 10267754Smsmith * required license or other approval from the U. S. Department of Commerce or 10367754Smsmith * any other agency or department of the United States Government. In the 10467754Smsmith * event Licensee exports any such software from the United States or 10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall 10667754Smsmith * ensure that the distribution and export/re-export of the software is in 10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the 10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor 10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process, 11067754Smsmith * software, or service, directly or indirectly, to any country for which the 11167754Smsmith * United States government or any agency thereof requires an export license, 11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining 11367754Smsmith * such license, approval or letter. 11467754Smsmith * 11567754Smsmith *****************************************************************************/ 11667754Smsmith 11767754Smsmith 11867754Smsmith#include "acpi.h" 11967754Smsmith#include "acparser.h" 12067754Smsmith#include "amlcode.h" 12167754Smsmith#include "acdispat.h" 12267754Smsmith#include "acnamesp.h" 12367754Smsmith#include "acparser.h" 12467754Smsmith#include "acevents.h" 12567754Smsmith#include "acinterp.h" 12667754Smsmith#include "acdebug.h" 12767754Smsmith 12867754Smsmith 12967754Smsmith#ifdef ENABLE_DEBUGGER 13067754Smsmith 13167754Smsmith 13277424Smsmith#define _COMPONENT ACPI_DEBUGGER 13391116Smsmith ACPI_MODULE_NAME ("dbdisply") 13467754Smsmith 13567754Smsmith 13667754Smsmith/****************************************************************************** 13767754Smsmith * 13867754Smsmith * FUNCTION: AcpiDbGetPointer 13967754Smsmith * 14067754Smsmith * PARAMETERS: Target - Pointer to string to be converted 14167754Smsmith * 14267754Smsmith * RETURN: Converted pointer 14367754Smsmith * 14467754Smsmith * DESCRIPTION: Convert an ascii pointer value to a real value 14567754Smsmith * 14667754Smsmith *****************************************************************************/ 14767754Smsmith 14867754Smsmithvoid * 14967754SmsmithAcpiDbGetPointer ( 15067754Smsmith void *Target) 15167754Smsmith{ 15267754Smsmith void *ObjPtr; 15367754Smsmith 15467754Smsmith 15567754Smsmith#ifdef _IA16 15667754Smsmith#include <stdio.h> 15767754Smsmith 15867754Smsmith /* Have to handle 16-bit pointers of the form segment:offset */ 15967754Smsmith 16067754Smsmith if (!sscanf (Target, "%p", &ObjPtr)) 16167754Smsmith { 16267754Smsmith AcpiOsPrintf ("Invalid pointer: %s\n", Target); 16367754Smsmith return (NULL); 16467754Smsmith } 16567754Smsmith 16667754Smsmith#else 16767754Smsmith 16867754Smsmith /* Simple flat pointer */ 16967754Smsmith 17091116Smsmith ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); 17167754Smsmith#endif 17267754Smsmith 17367754Smsmith return (ObjPtr); 17467754Smsmith} 17567754Smsmith 17667754Smsmith 17767754Smsmith/******************************************************************************* 17867754Smsmith * 17967754Smsmith * FUNCTION: AcpiDbDumpParserDescriptor 18067754Smsmith * 18167754Smsmith * PARAMETERS: Op - A parser Op descriptor 18267754Smsmith * 18367754Smsmith * RETURN: None 18467754Smsmith * 18567754Smsmith * DESCRIPTION: Display a formatted parser object 18667754Smsmith * 18767754Smsmith ******************************************************************************/ 18867754Smsmith 18967754Smsmithvoid 19067754SmsmithAcpiDbDumpParserDescriptor ( 19167754Smsmith ACPI_PARSE_OBJECT *Op) 19267754Smsmith{ 19383174Smsmith const ACPI_OPCODE_INFO *Info; 19467754Smsmith 19567754Smsmith 19667754Smsmith Info = AcpiPsGetOpcodeInfo (Op->Opcode); 19767754Smsmith 19867754Smsmith AcpiOsPrintf ("Parser Op Descriptor:\n"); 19967754Smsmith AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Opcode); 20067754Smsmith 20191116Smsmith ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name)); 20267754Smsmith 20367754Smsmith AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Value); 20467754Smsmith AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Parent); 20567754Smsmith AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Next); 20667754Smsmith} 20767754Smsmith 20867754Smsmith 20967754Smsmith/******************************************************************************* 21067754Smsmith * 21167754Smsmith * FUNCTION: AcpiDbDecodeAndDisplayObject 21267754Smsmith * 21367754Smsmith * PARAMETERS: Target - String with object to be displayed. Names 21467754Smsmith * and hex pointers are supported. 21567754Smsmith * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 21667754Smsmith * 21767754Smsmith * RETURN: None 21867754Smsmith * 21967754Smsmith * DESCRIPTION: Display a formatted ACPI object 22067754Smsmith * 22167754Smsmith ******************************************************************************/ 22267754Smsmith 22367754Smsmithvoid 22467754SmsmithAcpiDbDecodeAndDisplayObject ( 22567754Smsmith NATIVE_CHAR *Target, 22667754Smsmith NATIVE_CHAR *OutputType) 22767754Smsmith{ 22867754Smsmith void *ObjPtr; 22967754Smsmith ACPI_NAMESPACE_NODE *Node; 23087031Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 23167754Smsmith UINT32 Display = DB_BYTE_DISPLAY; 23267754Smsmith NATIVE_CHAR Buffer[80]; 23367754Smsmith ACPI_BUFFER RetBuf; 23467754Smsmith ACPI_STATUS Status; 23567754Smsmith UINT32 Size; 23667754Smsmith 23767754Smsmith 23867754Smsmith if (!Target) 23967754Smsmith { 24067754Smsmith return; 24167754Smsmith } 24267754Smsmith 24367754Smsmith /* Decode the output type */ 24467754Smsmith 24567754Smsmith if (OutputType) 24667754Smsmith { 24791116Smsmith ACPI_STRUPR (OutputType); 24867754Smsmith if (OutputType[0] == 'W') 24967754Smsmith { 25067754Smsmith Display = DB_WORD_DISPLAY; 25167754Smsmith } 25267754Smsmith else if (OutputType[0] == 'D') 25367754Smsmith { 25467754Smsmith Display = DB_DWORD_DISPLAY; 25567754Smsmith } 25667754Smsmith else if (OutputType[0] == 'Q') 25767754Smsmith { 25867754Smsmith Display = DB_QWORD_DISPLAY; 25967754Smsmith } 26067754Smsmith } 26167754Smsmith 26267754Smsmith RetBuf.Length = sizeof (Buffer); 26367754Smsmith RetBuf.Pointer = Buffer; 26467754Smsmith 26567754Smsmith /* Differentiate between a number and a name */ 26667754Smsmith 26767754Smsmith if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 26867754Smsmith { 26967754Smsmith ObjPtr = AcpiDbGetPointer (Target); 27067754Smsmith if (!AcpiOsReadable (ObjPtr, 16)) 27167754Smsmith { 27267754Smsmith AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr); 27367754Smsmith return; 27467754Smsmith } 27567754Smsmith 27667754Smsmith /* Decode the object type */ 27767754Smsmith 27891116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) 27967754Smsmith { 28091116Smsmith case ACPI_DESC_TYPE_NAMED: 28167754Smsmith 28291116Smsmith /* This is a namespace Node */ 28391116Smsmith 28467754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 28567754Smsmith { 28667754Smsmith AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr); 28767754Smsmith return; 28867754Smsmith } 28967754Smsmith 29067754Smsmith Node = ObjPtr; 29167754Smsmith goto DumpNte; 29267754Smsmith 29367754Smsmith 29491116Smsmith case ACPI_DESC_TYPE_INTERNAL: 29591116Smsmith 29691116Smsmith /* This is a ACPI OPERAND OBJECT */ 29791116Smsmith 29867754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 29967754Smsmith { 30067754Smsmith AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr); 30167754Smsmith return; 30267754Smsmith } 30367754Smsmith 30477424Smsmith AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 30577424Smsmith AcpiExDumpObjectDescriptor (ObjPtr, 1); 30691116Smsmith break; 30767754Smsmith 30867754Smsmith 30991116Smsmith case ACPI_DESC_TYPE_PARSER: 31091116Smsmith 31191116Smsmith /* This is a Parser Op object */ 31291116Smsmith 31367754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) 31467754Smsmith { 31567754Smsmith AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr); 31667754Smsmith return; 31767754Smsmith } 31867754Smsmith 31977424Smsmith AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); 32067754Smsmith AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 32191116Smsmith break; 32267754Smsmith 32391116Smsmith 32491116Smsmith default: 32591116Smsmith 32691116Smsmith /* Is not a recognizeable object */ 32791116Smsmith 32867754Smsmith Size = 16; 32967754Smsmith if (AcpiOsReadable (ObjPtr, 64)) 33067754Smsmith { 33167754Smsmith Size = 64; 33267754Smsmith } 33367754Smsmith 33467754Smsmith /* Just dump some memory */ 33567754Smsmith 33677424Smsmith AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 33791116Smsmith break; 33867754Smsmith } 33967754Smsmith 34067754Smsmith return; 34167754Smsmith } 34267754Smsmith 34367754Smsmith /* The parameter is a name string that must be resolved to a Named obj */ 34467754Smsmith 34567754Smsmith Node = AcpiDbLocalNsLookup (Target); 34667754Smsmith if (!Node) 34767754Smsmith { 34867754Smsmith return; 34967754Smsmith } 35067754Smsmith 35167754Smsmith 35267754SmsmithDumpNte: 35367754Smsmith /* Now dump the Named obj */ 35467754Smsmith 35567754Smsmith Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 35667754Smsmith if (ACPI_FAILURE (Status)) 35767754Smsmith { 35867754Smsmith AcpiOsPrintf ("Could not convert name to pathname\n"); 35967754Smsmith } 36067754Smsmith 36169746Smsmith else 36269746Smsmith { 36385756Smsmith AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, RetBuf.Pointer); 36469746Smsmith } 36569746Smsmith 36667754Smsmith if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 36767754Smsmith { 36867754Smsmith AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 36967754Smsmith return; 37067754Smsmith } 37167754Smsmith 37277424Smsmith AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); 37377424Smsmith AcpiExDumpNode (Node, 1); 37467754Smsmith 37587031Smsmith ObjDesc = AcpiNsGetAttachedObject (Node); 37687031Smsmith if (ObjDesc) 37767754Smsmith { 37887031Smsmith AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); 37987031Smsmith if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 38067754Smsmith { 38187031Smsmith AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc); 38267754Smsmith return; 38367754Smsmith } 38467754Smsmith 38587031Smsmith AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 38687031Smsmith AcpiExDumpObjectDescriptor (ObjDesc, 1); 38767754Smsmith } 38867754Smsmith} 38967754Smsmith 39067754Smsmith 39167754Smsmith/******************************************************************************* 39267754Smsmith * 39367754Smsmith * FUNCTION: AcpiDbDecodeInternalObject 39467754Smsmith * 39567754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 39667754Smsmith * 39767754Smsmith * RETURN: None 39867754Smsmith * 39967754Smsmith * DESCRIPTION: Short display of an internal object. Numbers and Strings. 40067754Smsmith * 40167754Smsmith ******************************************************************************/ 40267754Smsmith 40367754Smsmithvoid 40467754SmsmithAcpiDbDecodeInternalObject ( 40567754Smsmith ACPI_OPERAND_OBJECT *ObjDesc) 40667754Smsmith{ 40771867Smsmith UINT32 i; 40867754Smsmith 40971867Smsmith 41067754Smsmith if (!ObjDesc) 41167754Smsmith { 41267754Smsmith return; 41367754Smsmith } 41467754Smsmith 41577424Smsmith AcpiOsPrintf (" %s", AcpiUtGetTypeName (ObjDesc->Common.Type)); 41667754Smsmith 41767754Smsmith switch (ObjDesc->Common.Type) 41867754Smsmith { 41971867Smsmith case ACPI_TYPE_INTEGER: 42082367Smsmith 42191116Smsmith AcpiOsPrintf (" %.8X%.8X", ACPI_HIDWORD (ObjDesc->Integer.Value), 42291116Smsmith ACPI_LODWORD (ObjDesc->Integer.Value)); 42367754Smsmith break; 42467754Smsmith 42582367Smsmith 42667754Smsmith case ACPI_TYPE_STRING: 42782367Smsmith 42880062Smsmith AcpiOsPrintf ("(%d) \"%.24s", 42971867Smsmith ObjDesc->String.Length, ObjDesc->String.Pointer); 43080062Smsmith 43180062Smsmith if (ObjDesc->String.Length > 24) 43280062Smsmith { 43383174Smsmith AcpiOsPrintf ("..."); 43480062Smsmith } 43580062Smsmith else 43680062Smsmith { 43780062Smsmith AcpiOsPrintf ("\""); 43880062Smsmith } 43967754Smsmith break; 44071867Smsmith 44182367Smsmith 44271867Smsmith case ACPI_TYPE_BUFFER: 44382367Smsmith 44471867Smsmith AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length); 44571867Smsmith for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) 44671867Smsmith { 44771867Smsmith AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); 44871867Smsmith } 44971867Smsmith break; 45067754Smsmith } 45167754Smsmith} 45267754Smsmith 45367754Smsmith 45467754Smsmith/******************************************************************************* 45567754Smsmith * 45667754Smsmith * FUNCTION: AcpiDbDisplayInternalObject 45767754Smsmith * 45867754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 45967754Smsmith * WalkState - Current walk state 46067754Smsmith * 46167754Smsmith * RETURN: None 46267754Smsmith * 46367754Smsmith * DESCRIPTION: Short display of an internal object 46467754Smsmith * 46567754Smsmith ******************************************************************************/ 46667754Smsmith 46767754Smsmithvoid 46867754SmsmithAcpiDbDisplayInternalObject ( 46967754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 47067754Smsmith ACPI_WALK_STATE *WalkState) 47167754Smsmith{ 47267754Smsmith UINT8 Type; 47367754Smsmith 47467754Smsmith 47567754Smsmith AcpiOsPrintf ("%p ", ObjDesc); 47667754Smsmith 47767754Smsmith if (!ObjDesc) 47867754Smsmith { 47967754Smsmith AcpiOsPrintf ("<NullObj>\n"); 48067754Smsmith return; 48167754Smsmith } 48267754Smsmith 48367754Smsmith /* Decode the object type */ 48467754Smsmith 48591116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 48667754Smsmith { 48791116Smsmith case ACPI_DESC_TYPE_PARSER: 48891116Smsmith 48967754Smsmith AcpiOsPrintf ("<Parser> "); 49091116Smsmith break; 49167754Smsmith 49291116Smsmith 49391116Smsmith case ACPI_DESC_TYPE_NAMED: 49491116Smsmith 49570243Smsmith AcpiOsPrintf ("<Node> Name %4.4s Type-%s", 49669746Smsmith &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name, 49777424Smsmith AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type)); 49887031Smsmith 49969746Smsmith if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG) 50069746Smsmith { 50169746Smsmith AcpiOsPrintf (" [Method Arg]"); 50269746Smsmith } 50369746Smsmith if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_LOCAL) 50469746Smsmith { 50569746Smsmith AcpiOsPrintf (" [Method Local]"); 50669746Smsmith } 50791116Smsmith break; 50867754Smsmith 50991116Smsmith 51091116Smsmith case ACPI_DESC_TYPE_INTERNAL: 51191116Smsmith 51267754Smsmith Type = ObjDesc->Common.Type; 51367754Smsmith if (Type > INTERNAL_TYPE_MAX) 51467754Smsmith { 51567754Smsmith AcpiOsPrintf (" Type %x [Invalid Type]", Type); 51667754Smsmith return; 51767754Smsmith } 51867754Smsmith 51967754Smsmith /* Decode the ACPI object type */ 52067754Smsmith 52167754Smsmith switch (ObjDesc->Common.Type) 52267754Smsmith { 52367754Smsmith case INTERNAL_TYPE_REFERENCE: 52477424Smsmith switch (ObjDesc->Reference.Opcode) 52567754Smsmith { 52667754Smsmith case AML_ZERO_OP: 52784491Smsmith AcpiOsPrintf ("[Const] Zero (0) [Null Target]", 0); 52867754Smsmith break; 52967754Smsmith 53067754Smsmith case AML_ONES_OP: 53184491Smsmith AcpiOsPrintf ("[Const] Ones (0xFFFFFFFFFFFFFFFF) [No Limit]"); 53267754Smsmith break; 53367754Smsmith 53467754Smsmith case AML_ONE_OP: 53584491Smsmith AcpiOsPrintf ("[Const] One (1)"); 53667754Smsmith break; 53767754Smsmith 53884491Smsmith case AML_REVISION_OP: 53985756Smsmith AcpiOsPrintf ("[Const] Revision (%X)", ACPI_CA_SUPPORT_LEVEL); 54084491Smsmith break; 54184491Smsmith 54267754Smsmith case AML_LOCAL_OP: 54384491Smsmith AcpiOsPrintf ("[Local%d]", ObjDesc->Reference.Offset); 54467754Smsmith if (WalkState) 54567754Smsmith { 54667754Smsmith ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object; 54784491Smsmith AcpiOsPrintf (" %p", ObjDesc); 54867754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 54967754Smsmith } 55067754Smsmith break; 55167754Smsmith 55267754Smsmith case AML_ARG_OP: 55384491Smsmith AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); 55467754Smsmith if (WalkState) 55567754Smsmith { 55667754Smsmith ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object; 55784491Smsmith AcpiOsPrintf (" %p", ObjDesc); 55867754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 55967754Smsmith } 56067754Smsmith break; 56167754Smsmith 56267754Smsmith case AML_DEBUG_OP: 56367754Smsmith AcpiOsPrintf ("[Debug] "); 56467754Smsmith break; 56567754Smsmith 56667754Smsmith case AML_INDEX_OP: 56791116Smsmith AcpiOsPrintf ("[Index] "); 56867754Smsmith AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); 56967754Smsmith break; 57067754Smsmith 57167754Smsmith default: 57267754Smsmith break; 57367754Smsmith 57467754Smsmith } 57567754Smsmith break; 57667754Smsmith 57767754Smsmith default: 57884491Smsmith AcpiOsPrintf ("<Obj> "); 57971867Smsmith AcpiOsPrintf (" "); 58067754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 58167754Smsmith break; 58267754Smsmith } 58391116Smsmith break; 58467754Smsmith 58591116Smsmith 58691116Smsmith default: 58791116Smsmith 58867754Smsmith AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> "); 58991116Smsmith break; 59067754Smsmith } 59167754Smsmith 59291116Smsmith 59367754Smsmith AcpiOsPrintf ("\n"); 59467754Smsmith} 59567754Smsmith 59667754Smsmith 59767754Smsmith/******************************************************************************* 59867754Smsmith * 59967754Smsmith * FUNCTION: AcpiDbDisplayMethodInfo 60067754Smsmith * 60167754Smsmith * PARAMETERS: StartOp - Root of the control method parse tree 60267754Smsmith * 60367754Smsmith * RETURN: None 60467754Smsmith * 60567754Smsmith * DESCRIPTION: Display information about the current method 60667754Smsmith * 60767754Smsmith ******************************************************************************/ 60867754Smsmith 60967754Smsmithvoid 61067754SmsmithAcpiDbDisplayMethodInfo ( 61167754Smsmith ACPI_PARSE_OBJECT *StartOp) 61267754Smsmith{ 61367754Smsmith ACPI_WALK_STATE *WalkState; 61467754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 61567754Smsmith ACPI_NAMESPACE_NODE *Node; 61667754Smsmith ACPI_PARSE_OBJECT *RootOp; 61767754Smsmith ACPI_PARSE_OBJECT *Op; 61883174Smsmith const ACPI_OPCODE_INFO *OpInfo; 61967754Smsmith UINT32 NumOps = 0; 62067754Smsmith UINT32 NumOperands = 0; 62167754Smsmith UINT32 NumOperators = 0; 62267754Smsmith UINT32 NumRemainingOps = 0; 62367754Smsmith UINT32 NumRemainingOperands = 0; 62467754Smsmith UINT32 NumRemainingOperators = 0; 62567754Smsmith UINT32 NumArgs; 62667754Smsmith UINT32 Concurrency; 62767754Smsmith BOOLEAN CountRemaining = FALSE; 62867754Smsmith 62967754Smsmith 63067754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 63167754Smsmith if (!WalkState) 63267754Smsmith { 63367754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 63467754Smsmith return; 63567754Smsmith } 63667754Smsmith 63767754Smsmith ObjDesc = WalkState->MethodDesc; 63887031Smsmith Node = WalkState->MethodNode; 63967754Smsmith 64087031Smsmith NumArgs = ObjDesc->Method.ParamCount; 64167754Smsmith Concurrency = ObjDesc->Method.Concurrency; 64267754Smsmith 64367754Smsmith AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", &Node->Name); 64469746Smsmith AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); 64567754Smsmith 64667754Smsmith 64767754Smsmith RootOp = StartOp; 64867754Smsmith while (RootOp->Parent) 64967754Smsmith { 65067754Smsmith RootOp = RootOp->Parent; 65167754Smsmith } 65267754Smsmith 65367754Smsmith Op = RootOp; 65467754Smsmith 65567754Smsmith while (Op) 65667754Smsmith { 65767754Smsmith if (Op == StartOp) 65867754Smsmith { 65967754Smsmith CountRemaining = TRUE; 66067754Smsmith } 66167754Smsmith 66267754Smsmith NumOps++; 66367754Smsmith if (CountRemaining) 66467754Smsmith { 66567754Smsmith NumRemainingOps++; 66667754Smsmith } 66767754Smsmith 66867754Smsmith /* Decode the opcode */ 66967754Smsmith 67085756Smsmith OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); 67185756Smsmith switch (OpInfo->Class) 67267754Smsmith { 67385756Smsmith case AML_CLASS_ARGUMENT: 67467754Smsmith if (CountRemaining) 67567754Smsmith { 67667754Smsmith NumRemainingOperands++; 67767754Smsmith } 67867754Smsmith 67967754Smsmith NumOperands++; 68067754Smsmith break; 68167754Smsmith 68285756Smsmith case AML_CLASS_UNKNOWN: 68385756Smsmith /* Bad opcode or ASCII character */ 68485756Smsmith 68585756Smsmith continue; 68685756Smsmith 68767754Smsmith default: 68867754Smsmith if (CountRemaining) 68967754Smsmith { 69067754Smsmith NumRemainingOperators++; 69167754Smsmith } 69267754Smsmith 69367754Smsmith NumOperators++; 69467754Smsmith break; 69567754Smsmith } 69667754Smsmith 69767754Smsmith Op = AcpiPsGetDepthNext (StartOp, Op); 69867754Smsmith } 69967754Smsmith 70069746Smsmith AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 70167754Smsmith NumOps, NumOperators, NumOperands); 70267754Smsmith 70369746Smsmith AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 70467754Smsmith NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 70567754Smsmith} 70667754Smsmith 70767754Smsmith 70867754Smsmith/******************************************************************************* 70967754Smsmith * 71067754Smsmith * FUNCTION: AcpiDbDisplayLocals 71167754Smsmith * 71267754Smsmith * PARAMETERS: None 71367754Smsmith * 71467754Smsmith * RETURN: None 71567754Smsmith * 71667754Smsmith * DESCRIPTION: Display all locals for the currently running control method 71767754Smsmith * 71867754Smsmith ******************************************************************************/ 71967754Smsmith 72067754Smsmithvoid 72167754SmsmithAcpiDbDisplayLocals (void) 72267754Smsmith{ 72367754Smsmith UINT32 i; 72467754Smsmith ACPI_WALK_STATE *WalkState; 72567754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 72667754Smsmith ACPI_NAMESPACE_NODE *Node; 72767754Smsmith 72867754Smsmith 72967754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 73067754Smsmith if (!WalkState) 73167754Smsmith { 73267754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 73367754Smsmith return; 73467754Smsmith } 73567754Smsmith 73667754Smsmith ObjDesc = WalkState->MethodDesc; 73769450Smsmith Node = WalkState->MethodNode; 73867754Smsmith AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", &Node->Name); 73967754Smsmith 74067754Smsmith for (i = 0; i < MTH_NUM_LOCALS; i++) 74167754Smsmith { 74267754Smsmith ObjDesc = WalkState->LocalVariables[i].Object; 74367754Smsmith AcpiOsPrintf ("Local%d: ", i); 74467754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 74567754Smsmith } 74667754Smsmith} 74767754Smsmith 74867754Smsmith 74967754Smsmith/******************************************************************************* 75067754Smsmith * 75167754Smsmith * FUNCTION: AcpiDbDisplayArguments 75267754Smsmith * 75367754Smsmith * PARAMETERS: None 75467754Smsmith * 75567754Smsmith * RETURN: None 75667754Smsmith * 75767754Smsmith * DESCRIPTION: Display all arguments for the currently running control method 75867754Smsmith * 75967754Smsmith ******************************************************************************/ 76067754Smsmith 76167754Smsmithvoid 76267754SmsmithAcpiDbDisplayArguments (void) 76367754Smsmith{ 76467754Smsmith UINT32 i; 76567754Smsmith ACPI_WALK_STATE *WalkState; 76667754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 76767754Smsmith UINT32 NumArgs; 76867754Smsmith UINT32 Concurrency; 76967754Smsmith ACPI_NAMESPACE_NODE *Node; 77067754Smsmith 77167754Smsmith 77267754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 77367754Smsmith if (!WalkState) 77467754Smsmith { 77567754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 77667754Smsmith return; 77767754Smsmith } 77867754Smsmith 77967754Smsmith ObjDesc = WalkState->MethodDesc; 78087031Smsmith Node = WalkState->MethodNode; 78167754Smsmith 78287031Smsmith NumArgs = ObjDesc->Method.ParamCount; 78367754Smsmith Concurrency = ObjDesc->Method.Concurrency; 78467754Smsmith 78587031Smsmith AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", 78687031Smsmith &Node->Name, NumArgs, Concurrency); 78767754Smsmith 78867754Smsmith for (i = 0; i < NumArgs; i++) 78967754Smsmith { 79067754Smsmith ObjDesc = WalkState->Arguments[i].Object; 79167754Smsmith AcpiOsPrintf ("Arg%d: ", i); 79267754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 79367754Smsmith } 79467754Smsmith} 79567754Smsmith 79667754Smsmith 79767754Smsmith/******************************************************************************* 79867754Smsmith * 79967754Smsmith * FUNCTION: AcpiDbDisplayResults 80067754Smsmith * 80167754Smsmith * PARAMETERS: None 80267754Smsmith * 80367754Smsmith * RETURN: None 80467754Smsmith * 80567754Smsmith * DESCRIPTION: Display current contents of a method result stack 80667754Smsmith * 80767754Smsmith ******************************************************************************/ 80867754Smsmith 80967754Smsmithvoid 81067754SmsmithAcpiDbDisplayResults (void) 81167754Smsmith{ 81267754Smsmith UINT32 i; 81367754Smsmith ACPI_WALK_STATE *WalkState; 81467754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 81569746Smsmith UINT32 NumResults = 0; 81667754Smsmith ACPI_NAMESPACE_NODE *Node; 81767754Smsmith 81867754Smsmith 81967754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 82067754Smsmith if (!WalkState) 82167754Smsmith { 82267754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 82367754Smsmith return; 82467754Smsmith } 82567754Smsmith 82667754Smsmith ObjDesc = WalkState->MethodDesc; 82767754Smsmith Node = WalkState->MethodNode; 82867754Smsmith 82969746Smsmith if (WalkState->Results) 83069746Smsmith { 83169746Smsmith NumResults = WalkState->Results->Results.NumResults; 83269746Smsmith } 83367754Smsmith 83487031Smsmith AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 83587031Smsmith &Node->Name, NumResults); 83669746Smsmith 83769746Smsmith for (i = 0; i < NumResults; i++) 83867754Smsmith { 83969746Smsmith ObjDesc = WalkState->Results->Results.ObjDesc[i]; 84067754Smsmith AcpiOsPrintf ("Result%d: ", i); 84167754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 84267754Smsmith } 84367754Smsmith} 84467754Smsmith 84567754Smsmith 84667754Smsmith/******************************************************************************* 84767754Smsmith * 84867754Smsmith * FUNCTION: AcpiDbDisplayCallingTree 84967754Smsmith * 85067754Smsmith * PARAMETERS: None 85167754Smsmith * 85267754Smsmith * RETURN: None 85367754Smsmith * 85467754Smsmith * DESCRIPTION: Display current calling tree of nested control methods 85567754Smsmith * 85667754Smsmith ******************************************************************************/ 85767754Smsmith 85867754Smsmithvoid 85967754SmsmithAcpiDbDisplayCallingTree (void) 86067754Smsmith{ 86167754Smsmith UINT32 i; 86267754Smsmith ACPI_WALK_STATE *WalkState; 86367754Smsmith ACPI_NAMESPACE_NODE *Node; 86467754Smsmith 86567754Smsmith 86667754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 86767754Smsmith if (!WalkState) 86867754Smsmith { 86967754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 87067754Smsmith return; 87167754Smsmith } 87267754Smsmith 87369450Smsmith Node = WalkState->MethodNode; 87467754Smsmith AcpiOsPrintf ("Current Control Method Call Tree\n"); 87567754Smsmith 87667754Smsmith for (i = 0; WalkState; i++) 87767754Smsmith { 87869450Smsmith Node = WalkState->MethodNode; 87967754Smsmith 88067754Smsmith AcpiOsPrintf (" [%4.4s]\n", &Node->Name); 88167754Smsmith 88267754Smsmith WalkState = WalkState->Next; 88367754Smsmith } 88467754Smsmith} 88567754Smsmith 88667754Smsmith 88767754Smsmith/******************************************************************************* 88867754Smsmith * 88967754Smsmith * FUNCTION: AcpiDbDisplayResultObject 89067754Smsmith * 89167754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 89267754Smsmith * WalkState - Current walk state 89367754Smsmith * 89467754Smsmith * RETURN: None 89567754Smsmith * 89667754Smsmith * DESCRIPTION: Display the result of an AML opcode 89767754Smsmith * 89891116Smsmith * Note: Curently only displays the result object if we are single stepping. 89991116Smsmith * However, this output may be useful in other contexts and could be enabled 90091116Smsmith * to do so if needed. 90191116Smsmith * 90267754Smsmith ******************************************************************************/ 90367754Smsmith 90467754Smsmithvoid 90567754SmsmithAcpiDbDisplayResultObject ( 90667754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 90767754Smsmith ACPI_WALK_STATE *WalkState) 90867754Smsmith{ 90967754Smsmith 91091116Smsmith /* Only display if single stepping */ 91191116Smsmith 91267754Smsmith if (!AcpiGbl_CmSingleStep) 91367754Smsmith { 91467754Smsmith return; 91567754Smsmith } 91667754Smsmith 91767754Smsmith AcpiOsPrintf ("ResultObj: "); 91867754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 91967754Smsmith AcpiOsPrintf ("\n"); 92067754Smsmith} 92167754Smsmith 92267754Smsmith 92367754Smsmith/******************************************************************************* 92467754Smsmith * 92567754Smsmith * FUNCTION: AcpiDbDisplayArgumentObject 92667754Smsmith * 92767754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 92867754Smsmith * WalkState - Current walk state 92967754Smsmith * 93067754Smsmith * RETURN: None 93167754Smsmith * 93267754Smsmith * DESCRIPTION: Display the result of an AML opcode 93367754Smsmith * 93467754Smsmith ******************************************************************************/ 93567754Smsmith 93667754Smsmithvoid 93767754SmsmithAcpiDbDisplayArgumentObject ( 93867754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 93967754Smsmith ACPI_WALK_STATE *WalkState) 94067754Smsmith{ 94167754Smsmith 94267754Smsmith if (!AcpiGbl_CmSingleStep) 94367754Smsmith { 94467754Smsmith return; 94567754Smsmith } 94667754Smsmith 94767754Smsmith AcpiOsPrintf ("ArgObj: "); 94867754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 94967754Smsmith} 95067754Smsmith 95167754Smsmith#endif /* ENABLE_DEBUGGER */ 95267754Smsmith 953