xref: /freebsd/sys/contrib/dev/acpica/components/debugger/dbdisply.c (revision 722b16673c40aedf280895f2f2f676bb494518d7)
1a159c266SJung-uk Kim /*******************************************************************************
2a159c266SJung-uk Kim  *
3a159c266SJung-uk Kim  * Module Name: dbdisply - debug display commands
4a159c266SJung-uk Kim  *
5a159c266SJung-uk Kim  ******************************************************************************/
6a159c266SJung-uk Kim 
70d84335fSJung-uk Kim /******************************************************************************
80d84335fSJung-uk Kim  *
90d84335fSJung-uk Kim  * 1. Copyright Notice
100d84335fSJung-uk Kim  *
11*722b1667SJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp.
12a159c266SJung-uk Kim  * All rights reserved.
13a159c266SJung-uk Kim  *
140d84335fSJung-uk Kim  * 2. License
150d84335fSJung-uk Kim  *
160d84335fSJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
170d84335fSJung-uk Kim  * rights. You may have additional license terms from the party that provided
180d84335fSJung-uk Kim  * you this software, covering your right to use that party's intellectual
190d84335fSJung-uk Kim  * property rights.
200d84335fSJung-uk Kim  *
210d84335fSJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220d84335fSJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
230d84335fSJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240d84335fSJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
250d84335fSJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
260d84335fSJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
270d84335fSJung-uk Kim  *
280d84335fSJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290d84335fSJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
300d84335fSJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
310d84335fSJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
320d84335fSJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
330d84335fSJung-uk Kim  * license, and in no event shall the patent license extend to any additions
340d84335fSJung-uk Kim  * to or modifications of the Original Intel Code. No other license or right
350d84335fSJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
360d84335fSJung-uk Kim  *
370d84335fSJung-uk Kim  * The above copyright and patent license is granted only if the following
380d84335fSJung-uk Kim  * conditions are met:
390d84335fSJung-uk Kim  *
400d84335fSJung-uk Kim  * 3. Conditions
410d84335fSJung-uk Kim  *
420d84335fSJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
440d84335fSJung-uk Kim  * Code or modification with rights to further distribute source must include
450d84335fSJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
460d84335fSJung-uk Kim  * and the following Disclaimer and Export Compliance provision. In addition,
470d84335fSJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
480d84335fSJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
490d84335fSJung-uk Kim  * Code and the date of any change. Licensee must include in that file the
500d84335fSJung-uk Kim  * documentation of any changes made by any predecessor Licensee. Licensee
510d84335fSJung-uk Kim  * must include a prominent statement that the modification is derived,
520d84335fSJung-uk Kim  * directly or indirectly, from Original Intel Code.
530d84335fSJung-uk Kim  *
540d84335fSJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
560d84335fSJung-uk Kim  * Code or modification without rights to further distribute source must
570d84335fSJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
580d84335fSJung-uk Kim  * documentation and/or other materials provided with distribution. In
590d84335fSJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
600d84335fSJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
610d84335fSJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
620d84335fSJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
630d84335fSJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
640d84335fSJung-uk Kim  * make.
650d84335fSJung-uk Kim  *
660d84335fSJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
670d84335fSJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
680d84335fSJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
690d84335fSJung-uk Kim  * provision in the documentation and/or other materials provided with the
700d84335fSJung-uk Kim  * distribution.
710d84335fSJung-uk Kim  *
720d84335fSJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
730d84335fSJung-uk Kim  * Intel Code.
740d84335fSJung-uk Kim  *
750d84335fSJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760d84335fSJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
770d84335fSJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
780d84335fSJung-uk Kim  * without prior written authorization from Intel.
790d84335fSJung-uk Kim  *
800d84335fSJung-uk Kim  * 4. Disclaimer and Export Compliance
810d84335fSJung-uk Kim  *
820d84335fSJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830d84335fSJung-uk Kim  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840d84335fSJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
850d84335fSJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
860d84335fSJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
870d84335fSJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880d84335fSJung-uk Kim  * PARTICULAR PURPOSE.
890d84335fSJung-uk Kim  *
900d84335fSJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910d84335fSJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920d84335fSJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930d84335fSJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940d84335fSJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950d84335fSJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
960d84335fSJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970d84335fSJung-uk Kim  * LIMITED REMEDY.
980d84335fSJung-uk Kim  *
990d84335fSJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000d84335fSJung-uk Kim  * software or system incorporating such software without first obtaining any
1010d84335fSJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
1020d84335fSJung-uk Kim  * any other agency or department of the United States Government. In the
1030d84335fSJung-uk Kim  * event Licensee exports any such software from the United States or
1040d84335fSJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
1050d84335fSJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
1060d84335fSJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
1070d84335fSJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080d84335fSJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
1090d84335fSJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
1100d84335fSJung-uk Kim  * United States government or any agency thereof requires an export license,
1110d84335fSJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
1120d84335fSJung-uk Kim  * such license, approval or letter.
1130d84335fSJung-uk Kim  *
1140d84335fSJung-uk Kim  *****************************************************************************
1150d84335fSJung-uk Kim  *
1160d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
1170d84335fSJung-uk Kim  * following license:
1180d84335fSJung-uk Kim  *
119a159c266SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
120a159c266SJung-uk Kim  * modification, are permitted provided that the following conditions
121a159c266SJung-uk Kim  * are met:
122a159c266SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
123a159c266SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
124a159c266SJung-uk Kim  *    without modification.
125a159c266SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126a159c266SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
127a159c266SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
128a159c266SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
129a159c266SJung-uk Kim  *    binary redistribution.
130a159c266SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
131a159c266SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
132a159c266SJung-uk Kim  *    from this software without specific prior written permission.
133a159c266SJung-uk Kim  *
1340d84335fSJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1350d84335fSJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1360d84335fSJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1370d84335fSJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1380d84335fSJung-uk Kim  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1390d84335fSJung-uk Kim  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1400d84335fSJung-uk Kim  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1410d84335fSJung-uk Kim  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1420d84335fSJung-uk Kim  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1430d84335fSJung-uk Kim  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1440d84335fSJung-uk Kim  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1450d84335fSJung-uk Kim  *
1460d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
147a159c266SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
148a159c266SJung-uk Kim  * Software Foundation.
149a159c266SJung-uk Kim  *
1500d84335fSJung-uk Kim  *****************************************************************************/
151a159c266SJung-uk Kim 
152a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
153a159c266SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
154a159c266SJung-uk Kim #include <contrib/dev/acpica/include/amlcode.h>
155a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acdispat.h>
156a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acnamesp.h>
157a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acparser.h>
158a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acinterp.h>
159f8146b88SJung-uk Kim #include <contrib/dev/acpica/include/acevents.h>
160a159c266SJung-uk Kim #include <contrib/dev/acpica/include/acdebug.h>
161a159c266SJung-uk Kim 
162a159c266SJung-uk Kim 
163a159c266SJung-uk Kim #define _COMPONENT          ACPI_CA_DEBUGGER
164a159c266SJung-uk Kim         ACPI_MODULE_NAME    ("dbdisply")
165a159c266SJung-uk Kim 
166a159c266SJung-uk Kim /* Local prototypes */
167a159c266SJung-uk Kim 
168a159c266SJung-uk Kim static void
169a159c266SJung-uk Kim AcpiDbDumpParserDescriptor (
170a159c266SJung-uk Kim     ACPI_PARSE_OBJECT       *Op);
171a159c266SJung-uk Kim 
172a159c266SJung-uk Kim static void *
173a159c266SJung-uk Kim AcpiDbGetPointer (
174a159c266SJung-uk Kim     void                    *Target);
175a159c266SJung-uk Kim 
176895f26a9SJung-uk Kim static ACPI_STATUS
177895f26a9SJung-uk Kim AcpiDbDisplayNonRootHandlers (
178895f26a9SJung-uk Kim     ACPI_HANDLE             ObjHandle,
179895f26a9SJung-uk Kim     UINT32                  NestingLevel,
180895f26a9SJung-uk Kim     void                    *Context,
181895f26a9SJung-uk Kim     void                    **ReturnValue);
182a159c266SJung-uk Kim 
183a159c266SJung-uk Kim /*
184a159c266SJung-uk Kim  * System handler information.
185a159c266SJung-uk Kim  * Used for Handlers command, in AcpiDbDisplayHandlers.
186a159c266SJung-uk Kim  */
187a159c266SJung-uk Kim #define ACPI_PREDEFINED_PREFIX          "%25s (%.2X) : "
188a159c266SJung-uk Kim #define ACPI_HANDLER_NAME_STRING               "%30s : "
189a159c266SJung-uk Kim #define ACPI_HANDLER_PRESENT_STRING                    "%-9s (%p)\n"
190895f26a9SJung-uk Kim #define ACPI_HANDLER_PRESENT_STRING2                   "%-9s (%p)"
191a159c266SJung-uk Kim #define ACPI_HANDLER_NOT_PRESENT_STRING                "%-9s\n"
192a159c266SJung-uk Kim 
193a159c266SJung-uk Kim /* All predefined Address Space IDs */
194a159c266SJung-uk Kim 
195a159c266SJung-uk Kim static ACPI_ADR_SPACE_TYPE  AcpiGbl_SpaceIdList[] =
196a159c266SJung-uk Kim {
197a159c266SJung-uk Kim     ACPI_ADR_SPACE_SYSTEM_MEMORY,
198a159c266SJung-uk Kim     ACPI_ADR_SPACE_SYSTEM_IO,
199a159c266SJung-uk Kim     ACPI_ADR_SPACE_PCI_CONFIG,
200a159c266SJung-uk Kim     ACPI_ADR_SPACE_EC,
201a159c266SJung-uk Kim     ACPI_ADR_SPACE_SMBUS,
202a159c266SJung-uk Kim     ACPI_ADR_SPACE_CMOS,
203a159c266SJung-uk Kim     ACPI_ADR_SPACE_PCI_BAR_TARGET,
204a159c266SJung-uk Kim     ACPI_ADR_SPACE_IPMI,
205a159c266SJung-uk Kim     ACPI_ADR_SPACE_GPIO,
206a159c266SJung-uk Kim     ACPI_ADR_SPACE_GSBUS,
2070b229c80SJung-uk Kim     ACPI_ADR_SPACE_PLATFORM_COMM,
2080b229c80SJung-uk Kim     ACPI_ADR_SPACE_PLATFORM_RT,
209a159c266SJung-uk Kim     ACPI_ADR_SPACE_DATA_TABLE,
210a159c266SJung-uk Kim     ACPI_ADR_SPACE_FIXED_HARDWARE
211a159c266SJung-uk Kim };
212a159c266SJung-uk Kim 
213a159c266SJung-uk Kim /* Global handler information */
214a159c266SJung-uk Kim 
215a159c266SJung-uk Kim typedef struct acpi_handler_info
216a159c266SJung-uk Kim {
217a159c266SJung-uk Kim     void                    *Handler;
218a159c266SJung-uk Kim     char                    *Name;
219a159c266SJung-uk Kim 
220a159c266SJung-uk Kim } ACPI_HANDLER_INFO;
221a159c266SJung-uk Kim 
222a159c266SJung-uk Kim static ACPI_HANDLER_INFO    AcpiGbl_HandlerList[] =
223a159c266SJung-uk Kim {
224eef1b955SJung-uk Kim     {&AcpiGbl_GlobalNotify[0].Handler,  "System Notifications"},
225eef1b955SJung-uk Kim     {&AcpiGbl_GlobalNotify[1].Handler,  "Device Notifications"},
226a159c266SJung-uk Kim     {&AcpiGbl_TableHandler,             "ACPI Table Events"},
227a159c266SJung-uk Kim     {&AcpiGbl_ExceptionHandler,         "Control Method Exceptions"},
228a159c266SJung-uk Kim     {&AcpiGbl_InterfaceHandler,         "OSI Invocations"}
229a159c266SJung-uk Kim };
230a159c266SJung-uk Kim 
231a159c266SJung-uk Kim 
232a159c266SJung-uk Kim /*******************************************************************************
233a159c266SJung-uk Kim  *
234a159c266SJung-uk Kim  * FUNCTION:    AcpiDbGetPointer
235a159c266SJung-uk Kim  *
236a159c266SJung-uk Kim  * PARAMETERS:  Target          - Pointer to string to be converted
237a159c266SJung-uk Kim  *
238a159c266SJung-uk Kim  * RETURN:      Converted pointer
239a159c266SJung-uk Kim  *
240a159c266SJung-uk Kim  * DESCRIPTION: Convert an ascii pointer value to a real value
241a159c266SJung-uk Kim  *
242a159c266SJung-uk Kim  ******************************************************************************/
243a159c266SJung-uk Kim 
244a159c266SJung-uk Kim static void *
AcpiDbGetPointer(void * Target)245a159c266SJung-uk Kim AcpiDbGetPointer (
246a159c266SJung-uk Kim     void                    *Target)
247a159c266SJung-uk Kim {
248a159c266SJung-uk Kim     void                    *ObjPtr;
2498d744e47SJung-uk Kim     ACPI_SIZE               Address;
250a159c266SJung-uk Kim 
251a159c266SJung-uk Kim 
2525ef50723SJung-uk Kim     Address = strtoul (Target, NULL, 16);
2538d744e47SJung-uk Kim     ObjPtr = ACPI_TO_POINTER (Address);
254a159c266SJung-uk Kim     return (ObjPtr);
255a159c266SJung-uk Kim }
256a159c266SJung-uk Kim 
257a159c266SJung-uk Kim 
258a159c266SJung-uk Kim /*******************************************************************************
259a159c266SJung-uk Kim  *
260a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDumpParserDescriptor
261a159c266SJung-uk Kim  *
262a159c266SJung-uk Kim  * PARAMETERS:  Op              - A parser Op descriptor
263a159c266SJung-uk Kim  *
264a159c266SJung-uk Kim  * RETURN:      None
265a159c266SJung-uk Kim  *
266a159c266SJung-uk Kim  * DESCRIPTION: Display a formatted parser object
267a159c266SJung-uk Kim  *
268a159c266SJung-uk Kim  ******************************************************************************/
269a159c266SJung-uk Kim 
270a159c266SJung-uk Kim static void
AcpiDbDumpParserDescriptor(ACPI_PARSE_OBJECT * Op)271a159c266SJung-uk Kim AcpiDbDumpParserDescriptor (
272a159c266SJung-uk Kim     ACPI_PARSE_OBJECT       *Op)
273a159c266SJung-uk Kim {
274a159c266SJung-uk Kim     const ACPI_OPCODE_INFO  *Info;
275a159c266SJung-uk Kim 
276a159c266SJung-uk Kim 
277a159c266SJung-uk Kim     Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
278a159c266SJung-uk Kim 
279a159c266SJung-uk Kim     AcpiOsPrintf ("Parser Op Descriptor:\n");
280a159c266SJung-uk Kim     AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
281a159c266SJung-uk Kim 
282a159c266SJung-uk Kim     ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name",
283a159c266SJung-uk Kim         Info->Name));
284a159c266SJung-uk Kim 
285a159c266SJung-uk Kim     AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
286a159c266SJung-uk Kim     AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
287a159c266SJung-uk Kim     AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next);
288a159c266SJung-uk Kim }
289a159c266SJung-uk Kim 
290a159c266SJung-uk Kim 
291a159c266SJung-uk Kim /*******************************************************************************
292a159c266SJung-uk Kim  *
293a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDecodeAndDisplayObject
294a159c266SJung-uk Kim  *
295a159c266SJung-uk Kim  * PARAMETERS:  Target          - String with object to be displayed. Names
296a159c266SJung-uk Kim  *                                and hex pointers are supported.
297a159c266SJung-uk Kim  *              OutputType      - Byte, Word, Dword, or Qword (B|W|D|Q)
298a159c266SJung-uk Kim  *
299a159c266SJung-uk Kim  * RETURN:      None
300a159c266SJung-uk Kim  *
301a159c266SJung-uk Kim  * DESCRIPTION: Display a formatted ACPI object
302a159c266SJung-uk Kim  *
303a159c266SJung-uk Kim  ******************************************************************************/
304a159c266SJung-uk Kim 
305a159c266SJung-uk Kim void
AcpiDbDecodeAndDisplayObject(char * Target,char * OutputType)306a159c266SJung-uk Kim AcpiDbDecodeAndDisplayObject (
307a159c266SJung-uk Kim     char                    *Target,
308a159c266SJung-uk Kim     char                    *OutputType)
309a159c266SJung-uk Kim {
310a159c266SJung-uk Kim     void                    *ObjPtr;
311a159c266SJung-uk Kim     ACPI_NAMESPACE_NODE     *Node;
312a159c266SJung-uk Kim     ACPI_OPERAND_OBJECT     *ObjDesc;
313a159c266SJung-uk Kim     UINT32                  Display = DB_BYTE_DISPLAY;
314a159c266SJung-uk Kim     char                    Buffer[80];
315a159c266SJung-uk Kim     ACPI_BUFFER             RetBuf;
316a159c266SJung-uk Kim     ACPI_STATUS             Status;
317a159c266SJung-uk Kim     UINT32                  Size;
318a159c266SJung-uk Kim 
319a159c266SJung-uk Kim 
320a159c266SJung-uk Kim     if (!Target)
321a159c266SJung-uk Kim     {
322a159c266SJung-uk Kim         return;
323a159c266SJung-uk Kim     }
324a159c266SJung-uk Kim 
325a159c266SJung-uk Kim     /* Decode the output type */
326a159c266SJung-uk Kim 
327a159c266SJung-uk Kim     if (OutputType)
328a159c266SJung-uk Kim     {
329a159c266SJung-uk Kim         AcpiUtStrupr (OutputType);
330a159c266SJung-uk Kim         if (OutputType[0] == 'W')
331a159c266SJung-uk Kim         {
332a159c266SJung-uk Kim             Display = DB_WORD_DISPLAY;
333a159c266SJung-uk Kim         }
334a159c266SJung-uk Kim         else if (OutputType[0] == 'D')
335a159c266SJung-uk Kim         {
336a159c266SJung-uk Kim             Display = DB_DWORD_DISPLAY;
337a159c266SJung-uk Kim         }
338a159c266SJung-uk Kim         else if (OutputType[0] == 'Q')
339a159c266SJung-uk Kim         {
340a159c266SJung-uk Kim             Display = DB_QWORD_DISPLAY;
341a159c266SJung-uk Kim         }
342a159c266SJung-uk Kim     }
343a159c266SJung-uk Kim 
344a159c266SJung-uk Kim     RetBuf.Length = sizeof (Buffer);
345a159c266SJung-uk Kim     RetBuf.Pointer = Buffer;
346a159c266SJung-uk Kim 
347a159c266SJung-uk Kim     /* Differentiate between a number and a name */
348a159c266SJung-uk Kim 
349a159c266SJung-uk Kim     if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
350a159c266SJung-uk Kim     {
351a159c266SJung-uk Kim         ObjPtr = AcpiDbGetPointer (Target);
352a159c266SJung-uk Kim         if (!AcpiOsReadable (ObjPtr, 16))
353a159c266SJung-uk Kim         {
35470e6ab8fSJung-uk Kim             AcpiOsPrintf (
35570e6ab8fSJung-uk Kim                 "Address %p is invalid in this address space\n",
356a159c266SJung-uk Kim                 ObjPtr);
357a159c266SJung-uk Kim             return;
358a159c266SJung-uk Kim         }
359a159c266SJung-uk Kim 
360a159c266SJung-uk Kim         /* Decode the object type */
361a159c266SJung-uk Kim 
362a159c266SJung-uk Kim         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr))
363a159c266SJung-uk Kim         {
364a159c266SJung-uk Kim         case ACPI_DESC_TYPE_NAMED:
365a159c266SJung-uk Kim 
366a159c266SJung-uk Kim             /* This is a namespace Node */
367a159c266SJung-uk Kim 
368a159c266SJung-uk Kim             if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
369a159c266SJung-uk Kim             {
370a159c266SJung-uk Kim                 AcpiOsPrintf (
37170e6ab8fSJung-uk Kim                     "Cannot read entire Named object at address %p\n",
37270e6ab8fSJung-uk Kim                     ObjPtr);
373a159c266SJung-uk Kim                 return;
374a159c266SJung-uk Kim             }
375a159c266SJung-uk Kim 
376a159c266SJung-uk Kim             Node = ObjPtr;
377a159c266SJung-uk Kim             goto DumpNode;
378a159c266SJung-uk Kim 
379a159c266SJung-uk Kim         case ACPI_DESC_TYPE_OPERAND:
380a159c266SJung-uk Kim 
381a159c266SJung-uk Kim             /* This is a ACPI OPERAND OBJECT */
382a159c266SJung-uk Kim 
383a159c266SJung-uk Kim             if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
384a159c266SJung-uk Kim             {
38570e6ab8fSJung-uk Kim                 AcpiOsPrintf (
38670e6ab8fSJung-uk Kim                     "Cannot read entire ACPI object at address %p\n",
387a159c266SJung-uk Kim                     ObjPtr);
388a159c266SJung-uk Kim                 return;
389a159c266SJung-uk Kim             }
390a159c266SJung-uk Kim 
39170e6ab8fSJung-uk Kim             AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT),
39270e6ab8fSJung-uk Kim                 Display, ACPI_UINT32_MAX);
393a159c266SJung-uk Kim             AcpiExDumpObjectDescriptor (ObjPtr, 1);
394a159c266SJung-uk Kim             break;
395a159c266SJung-uk Kim 
396a159c266SJung-uk Kim         case ACPI_DESC_TYPE_PARSER:
397a159c266SJung-uk Kim 
398a159c266SJung-uk Kim             /* This is a Parser Op object */
399a159c266SJung-uk Kim 
400a159c266SJung-uk Kim             if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
401a159c266SJung-uk Kim             {
402a159c266SJung-uk Kim                 AcpiOsPrintf (
40370e6ab8fSJung-uk Kim                     "Cannot read entire Parser object at address %p\n",
40470e6ab8fSJung-uk Kim                     ObjPtr);
405a159c266SJung-uk Kim                 return;
406a159c266SJung-uk Kim             }
407a159c266SJung-uk Kim 
40870e6ab8fSJung-uk Kim             AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT),
40970e6ab8fSJung-uk Kim                 Display, ACPI_UINT32_MAX);
410a159c266SJung-uk Kim             AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
411a159c266SJung-uk Kim             break;
412a159c266SJung-uk Kim 
413a159c266SJung-uk Kim         default:
414a159c266SJung-uk Kim 
415cd6518c7SJung-uk Kim             /* Is not a recognizable object */
416a159c266SJung-uk Kim 
417313a0c13SJung-uk Kim             AcpiOsPrintf (
418313a0c13SJung-uk Kim                 "Not a known ACPI internal object, descriptor type %2.2X\n",
419313a0c13SJung-uk Kim                 ACPI_GET_DESCRIPTOR_TYPE (ObjPtr));
420313a0c13SJung-uk Kim 
421a159c266SJung-uk Kim             Size = 16;
422a159c266SJung-uk Kim             if (AcpiOsReadable (ObjPtr, 64))
423a159c266SJung-uk Kim             {
424a159c266SJung-uk Kim                 Size = 64;
425a159c266SJung-uk Kim             }
426a159c266SJung-uk Kim 
427a159c266SJung-uk Kim             /* Just dump some memory */
428a159c266SJung-uk Kim 
4298ef1a331SJung-uk Kim             AcpiUtDebugDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
430a159c266SJung-uk Kim             break;
431a159c266SJung-uk Kim         }
432a159c266SJung-uk Kim 
433a159c266SJung-uk Kim         return;
434a159c266SJung-uk Kim     }
435a159c266SJung-uk Kim 
436a159c266SJung-uk Kim     /* The parameter is a name string that must be resolved to a Named obj */
437a159c266SJung-uk Kim 
438a159c266SJung-uk Kim     Node = AcpiDbLocalNsLookup (Target);
439a159c266SJung-uk Kim     if (!Node)
440a159c266SJung-uk Kim     {
441a159c266SJung-uk Kim         return;
442a159c266SJung-uk Kim     }
443a159c266SJung-uk Kim 
444a159c266SJung-uk Kim 
445a159c266SJung-uk Kim DumpNode:
446a159c266SJung-uk Kim     /* Now dump the NS node */
447a159c266SJung-uk Kim 
44870e6ab8fSJung-uk Kim     Status = AcpiGetName (Node, ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf);
449a159c266SJung-uk Kim     if (ACPI_FAILURE (Status))
450a159c266SJung-uk Kim     {
451a159c266SJung-uk Kim         AcpiOsPrintf ("Could not convert name to pathname\n");
452a159c266SJung-uk Kim     }
453a159c266SJung-uk Kim 
454a159c266SJung-uk Kim     else
455a159c266SJung-uk Kim     {
4565f9b24faSJung-uk Kim         AcpiOsPrintf ("Object %p: Namespace Node - Pathname: %s\n",
457a159c266SJung-uk Kim             Node, (char *) RetBuf.Pointer);
458a159c266SJung-uk Kim     }
459a159c266SJung-uk Kim 
460a159c266SJung-uk Kim     if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
461a159c266SJung-uk Kim     {
462a159c266SJung-uk Kim         AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
463a159c266SJung-uk Kim         return;
464a159c266SJung-uk Kim     }
465a159c266SJung-uk Kim 
4668ef1a331SJung-uk Kim     AcpiUtDebugDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
467a159c266SJung-uk Kim         Display, ACPI_UINT32_MAX);
468a159c266SJung-uk Kim     AcpiExDumpNamespaceNode (Node, 1);
469a159c266SJung-uk Kim 
470a159c266SJung-uk Kim     ObjDesc = AcpiNsGetAttachedObject (Node);
471a159c266SJung-uk Kim     if (ObjDesc)
472a159c266SJung-uk Kim     {
4735f9b24faSJung-uk Kim         AcpiOsPrintf ("\nAttached Object %p:", ObjDesc);
474a159c266SJung-uk Kim         if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
475a159c266SJung-uk Kim         {
476a159c266SJung-uk Kim             AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
477a159c266SJung-uk Kim                 ObjDesc);
478a159c266SJung-uk Kim             return;
479a159c266SJung-uk Kim         }
480a159c266SJung-uk Kim 
4815f9b24faSJung-uk Kim         if (ACPI_GET_DESCRIPTOR_TYPE (
4825f9b24faSJung-uk Kim             ((ACPI_NAMESPACE_NODE *) ObjDesc)) == ACPI_DESC_TYPE_NAMED)
4835f9b24faSJung-uk Kim         {
4845f9b24faSJung-uk Kim             AcpiOsPrintf (" Namespace Node - ");
4855f9b24faSJung-uk Kim             Status = AcpiGetName ((ACPI_NAMESPACE_NODE *) ObjDesc,
4865f9b24faSJung-uk Kim                 ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf);
4875f9b24faSJung-uk Kim             if (ACPI_FAILURE (Status))
4885f9b24faSJung-uk Kim             {
4895f9b24faSJung-uk Kim                 AcpiOsPrintf ("Could not convert name to pathname\n");
4905f9b24faSJung-uk Kim             }
4915f9b24faSJung-uk Kim             else
4925f9b24faSJung-uk Kim             {
4935f9b24faSJung-uk Kim                 AcpiOsPrintf ("Pathname: %s",
4945f9b24faSJung-uk Kim                     (char *) RetBuf.Pointer);
4955f9b24faSJung-uk Kim             }
4965f9b24faSJung-uk Kim 
4975f9b24faSJung-uk Kim             AcpiOsPrintf ("\n");
4985f9b24faSJung-uk Kim             AcpiUtDebugDumpBuffer ((void *) ObjDesc,
4995f9b24faSJung-uk Kim                 sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX);
5005f9b24faSJung-uk Kim         }
5015f9b24faSJung-uk Kim         else
5025f9b24faSJung-uk Kim         {
5035f9b24faSJung-uk Kim             AcpiOsPrintf ("\n");
50470e6ab8fSJung-uk Kim             AcpiUtDebugDumpBuffer ((void *) ObjDesc,
50570e6ab8fSJung-uk Kim                 sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
5065f9b24faSJung-uk Kim         }
5075f9b24faSJung-uk Kim 
508a159c266SJung-uk Kim         AcpiExDumpObjectDescriptor (ObjDesc, 1);
509a159c266SJung-uk Kim     }
510a159c266SJung-uk Kim }
511a159c266SJung-uk Kim 
512a159c266SJung-uk Kim 
513a159c266SJung-uk Kim /*******************************************************************************
514a159c266SJung-uk Kim  *
515a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayMethodInfo
516a159c266SJung-uk Kim  *
517a159c266SJung-uk Kim  * PARAMETERS:  StartOp         - Root of the control method parse tree
518a159c266SJung-uk Kim  *
519a159c266SJung-uk Kim  * RETURN:      None
520a159c266SJung-uk Kim  *
521a159c266SJung-uk Kim  * DESCRIPTION: Display information about the current method
522a159c266SJung-uk Kim  *
523a159c266SJung-uk Kim  ******************************************************************************/
524a159c266SJung-uk Kim 
525a159c266SJung-uk Kim void
AcpiDbDisplayMethodInfo(ACPI_PARSE_OBJECT * StartOp)526a159c266SJung-uk Kim AcpiDbDisplayMethodInfo (
527a159c266SJung-uk Kim     ACPI_PARSE_OBJECT       *StartOp)
528a159c266SJung-uk Kim {
529a159c266SJung-uk Kim     ACPI_WALK_STATE         *WalkState;
530a159c266SJung-uk Kim     ACPI_OPERAND_OBJECT     *ObjDesc;
531a159c266SJung-uk Kim     ACPI_NAMESPACE_NODE     *Node;
532a159c266SJung-uk Kim     ACPI_PARSE_OBJECT       *RootOp;
533a159c266SJung-uk Kim     ACPI_PARSE_OBJECT       *Op;
534a159c266SJung-uk Kim     const ACPI_OPCODE_INFO  *OpInfo;
535a159c266SJung-uk Kim     UINT32                  NumOps = 0;
536a159c266SJung-uk Kim     UINT32                  NumOperands = 0;
537a159c266SJung-uk Kim     UINT32                  NumOperators = 0;
538a159c266SJung-uk Kim     UINT32                  NumRemainingOps = 0;
539a159c266SJung-uk Kim     UINT32                  NumRemainingOperands = 0;
540a159c266SJung-uk Kim     UINT32                  NumRemainingOperators = 0;
541a159c266SJung-uk Kim     BOOLEAN                 CountRemaining = FALSE;
542a159c266SJung-uk Kim 
543a159c266SJung-uk Kim 
544a159c266SJung-uk Kim     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
545a159c266SJung-uk Kim     if (!WalkState)
546a159c266SJung-uk Kim     {
547a159c266SJung-uk Kim         AcpiOsPrintf ("There is no method currently executing\n");
548a159c266SJung-uk Kim         return;
549a159c266SJung-uk Kim     }
550a159c266SJung-uk Kim 
551a159c266SJung-uk Kim     ObjDesc = WalkState->MethodDesc;
552a159c266SJung-uk Kim     Node = WalkState->MethodNode;
553a159c266SJung-uk Kim 
554a159c266SJung-uk Kim     AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
555a159c266SJung-uk Kim         AcpiUtGetNodeName (Node));
556a159c266SJung-uk Kim     AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n",
557a159c266SJung-uk Kim         (UINT32) ObjDesc->Method.ParamCount,
558a159c266SJung-uk Kim         (UINT32) ObjDesc->Method.SyncLevel);
559a159c266SJung-uk Kim 
560a159c266SJung-uk Kim     RootOp = StartOp;
561a159c266SJung-uk Kim     while (RootOp->Common.Parent)
562a159c266SJung-uk Kim     {
563a159c266SJung-uk Kim         RootOp = RootOp->Common.Parent;
564a159c266SJung-uk Kim     }
565a159c266SJung-uk Kim 
566a159c266SJung-uk Kim     Op = RootOp;
567a159c266SJung-uk Kim 
568a159c266SJung-uk Kim     while (Op)
569a159c266SJung-uk Kim     {
570a159c266SJung-uk Kim         if (Op == StartOp)
571a159c266SJung-uk Kim         {
572a159c266SJung-uk Kim             CountRemaining = TRUE;
573a159c266SJung-uk Kim         }
574a159c266SJung-uk Kim 
575a159c266SJung-uk Kim         NumOps++;
576a159c266SJung-uk Kim         if (CountRemaining)
577a159c266SJung-uk Kim         {
578a159c266SJung-uk Kim             NumRemainingOps++;
579a159c266SJung-uk Kim         }
580a159c266SJung-uk Kim 
581a159c266SJung-uk Kim         /* Decode the opcode */
582a159c266SJung-uk Kim 
583a159c266SJung-uk Kim         OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
584a159c266SJung-uk Kim         switch (OpInfo->Class)
585a159c266SJung-uk Kim         {
586a159c266SJung-uk Kim         case AML_CLASS_ARGUMENT:
587a9d8d09cSJung-uk Kim 
588a159c266SJung-uk Kim             if (CountRemaining)
589a159c266SJung-uk Kim             {
590a159c266SJung-uk Kim                 NumRemainingOperands++;
591a159c266SJung-uk Kim             }
592a159c266SJung-uk Kim 
593a159c266SJung-uk Kim             NumOperands++;
594a159c266SJung-uk Kim             break;
595a159c266SJung-uk Kim 
596a159c266SJung-uk Kim         case AML_CLASS_UNKNOWN:
597a9d8d09cSJung-uk Kim 
598a159c266SJung-uk Kim             /* Bad opcode or ASCII character */
599a159c266SJung-uk Kim 
600a159c266SJung-uk Kim             continue;
601a159c266SJung-uk Kim 
602a159c266SJung-uk Kim         default:
603a9d8d09cSJung-uk Kim 
604a159c266SJung-uk Kim             if (CountRemaining)
605a159c266SJung-uk Kim             {
606a159c266SJung-uk Kim                 NumRemainingOperators++;
607a159c266SJung-uk Kim             }
608a159c266SJung-uk Kim 
609a159c266SJung-uk Kim             NumOperators++;
610a159c266SJung-uk Kim             break;
611a159c266SJung-uk Kim         }
612a159c266SJung-uk Kim 
613a159c266SJung-uk Kim         Op = AcpiPsGetDepthNext (StartOp, Op);
614a159c266SJung-uk Kim     }
615a159c266SJung-uk Kim 
616a159c266SJung-uk Kim     AcpiOsPrintf (
617a159c266SJung-uk Kim         "Method contains:       %X AML Opcodes - %X Operators, %X Operands\n",
618a159c266SJung-uk Kim         NumOps, NumOperators, NumOperands);
619a159c266SJung-uk Kim 
620a159c266SJung-uk Kim     AcpiOsPrintf (
621a159c266SJung-uk Kim         "Remaining to execute:  %X AML Opcodes - %X Operators, %X Operands\n",
622a159c266SJung-uk Kim         NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
623a159c266SJung-uk Kim }
624a159c266SJung-uk Kim 
625a159c266SJung-uk Kim 
626a159c266SJung-uk Kim /*******************************************************************************
627a159c266SJung-uk Kim  *
628a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayLocals
629a159c266SJung-uk Kim  *
630a159c266SJung-uk Kim  * PARAMETERS:  None
631a159c266SJung-uk Kim  *
632a159c266SJung-uk Kim  * RETURN:      None
633a159c266SJung-uk Kim  *
634a159c266SJung-uk Kim  * DESCRIPTION: Display all locals for the currently running control method
635a159c266SJung-uk Kim  *
636a159c266SJung-uk Kim  ******************************************************************************/
637a159c266SJung-uk Kim 
638a159c266SJung-uk Kim void
AcpiDbDisplayLocals(void)639a159c266SJung-uk Kim AcpiDbDisplayLocals (
640a159c266SJung-uk Kim     void)
641a159c266SJung-uk Kim {
642a159c266SJung-uk Kim     ACPI_WALK_STATE         *WalkState;
643a159c266SJung-uk Kim 
644a159c266SJung-uk Kim 
645a159c266SJung-uk Kim     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
646a159c266SJung-uk Kim     if (!WalkState)
647a159c266SJung-uk Kim     {
648a159c266SJung-uk Kim         AcpiOsPrintf ("There is no method currently executing\n");
649a159c266SJung-uk Kim         return;
650a159c266SJung-uk Kim     }
651a159c266SJung-uk Kim 
652fe0f0bbbSJung-uk Kim     AcpiDbDecodeLocals (WalkState);
653a159c266SJung-uk Kim }
654a159c266SJung-uk Kim 
655a159c266SJung-uk Kim 
656a159c266SJung-uk Kim /*******************************************************************************
657a159c266SJung-uk Kim  *
658a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayArguments
659a159c266SJung-uk Kim  *
660a159c266SJung-uk Kim  * PARAMETERS:  None
661a159c266SJung-uk Kim  *
662a159c266SJung-uk Kim  * RETURN:      None
663a159c266SJung-uk Kim  *
664a159c266SJung-uk Kim  * DESCRIPTION: Display all arguments for the currently running control method
665a159c266SJung-uk Kim  *
666a159c266SJung-uk Kim  ******************************************************************************/
667a159c266SJung-uk Kim 
668a159c266SJung-uk Kim void
AcpiDbDisplayArguments(void)669a159c266SJung-uk Kim AcpiDbDisplayArguments (
670a159c266SJung-uk Kim     void)
671a159c266SJung-uk Kim {
672a159c266SJung-uk Kim     ACPI_WALK_STATE         *WalkState;
673a159c266SJung-uk Kim 
674a159c266SJung-uk Kim 
675a159c266SJung-uk Kim     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
676a159c266SJung-uk Kim     if (!WalkState)
677a159c266SJung-uk Kim     {
678a159c266SJung-uk Kim         AcpiOsPrintf ("There is no method currently executing\n");
679a159c266SJung-uk Kim         return;
680a159c266SJung-uk Kim     }
681a159c266SJung-uk Kim 
682fe0f0bbbSJung-uk Kim     AcpiDbDecodeArguments (WalkState);
683a159c266SJung-uk Kim }
684a159c266SJung-uk Kim 
685a159c266SJung-uk Kim 
686a159c266SJung-uk Kim /*******************************************************************************
687a159c266SJung-uk Kim  *
688a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayResults
689a159c266SJung-uk Kim  *
690a159c266SJung-uk Kim  * PARAMETERS:  None
691a159c266SJung-uk Kim  *
692a159c266SJung-uk Kim  * RETURN:      None
693a159c266SJung-uk Kim  *
694a159c266SJung-uk Kim  * DESCRIPTION: Display current contents of a method result stack
695a159c266SJung-uk Kim  *
696a159c266SJung-uk Kim  ******************************************************************************/
697a159c266SJung-uk Kim 
698a159c266SJung-uk Kim void
AcpiDbDisplayResults(void)699a159c266SJung-uk Kim AcpiDbDisplayResults (
700a159c266SJung-uk Kim     void)
701a159c266SJung-uk Kim {
702a159c266SJung-uk Kim     UINT32                  i;
703a159c266SJung-uk Kim     ACPI_WALK_STATE         *WalkState;
704a159c266SJung-uk Kim     ACPI_OPERAND_OBJECT     *ObjDesc;
705a159c266SJung-uk Kim     UINT32                  ResultCount = 0;
706a159c266SJung-uk Kim     ACPI_NAMESPACE_NODE     *Node;
707a159c266SJung-uk Kim     ACPI_GENERIC_STATE      *Frame;
708a159c266SJung-uk Kim     UINT32                  Index; /* Index onto current frame */
709a159c266SJung-uk Kim 
710a159c266SJung-uk Kim 
711a159c266SJung-uk Kim     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
712a159c266SJung-uk Kim     if (!WalkState)
713a159c266SJung-uk Kim     {
714a159c266SJung-uk Kim         AcpiOsPrintf ("There is no method currently executing\n");
715a159c266SJung-uk Kim         return;
716a159c266SJung-uk Kim     }
717a159c266SJung-uk Kim 
718a159c266SJung-uk Kim     Node  = WalkState->MethodNode;
719a159c266SJung-uk Kim 
720a159c266SJung-uk Kim     if (WalkState->Results)
721a159c266SJung-uk Kim     {
722a159c266SJung-uk Kim         ResultCount = WalkState->ResultCount;
723a159c266SJung-uk Kim     }
724a159c266SJung-uk Kim 
725a159c266SJung-uk Kim     AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
726a159c266SJung-uk Kim         AcpiUtGetNodeName (Node), ResultCount);
727a159c266SJung-uk Kim 
728a159c266SJung-uk Kim     /* From the top element of result stack */
729a159c266SJung-uk Kim 
730a159c266SJung-uk Kim     Frame = WalkState->Results;
731a159c266SJung-uk Kim     Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
732a159c266SJung-uk Kim 
733a159c266SJung-uk Kim     for (i = 0; i < ResultCount; i++)
734a159c266SJung-uk Kim     {
735a159c266SJung-uk Kim         ObjDesc = Frame->Results.ObjDesc[Index];
736a159c266SJung-uk Kim         AcpiOsPrintf ("Result%u: ", i);
737fe0f0bbbSJung-uk Kim         AcpiDbDisplayInternalObject (ObjDesc, WalkState);
73870e6ab8fSJung-uk Kim 
739a159c266SJung-uk Kim         if (Index == 0)
740a159c266SJung-uk Kim         {
741a159c266SJung-uk Kim             Frame = Frame->Results.Next;
742a159c266SJung-uk Kim             Index = ACPI_RESULTS_FRAME_OBJ_NUM;
743a159c266SJung-uk Kim         }
74470e6ab8fSJung-uk Kim 
745a159c266SJung-uk Kim         Index--;
746a159c266SJung-uk Kim     }
747a159c266SJung-uk Kim }
748a159c266SJung-uk Kim 
749a159c266SJung-uk Kim 
750a159c266SJung-uk Kim /*******************************************************************************
751a159c266SJung-uk Kim  *
752a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayCallingTree
753a159c266SJung-uk Kim  *
754a159c266SJung-uk Kim  * PARAMETERS:  None
755a159c266SJung-uk Kim  *
756a159c266SJung-uk Kim  * RETURN:      None
757a159c266SJung-uk Kim  *
758a159c266SJung-uk Kim  * DESCRIPTION: Display current calling tree of nested control methods
759a159c266SJung-uk Kim  *
760a159c266SJung-uk Kim  ******************************************************************************/
761a159c266SJung-uk Kim 
762a159c266SJung-uk Kim void
AcpiDbDisplayCallingTree(void)763a159c266SJung-uk Kim AcpiDbDisplayCallingTree (
764a159c266SJung-uk Kim     void)
765a159c266SJung-uk Kim {
766a159c266SJung-uk Kim     ACPI_WALK_STATE         *WalkState;
767a159c266SJung-uk Kim     ACPI_NAMESPACE_NODE     *Node;
768a159c266SJung-uk Kim 
769a159c266SJung-uk Kim 
770a159c266SJung-uk Kim     WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
771a159c266SJung-uk Kim     if (!WalkState)
772a159c266SJung-uk Kim     {
773a159c266SJung-uk Kim         AcpiOsPrintf ("There is no method currently executing\n");
774a159c266SJung-uk Kim         return;
775a159c266SJung-uk Kim     }
776a159c266SJung-uk Kim 
777a159c266SJung-uk Kim     AcpiOsPrintf ("Current Control Method Call Tree\n");
778a159c266SJung-uk Kim 
779a159c266SJung-uk Kim     while (WalkState)
780a159c266SJung-uk Kim     {
781a159c266SJung-uk Kim         Node = WalkState->MethodNode;
782a159c266SJung-uk Kim         AcpiOsPrintf ("    [%4.4s]\n", AcpiUtGetNodeName (Node));
783a159c266SJung-uk Kim 
784a159c266SJung-uk Kim         WalkState = WalkState->Next;
785a159c266SJung-uk Kim     }
786a159c266SJung-uk Kim }
787a159c266SJung-uk Kim 
788a159c266SJung-uk Kim 
789a159c266SJung-uk Kim /*******************************************************************************
790a159c266SJung-uk Kim  *
791a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayObjectType
792a159c266SJung-uk Kim  *
793f8146b88SJung-uk Kim  * PARAMETERS:  ObjectArg       - User entered NS node handle
794a159c266SJung-uk Kim  *
795a159c266SJung-uk Kim  * RETURN:      None
796a159c266SJung-uk Kim  *
797a159c266SJung-uk Kim  * DESCRIPTION: Display type of an arbitrary NS node
798a159c266SJung-uk Kim  *
799a159c266SJung-uk Kim  ******************************************************************************/
800a159c266SJung-uk Kim 
801a159c266SJung-uk Kim void
AcpiDbDisplayObjectType(char * ObjectArg)802a159c266SJung-uk Kim AcpiDbDisplayObjectType (
803f8146b88SJung-uk Kim     char                    *ObjectArg)
804a159c266SJung-uk Kim {
805f8146b88SJung-uk Kim     ACPI_SIZE               Arg;
806f8146b88SJung-uk Kim     ACPI_HANDLE             Handle;
807a159c266SJung-uk Kim     ACPI_DEVICE_INFO        *Info;
808a159c266SJung-uk Kim     ACPI_STATUS             Status;
809a159c266SJung-uk Kim     UINT32                  i;
810a159c266SJung-uk Kim 
811a159c266SJung-uk Kim 
812f8146b88SJung-uk Kim     Arg = strtoul (ObjectArg, NULL, 16);
813f8146b88SJung-uk Kim     Handle = ACPI_TO_POINTER (Arg);
814a159c266SJung-uk Kim 
815f8146b88SJung-uk Kim     Status = AcpiGetObjectInfo (Handle, &Info);
816a159c266SJung-uk Kim     if (ACPI_FAILURE (Status))
817a159c266SJung-uk Kim     {
818a159c266SJung-uk Kim         AcpiOsPrintf ("Could not get object info, %s\n",
819a159c266SJung-uk Kim             AcpiFormatException (Status));
820a159c266SJung-uk Kim         return;
821a159c266SJung-uk Kim     }
822a159c266SJung-uk Kim 
8238438a7a8SJung-uk Kim     AcpiOsPrintf ("ADR: %8.8X%8.8X, Flags: %X\n",
8248438a7a8SJung-uk Kim         ACPI_FORMAT_UINT64 (Info->Address), Info->Flags);
825f8146b88SJung-uk Kim 
826a159c266SJung-uk Kim     AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
827a159c266SJung-uk Kim         Info->HighestDstates[0], Info->HighestDstates[1],
828a159c266SJung-uk Kim         Info->HighestDstates[2], Info->HighestDstates[3]);
829f8146b88SJung-uk Kim 
830a159c266SJung-uk Kim     AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
831a159c266SJung-uk Kim         Info->LowestDstates[0], Info->LowestDstates[1],
832a159c266SJung-uk Kim         Info->LowestDstates[2], Info->LowestDstates[3],
833a159c266SJung-uk Kim         Info->LowestDstates[4]);
834a159c266SJung-uk Kim 
835a159c266SJung-uk Kim     if (Info->Valid & ACPI_VALID_HID)
836a159c266SJung-uk Kim     {
837a159c266SJung-uk Kim         AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String);
838a159c266SJung-uk Kim     }
83970e6ab8fSJung-uk Kim 
840a159c266SJung-uk Kim     if (Info->Valid & ACPI_VALID_UID)
841a159c266SJung-uk Kim     {
842a159c266SJung-uk Kim         AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String);
843a159c266SJung-uk Kim     }
84470e6ab8fSJung-uk Kim 
845a159c266SJung-uk Kim     if (Info->Valid & ACPI_VALID_CID)
846a159c266SJung-uk Kim     {
847a159c266SJung-uk Kim         for (i = 0; i < Info->CompatibleIdList.Count; i++)
848a159c266SJung-uk Kim         {
849a159c266SJung-uk Kim             AcpiOsPrintf ("CID %u: %s\n", i,
850a159c266SJung-uk Kim                 Info->CompatibleIdList.Ids[i].String);
851a159c266SJung-uk Kim         }
852a159c266SJung-uk Kim     }
853a159c266SJung-uk Kim 
854a159c266SJung-uk Kim     ACPI_FREE (Info);
855a159c266SJung-uk Kim }
856a159c266SJung-uk Kim 
857a159c266SJung-uk Kim 
858a159c266SJung-uk Kim /*******************************************************************************
859a159c266SJung-uk Kim  *
860a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayResultObject
861a159c266SJung-uk Kim  *
862a159c266SJung-uk Kim  * PARAMETERS:  ObjDesc         - Object to be displayed
863a159c266SJung-uk Kim  *              WalkState       - Current walk state
864a159c266SJung-uk Kim  *
865a159c266SJung-uk Kim  * RETURN:      None
866a159c266SJung-uk Kim  *
867a159c266SJung-uk Kim  * DESCRIPTION: Display the result of an AML opcode
868a159c266SJung-uk Kim  *
869cd6518c7SJung-uk Kim  * Note: Currently only displays the result object if we are single stepping.
870a159c266SJung-uk Kim  * However, this output may be useful in other contexts and could be enabled
871a159c266SJung-uk Kim  * to do so if needed.
872a159c266SJung-uk Kim  *
873a159c266SJung-uk Kim  ******************************************************************************/
874a159c266SJung-uk Kim 
875a159c266SJung-uk Kim void
AcpiDbDisplayResultObject(ACPI_OPERAND_OBJECT * ObjDesc,ACPI_WALK_STATE * WalkState)876a159c266SJung-uk Kim AcpiDbDisplayResultObject (
877a159c266SJung-uk Kim     ACPI_OPERAND_OBJECT     *ObjDesc,
878a159c266SJung-uk Kim     ACPI_WALK_STATE         *WalkState)
879a159c266SJung-uk Kim {
880a159c266SJung-uk Kim 
881f8146b88SJung-uk Kim #ifndef ACPI_APPLICATION
882f8146b88SJung-uk Kim     if (AcpiGbl_DbThreadId != AcpiOsGetThreadId())
883f8146b88SJung-uk Kim     {
884f8146b88SJung-uk Kim         return;
885f8146b88SJung-uk Kim     }
886f8146b88SJung-uk Kim #endif
887f8146b88SJung-uk Kim 
888a159c266SJung-uk Kim     /* Only display if single stepping */
889a159c266SJung-uk Kim 
890a159c266SJung-uk Kim     if (!AcpiGbl_CmSingleStep)
891a159c266SJung-uk Kim     {
892a159c266SJung-uk Kim         return;
893a159c266SJung-uk Kim     }
894a159c266SJung-uk Kim 
895a159c266SJung-uk Kim     AcpiOsPrintf ("ResultObj: ");
896fe0f0bbbSJung-uk Kim     AcpiDbDisplayInternalObject (ObjDesc, WalkState);
897a159c266SJung-uk Kim     AcpiOsPrintf ("\n");
898a159c266SJung-uk Kim }
899a159c266SJung-uk Kim 
900a159c266SJung-uk Kim 
901a159c266SJung-uk Kim /*******************************************************************************
902a159c266SJung-uk Kim  *
903a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayArgumentObject
904a159c266SJung-uk Kim  *
905a159c266SJung-uk Kim  * PARAMETERS:  ObjDesc         - Object to be displayed
906a159c266SJung-uk Kim  *              WalkState       - Current walk state
907a159c266SJung-uk Kim  *
908a159c266SJung-uk Kim  * RETURN:      None
909a159c266SJung-uk Kim  *
910a159c266SJung-uk Kim  * DESCRIPTION: Display the result of an AML opcode
911a159c266SJung-uk Kim  *
912a159c266SJung-uk Kim  ******************************************************************************/
913a159c266SJung-uk Kim 
914a159c266SJung-uk Kim void
AcpiDbDisplayArgumentObject(ACPI_OPERAND_OBJECT * ObjDesc,ACPI_WALK_STATE * WalkState)915a159c266SJung-uk Kim AcpiDbDisplayArgumentObject (
916a159c266SJung-uk Kim     ACPI_OPERAND_OBJECT     *ObjDesc,
917a159c266SJung-uk Kim     ACPI_WALK_STATE         *WalkState)
918a159c266SJung-uk Kim {
919a159c266SJung-uk Kim 
920f8146b88SJung-uk Kim #ifndef ACPI_APPLICATION
921f8146b88SJung-uk Kim     if (AcpiGbl_DbThreadId != AcpiOsGetThreadId())
922f8146b88SJung-uk Kim     {
923f8146b88SJung-uk Kim         return;
924f8146b88SJung-uk Kim     }
925f8146b88SJung-uk Kim #endif
926f8146b88SJung-uk Kim 
927a159c266SJung-uk Kim     if (!AcpiGbl_CmSingleStep)
928a159c266SJung-uk Kim     {
929a159c266SJung-uk Kim         return;
930a159c266SJung-uk Kim     }
931a159c266SJung-uk Kim 
932a159c266SJung-uk Kim     AcpiOsPrintf ("ArgObj:    ");
933fe0f0bbbSJung-uk Kim     AcpiDbDisplayInternalObject (ObjDesc, WalkState);
934a159c266SJung-uk Kim }
935a159c266SJung-uk Kim 
936a159c266SJung-uk Kim 
937a159c266SJung-uk Kim #if (!ACPI_REDUCED_HARDWARE)
938a159c266SJung-uk Kim /*******************************************************************************
939a159c266SJung-uk Kim  *
940a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayGpes
941a159c266SJung-uk Kim  *
942a159c266SJung-uk Kim  * PARAMETERS:  None
943a159c266SJung-uk Kim  *
944a159c266SJung-uk Kim  * RETURN:      None
945a159c266SJung-uk Kim  *
946a159c266SJung-uk Kim  * DESCRIPTION: Display the current GPE structures
947a159c266SJung-uk Kim  *
948a159c266SJung-uk Kim  ******************************************************************************/
949a159c266SJung-uk Kim 
950a159c266SJung-uk Kim void
AcpiDbDisplayGpes(void)951a159c266SJung-uk Kim AcpiDbDisplayGpes (
952a159c266SJung-uk Kim     void)
953a159c266SJung-uk Kim {
954a159c266SJung-uk Kim     ACPI_GPE_BLOCK_INFO     *GpeBlock;
955a159c266SJung-uk Kim     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo;
956a159c266SJung-uk Kim     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
957a159c266SJung-uk Kim     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
958a159c266SJung-uk Kim     char                    *GpeType;
959f38b0f21SJung-uk Kim     ACPI_GPE_NOTIFY_INFO    *Notify;
960a159c266SJung-uk Kim     UINT32                  GpeIndex;
961a159c266SJung-uk Kim     UINT32                  Block = 0;
962a159c266SJung-uk Kim     UINT32                  i;
963a159c266SJung-uk Kim     UINT32                  j;
964f38b0f21SJung-uk Kim     UINT32                  Count;
965a159c266SJung-uk Kim     char                    Buffer[80];
966a159c266SJung-uk Kim     ACPI_BUFFER             RetBuf;
967a159c266SJung-uk Kim     ACPI_STATUS             Status;
968a159c266SJung-uk Kim 
969a159c266SJung-uk Kim 
970a159c266SJung-uk Kim     RetBuf.Length = sizeof (Buffer);
971a159c266SJung-uk Kim     RetBuf.Pointer = Buffer;
972a159c266SJung-uk Kim 
973a159c266SJung-uk Kim     Block = 0;
974a159c266SJung-uk Kim 
975a159c266SJung-uk Kim     /* Walk the GPE lists */
976a159c266SJung-uk Kim 
977a159c266SJung-uk Kim     GpeXruptInfo = AcpiGbl_GpeXruptListHead;
978a159c266SJung-uk Kim     while (GpeXruptInfo)
979a159c266SJung-uk Kim     {
980a159c266SJung-uk Kim         GpeBlock = GpeXruptInfo->GpeBlockListHead;
981a159c266SJung-uk Kim         while (GpeBlock)
982a159c266SJung-uk Kim         {
98370e6ab8fSJung-uk Kim             Status = AcpiGetName (GpeBlock->Node,
98470e6ab8fSJung-uk Kim                 ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf);
985a159c266SJung-uk Kim             if (ACPI_FAILURE (Status))
986a159c266SJung-uk Kim             {
987a159c266SJung-uk Kim                 AcpiOsPrintf ("Could not convert name to pathname\n");
988a159c266SJung-uk Kim             }
989a159c266SJung-uk Kim 
990a159c266SJung-uk Kim             if (GpeBlock->Node == AcpiGbl_FadtGpeDevice)
991a159c266SJung-uk Kim             {
992a159c266SJung-uk Kim                 GpeType = "FADT-defined GPE block";
993a159c266SJung-uk Kim             }
994a159c266SJung-uk Kim             else
995a159c266SJung-uk Kim             {
996a159c266SJung-uk Kim                 GpeType = "GPE Block Device";
997a159c266SJung-uk Kim             }
998a159c266SJung-uk Kim 
99970e6ab8fSJung-uk Kim             AcpiOsPrintf (
100070e6ab8fSJung-uk Kim                 "\nBlock %u - Info %p  DeviceNode %p [%s] - %s\n",
1001a159c266SJung-uk Kim                 Block, GpeBlock, GpeBlock->Node, Buffer, GpeType);
1002a159c266SJung-uk Kim 
100370e6ab8fSJung-uk Kim             AcpiOsPrintf (
100470e6ab8fSJung-uk Kim                 "    Registers:    %u (%u GPEs)\n",
1005a159c266SJung-uk Kim                 GpeBlock->RegisterCount, GpeBlock->GpeCount);
1006a159c266SJung-uk Kim 
100770e6ab8fSJung-uk Kim             AcpiOsPrintf (
100870e6ab8fSJung-uk Kim                 "    GPE range:    0x%X to 0x%X on interrupt %u\n",
1009a159c266SJung-uk Kim                 GpeBlock->BlockBaseNumber,
1010a159c266SJung-uk Kim                 GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1),
1011a159c266SJung-uk Kim                 GpeXruptInfo->InterruptNumber);
1012a159c266SJung-uk Kim 
1013a159c266SJung-uk Kim             AcpiOsPrintf (
1014a159c266SJung-uk Kim                 "    RegisterInfo: %p  Status %8.8X%8.8X Enable %8.8X%8.8X\n",
1015a159c266SJung-uk Kim                 GpeBlock->RegisterInfo,
101670e6ab8fSJung-uk Kim                 ACPI_FORMAT_UINT64 (
101770e6ab8fSJung-uk Kim                     GpeBlock->RegisterInfo->StatusAddress.Address),
101870e6ab8fSJung-uk Kim                 ACPI_FORMAT_UINT64 (
101970e6ab8fSJung-uk Kim                     GpeBlock->RegisterInfo->EnableAddress.Address));
1020a159c266SJung-uk Kim 
1021a159c266SJung-uk Kim             AcpiOsPrintf ("    EventInfo:    %p\n", GpeBlock->EventInfo);
1022a159c266SJung-uk Kim 
1023a159c266SJung-uk Kim             /* Examine each GPE Register within the block */
1024a159c266SJung-uk Kim 
1025a159c266SJung-uk Kim             for (i = 0; i < GpeBlock->RegisterCount; i++)
1026a159c266SJung-uk Kim             {
1027a159c266SJung-uk Kim                 GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
1028a159c266SJung-uk Kim 
1029a159c266SJung-uk Kim                 AcpiOsPrintf (
103070e6ab8fSJung-uk Kim                     "    Reg %u: (GPE %.2X-%.2X)  "
103170e6ab8fSJung-uk Kim                     "RunEnable %2.2X WakeEnable %2.2X"
1032a159c266SJung-uk Kim                     " Status %8.8X%8.8X Enable %8.8X%8.8X\n",
1033a159c266SJung-uk Kim                     i, GpeRegisterInfo->BaseGpeNumber,
103470e6ab8fSJung-uk Kim                     GpeRegisterInfo->BaseGpeNumber +
103570e6ab8fSJung-uk Kim                         (ACPI_GPE_REGISTER_WIDTH - 1),
1036a159c266SJung-uk Kim                     GpeRegisterInfo->EnableForRun,
1037a159c266SJung-uk Kim                     GpeRegisterInfo->EnableForWake,
103870e6ab8fSJung-uk Kim                     ACPI_FORMAT_UINT64 (
103970e6ab8fSJung-uk Kim                         GpeRegisterInfo->StatusAddress.Address),
104070e6ab8fSJung-uk Kim                     ACPI_FORMAT_UINT64 (
104170e6ab8fSJung-uk Kim                         GpeRegisterInfo->EnableAddress.Address));
1042a159c266SJung-uk Kim 
1043a159c266SJung-uk Kim                 /* Now look at the individual GPEs in this byte register */
1044a159c266SJung-uk Kim 
1045a159c266SJung-uk Kim                 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
1046a159c266SJung-uk Kim                 {
1047a159c266SJung-uk Kim                     GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
1048a159c266SJung-uk Kim                     GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
1049a159c266SJung-uk Kim 
10501c0e1b6dSJung-uk Kim                     if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
1051a159c266SJung-uk Kim                         ACPI_GPE_DISPATCH_NONE)
1052a159c266SJung-uk Kim                     {
1053a159c266SJung-uk Kim                         /* This GPE is not used (no method or handler), ignore it */
1054a159c266SJung-uk Kim 
1055a159c266SJung-uk Kim                         continue;
1056a159c266SJung-uk Kim                     }
1057a159c266SJung-uk Kim 
1058a159c266SJung-uk Kim                     AcpiOsPrintf (
1059a159c266SJung-uk Kim                         "        GPE %.2X: %p  RunRefs %2.2X Flags %2.2X (",
1060a159c266SJung-uk Kim                         GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo,
1061a159c266SJung-uk Kim                         GpeEventInfo->RuntimeCount, GpeEventInfo->Flags);
1062a159c266SJung-uk Kim 
1063a159c266SJung-uk Kim                     /* Decode the flags byte */
1064a159c266SJung-uk Kim 
1065a159c266SJung-uk Kim                     if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
1066a159c266SJung-uk Kim                     {
1067a159c266SJung-uk Kim                         AcpiOsPrintf ("Level, ");
1068a159c266SJung-uk Kim                     }
1069a159c266SJung-uk Kim                     else
1070a159c266SJung-uk Kim                     {
1071a159c266SJung-uk Kim                         AcpiOsPrintf ("Edge,  ");
1072a159c266SJung-uk Kim                     }
1073a159c266SJung-uk Kim 
1074a159c266SJung-uk Kim                     if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
1075a159c266SJung-uk Kim                     {
1076a159c266SJung-uk Kim                         AcpiOsPrintf ("CanWake, ");
1077a159c266SJung-uk Kim                     }
1078a159c266SJung-uk Kim                     else
1079a159c266SJung-uk Kim                     {
1080a159c266SJung-uk Kim                         AcpiOsPrintf ("RunOnly, ");
1081a159c266SJung-uk Kim                     }
1082a159c266SJung-uk Kim 
10831c0e1b6dSJung-uk Kim                     switch (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags))
1084a159c266SJung-uk Kim                     {
1085a159c266SJung-uk Kim                     case ACPI_GPE_DISPATCH_NONE:
1086a9d8d09cSJung-uk Kim 
1087a159c266SJung-uk Kim                         AcpiOsPrintf ("NotUsed");
1088a159c266SJung-uk Kim                         break;
1089a9d8d09cSJung-uk Kim 
1090a159c266SJung-uk Kim                     case ACPI_GPE_DISPATCH_METHOD:
1091a9d8d09cSJung-uk Kim 
1092a159c266SJung-uk Kim                         AcpiOsPrintf ("Method");
1093a159c266SJung-uk Kim                         break;
10941c0e1b6dSJung-uk Kim 
1095a159c266SJung-uk Kim                     case ACPI_GPE_DISPATCH_HANDLER:
1096a9d8d09cSJung-uk Kim 
1097a159c266SJung-uk Kim                         AcpiOsPrintf ("Handler");
1098a159c266SJung-uk Kim                         break;
1099a9d8d09cSJung-uk Kim 
1100a159c266SJung-uk Kim                     case ACPI_GPE_DISPATCH_NOTIFY:
1101a9d8d09cSJung-uk Kim 
1102f38b0f21SJung-uk Kim                         Count = 0;
1103f38b0f21SJung-uk Kim                         Notify = GpeEventInfo->Dispatch.NotifyList;
1104f38b0f21SJung-uk Kim                         while (Notify)
1105f38b0f21SJung-uk Kim                         {
1106f38b0f21SJung-uk Kim                             Count++;
1107f38b0f21SJung-uk Kim                             Notify = Notify->Next;
1108f38b0f21SJung-uk Kim                         }
110970e6ab8fSJung-uk Kim 
111070e6ab8fSJung-uk Kim                         AcpiOsPrintf ("Implicit Notify on %u devices",
111170e6ab8fSJung-uk Kim                             Count);
1112a159c266SJung-uk Kim                         break;
1113a9d8d09cSJung-uk Kim 
11141c0e1b6dSJung-uk Kim                     case ACPI_GPE_DISPATCH_RAW_HANDLER:
11151c0e1b6dSJung-uk Kim 
11161c0e1b6dSJung-uk Kim                         AcpiOsPrintf ("RawHandler");
11171c0e1b6dSJung-uk Kim                         break;
11181c0e1b6dSJung-uk Kim 
1119a159c266SJung-uk Kim                     default:
1120a9d8d09cSJung-uk Kim 
1121a159c266SJung-uk Kim                         AcpiOsPrintf ("UNKNOWN: %X",
11221c0e1b6dSJung-uk Kim                             ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags));
1123a159c266SJung-uk Kim                         break;
1124a159c266SJung-uk Kim                     }
1125a159c266SJung-uk Kim 
1126a159c266SJung-uk Kim                     AcpiOsPrintf (")\n");
1127a159c266SJung-uk Kim                 }
1128a159c266SJung-uk Kim             }
112970e6ab8fSJung-uk Kim 
1130a159c266SJung-uk Kim             Block++;
1131a159c266SJung-uk Kim             GpeBlock = GpeBlock->Next;
1132a159c266SJung-uk Kim         }
113370e6ab8fSJung-uk Kim 
1134a159c266SJung-uk Kim         GpeXruptInfo = GpeXruptInfo->Next;
1135a159c266SJung-uk Kim     }
1136a159c266SJung-uk Kim }
1137a159c266SJung-uk Kim #endif /* !ACPI_REDUCED_HARDWARE */
1138a159c266SJung-uk Kim 
1139a159c266SJung-uk Kim 
1140a159c266SJung-uk Kim /*******************************************************************************
1141a159c266SJung-uk Kim  *
1142a159c266SJung-uk Kim  * FUNCTION:    AcpiDbDisplayHandlers
1143a159c266SJung-uk Kim  *
1144a159c266SJung-uk Kim  * PARAMETERS:  None
1145a159c266SJung-uk Kim  *
1146a159c266SJung-uk Kim  * RETURN:      None
1147a159c266SJung-uk Kim  *
1148a159c266SJung-uk Kim  * DESCRIPTION: Display the currently installed global handlers
1149a159c266SJung-uk Kim  *
1150a159c266SJung-uk Kim  ******************************************************************************/
1151a159c266SJung-uk Kim 
1152a159c266SJung-uk Kim void
AcpiDbDisplayHandlers(void)1153a159c266SJung-uk Kim AcpiDbDisplayHandlers (
1154a159c266SJung-uk Kim     void)
1155a159c266SJung-uk Kim {
1156a159c266SJung-uk Kim     ACPI_OPERAND_OBJECT     *ObjDesc;
1157a159c266SJung-uk Kim     ACPI_OPERAND_OBJECT     *HandlerObj;
1158a159c266SJung-uk Kim     ACPI_ADR_SPACE_TYPE     SpaceId;
1159a159c266SJung-uk Kim     UINT32                  i;
1160a159c266SJung-uk Kim 
1161a159c266SJung-uk Kim 
1162a159c266SJung-uk Kim     /* Operation region handlers */
1163a159c266SJung-uk Kim 
1164895f26a9SJung-uk Kim     AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n");
1165a159c266SJung-uk Kim 
1166a159c266SJung-uk Kim     ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
1167a159c266SJung-uk Kim     if (ObjDesc)
1168a159c266SJung-uk Kim     {
1169a159c266SJung-uk Kim         for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++)
1170a159c266SJung-uk Kim         {
1171a159c266SJung-uk Kim             SpaceId = AcpiGbl_SpaceIdList[i];
1172a159c266SJung-uk Kim 
1173a159c266SJung-uk Kim             AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
1174a159c266SJung-uk Kim                 AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId);
1175a159c266SJung-uk Kim 
1176f8146b88SJung-uk Kim             HandlerObj = AcpiEvFindRegionHandler (
1177f8146b88SJung-uk Kim                 SpaceId, ObjDesc->CommonNotify.Handler);
1178f8146b88SJung-uk Kim             if (HandlerObj)
1179a159c266SJung-uk Kim             {
1180a159c266SJung-uk Kim                 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
1181a159c266SJung-uk Kim                     (HandlerObj->AddressSpace.HandlerFlags &
118270e6ab8fSJung-uk Kim                         ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ?
118370e6ab8fSJung-uk Kim                         "Default" : "User",
1184a159c266SJung-uk Kim                     HandlerObj->AddressSpace.Handler);
118570e6ab8fSJung-uk Kim 
1186a159c266SJung-uk Kim                 goto FoundHandler;
1187a159c266SJung-uk Kim             }
1188a159c266SJung-uk Kim 
1189a159c266SJung-uk Kim             /* There is no handler for this SpaceId */
1190a159c266SJung-uk Kim 
1191a159c266SJung-uk Kim             AcpiOsPrintf ("None\n");
1192a159c266SJung-uk Kim 
1193a159c266SJung-uk Kim         FoundHandler:;
1194a159c266SJung-uk Kim         }
1195a159c266SJung-uk Kim 
1196a159c266SJung-uk Kim         /* Find all handlers for user-defined SpaceIDs */
1197a159c266SJung-uk Kim 
1198f8146b88SJung-uk Kim         HandlerObj = ObjDesc->CommonNotify.Handler;
1199a159c266SJung-uk Kim         while (HandlerObj)
1200a159c266SJung-uk Kim         {
1201a159c266SJung-uk Kim             if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN)
1202a159c266SJung-uk Kim             {
1203a159c266SJung-uk Kim                 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
1204a159c266SJung-uk Kim                     "User-defined ID", HandlerObj->AddressSpace.SpaceId);
1205a159c266SJung-uk Kim                 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
1206a159c266SJung-uk Kim                     (HandlerObj->AddressSpace.HandlerFlags &
120770e6ab8fSJung-uk Kim                         ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ?
120870e6ab8fSJung-uk Kim                         "Default" : "User",
1209a159c266SJung-uk Kim                     HandlerObj->AddressSpace.Handler);
1210a159c266SJung-uk Kim             }
1211a159c266SJung-uk Kim 
1212a159c266SJung-uk Kim             HandlerObj = HandlerObj->AddressSpace.Next;
1213a159c266SJung-uk Kim         }
1214a159c266SJung-uk Kim     }
1215a159c266SJung-uk Kim 
1216a159c266SJung-uk Kim #if (!ACPI_REDUCED_HARDWARE)
1217a159c266SJung-uk Kim 
1218a159c266SJung-uk Kim     /* Fixed event handlers */
1219a159c266SJung-uk Kim 
1220a159c266SJung-uk Kim     AcpiOsPrintf ("\nFixed Event Handlers:\n");
1221a159c266SJung-uk Kim 
1222a159c266SJung-uk Kim     for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
1223a159c266SJung-uk Kim     {
1224a159c266SJung-uk Kim         AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i);
1225a159c266SJung-uk Kim         if (AcpiGbl_FixedEventHandlers[i].Handler)
1226a159c266SJung-uk Kim         {
1227a159c266SJung-uk Kim             AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1228a159c266SJung-uk Kim                 AcpiGbl_FixedEventHandlers[i].Handler);
1229a159c266SJung-uk Kim         }
1230a159c266SJung-uk Kim         else
1231a159c266SJung-uk Kim         {
1232a159c266SJung-uk Kim             AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1233a159c266SJung-uk Kim         }
1234a159c266SJung-uk Kim     }
1235a159c266SJung-uk Kim 
1236a159c266SJung-uk Kim #endif /* !ACPI_REDUCED_HARDWARE */
1237a159c266SJung-uk Kim 
1238a159c266SJung-uk Kim     /* Miscellaneous global handlers */
1239a159c266SJung-uk Kim 
1240a159c266SJung-uk Kim     AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
1241a159c266SJung-uk Kim 
1242a159c266SJung-uk Kim     for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++)
1243a159c266SJung-uk Kim     {
124470e6ab8fSJung-uk Kim         AcpiOsPrintf (ACPI_HANDLER_NAME_STRING,
124570e6ab8fSJung-uk Kim             AcpiGbl_HandlerList[i].Name);
124670e6ab8fSJung-uk Kim 
1247a159c266SJung-uk Kim         if (AcpiGbl_HandlerList[i].Handler)
1248a159c266SJung-uk Kim         {
1249a159c266SJung-uk Kim             AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
1250a159c266SJung-uk Kim                 AcpiGbl_HandlerList[i].Handler);
1251a159c266SJung-uk Kim         }
1252a159c266SJung-uk Kim         else
1253a159c266SJung-uk Kim         {
1254a159c266SJung-uk Kim             AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1255a159c266SJung-uk Kim         }
1256a159c266SJung-uk Kim     }
1257895f26a9SJung-uk Kim 
1258895f26a9SJung-uk Kim 
1259895f26a9SJung-uk Kim     /* Other handlers that are installed throughout the namespace */
1260895f26a9SJung-uk Kim 
1261895f26a9SJung-uk Kim     AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n");
1262895f26a9SJung-uk Kim 
1263895f26a9SJung-uk Kim     (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1264895f26a9SJung-uk Kim         ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers,
1265895f26a9SJung-uk Kim         NULL, NULL, NULL);
1266895f26a9SJung-uk Kim }
1267895f26a9SJung-uk Kim 
1268895f26a9SJung-uk Kim 
1269895f26a9SJung-uk Kim /*******************************************************************************
1270895f26a9SJung-uk Kim  *
1271895f26a9SJung-uk Kim  * FUNCTION:    AcpiDbDisplayNonRootHandlers
1272895f26a9SJung-uk Kim  *
1273895f26a9SJung-uk Kim  * PARAMETERS:  ACPI_WALK_CALLBACK
1274895f26a9SJung-uk Kim  *
1275895f26a9SJung-uk Kim  * RETURN:      Status
1276895f26a9SJung-uk Kim  *
1277895f26a9SJung-uk Kim  * DESCRIPTION: Display information about all handlers installed for a
1278895f26a9SJung-uk Kim  *              device object.
1279895f26a9SJung-uk Kim  *
1280895f26a9SJung-uk Kim  ******************************************************************************/
1281895f26a9SJung-uk Kim 
1282895f26a9SJung-uk Kim static ACPI_STATUS
AcpiDbDisplayNonRootHandlers(ACPI_HANDLE ObjHandle,UINT32 NestingLevel,void * Context,void ** ReturnValue)1283895f26a9SJung-uk Kim AcpiDbDisplayNonRootHandlers (
1284895f26a9SJung-uk Kim     ACPI_HANDLE             ObjHandle,
1285895f26a9SJung-uk Kim     UINT32                  NestingLevel,
1286895f26a9SJung-uk Kim     void                    *Context,
1287895f26a9SJung-uk Kim     void                    **ReturnValue)
1288895f26a9SJung-uk Kim {
1289895f26a9SJung-uk Kim     ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
1290895f26a9SJung-uk Kim     ACPI_OPERAND_OBJECT     *ObjDesc;
1291895f26a9SJung-uk Kim     ACPI_OPERAND_OBJECT     *HandlerObj;
1292895f26a9SJung-uk Kim     char                    *Pathname;
1293895f26a9SJung-uk Kim 
1294895f26a9SJung-uk Kim 
1295895f26a9SJung-uk Kim     ObjDesc = AcpiNsGetAttachedObject (Node);
1296895f26a9SJung-uk Kim     if (!ObjDesc)
1297895f26a9SJung-uk Kim     {
1298895f26a9SJung-uk Kim         return (AE_OK);
1299895f26a9SJung-uk Kim     }
1300895f26a9SJung-uk Kim 
1301f8146b88SJung-uk Kim     Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
1302895f26a9SJung-uk Kim     if (!Pathname)
1303895f26a9SJung-uk Kim     {
1304895f26a9SJung-uk Kim         return (AE_OK);
1305895f26a9SJung-uk Kim     }
1306895f26a9SJung-uk Kim 
1307895f26a9SJung-uk Kim     /* Display all handlers associated with this device */
1308895f26a9SJung-uk Kim 
1309f8146b88SJung-uk Kim     HandlerObj = ObjDesc->CommonNotify.Handler;
1310895f26a9SJung-uk Kim     while (HandlerObj)
1311895f26a9SJung-uk Kim     {
1312895f26a9SJung-uk Kim         AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
1313895f26a9SJung-uk Kim             AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId),
1314895f26a9SJung-uk Kim             HandlerObj->AddressSpace.SpaceId);
1315895f26a9SJung-uk Kim 
1316895f26a9SJung-uk Kim         AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2,
1317895f26a9SJung-uk Kim             (HandlerObj->AddressSpace.HandlerFlags &
1318895f26a9SJung-uk Kim                 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
1319895f26a9SJung-uk Kim             HandlerObj->AddressSpace.Handler);
1320895f26a9SJung-uk Kim 
1321895f26a9SJung-uk Kim         AcpiOsPrintf (" Device Name: %s (%p)\n", Pathname, Node);
1322895f26a9SJung-uk Kim 
1323895f26a9SJung-uk Kim         HandlerObj = HandlerObj->AddressSpace.Next;
1324895f26a9SJung-uk Kim     }
1325895f26a9SJung-uk Kim 
1326895f26a9SJung-uk Kim     ACPI_FREE (Pathname);
1327895f26a9SJung-uk Kim     return (AE_OK);
1328a159c266SJung-uk Kim }
1329