dbdisply.c revision 117521
1135446Strhodes/******************************************************************************* 2224092Sdougb * 3135446Strhodes * Module Name: dbdisply - debug display commands 4135446Strhodes * $Revision: 95 $ 5174187Sdougb * 6135446Strhodes ******************************************************************************/ 7135446Strhodes 8135446Strhodes/****************************************************************************** 9135446Strhodes * 10135446Strhodes * 1. Copyright Notice 11135446Strhodes * 12135446Strhodes * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. 13135446Strhodes * All rights reserved. 14135446Strhodes * 15135446Strhodes * 2. License 16135446Strhodes * 17135446Strhodes * 2.1. This is your license from Intel Corp. under its intellectual property 18225361Sdougb * rights. You may have additional license terms from the party that provided 19135446Strhodes * you this software, covering your right to use that party's intellectual 20170222Sdougb * property rights. 21170222Sdougb * 22135446Strhodes * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23135446Strhodes * copy of the source code appearing in this file ("Covered Code") an 24224092Sdougb * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25135446Strhodes * base code distributed originally by Intel ("Original Intel Code") to copy, 26224092Sdougb * make derivatives, distribute, use and display any portion of the Covered 27224092Sdougb * Code in any form, with the right to sublicense such rights; and 28193149Sdougb * 29193149Sdougb * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30135446Strhodes * license (with the right to sublicense), under only those claims of Intel 31135446Strhodes * patents that are infringed by the Original Intel Code, to make, use, sell, 32135446Strhodes * offer to sell, and import the Covered Code and derivative works thereof 33170222Sdougb * solely to the minimum extent necessary to exercise the above copyright 34135446Strhodes * license, and in no event shall the patent license extend to any additions 35135446Strhodes * to or modifications of the Original Intel Code. No other license or right 36135446Strhodes * is granted directly or by implication, estoppel or otherwise; 37135446Strhodes * 38170222Sdougb * The above copyright and patent license is granted only if the following 39224092Sdougb * conditions are met: 40224092Sdougb * 41224092Sdougb * 3. Conditions 42224092Sdougb * 43135446Strhodes * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44135446Strhodes * Redistribution of source code of any substantial portion of the Covered 45135446Strhodes * Code or modification with rights to further distribute source must include 46224092Sdougb * the above Copyright Notice, the above License, this list of Conditions, 47135446Strhodes * and the following Disclaimer and Export Compliance provision. In addition, 48135446Strhodes * Licensee must cause all Covered Code to which Licensee contributes to 49135446Strhodes * contain a file documenting the changes Licensee made to create that Covered 50135446Strhodes * Code and the date of any change. Licensee must include in that file the 51224092Sdougb * documentation of any changes made by any predecessor Licensee. Licensee 52135446Strhodes * must include a prominent statement that the modification is derived, 53135446Strhodes * directly or indirectly, from Original Intel Code. 54135446Strhodes * 55135446Strhodes * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56224092Sdougb * Redistribution of source code of any substantial portion of the Covered 57193149Sdougb * Code or modification without rights to further distribute source must 58135446Strhodes * include the following Disclaimer and Export Compliance provision in the 59135446Strhodes * documentation and/or other materials provided with distribution. In 60135446Strhodes * addition, Licensee may not authorize further sublicense of source of any 61135446Strhodes * portion of the Covered Code, and must include terms to the effect that the 62135446Strhodes * license from Licensee to its licensee is limited to the intellectual 63135446Strhodes * property embodied in the software Licensee provides to its licensee, and 64135446Strhodes * not to intellectual property embodied in modifications its licensee may 65135446Strhodes * make. 66135446Strhodes * 67135446Strhodes * 3.3. Redistribution of Executable. Redistribution in executable form of any 68135446Strhodes * substantial portion of the Covered Code or modification must reproduce the 69135446Strhodes * above Copyright Notice, and the following Disclaimer and Export Compliance 70135446Strhodes * provision in the documentation and/or other materials provided with the 71135446Strhodes * distribution. 72135446Strhodes * 73135446Strhodes * 3.4. Intel retains all right, title, and interest in and to the Original 74135446Strhodes * Intel Code. 75135446Strhodes * 76135446Strhodes * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77135446Strhodes * Intel shall be used in advertising or otherwise to promote the sale, use or 78135446Strhodes * other dealings in products derived from or relating to the Covered Code 79135446Strhodes * without prior written authorization from Intel. 80135446Strhodes * 81135446Strhodes * 4. Disclaimer and Export Compliance 82135446Strhodes * 83135446Strhodes * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84135446Strhodes * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85135446Strhodes * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86135446Strhodes * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87135446Strhodes * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88135446Strhodes * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89135446Strhodes * PARTICULAR PURPOSE. 90135446Strhodes * 91135446Strhodes * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92135446Strhodes * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93135446Strhodes * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94135446Strhodes * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95170222Sdougb * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96135446Strhodes * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97170222Sdougb * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98224092Sdougb * LIMITED REMEDY. 99135446Strhodes * 100135446Strhodes * 4.3. Licensee shall not export, either directly or indirectly, any of this 101135446Strhodes * software or system incorporating such software without first obtaining any 102135446Strhodes * required license or other approval from the U. S. Department of Commerce or 103135446Strhodes * any other agency or department of the United States Government. In the 104135446Strhodes * event Licensee exports any such software from the United States or 105135446Strhodes * re-exports any such software from a foreign destination, Licensee shall 106135446Strhodes * ensure that the distribution and export/re-export of the software is in 107135446Strhodes * compliance with all laws, regulations, orders, or other restrictions of the 108224092Sdougb * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109224092Sdougb * any of its subsidiaries will export/re-export any technical data, process, 110135446Strhodes * software, or service, directly or indirectly, to any country for which the 111135446Strhodes * United States government or any agency thereof requires an export license, 112135446Strhodes * other governmental approval, or letter of assurance, without first obtaining 113135446Strhodes * such license, approval or letter. 114135446Strhodes * 115135446Strhodes *****************************************************************************/ 116135446Strhodes 117224092Sdougb 118135446Strhodes#include "acpi.h" 119135446Strhodes#include "amlcode.h" 120170222Sdougb#include "acdispat.h" 121135446Strhodes#include "acnamesp.h" 122135446Strhodes#include "acparser.h" 123170222Sdougb#include "acinterp.h" 124135446Strhodes#include "acdebug.h" 125135446Strhodes#include "acdisasm.h" 126135446Strhodes 127135446Strhodes 128135446Strhodes#ifdef ACPI_DEBUGGER 129135446Strhodes 130135446Strhodes 131135446Strhodes#define _COMPONENT ACPI_CA_DEBUGGER 132170222Sdougb ACPI_MODULE_NAME ("dbdisply") 133170222Sdougb 134170222Sdougb 135135446Strhodes/****************************************************************************** 136135446Strhodes * 137135446Strhodes * FUNCTION: AcpiDbGetPointer 138135446Strhodes * 139135446Strhodes * PARAMETERS: Target - Pointer to string to be converted 140135446Strhodes * 141135446Strhodes * RETURN: Converted pointer 142135446Strhodes * 143135446Strhodes * DESCRIPTION: Convert an ascii pointer value to a real value 144135446Strhodes * 145170222Sdougb *****************************************************************************/ 146135446Strhodes 147135446Strhodesvoid * 148135446StrhodesAcpiDbGetPointer ( 149135446Strhodes void *Target) 150135446Strhodes{ 151193149Sdougb void *ObjPtr; 152193149Sdougb 153224092Sdougb 154224092Sdougb#if ACPI_MACHINE_WIDTH == 16 155224092Sdougb#include <stdio.h> 156135446Strhodes 157135446Strhodes /* Have to handle 16-bit pointers of the form segment:offset */ 158135446Strhodes 159135446Strhodes if (!sscanf (Target, "%p", &ObjPtr)) 160135446Strhodes { 161135446Strhodes AcpiOsPrintf ("Invalid pointer: %s\n", Target); 162135446Strhodes return (NULL); 163135446Strhodes } 164135446Strhodes 165170222Sdougb#else 166170222Sdougb 167135446Strhodes /* Simple flat pointer */ 168135446Strhodes 169216175Sdougb ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); 170216175Sdougb#endif 171135446Strhodes 172193149Sdougb return (ObjPtr); 173135446Strhodes} 174193149Sdougb 175135446Strhodes 176193149Sdougb/******************************************************************************* 177193149Sdougb * 178193149Sdougb * FUNCTION: AcpiDbDumpParserDescriptor 179193149Sdougb * 180224092Sdougb * PARAMETERS: Op - A parser Op descriptor 181224092Sdougb * 182224092Sdougb * RETURN: None 183224092Sdougb * 184135446Strhodes * DESCRIPTION: Display a formatted parser object 185135446Strhodes * 186135446Strhodes ******************************************************************************/ 187135446Strhodes 188135446Strhodesvoid 189135446StrhodesAcpiDbDumpParserDescriptor ( 190135446Strhodes ACPI_PARSE_OBJECT *Op) 191135446Strhodes{ 192170222Sdougb const ACPI_OPCODE_INFO *Info; 193224092Sdougb 194224092Sdougb 195224092Sdougb Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 196135446Strhodes 197224092Sdougb AcpiOsPrintf ("Parser Op Descriptor:\n"); 198224092Sdougb AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); 199224092Sdougb 200224092Sdougb ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name)); 201224092Sdougb 202135446Strhodes AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); 203135446Strhodes AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); 204135446Strhodes AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); 205135446Strhodes} 206224092Sdougb 207135446Strhodes 208135446Strhodes/******************************************************************************* 209135446Strhodes * 210135446Strhodes * FUNCTION: AcpiDbDecodeAndDisplayObject 211135446Strhodes * 212135446Strhodes * PARAMETERS: Target - String with object to be displayed. Names 213135446Strhodes * and hex pointers are supported. 214135446Strhodes * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 215135446Strhodes * 216135446Strhodes * RETURN: None 217135446Strhodes * 218135446Strhodes * DESCRIPTION: Display a formatted ACPI object 219135446Strhodes * 220135446Strhodes ******************************************************************************/ 221135446Strhodes 222135446Strhodesvoid 223135446StrhodesAcpiDbDecodeAndDisplayObject ( 224135446Strhodes char *Target, 225135446Strhodes char *OutputType) 226135446Strhodes{ 227135446Strhodes void *ObjPtr; 228135446Strhodes ACPI_NAMESPACE_NODE *Node; 229135446Strhodes ACPI_OPERAND_OBJECT *ObjDesc; 230135446Strhodes UINT32 Display = DB_BYTE_DISPLAY; 231135446Strhodes char Buffer[80]; 232135446Strhodes ACPI_BUFFER RetBuf; 233135446Strhodes ACPI_STATUS Status; 234135446Strhodes UINT32 Size; 235135446Strhodes 236224092Sdougb 237135446Strhodes if (!Target) 238135446Strhodes { 239135446Strhodes return; 240224092Sdougb } 241224092Sdougb 242135446Strhodes /* Decode the output type */ 243170222Sdougb 244170222Sdougb if (OutputType) 245170222Sdougb { 246135446Strhodes ACPI_STRUPR (OutputType); 247135446Strhodes if (OutputType[0] == 'W') 248135446Strhodes { 249135446Strhodes Display = DB_WORD_DISPLAY; 250224092Sdougb } 251135446Strhodes else if (OutputType[0] == 'D') 252135446Strhodes { 253135446Strhodes Display = DB_DWORD_DISPLAY; 254224092Sdougb } 255135446Strhodes else if (OutputType[0] == 'Q') 256135446Strhodes { 257135446Strhodes Display = DB_QWORD_DISPLAY; 258135446Strhodes } 259135446Strhodes } 260135446Strhodes 261135446Strhodes RetBuf.Length = sizeof (Buffer); 262135446Strhodes RetBuf.Pointer = Buffer; 263135446Strhodes 264135446Strhodes /* Differentiate between a number and a name */ 265135446Strhodes 266135446Strhodes if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 267135446Strhodes { 268224092Sdougb ObjPtr = AcpiDbGetPointer (Target); 269224092Sdougb if (!AcpiOsReadable (ObjPtr, 16)) 270224092Sdougb { 271224092Sdougb AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr); 272135446Strhodes return; 273135446Strhodes } 274135446Strhodes 275135446Strhodes /* Decode the object type */ 276135446Strhodes 277135446Strhodes switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) 278135446Strhodes { 279224092Sdougb case ACPI_DESC_TYPE_NAMED: 280135446Strhodes 281135446Strhodes /* This is a namespace Node */ 282224092Sdougb 283135446Strhodes if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 284135446Strhodes { 285224092Sdougb AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr); 286224092Sdougb return; 287224092Sdougb } 288224092Sdougb 289224092Sdougb Node = ObjPtr; 290224092Sdougb goto DumpNte; 291224092Sdougb 292224092Sdougb 293224092Sdougb case ACPI_DESC_TYPE_OPERAND: 294224092Sdougb 295224092Sdougb /* This is a ACPI OPERAND OBJECT */ 296224092Sdougb 297224092Sdougb if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 298224092Sdougb { 299224092Sdougb AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr); 300224092Sdougb return; 301224092Sdougb } 302224092Sdougb 303224092Sdougb AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 304224092Sdougb AcpiExDumpObjectDescriptor (ObjPtr, 1); 305224092Sdougb break; 306224092Sdougb 307224092Sdougb 308224092Sdougb case ACPI_DESC_TYPE_PARSER: 309224092Sdougb 310224092Sdougb /* This is a Parser Op object */ 311224092Sdougb 312224092Sdougb if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) 313224092Sdougb { 314224092Sdougb AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr); 315224092Sdougb return; 316224092Sdougb } 317224092Sdougb 318135446Strhodes AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); 319224092Sdougb AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 320135446Strhodes break; 321135446Strhodes 322135446Strhodes 323135446Strhodes default: 324224092Sdougb 325170222Sdougb /* Is not a recognizeable object */ 326170222Sdougb 327170222Sdougb Size = 16; 328170222Sdougb if (AcpiOsReadable (ObjPtr, 64)) 329170222Sdougb { 330224092Sdougb Size = 64; 331224092Sdougb } 332224092Sdougb 333224092Sdougb /* Just dump some memory */ 334224092Sdougb 335135446Strhodes AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 336135446Strhodes break; 337135446Strhodes } 338135446Strhodes 339135446Strhodes return; 340135446Strhodes } 341170222Sdougb 342170222Sdougb /* The parameter is a name string that must be resolved to a Named obj */ 343135446Strhodes 344135446Strhodes Node = AcpiDbLocalNsLookup (Target); 345135446Strhodes if (!Node) 346135446Strhodes { 347135446Strhodes return; 348135446Strhodes } 349135446Strhodes 350135446Strhodes 351216175SdougbDumpNte: 352216175Sdougb /* Now dump the Named obj */ 353216175Sdougb 354216175Sdougb Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 355135446Strhodes if (ACPI_FAILURE (Status)) 356135446Strhodes { 357193149Sdougb AcpiOsPrintf ("Could not convert name to pathname\n"); 358193149Sdougb } 359135446Strhodes 360135446Strhodes else 361193149Sdougb { 362193149Sdougb AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, (char *) RetBuf.Pointer); 363135446Strhodes } 364135446Strhodes 365193149Sdougb if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 366193149Sdougb { 367193149Sdougb AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 368193149Sdougb return; 369193149Sdougb } 370193149Sdougb 371193149Sdougb AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); 372193149Sdougb AcpiExDumpNode (Node, 1); 373224092Sdougb 374224092Sdougb ObjDesc = AcpiNsGetAttachedObject (Node); 375224092Sdougb if (ObjDesc) 376224092Sdougb { 377224092Sdougb AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); 378224092Sdougb if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 379224092Sdougb { 380224092Sdougb AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc); 381224092Sdougb return; 382224092Sdougb } 383135446Strhodes 384135446Strhodes AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 385135446Strhodes AcpiExDumpObjectDescriptor (ObjDesc, 1); 386135446Strhodes } 387135446Strhodes} 388135446Strhodes 389135446Strhodes 390135446Strhodes/******************************************************************************* 391135446Strhodes * 392135446Strhodes * FUNCTION: AcpiDbDisplayMethodInfo 393135446Strhodes * 394135446Strhodes * PARAMETERS: StartOp - Root of the control method parse tree 395135446Strhodes * 396135446Strhodes * RETURN: None 397135446Strhodes * 398135446Strhodes * DESCRIPTION: Display information about the current method 399135446Strhodes * 400135446Strhodes ******************************************************************************/ 401135446Strhodes 402135446Strhodesvoid 403135446StrhodesAcpiDbDisplayMethodInfo ( 404135446Strhodes ACPI_PARSE_OBJECT *StartOp) 405135446Strhodes{ 406135446Strhodes ACPI_WALK_STATE *WalkState; 407135446Strhodes ACPI_OPERAND_OBJECT *ObjDesc; 408186462Sdougb ACPI_NAMESPACE_NODE *Node; 409135446Strhodes ACPI_PARSE_OBJECT *RootOp; 410135446Strhodes ACPI_PARSE_OBJECT *Op; 411135446Strhodes const ACPI_OPCODE_INFO *OpInfo; 412135446Strhodes UINT32 NumOps = 0; 413135446Strhodes UINT32 NumOperands = 0; 414135446Strhodes UINT32 NumOperators = 0; 415135446Strhodes UINT32 NumRemainingOps = 0; 416135446Strhodes UINT32 NumRemainingOperands = 0; 417135446Strhodes UINT32 NumRemainingOperators = 0; 418193149Sdougb UINT32 NumArgs; 419193149Sdougb UINT32 Concurrency; 420193149Sdougb BOOLEAN CountRemaining = FALSE; 421193149Sdougb 422224092Sdougb 423224092Sdougb WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 424224092Sdougb if (!WalkState) 425224092Sdougb { 426224092Sdougb AcpiOsPrintf ("There is no method currently executing\n"); 427224092Sdougb return; 428224092Sdougb } 429224092Sdougb 430224092Sdougb ObjDesc = WalkState->MethodDesc; 431224092Sdougb Node = WalkState->MethodNode; 432224092Sdougb 433224092Sdougb NumArgs = ObjDesc->Method.ParamCount; 434224092Sdougb Concurrency = ObjDesc->Method.Concurrency; 435135446Strhodes 436135446Strhodes AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", Node->Name.Ascii); 437135446Strhodes AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); 438135446Strhodes 439135446Strhodes 440135446Strhodes RootOp = StartOp; 441135446Strhodes while (RootOp->Common.Parent) 442135446Strhodes { 443135446Strhodes RootOp = RootOp->Common.Parent; 444135446Strhodes } 445135446Strhodes 446135446Strhodes Op = RootOp; 447135446Strhodes 448135446Strhodes while (Op) 449135446Strhodes { 450135446Strhodes if (Op == StartOp) 451135446Strhodes { 452135446Strhodes CountRemaining = TRUE; 453135446Strhodes } 454135446Strhodes 455135446Strhodes NumOps++; 456135446Strhodes if (CountRemaining) 457135446Strhodes { 458135446Strhodes NumRemainingOps++; 459135446Strhodes } 460135446Strhodes 461135446Strhodes /* Decode the opcode */ 462135446Strhodes 463135446Strhodes OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 464135446Strhodes switch (OpInfo->Class) 465135446Strhodes { 466135446Strhodes case AML_CLASS_ARGUMENT: 467135446Strhodes if (CountRemaining) 468135446Strhodes { 469135446Strhodes NumRemainingOperands++; 470135446Strhodes } 471135446Strhodes 472135446Strhodes NumOperands++; 473135446Strhodes break; 474135446Strhodes 475135446Strhodes case AML_CLASS_UNKNOWN: 476135446Strhodes /* Bad opcode or ASCII character */ 477135446Strhodes 478135446Strhodes continue; 479135446Strhodes 480135446Strhodes default: 481135446Strhodes if (CountRemaining) 482135446Strhodes { 483135446Strhodes NumRemainingOperators++; 484135446Strhodes } 485135446Strhodes 486135446Strhodes NumOperators++; 487135446Strhodes break; 488135446Strhodes } 489135446Strhodes 490224092Sdougb Op = AcpiPsGetDepthNext (StartOp, Op); 491170222Sdougb } 492170222Sdougb 493135446Strhodes AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 494135446Strhodes NumOps, NumOperators, NumOperands); 495135446Strhodes 496135446Strhodes AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 497224092Sdougb NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 498224092Sdougb} 499224092Sdougb 500224092Sdougb 501224092Sdougb/******************************************************************************* 502224092Sdougb * 503135446Strhodes * FUNCTION: AcpiDbDisplayLocals 504135446Strhodes * 505135446Strhodes * PARAMETERS: None 506135446Strhodes * 507135446Strhodes * RETURN: None 508135446Strhodes * 509135446Strhodes * DESCRIPTION: Display all locals for the currently running control method 510135446Strhodes * 511135446Strhodes ******************************************************************************/ 512135446Strhodes 513135446Strhodesvoid 514135446StrhodesAcpiDbDisplayLocals (void) 515135446Strhodes{ 516135446Strhodes ACPI_WALK_STATE *WalkState; 517135446Strhodes 518135446Strhodes 519135446Strhodes WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 520135446Strhodes if (!WalkState) 521135446Strhodes { 522135446Strhodes AcpiOsPrintf ("There is no method currently executing\n"); 523224092Sdougb return; 524135446Strhodes } 525135446Strhodes 526135446Strhodes AcpiDmDisplayLocals (WalkState); 527135446Strhodes} 528135446Strhodes 529135446Strhodes 530135446Strhodes/******************************************************************************* 531135446Strhodes * 532135446Strhodes * FUNCTION: AcpiDbDisplayArguments 533135446Strhodes * 534135446Strhodes * PARAMETERS: None 535135446Strhodes * 536224092Sdougb * RETURN: None 537135446Strhodes * 538135446Strhodes * DESCRIPTION: Display all arguments for the currently running control method 539135446Strhodes * 540135446Strhodes ******************************************************************************/ 541135446Strhodes 542135446Strhodesvoid 543135446StrhodesAcpiDbDisplayArguments (void) 544135446Strhodes{ 545135446Strhodes ACPI_WALK_STATE *WalkState; 546135446Strhodes 547135446Strhodes 548135446Strhodes WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 549135446Strhodes if (!WalkState) 550135446Strhodes { 551135446Strhodes AcpiOsPrintf ("There is no method currently executing\n"); 552135446Strhodes return; 553135446Strhodes } 554135446Strhodes 555135446Strhodes AcpiDmDisplayArguments (WalkState); 556135446Strhodes} 557135446Strhodes 558135446Strhodes 559135446Strhodes/******************************************************************************* 560135446Strhodes * 561135446Strhodes * FUNCTION: AcpiDbDisplayResults 562135446Strhodes * 563135446Strhodes * PARAMETERS: None 564135446Strhodes * 565135446Strhodes * RETURN: None 566135446Strhodes * 567135446Strhodes * DESCRIPTION: Display current contents of a method result stack 568135446Strhodes * 569135446Strhodes ******************************************************************************/ 570135446Strhodes 571135446Strhodesvoid 572135446StrhodesAcpiDbDisplayResults (void) 573135446Strhodes{ 574135446Strhodes UINT32 i; 575135446Strhodes ACPI_WALK_STATE *WalkState; 576135446Strhodes ACPI_OPERAND_OBJECT *ObjDesc; 577135446Strhodes UINT32 NumResults = 0; 578135446Strhodes ACPI_NAMESPACE_NODE *Node; 579135446Strhodes 580135446Strhodes 581135446Strhodes WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 582135446Strhodes if (!WalkState) 583135446Strhodes { 584135446Strhodes AcpiOsPrintf ("There is no method currently executing\n"); 585135446Strhodes return; 586135446Strhodes } 587135446Strhodes 588135446Strhodes ObjDesc = WalkState->MethodDesc; 589135446Strhodes Node = WalkState->MethodNode; 590135446Strhodes 591135446Strhodes if (WalkState->Results) 592135446Strhodes { 593135446Strhodes NumResults = WalkState->Results->Results.NumResults; 594135446Strhodes } 595135446Strhodes 596135446Strhodes AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 597135446Strhodes Node->Name.Ascii, NumResults); 598135446Strhodes 599135446Strhodes for (i = 0; i < NumResults; i++) 600135446Strhodes { 601135446Strhodes ObjDesc = WalkState->Results->Results.ObjDesc[i]; 602135446Strhodes AcpiOsPrintf ("Result%d: ", i); 603135446Strhodes AcpiDmDisplayInternalObject (ObjDesc, WalkState); 604135446Strhodes } 605135446Strhodes} 606135446Strhodes 607135446Strhodes 608135446Strhodes/******************************************************************************* 609135446Strhodes * 610135446Strhodes * FUNCTION: AcpiDbDisplayCallingTree 611135446Strhodes * 612135446Strhodes * PARAMETERS: None 613135446Strhodes * 614135446Strhodes * RETURN: None 615135446Strhodes * 616135446Strhodes * DESCRIPTION: Display current calling tree of nested control methods 617135446Strhodes * 618135446Strhodes ******************************************************************************/ 619135446Strhodes 620135446Strhodesvoid 621135446StrhodesAcpiDbDisplayCallingTree (void) 622135446Strhodes{ 623135446Strhodes ACPI_WALK_STATE *WalkState; 624135446Strhodes ACPI_NAMESPACE_NODE *Node; 625135446Strhodes 626135446Strhodes 627135446Strhodes WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 628135446Strhodes if (!WalkState) 629135446Strhodes { 630135446Strhodes AcpiOsPrintf ("There is no method currently executing\n"); 631135446Strhodes return; 632135446Strhodes } 633135446Strhodes 634135446Strhodes Node = WalkState->MethodNode; 635135446Strhodes AcpiOsPrintf ("Current Control Method Call Tree\n"); 636135446Strhodes 637135446Strhodes while (WalkState) 638135446Strhodes { 639135446Strhodes Node = WalkState->MethodNode; 640135446Strhodes 641135446Strhodes AcpiOsPrintf (" [%4.4s]\n", Node->Name.Ascii); 642135446Strhodes 643135446Strhodes WalkState = WalkState->Next; 644135446Strhodes } 645135446Strhodes} 646135446Strhodes 647135446Strhodes 648135446Strhodes/******************************************************************************* 649135446Strhodes * 650135446Strhodes * FUNCTION: AcpiDbDisplayObjectType 651135446Strhodes * 652135446Strhodes * PARAMETERS: None 653135446Strhodes * 654135446Strhodes * RETURN: None 655135446Strhodes * 656135446Strhodes * DESCRIPTION: Display current calling tree of nested control methods 657135446Strhodes * 658135446Strhodes ******************************************************************************/ 659135446Strhodes 660135446Strhodesvoid 661135446StrhodesAcpiDbDisplayObjectType ( 662135446Strhodes char *ObjectArg) 663135446Strhodes{ 664135446Strhodes ACPI_HANDLE Handle; 665135446Strhodes ACPI_BUFFER Buffer; 666135446Strhodes ACPI_DEVICE_INFO *Info; 667135446Strhodes ACPI_STATUS Status; 668135446Strhodes ACPI_NATIVE_UINT i; 669135446Strhodes 670135446Strhodes 671135446Strhodes Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); 672135446Strhodes Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 673135446Strhodes 674135446Strhodes Status = AcpiGetObjectInfo (Handle, &Buffer); 675135446Strhodes if (ACPI_SUCCESS (Status)) 676135446Strhodes { 677135446Strhodes Info = Buffer.Pointer; 678135446Strhodes AcpiOsPrintf ("HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n", 679135446Strhodes &Info->HardwareId, 680135446Strhodes ACPI_HIDWORD (Info->Address), ACPI_LODWORD (Info->Address), 681135446Strhodes Info->CurrentStatus); 682135446Strhodes 683135446Strhodes if (Info->Valid & ACPI_VALID_CID) 684135446Strhodes { 685135446Strhodes for (i = 0; i < Info->CompatibilityId.Count; i++) 686135446Strhodes { 687135446Strhodes AcpiOsPrintf ("CID #%d: %s\n", i, &Info->CompatibilityId.Id[i]); 688193149Sdougb } 689135446Strhodes } 690135446Strhodes 691135446Strhodes ACPI_MEM_FREE (Info); 692135446Strhodes } 693135446Strhodes else 694135446Strhodes { 695135446Strhodes AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); 696135446Strhodes } 697135446Strhodes 698135446Strhodes} 699135446Strhodes 700135446Strhodes 701135446Strhodes/******************************************************************************* 702135446Strhodes * 703135446Strhodes * FUNCTION: AcpiDbDisplayResultObject 704135446Strhodes * 705135446Strhodes * PARAMETERS: ObjDesc - Object to be displayed 706135446Strhodes * WalkState - Current walk state 707135446Strhodes * 708135446Strhodes * RETURN: None 709135446Strhodes * 710135446Strhodes * DESCRIPTION: Display the result of an AML opcode 711135446Strhodes * 712135446Strhodes * Note: Curently only displays the result object if we are single stepping. 713135446Strhodes * However, this output may be useful in other contexts and could be enabled 714135446Strhodes * to do so if needed. 715135446Strhodes * 716135446Strhodes ******************************************************************************/ 717135446Strhodes 718224092Sdougbvoid 719224092SdougbAcpiDbDisplayResultObject ( 720224092Sdougb ACPI_OPERAND_OBJECT *ObjDesc, 721224092Sdougb ACPI_WALK_STATE *WalkState) 722224092Sdougb{ 723135446Strhodes 724135446Strhodes /* Only display if single stepping */ 725135446Strhodes 726224092Sdougb if (!AcpiGbl_CmSingleStep) 727135446Strhodes { 728224092Sdougb return; 729170222Sdougb } 730170222Sdougb 731224092Sdougb AcpiOsPrintf ("ResultObj: "); 732135446Strhodes AcpiDmDisplayInternalObject (ObjDesc, WalkState); 733135446Strhodes AcpiOsPrintf ("\n"); 734135446Strhodes} 735135446Strhodes 736135446Strhodes 737135446Strhodes/******************************************************************************* 738170222Sdougb * 739224092Sdougb * FUNCTION: AcpiDbDisplayArgumentObject 740170222Sdougb * 741170222Sdougb * PARAMETERS: ObjDesc - Object to be displayed 742224092Sdougb * WalkState - Current walk state 743135446Strhodes * 744135446Strhodes * RETURN: None 745224092Sdougb * 746224092Sdougb * DESCRIPTION: Display the result of an AML opcode 747224092Sdougb * 748224092Sdougb ******************************************************************************/ 749224092Sdougb 750224092Sdougbvoid 751224092SdougbAcpiDbDisplayArgumentObject ( 752135446Strhodes ACPI_OPERAND_OBJECT *ObjDesc, 753135446Strhodes ACPI_WALK_STATE *WalkState) 754135446Strhodes{ 755135446Strhodes 756135446Strhodes if (!AcpiGbl_CmSingleStep) 757135446Strhodes { 758135446Strhodes return; 759135446Strhodes } 760135446Strhodes 761135446Strhodes AcpiOsPrintf ("ArgObj: "); 762135446Strhodes AcpiDmDisplayInternalObject (ObjDesc, WalkState); 763135446Strhodes} 764135446Strhodes 765135446Strhodes 766135446Strhodes/******************************************************************************* 767224092Sdougb * 768224092Sdougb * FUNCTION: AcpiDbDisplayGpes 769135446Strhodes * 770135446Strhodes * PARAMETERS: 771135446Strhodes * 772224092Sdougb * RETURN: None 773135446Strhodes * 774224092Sdougb * DESCRIPTION: Display the GPE structures 775224092Sdougb * 776224092Sdougb ******************************************************************************/ 777224092Sdougb 778135446Strhodesvoid 779135446StrhodesAcpiDbDisplayGpes (void) 780224092Sdougb{ 781224092Sdougb ACPI_GPE_BLOCK_INFO *GpeBlock; 782224092Sdougb ACPI_GPE_XRUPT_INFO *GpeXruptInfo; 783224092Sdougb UINT32 i = 0; 784224092Sdougb 785224092Sdougb 786224092Sdougb GpeXruptInfo = AcpiGbl_GpeXruptListHead; 787135446Strhodes while (GpeXruptInfo) 788224092Sdougb { 789224092Sdougb GpeBlock = GpeXruptInfo->GpeBlockListHead; 790224092Sdougb while (GpeBlock) 791224092Sdougb { 792224092Sdougb AcpiOsPrintf ("Block %d - %p\n", i, GpeBlock); 793224092Sdougb AcpiOsPrintf (" Registers: %d\n", GpeBlock->RegisterCount); 794135446Strhodes AcpiOsPrintf (" GPE range: %d to %d\n", GpeBlock->BlockBaseNumber, 795135446Strhodes GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8) -1); 796224092Sdougb AcpiOsPrintf (" RegisterInfo: %p\n", GpeBlock->RegisterInfo); 797224092Sdougb AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); 798224092Sdougb i++; 799224092Sdougb 800224092Sdougb GpeBlock = GpeBlock->Next; 801224092Sdougb } 802224092Sdougb 803224092Sdougb GpeXruptInfo = GpeXruptInfo->Next; 804224092Sdougb } 805224092Sdougb} 806224092Sdougb 807224092Sdougb 808135446Strhodes#endif /* ACPI_DEBUGGER */ 809224092Sdougb 810224092Sdougb