1*3446Smrj /******************************************************************************* 2*3446Smrj * 3*3446Smrj * Module Name: dbdisply - debug display commands 4*3446Smrj * $Revision: 1.116 $ 5*3446Smrj * 6*3446Smrj ******************************************************************************/ 7*3446Smrj 8*3446Smrj /****************************************************************************** 9*3446Smrj * 10*3446Smrj * 1. Copyright Notice 11*3446Smrj * 12*3446Smrj * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. 13*3446Smrj * All rights reserved. 14*3446Smrj * 15*3446Smrj * 2. License 16*3446Smrj * 17*3446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property 18*3446Smrj * rights. You may have additional license terms from the party that provided 19*3446Smrj * you this software, covering your right to use that party's intellectual 20*3446Smrj * property rights. 21*3446Smrj * 22*3446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23*3446Smrj * copy of the source code appearing in this file ("Covered Code") an 24*3446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25*3446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy, 26*3446Smrj * make derivatives, distribute, use and display any portion of the Covered 27*3446Smrj * Code in any form, with the right to sublicense such rights; and 28*3446Smrj * 29*3446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30*3446Smrj * license (with the right to sublicense), under only those claims of Intel 31*3446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell, 32*3446Smrj * offer to sell, and import the Covered Code and derivative works thereof 33*3446Smrj * solely to the minimum extent necessary to exercise the above copyright 34*3446Smrj * license, and in no event shall the patent license extend to any additions 35*3446Smrj * to or modifications of the Original Intel Code. No other license or right 36*3446Smrj * is granted directly or by implication, estoppel or otherwise; 37*3446Smrj * 38*3446Smrj * The above copyright and patent license is granted only if the following 39*3446Smrj * conditions are met: 40*3446Smrj * 41*3446Smrj * 3. Conditions 42*3446Smrj * 43*3446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44*3446Smrj * Redistribution of source code of any substantial portion of the Covered 45*3446Smrj * Code or modification with rights to further distribute source must include 46*3446Smrj * the above Copyright Notice, the above License, this list of Conditions, 47*3446Smrj * and the following Disclaimer and Export Compliance provision. In addition, 48*3446Smrj * Licensee must cause all Covered Code to which Licensee contributes to 49*3446Smrj * contain a file documenting the changes Licensee made to create that Covered 50*3446Smrj * Code and the date of any change. Licensee must include in that file the 51*3446Smrj * documentation of any changes made by any predecessor Licensee. Licensee 52*3446Smrj * must include a prominent statement that the modification is derived, 53*3446Smrj * directly or indirectly, from Original Intel Code. 54*3446Smrj * 55*3446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56*3446Smrj * Redistribution of source code of any substantial portion of the Covered 57*3446Smrj * Code or modification without rights to further distribute source must 58*3446Smrj * include the following Disclaimer and Export Compliance provision in the 59*3446Smrj * documentation and/or other materials provided with distribution. In 60*3446Smrj * addition, Licensee may not authorize further sublicense of source of any 61*3446Smrj * portion of the Covered Code, and must include terms to the effect that the 62*3446Smrj * license from Licensee to its licensee is limited to the intellectual 63*3446Smrj * property embodied in the software Licensee provides to its licensee, and 64*3446Smrj * not to intellectual property embodied in modifications its licensee may 65*3446Smrj * make. 66*3446Smrj * 67*3446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any 68*3446Smrj * substantial portion of the Covered Code or modification must reproduce the 69*3446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance 70*3446Smrj * provision in the documentation and/or other materials provided with the 71*3446Smrj * distribution. 72*3446Smrj * 73*3446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original 74*3446Smrj * Intel Code. 75*3446Smrj * 76*3446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77*3446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or 78*3446Smrj * other dealings in products derived from or relating to the Covered Code 79*3446Smrj * without prior written authorization from Intel. 80*3446Smrj * 81*3446Smrj * 4. Disclaimer and Export Compliance 82*3446Smrj * 83*3446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84*3446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85*3446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86*3446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87*3446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88*3446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89*3446Smrj * PARTICULAR PURPOSE. 90*3446Smrj * 91*3446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92*3446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93*3446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94*3446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95*3446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96*3446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97*3446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98*3446Smrj * LIMITED REMEDY. 99*3446Smrj * 100*3446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this 101*3446Smrj * software or system incorporating such software without first obtaining any 102*3446Smrj * required license or other approval from the U. S. Department of Commerce or 103*3446Smrj * any other agency or department of the United States Government. In the 104*3446Smrj * event Licensee exports any such software from the United States or 105*3446Smrj * re-exports any such software from a foreign destination, Licensee shall 106*3446Smrj * ensure that the distribution and export/re-export of the software is in 107*3446Smrj * compliance with all laws, regulations, orders, or other restrictions of the 108*3446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109*3446Smrj * any of its subsidiaries will export/re-export any technical data, process, 110*3446Smrj * software, or service, directly or indirectly, to any country for which the 111*3446Smrj * United States government or any agency thereof requires an export license, 112*3446Smrj * other governmental approval, or letter of assurance, without first obtaining 113*3446Smrj * such license, approval or letter. 114*3446Smrj * 115*3446Smrj *****************************************************************************/ 116*3446Smrj 117*3446Smrj 118*3446Smrj #include "acpi.h" 119*3446Smrj #include "amlcode.h" 120*3446Smrj #include "acdispat.h" 121*3446Smrj #include "acnamesp.h" 122*3446Smrj #include "acparser.h" 123*3446Smrj #include "acinterp.h" 124*3446Smrj #include "acdebug.h" 125*3446Smrj #include "acdisasm.h" 126*3446Smrj 127*3446Smrj 128*3446Smrj #ifdef ACPI_DEBUGGER 129*3446Smrj 130*3446Smrj #define _COMPONENT ACPI_CA_DEBUGGER 131*3446Smrj ACPI_MODULE_NAME ("dbdisply") 132*3446Smrj 133*3446Smrj /* Local prototypes */ 134*3446Smrj 135*3446Smrj static void 136*3446Smrj AcpiDbDumpParserDescriptor ( 137*3446Smrj ACPI_PARSE_OBJECT *Op); 138*3446Smrj 139*3446Smrj static void * 140*3446Smrj AcpiDbGetPointer ( 141*3446Smrj void *Target); 142*3446Smrj 143*3446Smrj 144*3446Smrj /******************************************************************************* 145*3446Smrj * 146*3446Smrj * FUNCTION: AcpiDbGetPointer 147*3446Smrj * 148*3446Smrj * PARAMETERS: Target - Pointer to string to be converted 149*3446Smrj * 150*3446Smrj * RETURN: Converted pointer 151*3446Smrj * 152*3446Smrj * DESCRIPTION: Convert an ascii pointer value to a real value 153*3446Smrj * 154*3446Smrj ******************************************************************************/ 155*3446Smrj 156*3446Smrj static void * 157*3446Smrj AcpiDbGetPointer ( 158*3446Smrj void *Target) 159*3446Smrj { 160*3446Smrj void *ObjPtr; 161*3446Smrj 162*3446Smrj 163*3446Smrj #if ACPI_MACHINE_WIDTH == 16 164*3446Smrj #include <stdio.h> 165*3446Smrj 166*3446Smrj /* Have to handle 16-bit pointers of the form segment:offset */ 167*3446Smrj 168*3446Smrj if (!sscanf (Target, "%p", &ObjPtr)) 169*3446Smrj { 170*3446Smrj AcpiOsPrintf ("Invalid pointer: %s\n", Target); 171*3446Smrj return (NULL); 172*3446Smrj } 173*3446Smrj 174*3446Smrj #else 175*3446Smrj 176*3446Smrj /* Simple flat pointer */ 177*3446Smrj 178*3446Smrj ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); 179*3446Smrj #endif 180*3446Smrj 181*3446Smrj return (ObjPtr); 182*3446Smrj } 183*3446Smrj 184*3446Smrj 185*3446Smrj /******************************************************************************* 186*3446Smrj * 187*3446Smrj * FUNCTION: AcpiDbDumpParserDescriptor 188*3446Smrj * 189*3446Smrj * PARAMETERS: Op - A parser Op descriptor 190*3446Smrj * 191*3446Smrj * RETURN: None 192*3446Smrj * 193*3446Smrj * DESCRIPTION: Display a formatted parser object 194*3446Smrj * 195*3446Smrj ******************************************************************************/ 196*3446Smrj 197*3446Smrj static void 198*3446Smrj AcpiDbDumpParserDescriptor ( 199*3446Smrj ACPI_PARSE_OBJECT *Op) 200*3446Smrj { 201*3446Smrj const ACPI_OPCODE_INFO *Info; 202*3446Smrj 203*3446Smrj 204*3446Smrj Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 205*3446Smrj 206*3446Smrj AcpiOsPrintf ("Parser Op Descriptor:\n"); 207*3446Smrj AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); 208*3446Smrj 209*3446Smrj ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", 210*3446Smrj Info->Name)); 211*3446Smrj 212*3446Smrj AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); 213*3446Smrj AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); 214*3446Smrj AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); 215*3446Smrj } 216*3446Smrj 217*3446Smrj 218*3446Smrj /******************************************************************************* 219*3446Smrj * 220*3446Smrj * FUNCTION: AcpiDbDecodeAndDisplayObject 221*3446Smrj * 222*3446Smrj * PARAMETERS: Target - String with object to be displayed. Names 223*3446Smrj * and hex pointers are supported. 224*3446Smrj * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 225*3446Smrj * 226*3446Smrj * RETURN: None 227*3446Smrj * 228*3446Smrj * DESCRIPTION: Display a formatted ACPI object 229*3446Smrj * 230*3446Smrj ******************************************************************************/ 231*3446Smrj 232*3446Smrj void 233*3446Smrj AcpiDbDecodeAndDisplayObject ( 234*3446Smrj char *Target, 235*3446Smrj char *OutputType) 236*3446Smrj { 237*3446Smrj void *ObjPtr; 238*3446Smrj ACPI_NAMESPACE_NODE *Node; 239*3446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 240*3446Smrj UINT32 Display = DB_BYTE_DISPLAY; 241*3446Smrj char Buffer[80]; 242*3446Smrj ACPI_BUFFER RetBuf; 243*3446Smrj ACPI_STATUS Status; 244*3446Smrj UINT32 Size; 245*3446Smrj 246*3446Smrj 247*3446Smrj if (!Target) 248*3446Smrj { 249*3446Smrj return; 250*3446Smrj } 251*3446Smrj 252*3446Smrj /* Decode the output type */ 253*3446Smrj 254*3446Smrj if (OutputType) 255*3446Smrj { 256*3446Smrj AcpiUtStrupr (OutputType); 257*3446Smrj if (OutputType[0] == 'W') 258*3446Smrj { 259*3446Smrj Display = DB_WORD_DISPLAY; 260*3446Smrj } 261*3446Smrj else if (OutputType[0] == 'D') 262*3446Smrj { 263*3446Smrj Display = DB_DWORD_DISPLAY; 264*3446Smrj } 265*3446Smrj else if (OutputType[0] == 'Q') 266*3446Smrj { 267*3446Smrj Display = DB_QWORD_DISPLAY; 268*3446Smrj } 269*3446Smrj } 270*3446Smrj 271*3446Smrj RetBuf.Length = sizeof (Buffer); 272*3446Smrj RetBuf.Pointer = Buffer; 273*3446Smrj 274*3446Smrj /* Differentiate between a number and a name */ 275*3446Smrj 276*3446Smrj if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 277*3446Smrj { 278*3446Smrj ObjPtr = AcpiDbGetPointer (Target); 279*3446Smrj if (!AcpiOsReadable (ObjPtr, 16)) 280*3446Smrj { 281*3446Smrj AcpiOsPrintf ("Address %p is invalid in this address space\n", 282*3446Smrj ObjPtr); 283*3446Smrj return; 284*3446Smrj } 285*3446Smrj 286*3446Smrj /* Decode the object type */ 287*3446Smrj 288*3446Smrj switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) 289*3446Smrj { 290*3446Smrj case ACPI_DESC_TYPE_NAMED: 291*3446Smrj 292*3446Smrj /* This is a namespace Node */ 293*3446Smrj 294*3446Smrj if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 295*3446Smrj { 296*3446Smrj AcpiOsPrintf ( 297*3446Smrj "Cannot read entire Named object at address %p\n", ObjPtr); 298*3446Smrj return; 299*3446Smrj } 300*3446Smrj 301*3446Smrj Node = ObjPtr; 302*3446Smrj goto DumpNode; 303*3446Smrj 304*3446Smrj 305*3446Smrj case ACPI_DESC_TYPE_OPERAND: 306*3446Smrj 307*3446Smrj /* This is a ACPI OPERAND OBJECT */ 308*3446Smrj 309*3446Smrj if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 310*3446Smrj { 311*3446Smrj AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", 312*3446Smrj ObjPtr); 313*3446Smrj return; 314*3446Smrj } 315*3446Smrj 316*3446Smrj AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, 317*3446Smrj ACPI_UINT32_MAX); 318*3446Smrj AcpiExDumpObjectDescriptor (ObjPtr, 1); 319*3446Smrj break; 320*3446Smrj 321*3446Smrj 322*3446Smrj case ACPI_DESC_TYPE_PARSER: 323*3446Smrj 324*3446Smrj /* This is a Parser Op object */ 325*3446Smrj 326*3446Smrj if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) 327*3446Smrj { 328*3446Smrj AcpiOsPrintf ( 329*3446Smrj "Cannot read entire Parser object at address %p\n", ObjPtr); 330*3446Smrj return; 331*3446Smrj } 332*3446Smrj 333*3446Smrj AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, 334*3446Smrj ACPI_UINT32_MAX); 335*3446Smrj AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 336*3446Smrj break; 337*3446Smrj 338*3446Smrj 339*3446Smrj default: 340*3446Smrj 341*3446Smrj /* Is not a recognizeable object */ 342*3446Smrj 343*3446Smrj Size = 16; 344*3446Smrj if (AcpiOsReadable (ObjPtr, 64)) 345*3446Smrj { 346*3446Smrj Size = 64; 347*3446Smrj } 348*3446Smrj 349*3446Smrj /* Just dump some memory */ 350*3446Smrj 351*3446Smrj AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 352*3446Smrj break; 353*3446Smrj } 354*3446Smrj 355*3446Smrj return; 356*3446Smrj } 357*3446Smrj 358*3446Smrj /* The parameter is a name string that must be resolved to a Named obj */ 359*3446Smrj 360*3446Smrj Node = AcpiDbLocalNsLookup (Target); 361*3446Smrj if (!Node) 362*3446Smrj { 363*3446Smrj return; 364*3446Smrj } 365*3446Smrj 366*3446Smrj 367*3446Smrj DumpNode: 368*3446Smrj /* Now dump the NS node */ 369*3446Smrj 370*3446Smrj Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 371*3446Smrj if (ACPI_FAILURE (Status)) 372*3446Smrj { 373*3446Smrj AcpiOsPrintf ("Could not convert name to pathname\n"); 374*3446Smrj } 375*3446Smrj 376*3446Smrj else 377*3446Smrj { 378*3446Smrj AcpiOsPrintf ("Object (%p) Pathname: %s\n", 379*3446Smrj Node, (char *) RetBuf.Pointer); 380*3446Smrj } 381*3446Smrj 382*3446Smrj if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 383*3446Smrj { 384*3446Smrj AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 385*3446Smrj return; 386*3446Smrj } 387*3446Smrj 388*3446Smrj AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), 389*3446Smrj Display, ACPI_UINT32_MAX); 390*3446Smrj AcpiExDumpNamespaceNode (Node, 1); 391*3446Smrj 392*3446Smrj ObjDesc = AcpiNsGetAttachedObject (Node); 393*3446Smrj if (ObjDesc) 394*3446Smrj { 395*3446Smrj AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); 396*3446Smrj if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 397*3446Smrj { 398*3446Smrj AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", 399*3446Smrj ObjDesc); 400*3446Smrj return; 401*3446Smrj } 402*3446Smrj 403*3446Smrj AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), 404*3446Smrj Display, ACPI_UINT32_MAX); 405*3446Smrj AcpiExDumpObjectDescriptor (ObjDesc, 1); 406*3446Smrj } 407*3446Smrj } 408*3446Smrj 409*3446Smrj 410*3446Smrj /******************************************************************************* 411*3446Smrj * 412*3446Smrj * FUNCTION: AcpiDbDisplayMethodInfo 413*3446Smrj * 414*3446Smrj * PARAMETERS: StartOp - Root of the control method parse tree 415*3446Smrj * 416*3446Smrj * RETURN: None 417*3446Smrj * 418*3446Smrj * DESCRIPTION: Display information about the current method 419*3446Smrj * 420*3446Smrj ******************************************************************************/ 421*3446Smrj 422*3446Smrj void 423*3446Smrj AcpiDbDisplayMethodInfo ( 424*3446Smrj ACPI_PARSE_OBJECT *StartOp) 425*3446Smrj { 426*3446Smrj ACPI_WALK_STATE *WalkState; 427*3446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 428*3446Smrj ACPI_NAMESPACE_NODE *Node; 429*3446Smrj ACPI_PARSE_OBJECT *RootOp; 430*3446Smrj ACPI_PARSE_OBJECT *Op; 431*3446Smrj const ACPI_OPCODE_INFO *OpInfo; 432*3446Smrj UINT32 NumOps = 0; 433*3446Smrj UINT32 NumOperands = 0; 434*3446Smrj UINT32 NumOperators = 0; 435*3446Smrj UINT32 NumRemainingOps = 0; 436*3446Smrj UINT32 NumRemainingOperands = 0; 437*3446Smrj UINT32 NumRemainingOperators = 0; 438*3446Smrj BOOLEAN CountRemaining = FALSE; 439*3446Smrj 440*3446Smrj 441*3446Smrj WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 442*3446Smrj if (!WalkState) 443*3446Smrj { 444*3446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 445*3446Smrj return; 446*3446Smrj } 447*3446Smrj 448*3446Smrj ObjDesc = WalkState->MethodDesc; 449*3446Smrj Node = WalkState->MethodNode; 450*3446Smrj 451*3446Smrj AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", 452*3446Smrj AcpiUtGetNodeName (Node)); 453*3446Smrj AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n", 454*3446Smrj (UINT32) ObjDesc->Method.ParamCount, 455*3446Smrj (UINT32) ObjDesc->Method.SyncLevel); 456*3446Smrj 457*3446Smrj 458*3446Smrj RootOp = StartOp; 459*3446Smrj while (RootOp->Common.Parent) 460*3446Smrj { 461*3446Smrj RootOp = RootOp->Common.Parent; 462*3446Smrj } 463*3446Smrj 464*3446Smrj Op = RootOp; 465*3446Smrj 466*3446Smrj while (Op) 467*3446Smrj { 468*3446Smrj if (Op == StartOp) 469*3446Smrj { 470*3446Smrj CountRemaining = TRUE; 471*3446Smrj } 472*3446Smrj 473*3446Smrj NumOps++; 474*3446Smrj if (CountRemaining) 475*3446Smrj { 476*3446Smrj NumRemainingOps++; 477*3446Smrj } 478*3446Smrj 479*3446Smrj /* Decode the opcode */ 480*3446Smrj 481*3446Smrj OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 482*3446Smrj switch (OpInfo->Class) 483*3446Smrj { 484*3446Smrj case AML_CLASS_ARGUMENT: 485*3446Smrj if (CountRemaining) 486*3446Smrj { 487*3446Smrj NumRemainingOperands++; 488*3446Smrj } 489*3446Smrj 490*3446Smrj NumOperands++; 491*3446Smrj break; 492*3446Smrj 493*3446Smrj case AML_CLASS_UNKNOWN: 494*3446Smrj /* Bad opcode or ASCII character */ 495*3446Smrj 496*3446Smrj continue; 497*3446Smrj 498*3446Smrj default: 499*3446Smrj if (CountRemaining) 500*3446Smrj { 501*3446Smrj NumRemainingOperators++; 502*3446Smrj } 503*3446Smrj 504*3446Smrj NumOperators++; 505*3446Smrj break; 506*3446Smrj } 507*3446Smrj 508*3446Smrj Op = AcpiPsGetDepthNext (StartOp, Op); 509*3446Smrj } 510*3446Smrj 511*3446Smrj AcpiOsPrintf ( 512*3446Smrj "Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 513*3446Smrj NumOps, NumOperators, NumOperands); 514*3446Smrj 515*3446Smrj AcpiOsPrintf ( 516*3446Smrj "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 517*3446Smrj NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 518*3446Smrj } 519*3446Smrj 520*3446Smrj 521*3446Smrj /******************************************************************************* 522*3446Smrj * 523*3446Smrj * FUNCTION: AcpiDbDisplayLocals 524*3446Smrj * 525*3446Smrj * PARAMETERS: None 526*3446Smrj * 527*3446Smrj * RETURN: None 528*3446Smrj * 529*3446Smrj * DESCRIPTION: Display all locals for the currently running control method 530*3446Smrj * 531*3446Smrj ******************************************************************************/ 532*3446Smrj 533*3446Smrj void 534*3446Smrj AcpiDbDisplayLocals ( 535*3446Smrj void) 536*3446Smrj { 537*3446Smrj ACPI_WALK_STATE *WalkState; 538*3446Smrj 539*3446Smrj 540*3446Smrj WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 541*3446Smrj if (!WalkState) 542*3446Smrj { 543*3446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 544*3446Smrj return; 545*3446Smrj } 546*3446Smrj 547*3446Smrj AcpiDmDisplayLocals (WalkState); 548*3446Smrj } 549*3446Smrj 550*3446Smrj 551*3446Smrj /******************************************************************************* 552*3446Smrj * 553*3446Smrj * FUNCTION: AcpiDbDisplayArguments 554*3446Smrj * 555*3446Smrj * PARAMETERS: None 556*3446Smrj * 557*3446Smrj * RETURN: None 558*3446Smrj * 559*3446Smrj * DESCRIPTION: Display all arguments for the currently running control method 560*3446Smrj * 561*3446Smrj ******************************************************************************/ 562*3446Smrj 563*3446Smrj void 564*3446Smrj AcpiDbDisplayArguments ( 565*3446Smrj void) 566*3446Smrj { 567*3446Smrj ACPI_WALK_STATE *WalkState; 568*3446Smrj 569*3446Smrj 570*3446Smrj WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 571*3446Smrj if (!WalkState) 572*3446Smrj { 573*3446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 574*3446Smrj return; 575*3446Smrj } 576*3446Smrj 577*3446Smrj AcpiDmDisplayArguments (WalkState); 578*3446Smrj } 579*3446Smrj 580*3446Smrj 581*3446Smrj /******************************************************************************* 582*3446Smrj * 583*3446Smrj * FUNCTION: AcpiDbDisplayResults 584*3446Smrj * 585*3446Smrj * PARAMETERS: None 586*3446Smrj * 587*3446Smrj * RETURN: None 588*3446Smrj * 589*3446Smrj * DESCRIPTION: Display current contents of a method result stack 590*3446Smrj * 591*3446Smrj ******************************************************************************/ 592*3446Smrj 593*3446Smrj void 594*3446Smrj AcpiDbDisplayResults ( 595*3446Smrj void) 596*3446Smrj { 597*3446Smrj UINT32 i; 598*3446Smrj ACPI_WALK_STATE *WalkState; 599*3446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 600*3446Smrj UINT32 NumResults = 0; 601*3446Smrj ACPI_NAMESPACE_NODE *Node; 602*3446Smrj 603*3446Smrj 604*3446Smrj WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 605*3446Smrj if (!WalkState) 606*3446Smrj { 607*3446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 608*3446Smrj return; 609*3446Smrj } 610*3446Smrj 611*3446Smrj ObjDesc = WalkState->MethodDesc; 612*3446Smrj Node = WalkState->MethodNode; 613*3446Smrj 614*3446Smrj if (WalkState->Results) 615*3446Smrj { 616*3446Smrj NumResults = WalkState->Results->Results.NumResults; 617*3446Smrj } 618*3446Smrj 619*3446Smrj AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 620*3446Smrj AcpiUtGetNodeName (Node), NumResults); 621*3446Smrj 622*3446Smrj for (i = 0; i < NumResults; i++) 623*3446Smrj { 624*3446Smrj ObjDesc = WalkState->Results->Results.ObjDesc[i]; 625*3446Smrj AcpiOsPrintf ("Result%d: ", i); 626*3446Smrj AcpiDmDisplayInternalObject (ObjDesc, WalkState); 627*3446Smrj } 628*3446Smrj } 629*3446Smrj 630*3446Smrj 631*3446Smrj /******************************************************************************* 632*3446Smrj * 633*3446Smrj * FUNCTION: AcpiDbDisplayCallingTree 634*3446Smrj * 635*3446Smrj * PARAMETERS: None 636*3446Smrj * 637*3446Smrj * RETURN: None 638*3446Smrj * 639*3446Smrj * DESCRIPTION: Display current calling tree of nested control methods 640*3446Smrj * 641*3446Smrj ******************************************************************************/ 642*3446Smrj 643*3446Smrj void 644*3446Smrj AcpiDbDisplayCallingTree ( 645*3446Smrj void) 646*3446Smrj { 647*3446Smrj ACPI_WALK_STATE *WalkState; 648*3446Smrj ACPI_NAMESPACE_NODE *Node; 649*3446Smrj 650*3446Smrj 651*3446Smrj WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 652*3446Smrj if (!WalkState) 653*3446Smrj { 654*3446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 655*3446Smrj return; 656*3446Smrj } 657*3446Smrj 658*3446Smrj Node = WalkState->MethodNode; 659*3446Smrj AcpiOsPrintf ("Current Control Method Call Tree\n"); 660*3446Smrj 661*3446Smrj while (WalkState) 662*3446Smrj { 663*3446Smrj Node = WalkState->MethodNode; 664*3446Smrj 665*3446Smrj AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); 666*3446Smrj 667*3446Smrj WalkState = WalkState->Next; 668*3446Smrj } 669*3446Smrj } 670*3446Smrj 671*3446Smrj 672*3446Smrj /******************************************************************************* 673*3446Smrj * 674*3446Smrj * FUNCTION: AcpiDbDisplayObjectType 675*3446Smrj * 676*3446Smrj * PARAMETERS: ObjectArg - User entered NS node handle 677*3446Smrj * 678*3446Smrj * RETURN: None 679*3446Smrj * 680*3446Smrj * DESCRIPTION: Display type of an arbitrary NS node 681*3446Smrj * 682*3446Smrj ******************************************************************************/ 683*3446Smrj 684*3446Smrj void 685*3446Smrj AcpiDbDisplayObjectType ( 686*3446Smrj char *ObjectArg) 687*3446Smrj { 688*3446Smrj ACPI_HANDLE Handle; 689*3446Smrj ACPI_BUFFER Buffer; 690*3446Smrj ACPI_DEVICE_INFO *Info; 691*3446Smrj ACPI_STATUS Status; 692*3446Smrj ACPI_NATIVE_UINT i; 693*3446Smrj 694*3446Smrj 695*3446Smrj Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); 696*3446Smrj Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 697*3446Smrj 698*3446Smrj Status = AcpiGetObjectInfo (Handle, &Buffer); 699*3446Smrj if (ACPI_SUCCESS (Status)) 700*3446Smrj { 701*3446Smrj Info = Buffer.Pointer; 702*3446Smrj AcpiOsPrintf ( 703*3446Smrj "S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n", 704*3446Smrj Info->HighestDstates[0], Info->HighestDstates[1], 705*3446Smrj Info->HighestDstates[2], Info->HighestDstates[3], 706*3446Smrj Info->HardwareId.Value, 707*3446Smrj ACPI_FORMAT_UINT64 (Info->Address), 708*3446Smrj Info->CurrentStatus); 709*3446Smrj 710*3446Smrj if (Info->Valid & ACPI_VALID_CID) 711*3446Smrj { 712*3446Smrj for (i = 0; i < Info->CompatibilityId.Count; i++) 713*3446Smrj { 714*3446Smrj AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i, 715*3446Smrj Info->CompatibilityId.Id[i].Value); 716*3446Smrj } 717*3446Smrj } 718*3446Smrj 719*3446Smrj ACPI_FREE (Info); 720*3446Smrj } 721*3446Smrj else 722*3446Smrj { 723*3446Smrj AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); 724*3446Smrj } 725*3446Smrj } 726*3446Smrj 727*3446Smrj 728*3446Smrj /******************************************************************************* 729*3446Smrj * 730*3446Smrj * FUNCTION: AcpiDbDisplayResultObject 731*3446Smrj * 732*3446Smrj * PARAMETERS: ObjDesc - Object to be displayed 733*3446Smrj * WalkState - Current walk state 734*3446Smrj * 735*3446Smrj * RETURN: None 736*3446Smrj * 737*3446Smrj * DESCRIPTION: Display the result of an AML opcode 738*3446Smrj * 739*3446Smrj * Note: Curently only displays the result object if we are single stepping. 740*3446Smrj * However, this output may be useful in other contexts and could be enabled 741*3446Smrj * to do so if needed. 742*3446Smrj * 743*3446Smrj ******************************************************************************/ 744*3446Smrj 745*3446Smrj void 746*3446Smrj AcpiDbDisplayResultObject ( 747*3446Smrj ACPI_OPERAND_OBJECT *ObjDesc, 748*3446Smrj ACPI_WALK_STATE *WalkState) 749*3446Smrj { 750*3446Smrj 751*3446Smrj /* Only display if single stepping */ 752*3446Smrj 753*3446Smrj if (!AcpiGbl_CmSingleStep) 754*3446Smrj { 755*3446Smrj return; 756*3446Smrj } 757*3446Smrj 758*3446Smrj AcpiOsPrintf ("ResultObj: "); 759*3446Smrj AcpiDmDisplayInternalObject (ObjDesc, WalkState); 760*3446Smrj AcpiOsPrintf ("\n"); 761*3446Smrj } 762*3446Smrj 763*3446Smrj 764*3446Smrj /******************************************************************************* 765*3446Smrj * 766*3446Smrj * FUNCTION: AcpiDbDisplayArgumentObject 767*3446Smrj * 768*3446Smrj * PARAMETERS: ObjDesc - Object to be displayed 769*3446Smrj * WalkState - Current walk state 770*3446Smrj * 771*3446Smrj * RETURN: None 772*3446Smrj * 773*3446Smrj * DESCRIPTION: Display the result of an AML opcode 774*3446Smrj * 775*3446Smrj ******************************************************************************/ 776*3446Smrj 777*3446Smrj void 778*3446Smrj AcpiDbDisplayArgumentObject ( 779*3446Smrj ACPI_OPERAND_OBJECT *ObjDesc, 780*3446Smrj ACPI_WALK_STATE *WalkState) 781*3446Smrj { 782*3446Smrj 783*3446Smrj if (!AcpiGbl_CmSingleStep) 784*3446Smrj { 785*3446Smrj return; 786*3446Smrj } 787*3446Smrj 788*3446Smrj AcpiOsPrintf ("ArgObj: "); 789*3446Smrj AcpiDmDisplayInternalObject (ObjDesc, WalkState); 790*3446Smrj } 791*3446Smrj 792*3446Smrj 793*3446Smrj /******************************************************************************* 794*3446Smrj * 795*3446Smrj * FUNCTION: AcpiDbDisplayGpes 796*3446Smrj * 797*3446Smrj * PARAMETERS: None 798*3446Smrj * 799*3446Smrj * RETURN: None 800*3446Smrj * 801*3446Smrj * DESCRIPTION: Display the current GPE structures 802*3446Smrj * 803*3446Smrj ******************************************************************************/ 804*3446Smrj 805*3446Smrj void 806*3446Smrj AcpiDbDisplayGpes ( 807*3446Smrj void) 808*3446Smrj { 809*3446Smrj ACPI_GPE_BLOCK_INFO *GpeBlock; 810*3446Smrj ACPI_GPE_XRUPT_INFO *GpeXruptInfo; 811*3446Smrj ACPI_GPE_EVENT_INFO *GpeEventInfo; 812*3446Smrj ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; 813*3446Smrj UINT32 GpeIndex; 814*3446Smrj UINT32 Block = 0; 815*3446Smrj UINT32 i; 816*3446Smrj UINT32 j; 817*3446Smrj char Buffer[80]; 818*3446Smrj ACPI_BUFFER RetBuf; 819*3446Smrj ACPI_STATUS Status; 820*3446Smrj 821*3446Smrj 822*3446Smrj RetBuf.Length = sizeof (Buffer); 823*3446Smrj RetBuf.Pointer = Buffer; 824*3446Smrj 825*3446Smrj Block = 0; 826*3446Smrj 827*3446Smrj /* Walk the GPE lists */ 828*3446Smrj 829*3446Smrj GpeXruptInfo = AcpiGbl_GpeXruptListHead; 830*3446Smrj while (GpeXruptInfo) 831*3446Smrj { 832*3446Smrj GpeBlock = GpeXruptInfo->GpeBlockListHead; 833*3446Smrj while (GpeBlock) 834*3446Smrj { 835*3446Smrj Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf); 836*3446Smrj if (ACPI_FAILURE (Status)) 837*3446Smrj { 838*3446Smrj AcpiOsPrintf ("Could not convert name to pathname\n"); 839*3446Smrj } 840*3446Smrj 841*3446Smrj AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n", 842*3446Smrj Block, GpeBlock, GpeBlock->Node, Buffer); 843*3446Smrj 844*3446Smrj AcpiOsPrintf (" Registers: %u (%u GPEs)\n", 845*3446Smrj GpeBlock->RegisterCount, 846*3446Smrj ACPI_MUL_8 (GpeBlock->RegisterCount)); 847*3446Smrj 848*3446Smrj AcpiOsPrintf (" GPE range: 0x%X to 0x%X\n", 849*3446Smrj GpeBlock->BlockBaseNumber, 850*3446Smrj GpeBlock->BlockBaseNumber + 851*3446Smrj (GpeBlock->RegisterCount * 8) -1); 852*3446Smrj 853*3446Smrj AcpiOsPrintf ( 854*3446Smrj " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", 855*3446Smrj GpeBlock->RegisterInfo, 856*3446Smrj ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->StatusAddress.Address)), 857*3446Smrj ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->EnableAddress.Address))); 858*3446Smrj 859*3446Smrj AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); 860*3446Smrj 861*3446Smrj /* Examine each GPE Register within the block */ 862*3446Smrj 863*3446Smrj for (i = 0; i < GpeBlock->RegisterCount; i++) 864*3446Smrj { 865*3446Smrj GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; 866*3446Smrj 867*3446Smrj AcpiOsPrintf ( 868*3446Smrj " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n", 869*3446Smrj i, GpeRegisterInfo->EnableForWake, 870*3446Smrj GpeRegisterInfo->EnableForRun, 871*3446Smrj ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), 872*3446Smrj ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address))); 873*3446Smrj 874*3446Smrj /* Now look at the individual GPEs in this byte register */ 875*3446Smrj 876*3446Smrj for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 877*3446Smrj { 878*3446Smrj GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; 879*3446Smrj GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; 880*3446Smrj 881*3446Smrj if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)) 882*3446Smrj { 883*3446Smrj /* This GPE is not used (no method or handler) */ 884*3446Smrj 885*3446Smrj continue; 886*3446Smrj } 887*3446Smrj 888*3446Smrj AcpiOsPrintf ( 889*3446Smrj " GPE %.3X: %p Bit %2.2X Flags %2.2X: ", 890*3446Smrj GpeBlock->BlockBaseNumber + GpeIndex, 891*3446Smrj GpeEventInfo, GpeEventInfo->RegisterBit, 892*3446Smrj GpeEventInfo->Flags); 893*3446Smrj 894*3446Smrj if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) 895*3446Smrj { 896*3446Smrj AcpiOsPrintf ("Level, "); 897*3446Smrj } 898*3446Smrj else 899*3446Smrj { 900*3446Smrj AcpiOsPrintf ("Edge, "); 901*3446Smrj } 902*3446Smrj 903*3446Smrj switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) 904*3446Smrj { 905*3446Smrj case ACPI_GPE_TYPE_WAKE: 906*3446Smrj AcpiOsPrintf ("WakeOnly: "); 907*3446Smrj break; 908*3446Smrj case ACPI_GPE_TYPE_RUNTIME: 909*3446Smrj AcpiOsPrintf (" RunOnly: "); 910*3446Smrj break; 911*3446Smrj case ACPI_GPE_TYPE_WAKE_RUN: 912*3446Smrj AcpiOsPrintf (" WakeRun: "); 913*3446Smrj break; 914*3446Smrj default: 915*3446Smrj AcpiOsPrintf (" NotUsed: "); 916*3446Smrj break; 917*3446Smrj } 918*3446Smrj 919*3446Smrj if (GpeEventInfo->Flags & ACPI_GPE_WAKE_ENABLED) 920*3446Smrj { 921*3446Smrj AcpiOsPrintf ("[Wake 1 "); 922*3446Smrj } 923*3446Smrj else 924*3446Smrj { 925*3446Smrj AcpiOsPrintf ("[Wake 0 "); 926*3446Smrj } 927*3446Smrj 928*3446Smrj if (GpeEventInfo->Flags & ACPI_GPE_RUN_ENABLED) 929*3446Smrj { 930*3446Smrj AcpiOsPrintf ("Run 1], "); 931*3446Smrj } 932*3446Smrj else 933*3446Smrj { 934*3446Smrj AcpiOsPrintf ("Run 0], "); 935*3446Smrj } 936*3446Smrj 937*3446Smrj switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) 938*3446Smrj { 939*3446Smrj case ACPI_GPE_DISPATCH_NOT_USED: 940*3446Smrj AcpiOsPrintf ("NotUsed"); 941*3446Smrj break; 942*3446Smrj case ACPI_GPE_DISPATCH_HANDLER: 943*3446Smrj AcpiOsPrintf ("Handler"); 944*3446Smrj break; 945*3446Smrj case ACPI_GPE_DISPATCH_METHOD: 946*3446Smrj AcpiOsPrintf ("Method"); 947*3446Smrj break; 948*3446Smrj default: 949*3446Smrj AcpiOsPrintf ("UNKNOWN: %X", 950*3446Smrj GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK); 951*3446Smrj break; 952*3446Smrj } 953*3446Smrj 954*3446Smrj AcpiOsPrintf ("\n"); 955*3446Smrj } 956*3446Smrj } 957*3446Smrj Block++; 958*3446Smrj GpeBlock = GpeBlock->Next; 959*3446Smrj } 960*3446Smrj GpeXruptInfo = GpeXruptInfo->Next; 961*3446Smrj } 962*3446Smrj } 963*3446Smrj 964*3446Smrj #endif /* ACPI_DEBUGGER */ 965*3446Smrj 966