dbdisply.c revision 102550
167754Smsmith/******************************************************************************* 267754Smsmith * 367754Smsmith * Module Name: dbdisply - debug display commands 4102550Siwasaki * $Revision: 78 $ 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 "amlcode.h" 12067754Smsmith#include "acdispat.h" 12167754Smsmith#include "acnamesp.h" 12267754Smsmith#include "acparser.h" 12367754Smsmith#include "acinterp.h" 12467754Smsmith#include "acdebug.h" 12567754Smsmith 12667754Smsmith 127102550Siwasaki#ifdef ACPI_DEBUGGER 12867754Smsmith 12967754Smsmith 130102550Siwasaki#define _COMPONENT ACPI_CA_DEBUGGER 13191116Smsmith ACPI_MODULE_NAME ("dbdisply") 13267754Smsmith 13367754Smsmith 13467754Smsmith/****************************************************************************** 13567754Smsmith * 13667754Smsmith * FUNCTION: AcpiDbGetPointer 13767754Smsmith * 13867754Smsmith * PARAMETERS: Target - Pointer to string to be converted 13967754Smsmith * 14067754Smsmith * RETURN: Converted pointer 14167754Smsmith * 14267754Smsmith * DESCRIPTION: Convert an ascii pointer value to a real value 14367754Smsmith * 14467754Smsmith *****************************************************************************/ 14567754Smsmith 14667754Smsmithvoid * 14767754SmsmithAcpiDbGetPointer ( 14867754Smsmith void *Target) 14967754Smsmith{ 15067754Smsmith void *ObjPtr; 15167754Smsmith 15267754Smsmith 15399679Siwasaki#if ACPI_MACHINE_WIDTH == 16 15467754Smsmith#include <stdio.h> 15567754Smsmith 15667754Smsmith /* Have to handle 16-bit pointers of the form segment:offset */ 15767754Smsmith 15867754Smsmith if (!sscanf (Target, "%p", &ObjPtr)) 15967754Smsmith { 16067754Smsmith AcpiOsPrintf ("Invalid pointer: %s\n", Target); 16167754Smsmith return (NULL); 16267754Smsmith } 16367754Smsmith 16467754Smsmith#else 16567754Smsmith 16667754Smsmith /* Simple flat pointer */ 16767754Smsmith 16891116Smsmith ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); 16967754Smsmith#endif 17067754Smsmith 17167754Smsmith return (ObjPtr); 17267754Smsmith} 17367754Smsmith 17467754Smsmith 17567754Smsmith/******************************************************************************* 17667754Smsmith * 17767754Smsmith * FUNCTION: AcpiDbDumpParserDescriptor 17867754Smsmith * 17967754Smsmith * PARAMETERS: Op - A parser Op descriptor 18067754Smsmith * 18167754Smsmith * RETURN: None 18267754Smsmith * 18367754Smsmith * DESCRIPTION: Display a formatted parser object 18467754Smsmith * 18567754Smsmith ******************************************************************************/ 18667754Smsmith 18767754Smsmithvoid 18867754SmsmithAcpiDbDumpParserDescriptor ( 18967754Smsmith ACPI_PARSE_OBJECT *Op) 19067754Smsmith{ 19183174Smsmith const ACPI_OPCODE_INFO *Info; 19267754Smsmith 19367754Smsmith 19499679Siwasaki Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 19567754Smsmith 19667754Smsmith AcpiOsPrintf ("Parser Op Descriptor:\n"); 19799679Siwasaki AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); 19867754Smsmith 19991116Smsmith ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name)); 20067754Smsmith 20199679Siwasaki AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); 20299679Siwasaki AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); 20399679Siwasaki AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); 20467754Smsmith} 20567754Smsmith 20667754Smsmith 20767754Smsmith/******************************************************************************* 20867754Smsmith * 20967754Smsmith * FUNCTION: AcpiDbDecodeAndDisplayObject 21067754Smsmith * 21167754Smsmith * PARAMETERS: Target - String with object to be displayed. Names 21267754Smsmith * and hex pointers are supported. 21367754Smsmith * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 21467754Smsmith * 21567754Smsmith * RETURN: None 21667754Smsmith * 21767754Smsmith * DESCRIPTION: Display a formatted ACPI object 21867754Smsmith * 21967754Smsmith ******************************************************************************/ 22067754Smsmith 22167754Smsmithvoid 22267754SmsmithAcpiDbDecodeAndDisplayObject ( 22367754Smsmith NATIVE_CHAR *Target, 22467754Smsmith NATIVE_CHAR *OutputType) 22567754Smsmith{ 22667754Smsmith void *ObjPtr; 22767754Smsmith ACPI_NAMESPACE_NODE *Node; 22887031Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 22967754Smsmith UINT32 Display = DB_BYTE_DISPLAY; 23067754Smsmith NATIVE_CHAR Buffer[80]; 23167754Smsmith ACPI_BUFFER RetBuf; 23267754Smsmith ACPI_STATUS Status; 23367754Smsmith UINT32 Size; 23467754Smsmith 23567754Smsmith 23667754Smsmith if (!Target) 23767754Smsmith { 23867754Smsmith return; 23967754Smsmith } 24067754Smsmith 24167754Smsmith /* Decode the output type */ 24267754Smsmith 24367754Smsmith if (OutputType) 24467754Smsmith { 24591116Smsmith ACPI_STRUPR (OutputType); 24667754Smsmith if (OutputType[0] == 'W') 24767754Smsmith { 24867754Smsmith Display = DB_WORD_DISPLAY; 24967754Smsmith } 25067754Smsmith else if (OutputType[0] == 'D') 25167754Smsmith { 25267754Smsmith Display = DB_DWORD_DISPLAY; 25367754Smsmith } 25467754Smsmith else if (OutputType[0] == 'Q') 25567754Smsmith { 25667754Smsmith Display = DB_QWORD_DISPLAY; 25767754Smsmith } 25867754Smsmith } 25967754Smsmith 26067754Smsmith RetBuf.Length = sizeof (Buffer); 26167754Smsmith RetBuf.Pointer = Buffer; 26267754Smsmith 26367754Smsmith /* Differentiate between a number and a name */ 26467754Smsmith 26567754Smsmith if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 26667754Smsmith { 26767754Smsmith ObjPtr = AcpiDbGetPointer (Target); 26867754Smsmith if (!AcpiOsReadable (ObjPtr, 16)) 26967754Smsmith { 27067754Smsmith AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr); 27167754Smsmith return; 27267754Smsmith } 27367754Smsmith 27467754Smsmith /* Decode the object type */ 27567754Smsmith 27691116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) 27767754Smsmith { 27891116Smsmith case ACPI_DESC_TYPE_NAMED: 27967754Smsmith 28091116Smsmith /* This is a namespace Node */ 28191116Smsmith 28267754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 28367754Smsmith { 28467754Smsmith AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr); 28567754Smsmith return; 28667754Smsmith } 28767754Smsmith 28867754Smsmith Node = ObjPtr; 28967754Smsmith goto DumpNte; 29067754Smsmith 29167754Smsmith 29299679Siwasaki case ACPI_DESC_TYPE_OPERAND: 29391116Smsmith 29491116Smsmith /* This is a ACPI OPERAND OBJECT */ 29591116Smsmith 29667754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 29767754Smsmith { 29867754Smsmith AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr); 29967754Smsmith return; 30067754Smsmith } 30167754Smsmith 30277424Smsmith AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 30377424Smsmith AcpiExDumpObjectDescriptor (ObjPtr, 1); 30491116Smsmith break; 30567754Smsmith 30667754Smsmith 30791116Smsmith case ACPI_DESC_TYPE_PARSER: 30891116Smsmith 30991116Smsmith /* This is a Parser Op object */ 31091116Smsmith 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 31777424Smsmith AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); 31867754Smsmith AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 31991116Smsmith break; 32067754Smsmith 32191116Smsmith 32291116Smsmith default: 32391116Smsmith 32491116Smsmith /* Is not a recognizeable object */ 32591116Smsmith 32667754Smsmith Size = 16; 32767754Smsmith if (AcpiOsReadable (ObjPtr, 64)) 32867754Smsmith { 32967754Smsmith Size = 64; 33067754Smsmith } 33167754Smsmith 33267754Smsmith /* Just dump some memory */ 33367754Smsmith 33477424Smsmith AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 33591116Smsmith break; 33667754Smsmith } 33767754Smsmith 33867754Smsmith return; 33967754Smsmith } 34067754Smsmith 34167754Smsmith /* The parameter is a name string that must be resolved to a Named obj */ 34267754Smsmith 34367754Smsmith Node = AcpiDbLocalNsLookup (Target); 34467754Smsmith if (!Node) 34567754Smsmith { 34667754Smsmith return; 34767754Smsmith } 34867754Smsmith 34967754Smsmith 35067754SmsmithDumpNte: 35167754Smsmith /* Now dump the Named obj */ 35267754Smsmith 35367754Smsmith Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 35467754Smsmith if (ACPI_FAILURE (Status)) 35567754Smsmith { 35667754Smsmith AcpiOsPrintf ("Could not convert name to pathname\n"); 35767754Smsmith } 35867754Smsmith 35969746Smsmith else 36069746Smsmith { 36185756Smsmith AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, RetBuf.Pointer); 36269746Smsmith } 36369746Smsmith 36467754Smsmith if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 36567754Smsmith { 36667754Smsmith AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 36767754Smsmith return; 36867754Smsmith } 36967754Smsmith 37077424Smsmith AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); 37177424Smsmith AcpiExDumpNode (Node, 1); 37267754Smsmith 37387031Smsmith ObjDesc = AcpiNsGetAttachedObject (Node); 37487031Smsmith if (ObjDesc) 37567754Smsmith { 37687031Smsmith AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); 37787031Smsmith if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 37867754Smsmith { 37987031Smsmith AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc); 38067754Smsmith return; 38167754Smsmith } 38267754Smsmith 38387031Smsmith AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 38487031Smsmith AcpiExDumpObjectDescriptor (ObjDesc, 1); 38567754Smsmith } 38667754Smsmith} 38767754Smsmith 38867754Smsmith 38967754Smsmith/******************************************************************************* 39067754Smsmith * 39167754Smsmith * FUNCTION: AcpiDbDecodeInternalObject 39267754Smsmith * 39367754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 39467754Smsmith * 39567754Smsmith * RETURN: None 39667754Smsmith * 39767754Smsmith * DESCRIPTION: Short display of an internal object. Numbers and Strings. 39867754Smsmith * 39967754Smsmith ******************************************************************************/ 40067754Smsmith 40167754Smsmithvoid 40267754SmsmithAcpiDbDecodeInternalObject ( 40367754Smsmith ACPI_OPERAND_OBJECT *ObjDesc) 40467754Smsmith{ 40571867Smsmith UINT32 i; 40667754Smsmith 40771867Smsmith 40867754Smsmith if (!ObjDesc) 40967754Smsmith { 41099146Siwasaki AcpiOsPrintf (" Uninitialized\n"); 41167754Smsmith return; 41267754Smsmith } 41367754Smsmith 414100966Siwasaki if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 415100966Siwasaki { 416100966Siwasaki AcpiOsPrintf ("%p", ObjDesc); 417100966Siwasaki return; 418100966Siwasaki } 419100966Siwasaki 42099679Siwasaki AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); 42167754Smsmith 42299679Siwasaki switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 42367754Smsmith { 42471867Smsmith case ACPI_TYPE_INTEGER: 42582367Smsmith 42699679Siwasaki AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value), 42799679Siwasaki ACPI_LODWORD (ObjDesc->Integer.Value)); 42867754Smsmith break; 42967754Smsmith 43082367Smsmith 43167754Smsmith case ACPI_TYPE_STRING: 43282367Smsmith 43380062Smsmith AcpiOsPrintf ("(%d) \"%.24s", 43471867Smsmith ObjDesc->String.Length, ObjDesc->String.Pointer); 43580062Smsmith 43680062Smsmith if (ObjDesc->String.Length > 24) 43780062Smsmith { 43883174Smsmith AcpiOsPrintf ("..."); 43980062Smsmith } 44080062Smsmith else 44180062Smsmith { 44280062Smsmith AcpiOsPrintf ("\""); 44380062Smsmith } 44467754Smsmith break; 44571867Smsmith 44682367Smsmith 44771867Smsmith case ACPI_TYPE_BUFFER: 44882367Smsmith 44971867Smsmith AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length); 45071867Smsmith for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) 45171867Smsmith { 45271867Smsmith AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); 45371867Smsmith } 45471867Smsmith break; 45599679Siwasaki 456102550Siwasaki 45799679Siwasaki default: 458102550Siwasaki 459100966Siwasaki AcpiOsPrintf ("%p", ObjDesc); 46099679Siwasaki break; 46167754Smsmith } 46267754Smsmith} 46367754Smsmith 46467754Smsmith 46567754Smsmith/******************************************************************************* 46667754Smsmith * 467100966Siwasaki * FUNCTION: AcpiDbDecodeNode 468100966Siwasaki * 469100966Siwasaki * PARAMETERS: Node - Object to be displayed 470100966Siwasaki * 471100966Siwasaki * RETURN: None 472100966Siwasaki * 473100966Siwasaki * DESCRIPTION: Short display of a namespace node 474100966Siwasaki * 475100966Siwasaki ******************************************************************************/ 476100966Siwasaki 477100966Siwasakivoid 478100966SiwasakiAcpiDbDecodeNode ( 479100966Siwasaki ACPI_NAMESPACE_NODE *Node) 480100966Siwasaki{ 481100966Siwasaki 482100966Siwasaki 483100966Siwasaki AcpiOsPrintf ("<Node> Name %4.4s Type-%s", 484100966Siwasaki Node->Name.Ascii, AcpiUtGetTypeName (Node->Type)); 485100966Siwasaki 486100966Siwasaki if (Node->Flags & ANOBJ_METHOD_ARG) 487100966Siwasaki { 488100966Siwasaki AcpiOsPrintf (" [Method Arg]"); 489100966Siwasaki } 490100966Siwasaki if (Node->Flags & ANOBJ_METHOD_LOCAL) 491100966Siwasaki { 492100966Siwasaki AcpiOsPrintf (" [Method Local]"); 493100966Siwasaki } 494100966Siwasaki 495100966Siwasaki AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node)); 496100966Siwasaki} 497100966Siwasaki 498100966Siwasaki 499100966Siwasaki/******************************************************************************* 500100966Siwasaki * 50167754Smsmith * FUNCTION: AcpiDbDisplayInternalObject 50267754Smsmith * 50367754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 50467754Smsmith * WalkState - Current walk state 50567754Smsmith * 50667754Smsmith * RETURN: None 50767754Smsmith * 50867754Smsmith * DESCRIPTION: Short display of an internal object 50967754Smsmith * 51067754Smsmith ******************************************************************************/ 51167754Smsmith 51267754Smsmithvoid 51367754SmsmithAcpiDbDisplayInternalObject ( 51467754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 51567754Smsmith ACPI_WALK_STATE *WalkState) 51667754Smsmith{ 51767754Smsmith UINT8 Type; 51867754Smsmith 51967754Smsmith 52067754Smsmith AcpiOsPrintf ("%p ", ObjDesc); 52167754Smsmith 52267754Smsmith if (!ObjDesc) 52367754Smsmith { 52467754Smsmith AcpiOsPrintf ("<NullObj>\n"); 52567754Smsmith return; 52667754Smsmith } 52767754Smsmith 52867754Smsmith /* Decode the object type */ 52967754Smsmith 53091116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 53167754Smsmith { 53291116Smsmith case ACPI_DESC_TYPE_PARSER: 53391116Smsmith 53467754Smsmith AcpiOsPrintf ("<Parser> "); 53591116Smsmith break; 53667754Smsmith 53791116Smsmith 53891116Smsmith case ACPI_DESC_TYPE_NAMED: 53991116Smsmith 540100966Siwasaki AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc); 54191116Smsmith break; 54267754Smsmith 54391116Smsmith 54499679Siwasaki case ACPI_DESC_TYPE_OPERAND: 54591116Smsmith 54699679Siwasaki Type = ACPI_GET_OBJECT_TYPE (ObjDesc); 54767754Smsmith if (Type > INTERNAL_TYPE_MAX) 54867754Smsmith { 54999679Siwasaki AcpiOsPrintf (" Type %hX [Invalid Type]", Type); 55067754Smsmith return; 55167754Smsmith } 55267754Smsmith 55367754Smsmith /* Decode the ACPI object type */ 55467754Smsmith 55599679Siwasaki switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 55667754Smsmith { 55767754Smsmith case INTERNAL_TYPE_REFERENCE: 558100966Siwasaki 55977424Smsmith switch (ObjDesc->Reference.Opcode) 56067754Smsmith { 56167754Smsmith case AML_LOCAL_OP: 562100966Siwasaki 56399146Siwasaki AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset); 56467754Smsmith if (WalkState) 56567754Smsmith { 56667754Smsmith ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object; 56799146Siwasaki AcpiOsPrintf ("%p", ObjDesc); 56867754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 56967754Smsmith } 57067754Smsmith break; 57167754Smsmith 572100966Siwasaki 57367754Smsmith case AML_ARG_OP: 574100966Siwasaki 57599146Siwasaki AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); 57667754Smsmith if (WalkState) 57767754Smsmith { 57867754Smsmith ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object; 57999146Siwasaki AcpiOsPrintf ("%p", ObjDesc); 58067754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 58167754Smsmith } 58267754Smsmith break; 58367754Smsmith 584100966Siwasaki 58567754Smsmith case AML_DEBUG_OP: 586100966Siwasaki 58767754Smsmith AcpiOsPrintf ("[Debug] "); 58867754Smsmith break; 58967754Smsmith 590100966Siwasaki 59167754Smsmith case AML_INDEX_OP: 592100966Siwasaki 593100966Siwasaki AcpiOsPrintf ("[Index] "); 59467754Smsmith AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); 59567754Smsmith break; 59667754Smsmith 597100966Siwasaki 598100966Siwasaki case AML_REF_OF_OP: 599100966Siwasaki 600100966Siwasaki AcpiOsPrintf ("[Reference] "); 601100966Siwasaki 602100966Siwasaki /* Reference can be to a Node or an Operand object */ 603100966Siwasaki 604100966Siwasaki switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) 605100966Siwasaki { 606100966Siwasaki case ACPI_DESC_TYPE_NAMED: 607100966Siwasaki AcpiDbDecodeNode (ObjDesc->Reference.Object); 608100966Siwasaki break; 609100966Siwasaki 610100966Siwasaki case ACPI_DESC_TYPE_OPERAND: 611100966Siwasaki AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); 612100966Siwasaki break; 613100966Siwasaki 614100966Siwasaki default: 615100966Siwasaki break; 616100966Siwasaki } 617100966Siwasaki break; 618100966Siwasaki 619100966Siwasaki 62067754Smsmith default: 621100966Siwasaki 622102550Siwasaki AcpiOsPrintf ("Unknown Reference opcode %X\n", 62399679Siwasaki ObjDesc->Reference.Opcode); 62467754Smsmith break; 62567754Smsmith } 62667754Smsmith break; 62767754Smsmith 62867754Smsmith default: 629100966Siwasaki 63084491Smsmith AcpiOsPrintf ("<Obj> "); 63171867Smsmith AcpiOsPrintf (" "); 63267754Smsmith AcpiDbDecodeInternalObject (ObjDesc); 63367754Smsmith break; 63467754Smsmith } 63591116Smsmith break; 63667754Smsmith 63791116Smsmith 63891116Smsmith default: 63991116Smsmith 64067754Smsmith AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> "); 64191116Smsmith break; 64267754Smsmith } 64367754Smsmith 64467754Smsmith AcpiOsPrintf ("\n"); 64567754Smsmith} 64667754Smsmith 64767754Smsmith 64867754Smsmith/******************************************************************************* 64967754Smsmith * 65067754Smsmith * FUNCTION: AcpiDbDisplayMethodInfo 65167754Smsmith * 65267754Smsmith * PARAMETERS: StartOp - Root of the control method parse tree 65367754Smsmith * 65467754Smsmith * RETURN: None 65567754Smsmith * 65667754Smsmith * DESCRIPTION: Display information about the current method 65767754Smsmith * 65867754Smsmith ******************************************************************************/ 65967754Smsmith 66067754Smsmithvoid 66167754SmsmithAcpiDbDisplayMethodInfo ( 66267754Smsmith ACPI_PARSE_OBJECT *StartOp) 66367754Smsmith{ 66467754Smsmith ACPI_WALK_STATE *WalkState; 66567754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 66667754Smsmith ACPI_NAMESPACE_NODE *Node; 66767754Smsmith ACPI_PARSE_OBJECT *RootOp; 66867754Smsmith ACPI_PARSE_OBJECT *Op; 66983174Smsmith const ACPI_OPCODE_INFO *OpInfo; 67067754Smsmith UINT32 NumOps = 0; 67167754Smsmith UINT32 NumOperands = 0; 67267754Smsmith UINT32 NumOperators = 0; 67367754Smsmith UINT32 NumRemainingOps = 0; 67467754Smsmith UINT32 NumRemainingOperands = 0; 67567754Smsmith UINT32 NumRemainingOperators = 0; 67667754Smsmith UINT32 NumArgs; 67767754Smsmith UINT32 Concurrency; 67867754Smsmith BOOLEAN CountRemaining = FALSE; 67967754Smsmith 68067754Smsmith 68167754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 68267754Smsmith if (!WalkState) 68367754Smsmith { 68467754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 68567754Smsmith return; 68667754Smsmith } 68767754Smsmith 68867754Smsmith ObjDesc = WalkState->MethodDesc; 68987031Smsmith Node = WalkState->MethodNode; 69067754Smsmith 69187031Smsmith NumArgs = ObjDesc->Method.ParamCount; 69267754Smsmith Concurrency = ObjDesc->Method.Concurrency; 69367754Smsmith 69499679Siwasaki AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", Node->Name.Ascii); 69569746Smsmith AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); 69667754Smsmith 69767754Smsmith 69867754Smsmith RootOp = StartOp; 69999679Siwasaki while (RootOp->Common.Parent) 70067754Smsmith { 70199679Siwasaki RootOp = RootOp->Common.Parent; 70267754Smsmith } 70367754Smsmith 70467754Smsmith Op = RootOp; 70567754Smsmith 70667754Smsmith while (Op) 70767754Smsmith { 70867754Smsmith if (Op == StartOp) 70967754Smsmith { 71067754Smsmith CountRemaining = TRUE; 71167754Smsmith } 71267754Smsmith 71367754Smsmith NumOps++; 71467754Smsmith if (CountRemaining) 71567754Smsmith { 71667754Smsmith NumRemainingOps++; 71767754Smsmith } 71867754Smsmith 71967754Smsmith /* Decode the opcode */ 72067754Smsmith 72199679Siwasaki OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 72285756Smsmith switch (OpInfo->Class) 72367754Smsmith { 72485756Smsmith case AML_CLASS_ARGUMENT: 72567754Smsmith if (CountRemaining) 72667754Smsmith { 72767754Smsmith NumRemainingOperands++; 72867754Smsmith } 72967754Smsmith 73067754Smsmith NumOperands++; 73167754Smsmith break; 73267754Smsmith 73385756Smsmith case AML_CLASS_UNKNOWN: 73485756Smsmith /* Bad opcode or ASCII character */ 73585756Smsmith 73685756Smsmith continue; 73785756Smsmith 73867754Smsmith default: 73967754Smsmith if (CountRemaining) 74067754Smsmith { 74167754Smsmith NumRemainingOperators++; 74267754Smsmith } 74367754Smsmith 74467754Smsmith NumOperators++; 74567754Smsmith break; 74667754Smsmith } 74767754Smsmith 74867754Smsmith Op = AcpiPsGetDepthNext (StartOp, Op); 74967754Smsmith } 75067754Smsmith 75169746Smsmith AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 75267754Smsmith NumOps, NumOperators, NumOperands); 75367754Smsmith 75469746Smsmith AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 75567754Smsmith NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 75667754Smsmith} 75767754Smsmith 75867754Smsmith 75967754Smsmith/******************************************************************************* 76067754Smsmith * 76167754Smsmith * FUNCTION: AcpiDbDisplayLocals 76267754Smsmith * 76367754Smsmith * PARAMETERS: None 76467754Smsmith * 76567754Smsmith * RETURN: None 76667754Smsmith * 76767754Smsmith * DESCRIPTION: Display all locals for the currently running control method 76867754Smsmith * 76967754Smsmith ******************************************************************************/ 77067754Smsmith 77167754Smsmithvoid 77267754SmsmithAcpiDbDisplayLocals (void) 77367754Smsmith{ 77467754Smsmith UINT32 i; 77567754Smsmith ACPI_WALK_STATE *WalkState; 77667754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 77767754Smsmith ACPI_NAMESPACE_NODE *Node; 77867754Smsmith 77967754Smsmith 78067754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 78167754Smsmith if (!WalkState) 78267754Smsmith { 78367754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 78467754Smsmith return; 78567754Smsmith } 78667754Smsmith 78767754Smsmith ObjDesc = WalkState->MethodDesc; 78869450Smsmith Node = WalkState->MethodNode; 78999679Siwasaki AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", Node->Name.Ascii); 79067754Smsmith 79167754Smsmith for (i = 0; i < MTH_NUM_LOCALS; i++) 79267754Smsmith { 79367754Smsmith ObjDesc = WalkState->LocalVariables[i].Object; 79467754Smsmith AcpiOsPrintf ("Local%d: ", i); 79567754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 79667754Smsmith } 79767754Smsmith} 79867754Smsmith 79967754Smsmith 80067754Smsmith/******************************************************************************* 80167754Smsmith * 80267754Smsmith * FUNCTION: AcpiDbDisplayArguments 80367754Smsmith * 80467754Smsmith * PARAMETERS: None 80567754Smsmith * 80667754Smsmith * RETURN: None 80767754Smsmith * 80867754Smsmith * DESCRIPTION: Display all arguments for the currently running control method 80967754Smsmith * 81067754Smsmith ******************************************************************************/ 81167754Smsmith 81267754Smsmithvoid 81367754SmsmithAcpiDbDisplayArguments (void) 81467754Smsmith{ 81567754Smsmith UINT32 i; 81667754Smsmith ACPI_WALK_STATE *WalkState; 81767754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 81867754Smsmith UINT32 NumArgs; 81967754Smsmith UINT32 Concurrency; 82067754Smsmith ACPI_NAMESPACE_NODE *Node; 82167754Smsmith 82267754Smsmith 82367754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 82467754Smsmith if (!WalkState) 82567754Smsmith { 82667754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 82767754Smsmith return; 82867754Smsmith } 82967754Smsmith 83067754Smsmith ObjDesc = WalkState->MethodDesc; 83187031Smsmith Node = WalkState->MethodNode; 83267754Smsmith 83387031Smsmith NumArgs = ObjDesc->Method.ParamCount; 83467754Smsmith Concurrency = ObjDesc->Method.Concurrency; 83567754Smsmith 83687031Smsmith AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", 83799679Siwasaki Node->Name.Ascii, NumArgs, Concurrency); 83867754Smsmith 83967754Smsmith for (i = 0; i < NumArgs; i++) 84067754Smsmith { 84167754Smsmith ObjDesc = WalkState->Arguments[i].Object; 84267754Smsmith AcpiOsPrintf ("Arg%d: ", i); 84367754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 84467754Smsmith } 84567754Smsmith} 84667754Smsmith 84767754Smsmith 84867754Smsmith/******************************************************************************* 84967754Smsmith * 85067754Smsmith * FUNCTION: AcpiDbDisplayResults 85167754Smsmith * 85267754Smsmith * PARAMETERS: None 85367754Smsmith * 85467754Smsmith * RETURN: None 85567754Smsmith * 85667754Smsmith * DESCRIPTION: Display current contents of a method result stack 85767754Smsmith * 85867754Smsmith ******************************************************************************/ 85967754Smsmith 86067754Smsmithvoid 86167754SmsmithAcpiDbDisplayResults (void) 86267754Smsmith{ 86367754Smsmith UINT32 i; 86467754Smsmith ACPI_WALK_STATE *WalkState; 86567754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 86669746Smsmith UINT32 NumResults = 0; 86767754Smsmith ACPI_NAMESPACE_NODE *Node; 86867754Smsmith 86967754Smsmith 87067754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 87167754Smsmith if (!WalkState) 87267754Smsmith { 87367754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 87467754Smsmith return; 87567754Smsmith } 87667754Smsmith 87767754Smsmith ObjDesc = WalkState->MethodDesc; 87867754Smsmith Node = WalkState->MethodNode; 87967754Smsmith 88069746Smsmith if (WalkState->Results) 88169746Smsmith { 88269746Smsmith NumResults = WalkState->Results->Results.NumResults; 88369746Smsmith } 88467754Smsmith 88587031Smsmith AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 88699679Siwasaki Node->Name.Ascii, NumResults); 88769746Smsmith 88869746Smsmith for (i = 0; i < NumResults; i++) 88967754Smsmith { 89069746Smsmith ObjDesc = WalkState->Results->Results.ObjDesc[i]; 89167754Smsmith AcpiOsPrintf ("Result%d: ", i); 89267754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 89367754Smsmith } 89467754Smsmith} 89567754Smsmith 89667754Smsmith 89767754Smsmith/******************************************************************************* 89867754Smsmith * 89967754Smsmith * FUNCTION: AcpiDbDisplayCallingTree 90067754Smsmith * 90167754Smsmith * PARAMETERS: None 90267754Smsmith * 90367754Smsmith * RETURN: None 90467754Smsmith * 90567754Smsmith * DESCRIPTION: Display current calling tree of nested control methods 90667754Smsmith * 90767754Smsmith ******************************************************************************/ 90867754Smsmith 90967754Smsmithvoid 91067754SmsmithAcpiDbDisplayCallingTree (void) 91167754Smsmith{ 91267754Smsmith ACPI_WALK_STATE *WalkState; 91367754Smsmith ACPI_NAMESPACE_NODE *Node; 91467754Smsmith 91567754Smsmith 91667754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 91767754Smsmith if (!WalkState) 91867754Smsmith { 91967754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 92067754Smsmith return; 92167754Smsmith } 92267754Smsmith 92369450Smsmith Node = WalkState->MethodNode; 92467754Smsmith AcpiOsPrintf ("Current Control Method Call Tree\n"); 92567754Smsmith 92699679Siwasaki while (WalkState) 92767754Smsmith { 92869450Smsmith Node = WalkState->MethodNode; 92967754Smsmith 93099679Siwasaki AcpiOsPrintf (" [%4.4s]\n", Node->Name.Ascii); 93167754Smsmith 93267754Smsmith WalkState = WalkState->Next; 93367754Smsmith } 93467754Smsmith} 93567754Smsmith 93667754Smsmith 93767754Smsmith/******************************************************************************* 93867754Smsmith * 93967754Smsmith * FUNCTION: AcpiDbDisplayResultObject 94067754Smsmith * 94167754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 94267754Smsmith * WalkState - Current walk state 94367754Smsmith * 94467754Smsmith * RETURN: None 94567754Smsmith * 94667754Smsmith * DESCRIPTION: Display the result of an AML opcode 94767754Smsmith * 94891116Smsmith * Note: Curently only displays the result object if we are single stepping. 94991116Smsmith * However, this output may be useful in other contexts and could be enabled 95091116Smsmith * to do so if needed. 95191116Smsmith * 95267754Smsmith ******************************************************************************/ 95367754Smsmith 95467754Smsmithvoid 95567754SmsmithAcpiDbDisplayResultObject ( 95667754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 95767754Smsmith ACPI_WALK_STATE *WalkState) 95867754Smsmith{ 95967754Smsmith 96091116Smsmith /* Only display if single stepping */ 96191116Smsmith 96267754Smsmith if (!AcpiGbl_CmSingleStep) 96367754Smsmith { 96467754Smsmith return; 96567754Smsmith } 96667754Smsmith 96767754Smsmith AcpiOsPrintf ("ResultObj: "); 96867754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 96967754Smsmith AcpiOsPrintf ("\n"); 97067754Smsmith} 97167754Smsmith 97267754Smsmith 97367754Smsmith/******************************************************************************* 97467754Smsmith * 97567754Smsmith * FUNCTION: AcpiDbDisplayArgumentObject 97667754Smsmith * 97767754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 97867754Smsmith * WalkState - Current walk state 97967754Smsmith * 98067754Smsmith * RETURN: None 98167754Smsmith * 98267754Smsmith * DESCRIPTION: Display the result of an AML opcode 98367754Smsmith * 98467754Smsmith ******************************************************************************/ 98567754Smsmith 98667754Smsmithvoid 98767754SmsmithAcpiDbDisplayArgumentObject ( 98867754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 98967754Smsmith ACPI_WALK_STATE *WalkState) 99067754Smsmith{ 99167754Smsmith 99267754Smsmith if (!AcpiGbl_CmSingleStep) 99367754Smsmith { 99467754Smsmith return; 99567754Smsmith } 99667754Smsmith 99767754Smsmith AcpiOsPrintf ("ArgObj: "); 99867754Smsmith AcpiDbDisplayInternalObject (ObjDesc, WalkState); 99967754Smsmith} 100067754Smsmith 1001102550Siwasaki#endif /* ACPI_DEBUGGER */ 100267754Smsmith 1003