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