xref: /minix3/minix/drivers/power/acpi/namespace/nsdumpdv.c (revision 29492bb71c7148a089a5afafa0c99409161218df)
1433d6423SLionel Sambuc /******************************************************************************
2433d6423SLionel Sambuc  *
3433d6423SLionel Sambuc  * Module Name: nsdump - table dumping routines for debug
4433d6423SLionel Sambuc  *
5433d6423SLionel Sambuc  *****************************************************************************/
6433d6423SLionel Sambuc 
7*29492bb7SDavid van Moolenbroek /*
8*29492bb7SDavid van Moolenbroek  * Copyright (C) 2000 - 2014, Intel Corp.
9433d6423SLionel Sambuc  * All rights reserved.
10433d6423SLionel Sambuc  *
11*29492bb7SDavid van Moolenbroek  * Redistribution and use in source and binary forms, with or without
12*29492bb7SDavid van Moolenbroek  * modification, are permitted provided that the following conditions
13*29492bb7SDavid van Moolenbroek  * are met:
14*29492bb7SDavid van Moolenbroek  * 1. Redistributions of source code must retain the above copyright
15*29492bb7SDavid van Moolenbroek  *    notice, this list of conditions, and the following disclaimer,
16*29492bb7SDavid van Moolenbroek  *    without modification.
17*29492bb7SDavid van Moolenbroek  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18*29492bb7SDavid van Moolenbroek  *    substantially similar to the "NO WARRANTY" disclaimer below
19*29492bb7SDavid van Moolenbroek  *    ("Disclaimer") and any redistribution must be conditioned upon
20*29492bb7SDavid van Moolenbroek  *    including a substantially similar Disclaimer requirement for further
21*29492bb7SDavid van Moolenbroek  *    binary redistribution.
22*29492bb7SDavid van Moolenbroek  * 3. Neither the names of the above-listed copyright holders nor the names
23*29492bb7SDavid van Moolenbroek  *    of any contributors may be used to endorse or promote products derived
24*29492bb7SDavid van Moolenbroek  *    from this software without specific prior written permission.
25433d6423SLionel Sambuc  *
26*29492bb7SDavid van Moolenbroek  * Alternatively, this software may be distributed under the terms of the
27*29492bb7SDavid van Moolenbroek  * GNU General Public License ("GPL") version 2 as published by the Free
28*29492bb7SDavid van Moolenbroek  * Software Foundation.
29433d6423SLionel Sambuc  *
30*29492bb7SDavid van Moolenbroek  * NO WARRANTY
31*29492bb7SDavid van Moolenbroek  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32*29492bb7SDavid van Moolenbroek  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33*29492bb7SDavid van Moolenbroek  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34*29492bb7SDavid van Moolenbroek  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35*29492bb7SDavid van Moolenbroek  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36*29492bb7SDavid van Moolenbroek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37*29492bb7SDavid van Moolenbroek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38*29492bb7SDavid van Moolenbroek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*29492bb7SDavid van Moolenbroek  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40*29492bb7SDavid van Moolenbroek  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41*29492bb7SDavid van Moolenbroek  * POSSIBILITY OF SUCH DAMAGES.
42*29492bb7SDavid van Moolenbroek  */
43433d6423SLionel Sambuc 
44433d6423SLionel Sambuc #include "acpi.h"
45433d6423SLionel Sambuc 
46433d6423SLionel Sambuc 
47433d6423SLionel Sambuc /* TBD: This entire module is apparently obsolete and should be removed */
48433d6423SLionel Sambuc 
49433d6423SLionel Sambuc #define _COMPONENT          ACPI_NAMESPACE
50433d6423SLionel Sambuc         ACPI_MODULE_NAME    ("nsdumpdv")
51433d6423SLionel Sambuc 
52433d6423SLionel Sambuc #ifdef ACPI_OBSOLETE_FUNCTIONS
53433d6423SLionel Sambuc #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
54433d6423SLionel Sambuc 
55433d6423SLionel Sambuc #include "acnamesp.h"
56433d6423SLionel Sambuc 
57433d6423SLionel Sambuc /*******************************************************************************
58433d6423SLionel Sambuc  *
59433d6423SLionel Sambuc  * FUNCTION:    AcpiNsDumpOneDevice
60433d6423SLionel Sambuc  *
61433d6423SLionel Sambuc  * PARAMETERS:  Handle              - Node to be dumped
62433d6423SLionel Sambuc  *              Level               - Nesting level of the handle
63433d6423SLionel Sambuc  *              Context             - Passed into WalkNamespace
64433d6423SLionel Sambuc  *              ReturnValue         - Not used
65433d6423SLionel Sambuc  *
66433d6423SLionel Sambuc  * RETURN:      Status
67433d6423SLionel Sambuc  *
68433d6423SLionel Sambuc  * DESCRIPTION: Dump a single Node that represents a device
69433d6423SLionel Sambuc  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
70433d6423SLionel Sambuc  *
71433d6423SLionel Sambuc  ******************************************************************************/
72433d6423SLionel Sambuc 
73433d6423SLionel Sambuc static ACPI_STATUS
AcpiNsDumpOneDevice(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)74433d6423SLionel Sambuc AcpiNsDumpOneDevice (
75433d6423SLionel Sambuc     ACPI_HANDLE             ObjHandle,
76433d6423SLionel Sambuc     UINT32                  Level,
77433d6423SLionel Sambuc     void                    *Context,
78433d6423SLionel Sambuc     void                    **ReturnValue)
79433d6423SLionel Sambuc {
80433d6423SLionel Sambuc     ACPI_BUFFER             Buffer;
81433d6423SLionel Sambuc     ACPI_DEVICE_INFO        *Info;
82433d6423SLionel Sambuc     ACPI_STATUS             Status;
83433d6423SLionel Sambuc     UINT32                  i;
84433d6423SLionel Sambuc 
85433d6423SLionel Sambuc 
86433d6423SLionel Sambuc     ACPI_FUNCTION_NAME (NsDumpOneDevice);
87433d6423SLionel Sambuc 
88433d6423SLionel Sambuc 
89433d6423SLionel Sambuc     Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
90433d6423SLionel Sambuc 
91433d6423SLionel Sambuc     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
92433d6423SLionel Sambuc     Status = AcpiGetObjectInfo (ObjHandle, &Buffer);
93433d6423SLionel Sambuc     if (ACPI_SUCCESS (Status))
94433d6423SLionel Sambuc     {
95433d6423SLionel Sambuc         Info = Buffer.Pointer;
96433d6423SLionel Sambuc         for (i = 0; i < Level; i++)
97433d6423SLionel Sambuc         {
98433d6423SLionel Sambuc             ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
99433d6423SLionel Sambuc         }
100433d6423SLionel Sambuc 
101433d6423SLionel Sambuc         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
102433d6423SLionel Sambuc             "    HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
103433d6423SLionel Sambuc             Info->HardwareId.Value, ACPI_FORMAT_UINT64 (Info->Address),
104433d6423SLionel Sambuc             Info->CurrentStatus));
105433d6423SLionel Sambuc         ACPI_FREE (Info);
106433d6423SLionel Sambuc     }
107433d6423SLionel Sambuc 
108433d6423SLionel Sambuc     return (Status);
109433d6423SLionel Sambuc }
110433d6423SLionel Sambuc 
111433d6423SLionel Sambuc 
112433d6423SLionel Sambuc /*******************************************************************************
113433d6423SLionel Sambuc  *
114433d6423SLionel Sambuc  * FUNCTION:    AcpiNsDumpRootDevices
115433d6423SLionel Sambuc  *
116433d6423SLionel Sambuc  * PARAMETERS:  None
117433d6423SLionel Sambuc  *
118433d6423SLionel Sambuc  * RETURN:      None
119433d6423SLionel Sambuc  *
120433d6423SLionel Sambuc  * DESCRIPTION: Dump all objects of type "device"
121433d6423SLionel Sambuc  *
122433d6423SLionel Sambuc  ******************************************************************************/
123433d6423SLionel Sambuc 
124433d6423SLionel Sambuc void
AcpiNsDumpRootDevices(void)125433d6423SLionel Sambuc AcpiNsDumpRootDevices (
126433d6423SLionel Sambuc     void)
127433d6423SLionel Sambuc {
128433d6423SLionel Sambuc     ACPI_HANDLE             SysBusHandle;
129433d6423SLionel Sambuc     ACPI_STATUS             Status;
130433d6423SLionel Sambuc 
131433d6423SLionel Sambuc 
132433d6423SLionel Sambuc     ACPI_FUNCTION_NAME (NsDumpRootDevices);
133433d6423SLionel Sambuc 
134433d6423SLionel Sambuc 
135433d6423SLionel Sambuc     /* Only dump the table if tracing is enabled */
136433d6423SLionel Sambuc 
137433d6423SLionel Sambuc     if (!(ACPI_LV_TABLES & AcpiDbgLevel))
138433d6423SLionel Sambuc     {
139433d6423SLionel Sambuc         return;
140433d6423SLionel Sambuc     }
141433d6423SLionel Sambuc 
142*29492bb7SDavid van Moolenbroek     Status = AcpiGetHandle (NULL, METHOD_NAME__SB_, &SysBusHandle);
143433d6423SLionel Sambuc     if (ACPI_FAILURE (Status))
144433d6423SLionel Sambuc     {
145433d6423SLionel Sambuc         return;
146433d6423SLionel Sambuc     }
147433d6423SLionel Sambuc 
148433d6423SLionel Sambuc     ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
149433d6423SLionel Sambuc         "Display of all devices in the namespace:\n"));
150433d6423SLionel Sambuc 
151433d6423SLionel Sambuc     Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle,
152433d6423SLionel Sambuc                 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
153433d6423SLionel Sambuc                 AcpiNsDumpOneDevice, NULL, NULL, NULL);
154433d6423SLionel Sambuc }
155433d6423SLionel Sambuc 
156433d6423SLionel Sambuc #endif
157433d6423SLionel Sambuc #endif
158