dbdisply.c revision 69746
167754Smsmith/******************************************************************************* 267754Smsmith * 367754Smsmith * Module Name: dbdisply - debug display commands 469746Smsmith * $Revision: 38 $ 567754Smsmith * 667754Smsmith ******************************************************************************/ 767754Smsmith 867754Smsmith/****************************************************************************** 967754Smsmith * 1067754Smsmith * 1. Copyright Notice 1167754Smsmith * 1267754Smsmith * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights 1367754Smsmith * 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 13267754Smsmith#define _COMPONENT DEBUGGER 13367754Smsmith 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 17067754Smsmith ObjPtr = (void *) STRTOUL (Target, NULL, 16); 17167754Smsmith 17267754Smsmith#endif 17367754Smsmith 17467754Smsmith return (ObjPtr); 17567754Smsmith} 17667754Smsmith 17767754Smsmith 17867754Smsmith/******************************************************************************* 17967754Smsmith * 18067754Smsmith * FUNCTION: AcpiDbDumpParserDescriptor 18167754Smsmith * 18267754Smsmith * PARAMETERS: Op - A parser Op descriptor 18367754Smsmith * 18467754Smsmith * RETURN: None 18567754Smsmith * 18667754Smsmith * DESCRIPTION: Display a formatted parser object 18767754Smsmith * 18867754Smsmith ******************************************************************************/ 18967754Smsmith 19067754Smsmithvoid 19167754SmsmithAcpiDbDumpParserDescriptor ( 19267754Smsmith ACPI_PARSE_OBJECT *Op) 19367754Smsmith{ 19467754Smsmith ACPI_OPCODE_INFO *Info; 19567754Smsmith 19667754Smsmith 19767754Smsmith Info = AcpiPsGetOpcodeInfo (Op->Opcode); 19867754Smsmith 19967754Smsmith AcpiOsPrintf ("Parser Op Descriptor:\n"); 20067754Smsmith AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Opcode); 20167754Smsmith 20267754Smsmith DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name)); 20367754Smsmith 20467754Smsmith AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Value); 20567754Smsmith AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Parent); 20667754Smsmith AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Next); 20767754Smsmith} 20867754Smsmith 20967754Smsmith 21067754Smsmith/******************************************************************************* 21167754Smsmith * 21267754Smsmith * FUNCTION: AcpiDbDecodeAndDisplayObject 21367754Smsmith * 21467754Smsmith * PARAMETERS: Target - String with object to be displayed. Names 21567754Smsmith * and hex pointers are supported. 21667754Smsmith * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 21767754Smsmith * 21867754Smsmith * RETURN: None 21967754Smsmith * 22067754Smsmith * DESCRIPTION: Display a formatted ACPI object 22167754Smsmith * 22267754Smsmith ******************************************************************************/ 22367754Smsmith 22467754Smsmithvoid 22567754SmsmithAcpiDbDecodeAndDisplayObject ( 22667754Smsmith NATIVE_CHAR *Target, 22767754Smsmith NATIVE_CHAR *OutputType) 22867754Smsmith{ 22967754Smsmith void *ObjPtr; 23067754Smsmith ACPI_NAMESPACE_NODE *Node; 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 { 24767754Smsmith 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 26367754Smsmith RetBuf.Length = sizeof (Buffer); 26467754Smsmith RetBuf.Pointer = Buffer; 26567754Smsmith 26667754Smsmith /* Differentiate between a number and a name */ 26767754Smsmith 26867754Smsmith if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 26967754Smsmith { 27067754Smsmith ObjPtr = AcpiDbGetPointer (Target); 27167754Smsmith if (!AcpiOsReadable (ObjPtr, 16)) 27267754Smsmith { 27367754Smsmith AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr); 27467754Smsmith return; 27567754Smsmith } 27667754Smsmith 27767754Smsmith /* Decode the object type */ 27867754Smsmith 27967754Smsmith if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_NAMED)) 28067754Smsmith { 28167754Smsmith /* This is a Node */ 28267754Smsmith 28367754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 28467754Smsmith { 28567754Smsmith AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr); 28667754Smsmith return; 28767754Smsmith } 28867754Smsmith 28967754Smsmith Node = ObjPtr; 29067754Smsmith goto DumpNte; 29167754Smsmith } 29267754Smsmith 29367754Smsmith else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_INTERNAL)) 29467754Smsmith { 29567754Smsmith /* This is an ACPI OBJECT */ 29667754Smsmith 29767754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 29867754Smsmith { 29967754Smsmith AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr); 30067754Smsmith return; 30167754Smsmith } 30267754Smsmith 30367754Smsmith AcpiCmDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 30467754Smsmith AcpiAmlDumpObjectDescriptor (ObjPtr, 1); 30567754Smsmith } 30667754Smsmith 30767754Smsmith else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_PARSER)) 30867754Smsmith { 30967754Smsmith /* This is an Parser Op object */ 31067754Smsmith 31167754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) 31267754Smsmith { 31367754Smsmith AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr); 31467754Smsmith return; 31567754Smsmith } 31667754Smsmith 31767754Smsmith 31867754Smsmith AcpiCmDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); 31967754Smsmith AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 32067754Smsmith } 32167754Smsmith 32267754Smsmith else 32367754Smsmith { 32467754Smsmith Size = 16; 32567754Smsmith if (AcpiOsReadable (ObjPtr, 64)) 32667754Smsmith { 32767754Smsmith Size = 64; 32867754Smsmith } 32967754Smsmith 33067754Smsmith /* Just dump some memory */ 33167754Smsmith 33267754Smsmith AcpiCmDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 33367754Smsmith } 33467754Smsmith 33567754Smsmith return; 33667754Smsmith } 33767754Smsmith 33867754Smsmith 33967754Smsmith /* The parameter is a name string that must be resolved to a Named obj */ 34067754Smsmith 34167754Smsmith Node = AcpiDbLocalNsLookup (Target); 34267754Smsmith if (!Node) 34367754Smsmith { 34467754Smsmith return; 34567754Smsmith } 34667754Smsmith 34767754Smsmith 34867754SmsmithDumpNte: 34967754Smsmith /* Now dump the Named obj */ 35067754Smsmith 35167754Smsmith Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 35267754Smsmith if (ACPI_FAILURE (Status)) 35367754Smsmith { 35467754Smsmith AcpiOsPrintf ("Could not convert name to pathname\n"); 35567754Smsmith } 35667754Smsmith 35769746Smsmith else 35869746Smsmith { 35969746Smsmith AcpiOsPrintf ("Object Pathname: %s\n", RetBuf.Pointer); 36069746Smsmith } 36169746Smsmith 36267754Smsmith if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 36367754Smsmith { 36467754Smsmith AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 36567754Smsmith return; 36667754Smsmith } 36767754Smsmith 36867754Smsmith AcpiCmDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); 36967754Smsmith AcpiAmlDumpNode (Node, 1); 37067754Smsmith 37167754Smsmith if (Node->Object) 37267754Smsmith { 37369746Smsmith AcpiOsPrintf ("\nAttached Object (%p):\n", Node->Object); 37467754Smsmith if (!AcpiOsReadable (Node->Object, sizeof (ACPI_OPERAND_OBJECT))) 37567754Smsmith { 37667754Smsmith AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", Node->Object); 37767754Smsmith return; 37867754Smsmith } 37967754Smsmith 38067754Smsmith AcpiCmDumpBuffer (Node->Object, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 38167754Smsmith AcpiAmlDumpObjectDescriptor (Node->Object, 1); 38267754Smsmith } 38367754Smsmith} 38467754Smsmith 38567754Smsmith 38667754Smsmith/******************************************************************************* 38767754Smsmith * 38867754Smsmith * FUNCTION: AcpiDbDecodeInternalObject 38967754Smsmith * 39067754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 39167754Smsmith * 39267754Smsmith * RETURN: None 39367754Smsmith * 39467754Smsmith * DESCRIPTION: Short display of an internal object. Numbers and Strings. 39567754Smsmith * 39667754Smsmith ******************************************************************************/ 39767754Smsmith 39867754Smsmithvoid 39967754SmsmithAcpiDbDecodeInternalObject ( 40067754Smsmith ACPI_OPERAND_OBJECT *ObjDesc) 40167754Smsmith{ 40267754Smsmith 40367754Smsmith if (!ObjDesc) 40467754Smsmith { 40567754Smsmith return; 40667754Smsmith } 40767754Smsmith 40867754Smsmith AcpiOsPrintf (" %9.9s ", AcpiCmGetTypeName (ObjDesc->Common.Type)); 40967754Smsmith 41067754Smsmith switch (ObjDesc->Common.Type) 41167754Smsmith { 41267754Smsmith case ACPI_TYPE_NUMBER: 41369746Smsmith AcpiOsPrintf ("%.8X", ObjDesc->Number.Value); 41467754Smsmith break; 41567754Smsmith 41667754Smsmith case ACPI_TYPE_STRING: 41767754Smsmith AcpiOsPrintf ("\"%.16s\"...", ObjDesc->String.Pointer); 41867754Smsmith break; 41967754Smsmith } 42067754Smsmith} 42167754Smsmith 42267754Smsmith 42367754Smsmith/******************************************************************************* 42467754Smsmith * 42567754Smsmith * FUNCTION: AcpiDbDisplayInternalObject 42667754Smsmith * 42767754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 42867754Smsmith * WalkState - Current walk state 42967754Smsmith * 43067754Smsmith * RETURN: None 43167754Smsmith * 43267754Smsmith * DESCRIPTION: Short display of an internal object 43367754Smsmith * 43467754Smsmith ******************************************************************************/ 43567754Smsmith 43667754Smsmithvoid 43767754SmsmithAcpiDbDisplayInternalObject ( 43867754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 43967754Smsmith ACPI_WALK_STATE *WalkState) 44067754Smsmith{ 44167754Smsmith UINT8 Type; 44267754Smsmith 44367754Smsmith 44467754Smsmith AcpiOsPrintf ("%p ", ObjDesc); 44567754Smsmith 44667754Smsmith if (!ObjDesc) 44767754Smsmith { 44867754Smsmith AcpiOsPrintf ("<NullObj>\n"); 44967754Smsmith return; 45067754Smsmith } 45167754Smsmith 45267754Smsmith 45367754Smsmith /* Decode the object type */ 45467754Smsmith 45567754Smsmith else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_PARSER)) 45667754Smsmith { 45767754Smsmith AcpiOsPrintf ("<Parser> "); 45867754Smsmith } 45967754Smsmith 46067754Smsmith else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) 46167754Smsmith { 46269746Smsmith AcpiOsPrintf ("<Node> Name %4.4s Type-%s", 46369746Smsmith &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name, 46469746Smsmith AcpiCmGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type)); 46569746Smsmith if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG) 46669746Smsmith { 46769746Smsmith AcpiOsPrintf (" [Method Arg]"); 46869746Smsmith } 46969746Smsmith if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_LOCAL) 47069746Smsmith { 47169746Smsmith AcpiOsPrintf (" [Method Local]"); 47269746Smsmith } 47367754Smsmith } 47467754Smsmith 47567754Smsmith else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) 47667754Smsmith { 47767754Smsmith AcpiOsPrintf ("<Obj> "); 47867754Smsmith Type = ObjDesc->Common.Type; 47967754Smsmith if (Type > INTERNAL_TYPE_MAX) 48067754Smsmith { 48167754Smsmith AcpiOsPrintf (" Type %x [Invalid Type]", Type); 48267754Smsmith return; 48367754Smsmith } 48467754Smsmith 48567754Smsmith /* Decode the ACPI object type */ 48667754Smsmith 48767754Smsmith switch (ObjDesc->Common.Type) 48867754Smsmith { 48967754Smsmith case INTERNAL_TYPE_REFERENCE: 49067754Smsmith switch (ObjDesc->Reference.OpCode) 49167754Smsmith { 49267754Smsmith case AML_ZERO_OP: 49369746Smsmith AcpiOsPrintf ("[Const] Number %.8X", 0); 49467754Smsmith break; 49567754Smsmith 49667754Smsmith case AML_ONES_OP: 49769746Smsmith AcpiOsPrintf ("[Const] Number %.8X", ACPI_UINT32_MAX); 49867754Smsmith break; 49967754Smsmith 50067754Smsmith case AML_ONE_OP: 50169746Smsmith AcpiOsPrintf ("[Const] Number %.8X", 1); 50267754Smsmith break; 50367754Smsmith 50467754Smsmith case AML_LOCAL_OP: 50567754Smsmith AcpiOsPrintf ("[Local%d]", ObjDesc->Reference.Offset); 50667754Smsmith if (WalkState) 50767754Smsmith { 50867754Smsmith ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object; 50967754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 51067754Smsmith } 51167754Smsmith break; 51267754Smsmith 51367754Smsmith case AML_ARG_OP: 51467754Smsmith AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); 51567754Smsmith if (WalkState) 51667754Smsmith { 51767754Smsmith ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object; 51867754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 51967754Smsmith } 52067754Smsmith break; 52167754Smsmith 52267754Smsmith case AML_DEBUG_OP: 52367754Smsmith AcpiOsPrintf ("[Debug] "); 52467754Smsmith break; 52567754Smsmith 52667754Smsmith case AML_INDEX_OP: 52767754Smsmith AcpiOsPrintf ("[Index] "); 52867754Smsmith AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); 52967754Smsmith break; 53067754Smsmith 53167754Smsmith default: 53267754Smsmith break; 53367754Smsmith 53467754Smsmith } 53567754Smsmith break; 53667754Smsmith 53767754Smsmith default: 53867754Smsmith AcpiOsPrintf (" "); 53967754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 54067754Smsmith break; 54167754Smsmith } 54267754Smsmith } 54367754Smsmith 54467754Smsmith else 54567754Smsmith { 54667754Smsmith AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> "); 54767754Smsmith } 54867754Smsmith 54967754Smsmith AcpiOsPrintf ("\n"); 55067754Smsmith} 55167754Smsmith 55267754Smsmith 55367754Smsmith/******************************************************************************* 55467754Smsmith * 55567754Smsmith * FUNCTION: AcpiDbDisplayMethodInfo 55667754Smsmith * 55767754Smsmith * PARAMETERS: StartOp - Root of the control method parse tree 55867754Smsmith * 55967754Smsmith * RETURN: None 56067754Smsmith * 56167754Smsmith * DESCRIPTION: Display information about the current method 56267754Smsmith * 56367754Smsmith ******************************************************************************/ 56467754Smsmith 56567754Smsmithvoid 56667754SmsmithAcpiDbDisplayMethodInfo ( 56767754Smsmith ACPI_PARSE_OBJECT *StartOp) 56867754Smsmith{ 56967754Smsmith ACPI_WALK_STATE *WalkState; 57067754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 57167754Smsmith ACPI_NAMESPACE_NODE *Node; 57267754Smsmith ACPI_PARSE_OBJECT *RootOp; 57367754Smsmith ACPI_PARSE_OBJECT *Op; 57467754Smsmith ACPI_OPCODE_INFO *OpInfo; 57567754Smsmith UINT32 NumOps = 0; 57667754Smsmith UINT32 NumOperands = 0; 57767754Smsmith UINT32 NumOperators = 0; 57867754Smsmith UINT32 NumRemainingOps = 0; 57967754Smsmith UINT32 NumRemainingOperands = 0; 58067754Smsmith UINT32 NumRemainingOperators = 0; 58167754Smsmith UINT32 NumArgs; 58267754Smsmith UINT32 Concurrency; 58367754Smsmith BOOLEAN CountRemaining = FALSE; 58467754Smsmith 58567754Smsmith 58667754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 58767754Smsmith if (!WalkState) 58867754Smsmith { 58967754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 59067754Smsmith return; 59167754Smsmith } 59267754Smsmith 59367754Smsmith ObjDesc = WalkState->MethodDesc; 59469450Smsmith Node = WalkState->MethodNode; 59567754Smsmith 59667754Smsmith NumArgs = ObjDesc->Method.ParamCount; 59767754Smsmith Concurrency = ObjDesc->Method.Concurrency; 59867754Smsmith 59967754Smsmith AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", &Node->Name); 60069746Smsmith AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); 60167754Smsmith 60267754Smsmith 60367754Smsmith RootOp = StartOp; 60467754Smsmith while (RootOp->Parent) 60567754Smsmith { 60667754Smsmith RootOp = RootOp->Parent; 60767754Smsmith } 60867754Smsmith 60967754Smsmith Op = RootOp; 61067754Smsmith 61167754Smsmith while (Op) 61267754Smsmith { 61367754Smsmith if (Op == StartOp) 61467754Smsmith { 61567754Smsmith CountRemaining = TRUE; 61667754Smsmith } 61767754Smsmith 61867754Smsmith NumOps++; 61967754Smsmith if (CountRemaining) 62067754Smsmith { 62167754Smsmith NumRemainingOps++; 62267754Smsmith } 62367754Smsmith 62467754Smsmith OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); 62567754Smsmith if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) 62667754Smsmith { 62767754Smsmith /* Bad opcode or ASCII character */ 62867754Smsmith 62967754Smsmith continue; 63067754Smsmith } 63167754Smsmith 63267754Smsmith 63367754Smsmith /* Decode the opcode */ 63467754Smsmith 63567754Smsmith switch (ACPI_GET_OP_CLASS (OpInfo)) 63667754Smsmith { 63767754Smsmith case OPTYPE_CONSTANT: /* argument type only */ 63867754Smsmith case OPTYPE_LITERAL: /* argument type only */ 63967754Smsmith case OPTYPE_DATA_TERM: /* argument type only */ 64067754Smsmith case OPTYPE_LOCAL_VARIABLE: /* argument type only */ 64167754Smsmith case OPTYPE_METHOD_ARGUMENT: /* argument type only */ 64267754Smsmith if (CountRemaining) 64367754Smsmith { 64467754Smsmith NumRemainingOperands++; 64567754Smsmith } 64667754Smsmith 64767754Smsmith NumOperands++; 64867754Smsmith break; 64967754Smsmith 65067754Smsmith default: 65167754Smsmith if (CountRemaining) 65267754Smsmith { 65367754Smsmith NumRemainingOperators++; 65467754Smsmith } 65567754Smsmith 65667754Smsmith NumOperators++; 65767754Smsmith break; 65867754Smsmith } 65967754Smsmith 66067754Smsmith 66167754Smsmith Op = AcpiPsGetDepthNext (StartOp, Op); 66267754Smsmith } 66367754Smsmith 66469746Smsmith AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 66567754Smsmith NumOps, NumOperators, NumOperands); 66667754Smsmith 66769746Smsmith AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 66867754Smsmith NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 66967754Smsmith} 67067754Smsmith 67167754Smsmith 67267754Smsmith/******************************************************************************* 67367754Smsmith * 67467754Smsmith * FUNCTION: AcpiDbDisplayLocals 67567754Smsmith * 67667754Smsmith * PARAMETERS: None 67767754Smsmith * 67867754Smsmith * RETURN: None 67967754Smsmith * 68067754Smsmith * DESCRIPTION: Display all locals for the currently running control method 68167754Smsmith * 68267754Smsmith ******************************************************************************/ 68367754Smsmith 68467754Smsmithvoid 68567754SmsmithAcpiDbDisplayLocals (void) 68667754Smsmith{ 68767754Smsmith UINT32 i; 68867754Smsmith ACPI_WALK_STATE *WalkState; 68967754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 69067754Smsmith ACPI_NAMESPACE_NODE *Node; 69167754Smsmith 69267754Smsmith 69367754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 69467754Smsmith if (!WalkState) 69567754Smsmith { 69667754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 69767754Smsmith return; 69867754Smsmith } 69967754Smsmith 70067754Smsmith ObjDesc = WalkState->MethodDesc; 70169450Smsmith Node = WalkState->MethodNode; 70267754Smsmith 70367754Smsmith 70467754Smsmith AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", &Node->Name); 70567754Smsmith 70667754Smsmith for (i = 0; i < MTH_NUM_LOCALS; i++) 70767754Smsmith { 70867754Smsmith ObjDesc = WalkState->LocalVariables[i].Object; 70967754Smsmith AcpiOsPrintf ("Local%d: ", i); 71067754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 71167754Smsmith } 71267754Smsmith} 71367754Smsmith 71467754Smsmith 71567754Smsmith/******************************************************************************* 71667754Smsmith * 71767754Smsmith * FUNCTION: AcpiDbDisplayArguments 71867754Smsmith * 71967754Smsmith * PARAMETERS: None 72067754Smsmith * 72167754Smsmith * RETURN: None 72267754Smsmith * 72367754Smsmith * DESCRIPTION: Display all arguments for the currently running control method 72467754Smsmith * 72567754Smsmith ******************************************************************************/ 72667754Smsmith 72767754Smsmithvoid 72867754SmsmithAcpiDbDisplayArguments (void) 72967754Smsmith{ 73067754Smsmith UINT32 i; 73167754Smsmith ACPI_WALK_STATE *WalkState; 73267754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 73367754Smsmith UINT32 NumArgs; 73467754Smsmith UINT32 Concurrency; 73567754Smsmith ACPI_NAMESPACE_NODE *Node; 73667754Smsmith 73767754Smsmith 73867754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 73967754Smsmith if (!WalkState) 74067754Smsmith { 74167754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 74267754Smsmith return; 74367754Smsmith } 74467754Smsmith 74567754Smsmith ObjDesc = WalkState->MethodDesc; 74667754Smsmith Node = WalkState->MethodNode; 74767754Smsmith 74867754Smsmith NumArgs = ObjDesc->Method.ParamCount; 74967754Smsmith Concurrency = ObjDesc->Method.Concurrency; 75067754Smsmith 75169746Smsmith AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", &Node->Name, NumArgs, Concurrency); 75267754Smsmith 75367754Smsmith for (i = 0; i < NumArgs; i++) 75467754Smsmith { 75567754Smsmith ObjDesc = WalkState->Arguments[i].Object; 75667754Smsmith AcpiOsPrintf ("Arg%d: ", i); 75767754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 75867754Smsmith } 75967754Smsmith} 76067754Smsmith 76167754Smsmith 76267754Smsmith/******************************************************************************* 76367754Smsmith * 76467754Smsmith * FUNCTION: AcpiDbDisplayResults 76567754Smsmith * 76667754Smsmith * PARAMETERS: None 76767754Smsmith * 76867754Smsmith * RETURN: None 76967754Smsmith * 77067754Smsmith * DESCRIPTION: Display current contents of a method result stack 77167754Smsmith * 77267754Smsmith ******************************************************************************/ 77367754Smsmith 77467754Smsmithvoid 77567754SmsmithAcpiDbDisplayResults (void) 77667754Smsmith{ 77767754Smsmith UINT32 i; 77867754Smsmith ACPI_WALK_STATE *WalkState; 77967754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 78069746Smsmith UINT32 NumResults = 0; 78167754Smsmith ACPI_NAMESPACE_NODE *Node; 78267754Smsmith 78367754Smsmith 78467754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 78567754Smsmith if (!WalkState) 78667754Smsmith { 78767754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 78867754Smsmith return; 78967754Smsmith } 79067754Smsmith 79167754Smsmith ObjDesc = WalkState->MethodDesc; 79267754Smsmith Node = WalkState->MethodNode; 79367754Smsmith 79469746Smsmith if (WalkState->Results) 79569746Smsmith { 79669746Smsmith NumResults = WalkState->Results->Results.NumResults; 79769746Smsmith } 79867754Smsmith 79969746Smsmith AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", &Node->Name, NumResults); 80069746Smsmith 80169746Smsmith for (i = 0; i < NumResults; i++) 80267754Smsmith { 80369746Smsmith ObjDesc = WalkState->Results->Results.ObjDesc[i]; 80467754Smsmith AcpiOsPrintf ("Result%d: ", i); 80567754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 80667754Smsmith } 80767754Smsmith} 80867754Smsmith 80967754Smsmith 81067754Smsmith/******************************************************************************* 81167754Smsmith * 81267754Smsmith * FUNCTION: AcpiDbDisplayCallingTree 81367754Smsmith * 81467754Smsmith * PARAMETERS: None 81567754Smsmith * 81667754Smsmith * RETURN: None 81767754Smsmith * 81867754Smsmith * DESCRIPTION: Display current calling tree of nested control methods 81967754Smsmith * 82067754Smsmith ******************************************************************************/ 82167754Smsmith 82267754Smsmithvoid 82367754SmsmithAcpiDbDisplayCallingTree (void) 82467754Smsmith{ 82567754Smsmith UINT32 i; 82667754Smsmith ACPI_WALK_STATE *WalkState; 82767754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 82867754Smsmith ACPI_NAMESPACE_NODE *Node; 82967754Smsmith 83067754Smsmith 83167754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 83267754Smsmith if (!WalkState) 83367754Smsmith { 83467754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 83567754Smsmith return; 83667754Smsmith } 83767754Smsmith 83867754Smsmith ObjDesc = WalkState->MethodDesc; 83969450Smsmith Node = WalkState->MethodNode; 84067754Smsmith 84167754Smsmith AcpiOsPrintf ("Current Control Method Call Tree\n"); 84267754Smsmith 84367754Smsmith for (i = 0; WalkState; i++) 84467754Smsmith { 84567754Smsmith ObjDesc = WalkState->MethodDesc; 84669450Smsmith Node = WalkState->MethodNode; 84767754Smsmith 84867754Smsmith AcpiOsPrintf (" [%4.4s]\n", &Node->Name); 84967754Smsmith 85067754Smsmith WalkState = WalkState->Next; 85167754Smsmith } 85267754Smsmith} 85367754Smsmith 85467754Smsmith 85567754Smsmith/******************************************************************************* 85667754Smsmith * 85767754Smsmith * FUNCTION: AcpiDbDisplayResultObject 85867754Smsmith * 85967754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 86067754Smsmith * WalkState - Current walk state 86167754Smsmith * 86267754Smsmith * RETURN: None 86367754Smsmith * 86467754Smsmith * DESCRIPTION: Display the result of an AML opcode 86567754Smsmith * 86667754Smsmith ******************************************************************************/ 86767754Smsmith 86867754Smsmithvoid 86967754SmsmithAcpiDbDisplayResultObject ( 87067754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 87167754Smsmith ACPI_WALK_STATE *WalkState) 87267754Smsmith{ 87367754Smsmith 87467754Smsmith /* TBD: [Future] We don't always want to display the result. 87567754Smsmith * For now, only display if single stepping 87667754Smsmith * however, this output is very useful in other contexts also 87767754Smsmith */ 87867754Smsmith 87967754Smsmith if (!AcpiGbl_CmSingleStep) 88067754Smsmith { 88167754Smsmith return; 88267754Smsmith } 88367754Smsmith 88467754Smsmith AcpiOsPrintf ("ResultObj: "); 88567754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 88667754Smsmith AcpiOsPrintf ("\n"); 88767754Smsmith} 88867754Smsmith 88967754Smsmith 89067754Smsmith/******************************************************************************* 89167754Smsmith * 89267754Smsmith * FUNCTION: AcpiDbDisplayArgumentObject 89367754Smsmith * 89467754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 89567754Smsmith * WalkState - Current walk state 89667754Smsmith * 89767754Smsmith * RETURN: None 89867754Smsmith * 89967754Smsmith * DESCRIPTION: Display the result of an AML opcode 90067754Smsmith * 90167754Smsmith ******************************************************************************/ 90267754Smsmith 90367754Smsmithvoid 90467754SmsmithAcpiDbDisplayArgumentObject ( 90567754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 90667754Smsmith ACPI_WALK_STATE *WalkState) 90767754Smsmith{ 90867754Smsmith 90967754Smsmith 91067754Smsmith if (!AcpiGbl_CmSingleStep) 91167754Smsmith { 91267754Smsmith return; 91367754Smsmith } 91467754Smsmith 91567754Smsmith AcpiOsPrintf ("ArgObj: "); 91667754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 91767754Smsmith} 91867754Smsmith 91967754Smsmith#endif /* ENABLE_DEBUGGER */ 92067754Smsmith 921