1c2c66affSColin Finck /******************************************************************************
2c2c66affSColin Finck  *
3c2c66affSColin Finck  * Module Name: nsdump - table dumping routines for debug
4c2c66affSColin Finck  *
5c2c66affSColin Finck  *****************************************************************************/
6c2c66affSColin Finck 
7c2c66affSColin Finck /*
8*03b24380SThomas Faber  * Copyright (C) 2000 - 2022, Intel Corp.
9c2c66affSColin Finck  * All rights reserved.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * Redistribution and use in source and binary forms, with or without
12c2c66affSColin Finck  * modification, are permitted provided that the following conditions
13c2c66affSColin Finck  * are met:
14c2c66affSColin Finck  * 1. Redistributions of source code must retain the above copyright
15c2c66affSColin Finck  *    notice, this list of conditions, and the following disclaimer,
16c2c66affSColin Finck  *    without modification.
17c2c66affSColin Finck  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18c2c66affSColin Finck  *    substantially similar to the "NO WARRANTY" disclaimer below
19c2c66affSColin Finck  *    ("Disclaimer") and any redistribution must be conditioned upon
20c2c66affSColin Finck  *    including a substantially similar Disclaimer requirement for further
21c2c66affSColin Finck  *    binary redistribution.
22c2c66affSColin Finck  * 3. Neither the names of the above-listed copyright holders nor the names
23c2c66affSColin Finck  *    of any contributors may be used to endorse or promote products derived
24c2c66affSColin Finck  *    from this software without specific prior written permission.
25c2c66affSColin Finck  *
26c2c66affSColin Finck  * Alternatively, this software may be distributed under the terms of the
27c2c66affSColin Finck  * GNU General Public License ("GPL") version 2 as published by the Free
28c2c66affSColin Finck  * Software Foundation.
29c2c66affSColin Finck  *
30c2c66affSColin Finck  * NO WARRANTY
31c2c66affSColin Finck  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32c2c66affSColin Finck  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
336eb8cc49SThomas Faber  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34c2c66affSColin Finck  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35c2c66affSColin Finck  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36c2c66affSColin Finck  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37c2c66affSColin Finck  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38c2c66affSColin Finck  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39c2c66affSColin Finck  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40c2c66affSColin Finck  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41c2c66affSColin Finck  * POSSIBILITY OF SUCH DAMAGES.
42c2c66affSColin Finck  */
43c2c66affSColin Finck 
44c2c66affSColin Finck #include "acpi.h"
45c2c66affSColin Finck 
46c2c66affSColin Finck 
47c2c66affSColin Finck /* TBD: This entire module is apparently obsolete and should be removed */
48c2c66affSColin Finck 
49c2c66affSColin Finck #define _COMPONENT          ACPI_NAMESPACE
50c2c66affSColin Finck         ACPI_MODULE_NAME    ("nsdumpdv")
51c2c66affSColin Finck 
52c2c66affSColin Finck #ifdef ACPI_OBSOLETE_FUNCTIONS
53c2c66affSColin Finck #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
54c2c66affSColin Finck 
55c2c66affSColin Finck #include "acnamesp.h"
56c2c66affSColin Finck 
57c2c66affSColin Finck /*******************************************************************************
58c2c66affSColin Finck  *
59c2c66affSColin Finck  * FUNCTION:    AcpiNsDumpOneDevice
60c2c66affSColin Finck  *
61c2c66affSColin Finck  * PARAMETERS:  Handle              - Node to be dumped
62c2c66affSColin Finck  *              Level               - Nesting level of the handle
63c2c66affSColin Finck  *              Context             - Passed into WalkNamespace
64c2c66affSColin Finck  *              ReturnValue         - Not used
65c2c66affSColin Finck  *
66c2c66affSColin Finck  * RETURN:      Status
67c2c66affSColin Finck  *
68c2c66affSColin Finck  * DESCRIPTION: Dump a single Node that represents a device
69c2c66affSColin Finck  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
70c2c66affSColin Finck  *
71c2c66affSColin Finck  ******************************************************************************/
72c2c66affSColin Finck 
73c2c66affSColin Finck static ACPI_STATUS
AcpiNsDumpOneDevice(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)74c2c66affSColin Finck AcpiNsDumpOneDevice (
75c2c66affSColin Finck     ACPI_HANDLE             ObjHandle,
76c2c66affSColin Finck     UINT32                  Level,
77c2c66affSColin Finck     void                    *Context,
78c2c66affSColin Finck     void                    **ReturnValue)
79c2c66affSColin Finck {
80c2c66affSColin Finck     ACPI_BUFFER             Buffer;
81c2c66affSColin Finck     ACPI_DEVICE_INFO        *Info;
82c2c66affSColin Finck     ACPI_STATUS             Status;
83c2c66affSColin Finck     UINT32                  i;
84c2c66affSColin Finck 
85c2c66affSColin Finck 
86c2c66affSColin Finck     ACPI_FUNCTION_NAME (NsDumpOneDevice);
87c2c66affSColin Finck 
88c2c66affSColin Finck 
89c2c66affSColin Finck     Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
90c2c66affSColin Finck 
91c2c66affSColin Finck     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
92c2c66affSColin Finck     Status = AcpiGetObjectInfo (ObjHandle, &Buffer);
93c2c66affSColin Finck     if (ACPI_SUCCESS (Status))
94c2c66affSColin Finck     {
95c2c66affSColin Finck         Info = Buffer.Pointer;
96c2c66affSColin Finck         for (i = 0; i < Level; i++)
97c2c66affSColin Finck         {
98c2c66affSColin Finck             ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
99c2c66affSColin Finck         }
100c2c66affSColin Finck 
101c2c66affSColin Finck         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
1026847cc3aSThomas Faber             "    HID: %s, ADR: %8.8X%8.8X\n",
1036847cc3aSThomas Faber             Info->HardwareId.Value, ACPI_FORMAT_UINT64 (Info->Address)));
104c2c66affSColin Finck         ACPI_FREE (Info);
105c2c66affSColin Finck     }
106c2c66affSColin Finck 
107c2c66affSColin Finck     return (Status);
108c2c66affSColin Finck }
109c2c66affSColin Finck 
110c2c66affSColin Finck 
111c2c66affSColin Finck /*******************************************************************************
112c2c66affSColin Finck  *
113c2c66affSColin Finck  * FUNCTION:    AcpiNsDumpRootDevices
114c2c66affSColin Finck  *
115c2c66affSColin Finck  * PARAMETERS:  None
116c2c66affSColin Finck  *
117c2c66affSColin Finck  * RETURN:      None
118c2c66affSColin Finck  *
119c2c66affSColin Finck  * DESCRIPTION: Dump all objects of type "device"
120c2c66affSColin Finck  *
121c2c66affSColin Finck  ******************************************************************************/
122c2c66affSColin Finck 
123c2c66affSColin Finck void
AcpiNsDumpRootDevices(void)124c2c66affSColin Finck AcpiNsDumpRootDevices (
125c2c66affSColin Finck     void)
126c2c66affSColin Finck {
127c2c66affSColin Finck     ACPI_HANDLE             SysBusHandle;
128c2c66affSColin Finck     ACPI_STATUS             Status;
129c2c66affSColin Finck 
130c2c66affSColin Finck 
131c2c66affSColin Finck     ACPI_FUNCTION_NAME (NsDumpRootDevices);
132c2c66affSColin Finck 
133c2c66affSColin Finck 
134c2c66affSColin Finck     /* Only dump the table if tracing is enabled */
135c2c66affSColin Finck 
136c2c66affSColin Finck     if (!(ACPI_LV_TABLES & AcpiDbgLevel))
137c2c66affSColin Finck     {
138c2c66affSColin Finck         return;
139c2c66affSColin Finck     }
140c2c66affSColin Finck 
141c2c66affSColin Finck     Status = AcpiGetHandle (NULL, METHOD_NAME__SB_, &SysBusHandle);
142c2c66affSColin Finck     if (ACPI_FAILURE (Status))
143c2c66affSColin Finck     {
144c2c66affSColin Finck         return;
145c2c66affSColin Finck     }
146c2c66affSColin Finck 
147c2c66affSColin Finck     ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
148c2c66affSColin Finck         "Display of all devices in the namespace:\n"));
149c2c66affSColin Finck 
150c2c66affSColin Finck     Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle,
151c2c66affSColin Finck         ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
152c2c66affSColin Finck         AcpiNsDumpOneDevice, NULL, NULL, NULL);
153c2c66affSColin Finck }
154c2c66affSColin Finck 
155c2c66affSColin Finck #endif
156c2c66affSColin Finck #endif
157