167754Smsmith/******************************************************************************* 267754Smsmith * 367754Smsmith * Module Name: dbdisply - debug display commands 467754Smsmith * 567754Smsmith ******************************************************************************/ 667754Smsmith 7316303Sjkim/****************************************************************************** 8316303Sjkim * 9316303Sjkim * 1. Copyright Notice 10316303Sjkim * 11316303Sjkim * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. 1270243Smsmith * All rights reserved. 1367754Smsmith * 14316303Sjkim * 2. License 15316303Sjkim * 16316303Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property 17316303Sjkim * rights. You may have additional license terms from the party that provided 18316303Sjkim * you this software, covering your right to use that party's intellectual 19316303Sjkim * property rights. 20316303Sjkim * 21316303Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22316303Sjkim * copy of the source code appearing in this file ("Covered Code") an 23316303Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24316303Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy, 25316303Sjkim * make derivatives, distribute, use and display any portion of the Covered 26316303Sjkim * Code in any form, with the right to sublicense such rights; and 27316303Sjkim * 28316303Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29316303Sjkim * license (with the right to sublicense), under only those claims of Intel 30316303Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell, 31316303Sjkim * offer to sell, and import the Covered Code and derivative works thereof 32316303Sjkim * solely to the minimum extent necessary to exercise the above copyright 33316303Sjkim * license, and in no event shall the patent license extend to any additions 34316303Sjkim * to or modifications of the Original Intel Code. No other license or right 35316303Sjkim * is granted directly or by implication, estoppel or otherwise; 36316303Sjkim * 37316303Sjkim * The above copyright and patent license is granted only if the following 38316303Sjkim * conditions are met: 39316303Sjkim * 40316303Sjkim * 3. Conditions 41316303Sjkim * 42316303Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43316303Sjkim * Redistribution of source code of any substantial portion of the Covered 44316303Sjkim * Code or modification with rights to further distribute source must include 45316303Sjkim * the above Copyright Notice, the above License, this list of Conditions, 46316303Sjkim * and the following Disclaimer and Export Compliance provision. In addition, 47316303Sjkim * Licensee must cause all Covered Code to which Licensee contributes to 48316303Sjkim * contain a file documenting the changes Licensee made to create that Covered 49316303Sjkim * Code and the date of any change. Licensee must include in that file the 50316303Sjkim * documentation of any changes made by any predecessor Licensee. Licensee 51316303Sjkim * must include a prominent statement that the modification is derived, 52316303Sjkim * directly or indirectly, from Original Intel Code. 53316303Sjkim * 54316303Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55316303Sjkim * Redistribution of source code of any substantial portion of the Covered 56316303Sjkim * Code or modification without rights to further distribute source must 57316303Sjkim * include the following Disclaimer and Export Compliance provision in the 58316303Sjkim * documentation and/or other materials provided with distribution. In 59316303Sjkim * addition, Licensee may not authorize further sublicense of source of any 60316303Sjkim * portion of the Covered Code, and must include terms to the effect that the 61316303Sjkim * license from Licensee to its licensee is limited to the intellectual 62316303Sjkim * property embodied in the software Licensee provides to its licensee, and 63316303Sjkim * not to intellectual property embodied in modifications its licensee may 64316303Sjkim * make. 65316303Sjkim * 66316303Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any 67316303Sjkim * substantial portion of the Covered Code or modification must reproduce the 68316303Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance 69316303Sjkim * provision in the documentation and/or other materials provided with the 70316303Sjkim * distribution. 71316303Sjkim * 72316303Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original 73316303Sjkim * Intel Code. 74316303Sjkim * 75316303Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76316303Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or 77316303Sjkim * other dealings in products derived from or relating to the Covered Code 78316303Sjkim * without prior written authorization from Intel. 79316303Sjkim * 80316303Sjkim * 4. Disclaimer and Export Compliance 81316303Sjkim * 82316303Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83316303Sjkim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84316303Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85316303Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86316303Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87316303Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88316303Sjkim * PARTICULAR PURPOSE. 89316303Sjkim * 90316303Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91316303Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92316303Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93316303Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94316303Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95316303Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96316303Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97316303Sjkim * LIMITED REMEDY. 98316303Sjkim * 99316303Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this 100316303Sjkim * software or system incorporating such software without first obtaining any 101316303Sjkim * required license or other approval from the U. S. Department of Commerce or 102316303Sjkim * any other agency or department of the United States Government. In the 103316303Sjkim * event Licensee exports any such software from the United States or 104316303Sjkim * re-exports any such software from a foreign destination, Licensee shall 105316303Sjkim * ensure that the distribution and export/re-export of the software is in 106316303Sjkim * compliance with all laws, regulations, orders, or other restrictions of the 107316303Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108316303Sjkim * any of its subsidiaries will export/re-export any technical data, process, 109316303Sjkim * software, or service, directly or indirectly, to any country for which the 110316303Sjkim * United States government or any agency thereof requires an export license, 111316303Sjkim * other governmental approval, or letter of assurance, without first obtaining 112316303Sjkim * such license, approval or letter. 113316303Sjkim * 114316303Sjkim ***************************************************************************** 115316303Sjkim * 116316303Sjkim * Alternatively, you may choose to be licensed under the terms of the 117316303Sjkim * following license: 118316303Sjkim * 119217365Sjkim * Redistribution and use in source and binary forms, with or without 120217365Sjkim * modification, are permitted provided that the following conditions 121217365Sjkim * are met: 122217365Sjkim * 1. Redistributions of source code must retain the above copyright 123217365Sjkim * notice, this list of conditions, and the following disclaimer, 124217365Sjkim * without modification. 125217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 127217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 128217365Sjkim * including a substantially similar Disclaimer requirement for further 129217365Sjkim * binary redistribution. 130217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 131217365Sjkim * of any contributors may be used to endorse or promote products derived 132217365Sjkim * from this software without specific prior written permission. 13367754Smsmith * 134316303Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135316303Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136316303Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137316303Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138316303Sjkim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139316303Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140316303Sjkim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141316303Sjkim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142316303Sjkim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143316303Sjkim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144316303Sjkim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145316303Sjkim * 146316303Sjkim * Alternatively, you may choose to be licensed under the terms of the 147217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 148217365Sjkim * Software Foundation. 14967754Smsmith * 150316303Sjkim *****************************************************************************/ 15167754Smsmith 152193341Sjkim#include <contrib/dev/acpica/include/acpi.h> 153193341Sjkim#include <contrib/dev/acpica/include/accommon.h> 154193341Sjkim#include <contrib/dev/acpica/include/amlcode.h> 155193341Sjkim#include <contrib/dev/acpica/include/acdispat.h> 156193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h> 157193341Sjkim#include <contrib/dev/acpica/include/acparser.h> 158193341Sjkim#include <contrib/dev/acpica/include/acinterp.h> 159298714Sjkim#include <contrib/dev/acpica/include/acevents.h> 160193341Sjkim#include <contrib/dev/acpica/include/acdebug.h> 16167754Smsmith 16267754Smsmith 163102550Siwasaki#define _COMPONENT ACPI_CA_DEBUGGER 16491116Smsmith ACPI_MODULE_NAME ("dbdisply") 16567754Smsmith 166151937Sjkim/* Local prototypes */ 16767754Smsmith 168151937Sjkimstatic void 169151937SjkimAcpiDbDumpParserDescriptor ( 170151937Sjkim ACPI_PARSE_OBJECT *Op); 171151937Sjkim 172151937Sjkimstatic void * 173151937SjkimAcpiDbGetPointer ( 174151937Sjkim void *Target); 175151937Sjkim 176249663Sjkimstatic ACPI_STATUS 177249663SjkimAcpiDbDisplayNonRootHandlers ( 178249663Sjkim ACPI_HANDLE ObjHandle, 179249663Sjkim UINT32 NestingLevel, 180249663Sjkim void *Context, 181249663Sjkim void **ReturnValue); 182151937Sjkim 183220663Sjkim/* 184220663Sjkim * System handler information. 185220663Sjkim * Used for Handlers command, in AcpiDbDisplayHandlers. 186220663Sjkim */ 187220663Sjkim#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " 188220663Sjkim#define ACPI_HANDLER_NAME_STRING "%30s : " 189220663Sjkim#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" 190249663Sjkim#define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)" 191220663Sjkim#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" 192220663Sjkim 193220663Sjkim/* All predefined Address Space IDs */ 194220663Sjkim 195220663Sjkimstatic ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] = 196220663Sjkim{ 197220663Sjkim ACPI_ADR_SPACE_SYSTEM_MEMORY, 198220663Sjkim ACPI_ADR_SPACE_SYSTEM_IO, 199220663Sjkim ACPI_ADR_SPACE_PCI_CONFIG, 200220663Sjkim ACPI_ADR_SPACE_EC, 201220663Sjkim ACPI_ADR_SPACE_SMBUS, 202220663Sjkim ACPI_ADR_SPACE_CMOS, 203220663Sjkim ACPI_ADR_SPACE_PCI_BAR_TARGET, 204220663Sjkim ACPI_ADR_SPACE_IPMI, 205228110Sjkim ACPI_ADR_SPACE_GPIO, 206228110Sjkim ACPI_ADR_SPACE_GSBUS, 207220663Sjkim ACPI_ADR_SPACE_DATA_TABLE, 208220663Sjkim ACPI_ADR_SPACE_FIXED_HARDWARE 209220663Sjkim}; 210220663Sjkim 211220663Sjkim/* Global handler information */ 212220663Sjkim 213220663Sjkimtypedef struct acpi_handler_info 214220663Sjkim{ 215220663Sjkim void *Handler; 216220663Sjkim char *Name; 217220663Sjkim 218220663Sjkim} ACPI_HANDLER_INFO; 219220663Sjkim 220220663Sjkimstatic ACPI_HANDLER_INFO AcpiGbl_HandlerList[] = 221220663Sjkim{ 222234623Sjkim {&AcpiGbl_GlobalNotify[0].Handler, "System Notifications"}, 223234623Sjkim {&AcpiGbl_GlobalNotify[1].Handler, "Device Notifications"}, 224220663Sjkim {&AcpiGbl_TableHandler, "ACPI Table Events"}, 225220663Sjkim {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"}, 226220663Sjkim {&AcpiGbl_InterfaceHandler, "OSI Invocations"} 227220663Sjkim}; 228220663Sjkim 229220663Sjkim 230151937Sjkim/******************************************************************************* 23167754Smsmith * 23267754Smsmith * FUNCTION: AcpiDbGetPointer 23367754Smsmith * 23467754Smsmith * PARAMETERS: Target - Pointer to string to be converted 23567754Smsmith * 23667754Smsmith * RETURN: Converted pointer 23767754Smsmith * 23867754Smsmith * DESCRIPTION: Convert an ascii pointer value to a real value 23967754Smsmith * 240151937Sjkim ******************************************************************************/ 24167754Smsmith 242151937Sjkimstatic void * 24367754SmsmithAcpiDbGetPointer ( 24467754Smsmith void *Target) 24567754Smsmith{ 24667754Smsmith void *ObjPtr; 247252279Sjkim ACPI_SIZE Address; 24867754Smsmith 24967754Smsmith 250284583Sjkim Address = strtoul (Target, NULL, 16); 251252279Sjkim ObjPtr = ACPI_TO_POINTER (Address); 25267754Smsmith return (ObjPtr); 25367754Smsmith} 25467754Smsmith 25567754Smsmith 25667754Smsmith/******************************************************************************* 25767754Smsmith * 25867754Smsmith * FUNCTION: AcpiDbDumpParserDescriptor 25967754Smsmith * 26067754Smsmith * PARAMETERS: Op - A parser Op descriptor 26167754Smsmith * 26267754Smsmith * RETURN: None 26367754Smsmith * 26467754Smsmith * DESCRIPTION: Display a formatted parser object 26567754Smsmith * 26667754Smsmith ******************************************************************************/ 26767754Smsmith 268151937Sjkimstatic void 26967754SmsmithAcpiDbDumpParserDescriptor ( 27067754Smsmith ACPI_PARSE_OBJECT *Op) 27167754Smsmith{ 27283174Smsmith const ACPI_OPCODE_INFO *Info; 27367754Smsmith 27467754Smsmith 27599679Siwasaki Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 27667754Smsmith 27767754Smsmith AcpiOsPrintf ("Parser Op Descriptor:\n"); 27899679Siwasaki AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); 27967754Smsmith 280151937Sjkim ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", 281151937Sjkim Info->Name)); 28267754Smsmith 28399679Siwasaki AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); 28499679Siwasaki AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); 28599679Siwasaki AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); 28667754Smsmith} 28767754Smsmith 28867754Smsmith 28967754Smsmith/******************************************************************************* 29067754Smsmith * 29167754Smsmith * FUNCTION: AcpiDbDecodeAndDisplayObject 29267754Smsmith * 293241973Sjkim * PARAMETERS: Target - String with object to be displayed. Names 29467754Smsmith * and hex pointers are supported. 29567754Smsmith * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 29667754Smsmith * 29767754Smsmith * RETURN: None 29867754Smsmith * 29967754Smsmith * DESCRIPTION: Display a formatted ACPI object 30067754Smsmith * 30167754Smsmith ******************************************************************************/ 30267754Smsmith 30367754Smsmithvoid 30467754SmsmithAcpiDbDecodeAndDisplayObject ( 305114237Snjl char *Target, 306114237Snjl char *OutputType) 30767754Smsmith{ 30867754Smsmith void *ObjPtr; 30967754Smsmith ACPI_NAMESPACE_NODE *Node; 31087031Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 31167754Smsmith UINT32 Display = DB_BYTE_DISPLAY; 312114237Snjl char Buffer[80]; 31367754Smsmith ACPI_BUFFER RetBuf; 31467754Smsmith ACPI_STATUS Status; 31567754Smsmith UINT32 Size; 31667754Smsmith 31767754Smsmith 31867754Smsmith if (!Target) 31967754Smsmith { 32067754Smsmith return; 32167754Smsmith } 32267754Smsmith 32367754Smsmith /* Decode the output type */ 32467754Smsmith 32567754Smsmith if (OutputType) 32667754Smsmith { 327151937Sjkim AcpiUtStrupr (OutputType); 32867754Smsmith if (OutputType[0] == 'W') 32967754Smsmith { 33067754Smsmith Display = DB_WORD_DISPLAY; 33167754Smsmith } 33267754Smsmith else if (OutputType[0] == 'D') 33367754Smsmith { 33467754Smsmith Display = DB_DWORD_DISPLAY; 33567754Smsmith } 33667754Smsmith else if (OutputType[0] == 'Q') 33767754Smsmith { 33867754Smsmith Display = DB_QWORD_DISPLAY; 33967754Smsmith } 34067754Smsmith } 34167754Smsmith 34267754Smsmith RetBuf.Length = sizeof (Buffer); 34367754Smsmith RetBuf.Pointer = Buffer; 34467754Smsmith 34567754Smsmith /* Differentiate between a number and a name */ 34667754Smsmith 34767754Smsmith if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 34867754Smsmith { 34967754Smsmith ObjPtr = AcpiDbGetPointer (Target); 35067754Smsmith if (!AcpiOsReadable (ObjPtr, 16)) 35167754Smsmith { 352287168Sjkim AcpiOsPrintf ( 353287168Sjkim "Address %p is invalid in this address space\n", 354151937Sjkim ObjPtr); 35567754Smsmith return; 35667754Smsmith } 35767754Smsmith 35867754Smsmith /* Decode the object type */ 35967754Smsmith 36091116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) 36167754Smsmith { 36291116Smsmith case ACPI_DESC_TYPE_NAMED: 36367754Smsmith 36491116Smsmith /* This is a namespace Node */ 36591116Smsmith 36667754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 36767754Smsmith { 368151937Sjkim AcpiOsPrintf ( 369287168Sjkim "Cannot read entire Named object at address %p\n", 370287168Sjkim ObjPtr); 37167754Smsmith return; 37267754Smsmith } 37367754Smsmith 37467754Smsmith Node = ObjPtr; 375151937Sjkim goto DumpNode; 37667754Smsmith 37799679Siwasaki case ACPI_DESC_TYPE_OPERAND: 37891116Smsmith 37991116Smsmith /* This is a ACPI OPERAND OBJECT */ 38091116Smsmith 38167754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 38267754Smsmith { 383287168Sjkim AcpiOsPrintf ( 384287168Sjkim "Cannot read entire ACPI object at address %p\n", 385151937Sjkim ObjPtr); 38667754Smsmith return; 38767754Smsmith } 38867754Smsmith 389287168Sjkim AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), 390287168Sjkim Display, ACPI_UINT32_MAX); 39177424Smsmith AcpiExDumpObjectDescriptor (ObjPtr, 1); 39291116Smsmith break; 39367754Smsmith 39491116Smsmith case ACPI_DESC_TYPE_PARSER: 39591116Smsmith 39691116Smsmith /* This is a Parser Op object */ 39791116Smsmith 39867754Smsmith if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) 39967754Smsmith { 400151937Sjkim AcpiOsPrintf ( 401287168Sjkim "Cannot read entire Parser object at address %p\n", 402287168Sjkim ObjPtr); 40367754Smsmith return; 40467754Smsmith } 40567754Smsmith 406287168Sjkim AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), 407287168Sjkim Display, ACPI_UINT32_MAX); 40867754Smsmith AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 40991116Smsmith break; 41067754Smsmith 41191116Smsmith default: 41291116Smsmith 41391116Smsmith /* Is not a recognizeable object */ 41491116Smsmith 415272444Sjkim AcpiOsPrintf ( 416272444Sjkim "Not a known ACPI internal object, descriptor type %2.2X\n", 417272444Sjkim ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)); 418272444Sjkim 41967754Smsmith Size = 16; 42067754Smsmith if (AcpiOsReadable (ObjPtr, 64)) 42167754Smsmith { 42267754Smsmith Size = 64; 42367754Smsmith } 42467754Smsmith 42567754Smsmith /* Just dump some memory */ 42667754Smsmith 427241973Sjkim AcpiUtDebugDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 42891116Smsmith break; 42967754Smsmith } 43067754Smsmith 43167754Smsmith return; 43267754Smsmith } 43367754Smsmith 43467754Smsmith /* The parameter is a name string that must be resolved to a Named obj */ 43567754Smsmith 43667754Smsmith Node = AcpiDbLocalNsLookup (Target); 43767754Smsmith if (!Node) 43867754Smsmith { 43967754Smsmith return; 44067754Smsmith } 44167754Smsmith 44267754Smsmith 443151937SjkimDumpNode: 444151937Sjkim /* Now dump the NS node */ 44567754Smsmith 446287168Sjkim Status = AcpiGetName (Node, ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); 44767754Smsmith if (ACPI_FAILURE (Status)) 44867754Smsmith { 44967754Smsmith AcpiOsPrintf ("Could not convert name to pathname\n"); 45067754Smsmith } 45167754Smsmith 45269746Smsmith else 45369746Smsmith { 454322877Sjkim AcpiOsPrintf ("Object %p: Namespace Node - Pathname: %s\n", 455151937Sjkim Node, (char *) RetBuf.Pointer); 45669746Smsmith } 45769746Smsmith 45867754Smsmith if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 45967754Smsmith { 46067754Smsmith AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 46167754Smsmith return; 46267754Smsmith } 46367754Smsmith 464241973Sjkim AcpiUtDebugDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), 465151937Sjkim Display, ACPI_UINT32_MAX); 466167802Sjkim AcpiExDumpNamespaceNode (Node, 1); 46767754Smsmith 46887031Smsmith ObjDesc = AcpiNsGetAttachedObject (Node); 46987031Smsmith if (ObjDesc) 47067754Smsmith { 471322877Sjkim AcpiOsPrintf ("\nAttached Object %p:", ObjDesc); 47287031Smsmith if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 47367754Smsmith { 474151937Sjkim AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", 475151937Sjkim ObjDesc); 47667754Smsmith return; 47767754Smsmith } 47867754Smsmith 479322877Sjkim if (ACPI_GET_DESCRIPTOR_TYPE ( 480322877Sjkim ((ACPI_NAMESPACE_NODE *) ObjDesc)) == ACPI_DESC_TYPE_NAMED) 481322877Sjkim { 482322877Sjkim AcpiOsPrintf (" Namespace Node - "); 483322877Sjkim Status = AcpiGetName ((ACPI_NAMESPACE_NODE *) ObjDesc, 484322877Sjkim ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); 485322877Sjkim if (ACPI_FAILURE (Status)) 486322877Sjkim { 487322877Sjkim AcpiOsPrintf ("Could not convert name to pathname\n"); 488322877Sjkim } 489322877Sjkim else 490322877Sjkim { 491322877Sjkim AcpiOsPrintf ("Pathname: %s", 492322877Sjkim (char *) RetBuf.Pointer); 493322877Sjkim } 494322877Sjkim 495322877Sjkim AcpiOsPrintf ("\n"); 496322877Sjkim AcpiUtDebugDumpBuffer ((void *) ObjDesc, 497322877Sjkim sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); 498322877Sjkim } 499322877Sjkim else 500322877Sjkim { 501322877Sjkim AcpiOsPrintf ("\n"); 502322877Sjkim AcpiUtDebugDumpBuffer ((void *) ObjDesc, 503322877Sjkim sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 504322877Sjkim } 505322877Sjkim 50687031Smsmith AcpiExDumpObjectDescriptor (ObjDesc, 1); 50767754Smsmith } 50867754Smsmith} 50967754Smsmith 51067754Smsmith 51167754Smsmith/******************************************************************************* 51267754Smsmith * 51367754Smsmith * FUNCTION: AcpiDbDisplayMethodInfo 51467754Smsmith * 51567754Smsmith * PARAMETERS: StartOp - Root of the control method parse tree 51667754Smsmith * 51767754Smsmith * RETURN: None 51867754Smsmith * 51967754Smsmith * DESCRIPTION: Display information about the current method 52067754Smsmith * 52167754Smsmith ******************************************************************************/ 52267754Smsmith 52367754Smsmithvoid 52467754SmsmithAcpiDbDisplayMethodInfo ( 52567754Smsmith ACPI_PARSE_OBJECT *StartOp) 52667754Smsmith{ 52767754Smsmith ACPI_WALK_STATE *WalkState; 52867754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 52967754Smsmith ACPI_NAMESPACE_NODE *Node; 53067754Smsmith ACPI_PARSE_OBJECT *RootOp; 53167754Smsmith ACPI_PARSE_OBJECT *Op; 53283174Smsmith const ACPI_OPCODE_INFO *OpInfo; 53367754Smsmith UINT32 NumOps = 0; 53467754Smsmith UINT32 NumOperands = 0; 53567754Smsmith UINT32 NumOperators = 0; 53667754Smsmith UINT32 NumRemainingOps = 0; 53767754Smsmith UINT32 NumRemainingOperands = 0; 53867754Smsmith UINT32 NumRemainingOperators = 0; 53967754Smsmith BOOLEAN CountRemaining = FALSE; 54067754Smsmith 54167754Smsmith 54267754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 54367754Smsmith if (!WalkState) 54467754Smsmith { 54567754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 54667754Smsmith return; 54767754Smsmith } 54867754Smsmith 54967754Smsmith ObjDesc = WalkState->MethodDesc; 550298714Sjkim Node = WalkState->MethodNode; 55167754Smsmith 552123315Snjl AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", 553298714Sjkim AcpiUtGetNodeName (Node)); 554167802Sjkim AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n", 555298714Sjkim (UINT32) ObjDesc->Method.ParamCount, 556298714Sjkim (UINT32) ObjDesc->Method.SyncLevel); 55767754Smsmith 55867754Smsmith RootOp = StartOp; 55999679Siwasaki while (RootOp->Common.Parent) 56067754Smsmith { 56199679Siwasaki RootOp = RootOp->Common.Parent; 56267754Smsmith } 56367754Smsmith 56467754Smsmith Op = RootOp; 56567754Smsmith 56667754Smsmith while (Op) 56767754Smsmith { 56867754Smsmith if (Op == StartOp) 56967754Smsmith { 57067754Smsmith CountRemaining = TRUE; 57167754Smsmith } 57267754Smsmith 57367754Smsmith NumOps++; 57467754Smsmith if (CountRemaining) 57567754Smsmith { 57667754Smsmith NumRemainingOps++; 57767754Smsmith } 57867754Smsmith 57967754Smsmith /* Decode the opcode */ 58067754Smsmith 58199679Siwasaki OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 58285756Smsmith switch (OpInfo->Class) 58367754Smsmith { 58485756Smsmith case AML_CLASS_ARGUMENT: 585250838Sjkim 58667754Smsmith if (CountRemaining) 58767754Smsmith { 58867754Smsmith NumRemainingOperands++; 58967754Smsmith } 59067754Smsmith 59167754Smsmith NumOperands++; 59267754Smsmith break; 59367754Smsmith 59485756Smsmith case AML_CLASS_UNKNOWN: 595250838Sjkim 59685756Smsmith /* Bad opcode or ASCII character */ 59785756Smsmith 59885756Smsmith continue; 59985756Smsmith 60067754Smsmith default: 601250838Sjkim 60267754Smsmith if (CountRemaining) 60367754Smsmith { 60467754Smsmith NumRemainingOperators++; 60567754Smsmith } 60667754Smsmith 60767754Smsmith NumOperators++; 60867754Smsmith break; 60967754Smsmith } 61067754Smsmith 61167754Smsmith Op = AcpiPsGetDepthNext (StartOp, Op); 61267754Smsmith } 61367754Smsmith 614151937Sjkim AcpiOsPrintf ( 615151937Sjkim "Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 616151937Sjkim NumOps, NumOperators, NumOperands); 61767754Smsmith 618151937Sjkim AcpiOsPrintf ( 619151937Sjkim "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 620151937Sjkim NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 62167754Smsmith} 62267754Smsmith 62367754Smsmith 62467754Smsmith/******************************************************************************* 62567754Smsmith * 62667754Smsmith * FUNCTION: AcpiDbDisplayLocals 62767754Smsmith * 62867754Smsmith * PARAMETERS: None 62967754Smsmith * 63067754Smsmith * RETURN: None 63167754Smsmith * 63267754Smsmith * DESCRIPTION: Display all locals for the currently running control method 63367754Smsmith * 63467754Smsmith ******************************************************************************/ 63567754Smsmith 63667754Smsmithvoid 637151937SjkimAcpiDbDisplayLocals ( 638151937Sjkim void) 63967754Smsmith{ 64067754Smsmith ACPI_WALK_STATE *WalkState; 64167754Smsmith 64267754Smsmith 64367754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 64467754Smsmith if (!WalkState) 64567754Smsmith { 64667754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 64767754Smsmith return; 64867754Smsmith } 64967754Smsmith 650285797Sjkim AcpiDbDecodeLocals (WalkState); 65167754Smsmith} 65267754Smsmith 65367754Smsmith 65467754Smsmith/******************************************************************************* 65567754Smsmith * 65667754Smsmith * FUNCTION: AcpiDbDisplayArguments 65767754Smsmith * 65867754Smsmith * PARAMETERS: None 65967754Smsmith * 66067754Smsmith * RETURN: None 66167754Smsmith * 66267754Smsmith * DESCRIPTION: Display all arguments for the currently running control method 66367754Smsmith * 66467754Smsmith ******************************************************************************/ 66567754Smsmith 66667754Smsmithvoid 667151937SjkimAcpiDbDisplayArguments ( 668151937Sjkim void) 66967754Smsmith{ 67067754Smsmith ACPI_WALK_STATE *WalkState; 67167754Smsmith 67267754Smsmith 67367754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 67467754Smsmith if (!WalkState) 67567754Smsmith { 67667754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 67767754Smsmith return; 67867754Smsmith } 67967754Smsmith 680285797Sjkim AcpiDbDecodeArguments (WalkState); 68167754Smsmith} 68267754Smsmith 68367754Smsmith 68467754Smsmith/******************************************************************************* 68567754Smsmith * 68667754Smsmith * FUNCTION: AcpiDbDisplayResults 68767754Smsmith * 68867754Smsmith * PARAMETERS: None 68967754Smsmith * 69067754Smsmith * RETURN: None 69167754Smsmith * 69267754Smsmith * DESCRIPTION: Display current contents of a method result stack 69367754Smsmith * 69467754Smsmith ******************************************************************************/ 69567754Smsmith 69667754Smsmithvoid 697151937SjkimAcpiDbDisplayResults ( 698151937Sjkim void) 69967754Smsmith{ 70067754Smsmith UINT32 i; 70167754Smsmith ACPI_WALK_STATE *WalkState; 70267754Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 703167802Sjkim UINT32 ResultCount = 0; 70467754Smsmith ACPI_NAMESPACE_NODE *Node; 705167802Sjkim ACPI_GENERIC_STATE *Frame; 706167802Sjkim UINT32 Index; /* Index onto current frame */ 70767754Smsmith 70867754Smsmith 70967754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 71067754Smsmith if (!WalkState) 71167754Smsmith { 71267754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 71367754Smsmith return; 71467754Smsmith } 71567754Smsmith 71667754Smsmith ObjDesc = WalkState->MethodDesc; 717298714Sjkim Node = WalkState->MethodNode; 71867754Smsmith 71969746Smsmith if (WalkState->Results) 72069746Smsmith { 721167802Sjkim ResultCount = WalkState->ResultCount; 72269746Smsmith } 72367754Smsmith 72487031Smsmith AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 725287168Sjkim AcpiUtGetNodeName (Node), ResultCount); 72669746Smsmith 727167802Sjkim /* From the top element of result stack */ 728167802Sjkim 729167802Sjkim Frame = WalkState->Results; 730167802Sjkim Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM; 731167802Sjkim 732167802Sjkim for (i = 0; i < ResultCount; i++) 73367754Smsmith { 734167802Sjkim ObjDesc = Frame->Results.ObjDesc[Index]; 735209746Sjkim AcpiOsPrintf ("Result%u: ", i); 736285797Sjkim AcpiDbDisplayInternalObject (ObjDesc, WalkState); 737287168Sjkim 738167802Sjkim if (Index == 0) 739167802Sjkim { 740167802Sjkim Frame = Frame->Results.Next; 741167802Sjkim Index = ACPI_RESULTS_FRAME_OBJ_NUM; 742167802Sjkim } 743287168Sjkim 744167802Sjkim Index--; 74567754Smsmith } 74667754Smsmith} 74767754Smsmith 74867754Smsmith 74967754Smsmith/******************************************************************************* 75067754Smsmith * 75167754Smsmith * FUNCTION: AcpiDbDisplayCallingTree 75267754Smsmith * 75367754Smsmith * PARAMETERS: None 75467754Smsmith * 75567754Smsmith * RETURN: None 75667754Smsmith * 75767754Smsmith * DESCRIPTION: Display current calling tree of nested control methods 75867754Smsmith * 75967754Smsmith ******************************************************************************/ 76067754Smsmith 76167754Smsmithvoid 762151937SjkimAcpiDbDisplayCallingTree ( 763151937Sjkim void) 76467754Smsmith{ 76567754Smsmith ACPI_WALK_STATE *WalkState; 76667754Smsmith ACPI_NAMESPACE_NODE *Node; 76767754Smsmith 76867754Smsmith 76967754Smsmith WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 77067754Smsmith if (!WalkState) 77167754Smsmith { 77267754Smsmith AcpiOsPrintf ("There is no method currently executing\n"); 77367754Smsmith return; 77467754Smsmith } 77567754Smsmith 77669450Smsmith Node = WalkState->MethodNode; 77767754Smsmith AcpiOsPrintf ("Current Control Method Call Tree\n"); 77867754Smsmith 77999679Siwasaki while (WalkState) 78067754Smsmith { 78169450Smsmith Node = WalkState->MethodNode; 782123315Snjl AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); 78367754Smsmith 78467754Smsmith WalkState = WalkState->Next; 78567754Smsmith } 78667754Smsmith} 78767754Smsmith 78867754Smsmith 78967754Smsmith/******************************************************************************* 79067754Smsmith * 791117521Snjl * FUNCTION: AcpiDbDisplayObjectType 792117521Snjl * 793298714Sjkim * PARAMETERS: ObjectArg - User entered NS node handle 794117521Snjl * 795117521Snjl * RETURN: None 796117521Snjl * 797123315Snjl * DESCRIPTION: Display type of an arbitrary NS node 798117521Snjl * 799117521Snjl ******************************************************************************/ 800117521Snjl 801117521Snjlvoid 802117521SnjlAcpiDbDisplayObjectType ( 803298714Sjkim char *ObjectArg) 804117521Snjl{ 805298714Sjkim ACPI_SIZE Arg; 806298714Sjkim ACPI_HANDLE Handle; 807117521Snjl ACPI_DEVICE_INFO *Info; 808117521Snjl ACPI_STATUS Status; 809193267Sjkim UINT32 i; 810117521Snjl 811117521Snjl 812298714Sjkim Arg = strtoul (ObjectArg, NULL, 16); 813298714Sjkim Handle = ACPI_TO_POINTER (Arg); 814117521Snjl 815298714Sjkim Status = AcpiGetObjectInfo (Handle, &Info); 816197104Sjkim if (ACPI_FAILURE (Status)) 817117521Snjl { 818197104Sjkim AcpiOsPrintf ("Could not get object info, %s\n", 819197104Sjkim AcpiFormatException (Status)); 820197104Sjkim return; 821197104Sjkim } 822117521Snjl 823298714Sjkim AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", 824298714Sjkim ACPI_FORMAT_UINT64 (Info->Address), 825298714Sjkim Info->CurrentStatus, Info->Flags); 826117521Snjl 827298714Sjkim AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", 828298714Sjkim Info->HighestDstates[0], Info->HighestDstates[1], 829298714Sjkim Info->HighestDstates[2], Info->HighestDstates[3]); 830298714Sjkim 831298714Sjkim AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", 832298714Sjkim Info->LowestDstates[0], Info->LowestDstates[1], 833298714Sjkim Info->LowestDstates[2], Info->LowestDstates[3], 834298714Sjkim Info->LowestDstates[4]); 835298714Sjkim 836197104Sjkim if (Info->Valid & ACPI_VALID_HID) 837197104Sjkim { 838197104Sjkim AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); 839117521Snjl } 840287168Sjkim 841197104Sjkim if (Info->Valid & ACPI_VALID_UID) 842117521Snjl { 843197104Sjkim AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); 844117521Snjl } 845287168Sjkim 846197104Sjkim if (Info->Valid & ACPI_VALID_CID) 847197104Sjkim { 848197104Sjkim for (i = 0; i < Info->CompatibleIdList.Count; i++) 849197104Sjkim { 850209746Sjkim AcpiOsPrintf ("CID %u: %s\n", i, 851197104Sjkim Info->CompatibleIdList.Ids[i].String); 852197104Sjkim } 853197104Sjkim } 854197104Sjkim 855197104Sjkim ACPI_FREE (Info); 856117521Snjl} 857117521Snjl 858117521Snjl 859117521Snjl/******************************************************************************* 860117521Snjl * 86167754Smsmith * FUNCTION: AcpiDbDisplayResultObject 86267754Smsmith * 86367754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 86467754Smsmith * WalkState - Current walk state 86567754Smsmith * 86667754Smsmith * RETURN: None 86767754Smsmith * 86867754Smsmith * DESCRIPTION: Display the result of an AML opcode 86967754Smsmith * 87091116Smsmith * Note: Curently only displays the result object if we are single stepping. 87191116Smsmith * However, this output may be useful in other contexts and could be enabled 87291116Smsmith * to do so if needed. 87391116Smsmith * 87467754Smsmith ******************************************************************************/ 87567754Smsmith 87667754Smsmithvoid 87767754SmsmithAcpiDbDisplayResultObject ( 87867754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 87967754Smsmith ACPI_WALK_STATE *WalkState) 88067754Smsmith{ 88167754Smsmith 882298714Sjkim#ifndef ACPI_APPLICATION 883298714Sjkim if (AcpiGbl_DbThreadId != AcpiOsGetThreadId()) 884298714Sjkim { 885298714Sjkim return; 886298714Sjkim } 887298714Sjkim#endif 888298714Sjkim 88991116Smsmith /* Only display if single stepping */ 89091116Smsmith 89167754Smsmith if (!AcpiGbl_CmSingleStep) 89267754Smsmith { 89367754Smsmith return; 89467754Smsmith } 89567754Smsmith 89667754Smsmith AcpiOsPrintf ("ResultObj: "); 897285797Sjkim AcpiDbDisplayInternalObject (ObjDesc, WalkState); 89867754Smsmith AcpiOsPrintf ("\n"); 89967754Smsmith} 90067754Smsmith 90167754Smsmith 90267754Smsmith/******************************************************************************* 90367754Smsmith * 90467754Smsmith * FUNCTION: AcpiDbDisplayArgumentObject 90567754Smsmith * 90667754Smsmith * PARAMETERS: ObjDesc - Object to be displayed 90767754Smsmith * WalkState - Current walk state 90867754Smsmith * 90967754Smsmith * RETURN: None 91067754Smsmith * 91167754Smsmith * DESCRIPTION: Display the result of an AML opcode 91267754Smsmith * 91367754Smsmith ******************************************************************************/ 91467754Smsmith 91567754Smsmithvoid 91667754SmsmithAcpiDbDisplayArgumentObject ( 91767754Smsmith ACPI_OPERAND_OBJECT *ObjDesc, 91867754Smsmith ACPI_WALK_STATE *WalkState) 91967754Smsmith{ 92067754Smsmith 921298714Sjkim#ifndef ACPI_APPLICATION 922298714Sjkim if (AcpiGbl_DbThreadId != AcpiOsGetThreadId()) 923298714Sjkim { 924298714Sjkim return; 925298714Sjkim } 926298714Sjkim#endif 927298714Sjkim 92867754Smsmith if (!AcpiGbl_CmSingleStep) 92967754Smsmith { 93067754Smsmith return; 93167754Smsmith } 93267754Smsmith 93367754Smsmith AcpiOsPrintf ("ArgObj: "); 934285797Sjkim AcpiDbDisplayInternalObject (ObjDesc, WalkState); 93567754Smsmith} 93667754Smsmith 937114237Snjl 938231844Sjkim#if (!ACPI_REDUCED_HARDWARE) 939114237Snjl/******************************************************************************* 940114237Snjl * 941114237Snjl * FUNCTION: AcpiDbDisplayGpes 942114237Snjl * 943123315Snjl * PARAMETERS: None 944114237Snjl * 945114237Snjl * RETURN: None 946114237Snjl * 947123315Snjl * DESCRIPTION: Display the current GPE structures 948114237Snjl * 949114237Snjl ******************************************************************************/ 950114237Snjl 951114237Snjlvoid 952151937SjkimAcpiDbDisplayGpes ( 953151937Sjkim void) 954114237Snjl{ 955114237Snjl ACPI_GPE_BLOCK_INFO *GpeBlock; 956117521Snjl ACPI_GPE_XRUPT_INFO *GpeXruptInfo; 957129684Snjl ACPI_GPE_EVENT_INFO *GpeEventInfo; 958129684Snjl ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; 959207344Sjkim char *GpeType; 960237412Sjkim ACPI_GPE_NOTIFY_INFO *Notify; 961129684Snjl UINT32 GpeIndex; 962129684Snjl UINT32 Block = 0; 963129684Snjl UINT32 i; 964129684Snjl UINT32 j; 965237412Sjkim UINT32 Count; 966129684Snjl char Buffer[80]; 967129684Snjl ACPI_BUFFER RetBuf; 968129684Snjl ACPI_STATUS Status; 969114237Snjl 970114237Snjl 971129684Snjl RetBuf.Length = sizeof (Buffer); 972129684Snjl RetBuf.Pointer = Buffer; 973129684Snjl 974129684Snjl Block = 0; 975129684Snjl 976129684Snjl /* Walk the GPE lists */ 977129684Snjl 978117521Snjl GpeXruptInfo = AcpiGbl_GpeXruptListHead; 979117521Snjl while (GpeXruptInfo) 980114237Snjl { 981117521Snjl GpeBlock = GpeXruptInfo->GpeBlockListHead; 982117521Snjl while (GpeBlock) 983117521Snjl { 984287168Sjkim Status = AcpiGetName (GpeBlock->Node, 985287168Sjkim ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); 986129684Snjl if (ACPI_FAILURE (Status)) 987129684Snjl { 988129684Snjl AcpiOsPrintf ("Could not convert name to pathname\n"); 989129684Snjl } 990129684Snjl 991207344Sjkim if (GpeBlock->Node == AcpiGbl_FadtGpeDevice) 992207344Sjkim { 993207344Sjkim GpeType = "FADT-defined GPE block"; 994207344Sjkim } 995207344Sjkim else 996207344Sjkim { 997207344Sjkim GpeType = "GPE Block Device"; 998207344Sjkim } 999151937Sjkim 1000287168Sjkim AcpiOsPrintf ( 1001287168Sjkim "\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", 1002207344Sjkim Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); 1003207344Sjkim 1004287168Sjkim AcpiOsPrintf ( 1005287168Sjkim " Registers: %u (%u GPEs)\n", 1006206117Sjkim GpeBlock->RegisterCount, GpeBlock->GpeCount); 1007151937Sjkim 1008287168Sjkim AcpiOsPrintf ( 1009287168Sjkim " GPE range: 0x%X to 0x%X on interrupt %u\n", 1010151937Sjkim GpeBlock->BlockBaseNumber, 1011206117Sjkim GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), 1012206117Sjkim GpeXruptInfo->InterruptNumber); 1013151937Sjkim 1014151937Sjkim AcpiOsPrintf ( 1015151937Sjkim " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", 1016151937Sjkim GpeBlock->RegisterInfo, 1017287168Sjkim ACPI_FORMAT_UINT64 ( 1018287168Sjkim GpeBlock->RegisterInfo->StatusAddress.Address), 1019287168Sjkim ACPI_FORMAT_UINT64 ( 1020287168Sjkim GpeBlock->RegisterInfo->EnableAddress.Address)); 1021151937Sjkim 1022117521Snjl AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); 1023114237Snjl 1024129684Snjl /* Examine each GPE Register within the block */ 1025129684Snjl 1026129684Snjl for (i = 0; i < GpeBlock->RegisterCount; i++) 1027129684Snjl { 1028129684Snjl GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; 1029129684Snjl 1030129684Snjl AcpiOsPrintf ( 1031287168Sjkim " Reg %u: (GPE %.2X-%.2X) " 1032287168Sjkim "RunEnable %2.2X WakeEnable %2.2X" 1033206117Sjkim " Status %8.8X%8.8X Enable %8.8X%8.8X\n", 1034206117Sjkim i, GpeRegisterInfo->BaseGpeNumber, 1035287168Sjkim GpeRegisterInfo->BaseGpeNumber + 1036287168Sjkim (ACPI_GPE_REGISTER_WIDTH - 1), 1037151937Sjkim GpeRegisterInfo->EnableForRun, 1038206117Sjkim GpeRegisterInfo->EnableForWake, 1039287168Sjkim ACPI_FORMAT_UINT64 ( 1040287168Sjkim GpeRegisterInfo->StatusAddress.Address), 1041287168Sjkim ACPI_FORMAT_UINT64 ( 1042287168Sjkim GpeRegisterInfo->EnableAddress.Address)); 1043129684Snjl 1044129684Snjl /* Now look at the individual GPEs in this byte register */ 1045129684Snjl 1046129684Snjl for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 1047129684Snjl { 1048129684Snjl GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; 1049129684Snjl GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; 1050129684Snjl 1051278970Sjkim if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == 1052216471Sjkim ACPI_GPE_DISPATCH_NONE) 1053129684Snjl { 1054206117Sjkim /* This GPE is not used (no method or handler), ignore it */ 1055129684Snjl 1056129684Snjl continue; 1057129684Snjl } 1058129684Snjl 1059129684Snjl AcpiOsPrintf ( 1060209746Sjkim " GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", 1061206117Sjkim GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, 1062216471Sjkim GpeEventInfo->RuntimeCount, GpeEventInfo->Flags); 1063129684Snjl 1064206117Sjkim /* Decode the flags byte */ 1065206117Sjkim 1066129684Snjl if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) 1067129684Snjl { 1068129684Snjl AcpiOsPrintf ("Level, "); 1069129684Snjl } 1070129684Snjl else 1071129684Snjl { 1072129684Snjl AcpiOsPrintf ("Edge, "); 1073129684Snjl } 1074129684Snjl 1075206117Sjkim if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) 1076129684Snjl { 1077206117Sjkim AcpiOsPrintf ("CanWake, "); 1078129684Snjl } 1079129684Snjl else 1080129684Snjl { 1081206117Sjkim AcpiOsPrintf ("RunOnly, "); 1082129684Snjl } 1083129684Snjl 1084278970Sjkim switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)) 1085129684Snjl { 1086216471Sjkim case ACPI_GPE_DISPATCH_NONE: 1087250838Sjkim 1088129684Snjl AcpiOsPrintf ("NotUsed"); 1089129684Snjl break; 1090250838Sjkim 1091216471Sjkim case ACPI_GPE_DISPATCH_METHOD: 1092250838Sjkim 1093216471Sjkim AcpiOsPrintf ("Method"); 1094216471Sjkim break; 1095278970Sjkim 1096129684Snjl case ACPI_GPE_DISPATCH_HANDLER: 1097250838Sjkim 1098129684Snjl AcpiOsPrintf ("Handler"); 1099129684Snjl break; 1100250838Sjkim 1101216471Sjkim case ACPI_GPE_DISPATCH_NOTIFY: 1102250838Sjkim 1103237412Sjkim Count = 0; 1104237412Sjkim Notify = GpeEventInfo->Dispatch.NotifyList; 1105237412Sjkim while (Notify) 1106237412Sjkim { 1107237412Sjkim Count++; 1108237412Sjkim Notify = Notify->Next; 1109237412Sjkim } 1110287168Sjkim 1111287168Sjkim AcpiOsPrintf ("Implicit Notify on %u devices", 1112287168Sjkim Count); 1113129684Snjl break; 1114250838Sjkim 1115278970Sjkim case ACPI_GPE_DISPATCH_RAW_HANDLER: 1116278970Sjkim 1117278970Sjkim AcpiOsPrintf ("RawHandler"); 1118278970Sjkim break; 1119278970Sjkim 1120129684Snjl default: 1121250838Sjkim 1122129684Snjl AcpiOsPrintf ("UNKNOWN: %X", 1123278970Sjkim ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags)); 1124129684Snjl break; 1125129684Snjl } 1126129684Snjl 1127206117Sjkim AcpiOsPrintf (")\n"); 1128129684Snjl } 1129129684Snjl } 1130287168Sjkim 1131129684Snjl Block++; 1132117521Snjl GpeBlock = GpeBlock->Next; 1133117521Snjl } 1134287168Sjkim 1135117521Snjl GpeXruptInfo = GpeXruptInfo->Next; 1136114237Snjl } 1137114237Snjl} 1138231844Sjkim#endif /* !ACPI_REDUCED_HARDWARE */ 1139114237Snjl 1140220663Sjkim 1141218590Sjkim/******************************************************************************* 1142218590Sjkim * 1143218590Sjkim * FUNCTION: AcpiDbDisplayHandlers 1144218590Sjkim * 1145218590Sjkim * PARAMETERS: None 1146218590Sjkim * 1147218590Sjkim * RETURN: None 1148218590Sjkim * 1149218590Sjkim * DESCRIPTION: Display the currently installed global handlers 1150218590Sjkim * 1151218590Sjkim ******************************************************************************/ 1152218590Sjkim 1153218590Sjkimvoid 1154218590SjkimAcpiDbDisplayHandlers ( 1155218590Sjkim void) 1156218590Sjkim{ 1157218590Sjkim ACPI_OPERAND_OBJECT *ObjDesc; 1158218590Sjkim ACPI_OPERAND_OBJECT *HandlerObj; 1159218590Sjkim ACPI_ADR_SPACE_TYPE SpaceId; 1160218590Sjkim UINT32 i; 1161218590Sjkim 1162218590Sjkim 1163218590Sjkim /* Operation region handlers */ 1164218590Sjkim 1165249663Sjkim AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n"); 1166218590Sjkim 1167218590Sjkim ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); 1168218590Sjkim if (ObjDesc) 1169218590Sjkim { 1170220663Sjkim for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) 1171218590Sjkim { 1172220663Sjkim SpaceId = AcpiGbl_SpaceIdList[i]; 1173218590Sjkim 1174218590Sjkim AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1175218590Sjkim AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); 1176218590Sjkim 1177298714Sjkim HandlerObj = AcpiEvFindRegionHandler ( 1178298714Sjkim SpaceId, ObjDesc->CommonNotify.Handler); 1179298714Sjkim if (HandlerObj) 1180218590Sjkim { 1181298714Sjkim AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1182298714Sjkim (HandlerObj->AddressSpace.HandlerFlags & 1183298714Sjkim ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? 1184298714Sjkim "Default" : "User", 1185298714Sjkim HandlerObj->AddressSpace.Handler); 1186287168Sjkim 1187298714Sjkim goto FoundHandler; 1188218590Sjkim } 1189218590Sjkim 1190218590Sjkim /* There is no handler for this SpaceId */ 1191218590Sjkim 1192218590Sjkim AcpiOsPrintf ("None\n"); 1193218590Sjkim 1194218590Sjkim FoundHandler:; 1195218590Sjkim } 1196228110Sjkim 1197228110Sjkim /* Find all handlers for user-defined SpaceIDs */ 1198228110Sjkim 1199298714Sjkim HandlerObj = ObjDesc->CommonNotify.Handler; 1200228110Sjkim while (HandlerObj) 1201228110Sjkim { 1202228110Sjkim if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) 1203228110Sjkim { 1204228110Sjkim AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1205228110Sjkim "User-defined ID", HandlerObj->AddressSpace.SpaceId); 1206228110Sjkim AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1207228110Sjkim (HandlerObj->AddressSpace.HandlerFlags & 1208287168Sjkim ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? 1209287168Sjkim "Default" : "User", 1210228110Sjkim HandlerObj->AddressSpace.Handler); 1211228110Sjkim } 1212228110Sjkim 1213228110Sjkim HandlerObj = HandlerObj->AddressSpace.Next; 1214228110Sjkim } 1215218590Sjkim } 1216218590Sjkim 1217231844Sjkim#if (!ACPI_REDUCED_HARDWARE) 1218231844Sjkim 1219218590Sjkim /* Fixed event handlers */ 1220218590Sjkim 1221218590Sjkim AcpiOsPrintf ("\nFixed Event Handlers:\n"); 1222218590Sjkim 1223218590Sjkim for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) 1224218590Sjkim { 1225218590Sjkim AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); 1226218590Sjkim if (AcpiGbl_FixedEventHandlers[i].Handler) 1227218590Sjkim { 1228218590Sjkim AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1229218590Sjkim AcpiGbl_FixedEventHandlers[i].Handler); 1230218590Sjkim } 1231218590Sjkim else 1232218590Sjkim { 1233218590Sjkim AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1234218590Sjkim } 1235218590Sjkim } 1236218590Sjkim 1237231844Sjkim#endif /* !ACPI_REDUCED_HARDWARE */ 1238231844Sjkim 1239218590Sjkim /* Miscellaneous global handlers */ 1240218590Sjkim 1241218590Sjkim AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); 1242218590Sjkim 1243220663Sjkim for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) 1244218590Sjkim { 1245287168Sjkim AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, 1246287168Sjkim AcpiGbl_HandlerList[i].Name); 1247287168Sjkim 1248220663Sjkim if (AcpiGbl_HandlerList[i].Handler) 1249218590Sjkim { 1250218590Sjkim AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1251220663Sjkim AcpiGbl_HandlerList[i].Handler); 1252218590Sjkim } 1253218590Sjkim else 1254218590Sjkim { 1255218590Sjkim AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1256218590Sjkim } 1257218590Sjkim } 1258249663Sjkim 1259249663Sjkim 1260249663Sjkim /* Other handlers that are installed throughout the namespace */ 1261249663Sjkim 1262249663Sjkim AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); 1263249663Sjkim 1264249663Sjkim (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1265287168Sjkim ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, 1266287168Sjkim NULL, NULL, NULL); 1267218590Sjkim} 1268218590Sjkim 1269249663Sjkim 1270249663Sjkim/******************************************************************************* 1271249663Sjkim * 1272249663Sjkim * FUNCTION: AcpiDbDisplayNonRootHandlers 1273249663Sjkim * 1274249663Sjkim * PARAMETERS: ACPI_WALK_CALLBACK 1275249663Sjkim * 1276249663Sjkim * RETURN: Status 1277249663Sjkim * 1278249663Sjkim * DESCRIPTION: Display information about all handlers installed for a 1279249663Sjkim * device object. 1280249663Sjkim * 1281249663Sjkim ******************************************************************************/ 1282249663Sjkim 1283249663Sjkimstatic ACPI_STATUS 1284249663SjkimAcpiDbDisplayNonRootHandlers ( 1285249663Sjkim ACPI_HANDLE ObjHandle, 1286249663Sjkim UINT32 NestingLevel, 1287249663Sjkim void *Context, 1288249663Sjkim void **ReturnValue) 1289249663Sjkim{ 1290249663Sjkim ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); 1291249663Sjkim ACPI_OPERAND_OBJECT *ObjDesc; 1292249663Sjkim ACPI_OPERAND_OBJECT *HandlerObj; 1293249663Sjkim char *Pathname; 1294249663Sjkim 1295249663Sjkim 1296249663Sjkim ObjDesc = AcpiNsGetAttachedObject (Node); 1297249663Sjkim if (!ObjDesc) 1298249663Sjkim { 1299249663Sjkim return (AE_OK); 1300249663Sjkim } 1301249663Sjkim 1302298714Sjkim Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); 1303249663Sjkim if (!Pathname) 1304249663Sjkim { 1305249663Sjkim return (AE_OK); 1306249663Sjkim } 1307249663Sjkim 1308249663Sjkim /* Display all handlers associated with this device */ 1309249663Sjkim 1310298714Sjkim HandlerObj = ObjDesc->CommonNotify.Handler; 1311249663Sjkim while (HandlerObj) 1312249663Sjkim { 1313249663Sjkim AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1314249663Sjkim AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId), 1315249663Sjkim HandlerObj->AddressSpace.SpaceId); 1316249663Sjkim 1317249663Sjkim AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2, 1318249663Sjkim (HandlerObj->AddressSpace.HandlerFlags & 1319249663Sjkim ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1320249663Sjkim HandlerObj->AddressSpace.Handler); 1321249663Sjkim 1322249663Sjkim AcpiOsPrintf (" Device Name: %s (%p)\n", Pathname, Node); 1323249663Sjkim 1324249663Sjkim HandlerObj = HandlerObj->AddressSpace.Next; 1325249663Sjkim } 1326249663Sjkim 1327249663Sjkim ACPI_FREE (Pathname); 1328249663Sjkim return (AE_OK); 1329249663Sjkim} 1330