exdump.c revision 1.20 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: exdump - Interpreter debug output routines
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.19 christos /******************************************************************************
8 1.19 christos *
9 1.19 christos * 1. Copyright Notice
10 1.19 christos *
11 1.20 christos * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
12 1.1 jruoho * All rights reserved.
13 1.1 jruoho *
14 1.19 christos * 2. License
15 1.19 christos *
16 1.19 christos * 2.1. This is your license from Intel Corp. under its intellectual property
17 1.19 christos * rights. You may have additional license terms from the party that provided
18 1.19 christos * you this software, covering your right to use that party's intellectual
19 1.19 christos * property rights.
20 1.19 christos *
21 1.19 christos * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 1.19 christos * copy of the source code appearing in this file ("Covered Code") an
23 1.19 christos * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 1.19 christos * base code distributed originally by Intel ("Original Intel Code") to copy,
25 1.19 christos * make derivatives, distribute, use and display any portion of the Covered
26 1.19 christos * Code in any form, with the right to sublicense such rights; and
27 1.19 christos *
28 1.19 christos * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 1.19 christos * license (with the right to sublicense), under only those claims of Intel
30 1.19 christos * patents that are infringed by the Original Intel Code, to make, use, sell,
31 1.19 christos * offer to sell, and import the Covered Code and derivative works thereof
32 1.19 christos * solely to the minimum extent necessary to exercise the above copyright
33 1.19 christos * license, and in no event shall the patent license extend to any additions
34 1.19 christos * to or modifications of the Original Intel Code. No other license or right
35 1.19 christos * is granted directly or by implication, estoppel or otherwise;
36 1.19 christos *
37 1.19 christos * The above copyright and patent license is granted only if the following
38 1.19 christos * conditions are met:
39 1.19 christos *
40 1.19 christos * 3. Conditions
41 1.19 christos *
42 1.19 christos * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 1.19 christos * Redistribution of source code of any substantial portion of the Covered
44 1.19 christos * Code or modification with rights to further distribute source must include
45 1.19 christos * the above Copyright Notice, the above License, this list of Conditions,
46 1.19 christos * and the following Disclaimer and Export Compliance provision. In addition,
47 1.19 christos * Licensee must cause all Covered Code to which Licensee contributes to
48 1.19 christos * contain a file documenting the changes Licensee made to create that Covered
49 1.19 christos * Code and the date of any change. Licensee must include in that file the
50 1.19 christos * documentation of any changes made by any predecessor Licensee. Licensee
51 1.19 christos * must include a prominent statement that the modification is derived,
52 1.19 christos * directly or indirectly, from Original Intel Code.
53 1.19 christos *
54 1.19 christos * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 1.19 christos * Redistribution of source code of any substantial portion of the Covered
56 1.19 christos * Code or modification without rights to further distribute source must
57 1.19 christos * include the following Disclaimer and Export Compliance provision in the
58 1.19 christos * documentation and/or other materials provided with distribution. In
59 1.19 christos * addition, Licensee may not authorize further sublicense of source of any
60 1.19 christos * portion of the Covered Code, and must include terms to the effect that the
61 1.19 christos * license from Licensee to its licensee is limited to the intellectual
62 1.19 christos * property embodied in the software Licensee provides to its licensee, and
63 1.19 christos * not to intellectual property embodied in modifications its licensee may
64 1.19 christos * make.
65 1.19 christos *
66 1.19 christos * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 1.19 christos * substantial portion of the Covered Code or modification must reproduce the
68 1.19 christos * above Copyright Notice, and the following Disclaimer and Export Compliance
69 1.19 christos * provision in the documentation and/or other materials provided with the
70 1.19 christos * distribution.
71 1.19 christos *
72 1.19 christos * 3.4. Intel retains all right, title, and interest in and to the Original
73 1.19 christos * Intel Code.
74 1.19 christos *
75 1.19 christos * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 1.19 christos * Intel shall be used in advertising or otherwise to promote the sale, use or
77 1.19 christos * other dealings in products derived from or relating to the Covered Code
78 1.19 christos * without prior written authorization from Intel.
79 1.19 christos *
80 1.19 christos * 4. Disclaimer and Export Compliance
81 1.19 christos *
82 1.19 christos * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 1.19 christos * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 1.19 christos * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 1.19 christos * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 1.19 christos * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 1.19 christos * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 1.19 christos * PARTICULAR PURPOSE.
89 1.19 christos *
90 1.19 christos * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 1.19 christos * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 1.19 christos * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 1.19 christos * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 1.19 christos * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 1.19 christos * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 1.19 christos * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 1.19 christos * LIMITED REMEDY.
98 1.19 christos *
99 1.19 christos * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 1.19 christos * software or system incorporating such software without first obtaining any
101 1.19 christos * required license or other approval from the U. S. Department of Commerce or
102 1.19 christos * any other agency or department of the United States Government. In the
103 1.19 christos * event Licensee exports any such software from the United States or
104 1.19 christos * re-exports any such software from a foreign destination, Licensee shall
105 1.19 christos * ensure that the distribution and export/re-export of the software is in
106 1.19 christos * compliance with all laws, regulations, orders, or other restrictions of the
107 1.19 christos * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 1.19 christos * any of its subsidiaries will export/re-export any technical data, process,
109 1.19 christos * software, or service, directly or indirectly, to any country for which the
110 1.19 christos * United States government or any agency thereof requires an export license,
111 1.19 christos * other governmental approval, or letter of assurance, without first obtaining
112 1.19 christos * such license, approval or letter.
113 1.19 christos *
114 1.19 christos *****************************************************************************
115 1.19 christos *
116 1.19 christos * Alternatively, you may choose to be licensed under the terms of the
117 1.19 christos * following license:
118 1.19 christos *
119 1.3 jruoho * Redistribution and use in source and binary forms, with or without
120 1.3 jruoho * modification, are permitted provided that the following conditions
121 1.3 jruoho * are met:
122 1.3 jruoho * 1. Redistributions of source code must retain the above copyright
123 1.3 jruoho * notice, this list of conditions, and the following disclaimer,
124 1.3 jruoho * without modification.
125 1.3 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 1.3 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
127 1.3 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
128 1.3 jruoho * including a substantially similar Disclaimer requirement for further
129 1.3 jruoho * binary redistribution.
130 1.3 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
131 1.3 jruoho * of any contributors may be used to endorse or promote products derived
132 1.3 jruoho * from this software without specific prior written permission.
133 1.3 jruoho *
134 1.3 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 1.3 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 1.16 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 1.3 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 1.19 christos * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 1.19 christos * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 1.19 christos * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 1.19 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 1.19 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 1.19 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 1.19 christos * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 1.19 christos *
146 1.19 christos * Alternatively, you may choose to be licensed under the terms of the
147 1.19 christos * GNU General Public License ("GPL") version 2 as published by the Free
148 1.19 christos * Software Foundation.
149 1.19 christos *
150 1.19 christos *****************************************************************************/
151 1.1 jruoho
152 1.1 jruoho #include "acpi.h"
153 1.1 jruoho #include "accommon.h"
154 1.1 jruoho #include "acinterp.h"
155 1.1 jruoho #include "amlcode.h"
156 1.1 jruoho #include "acnamesp.h"
157 1.1 jruoho
158 1.1 jruoho
159 1.1 jruoho #define _COMPONENT ACPI_EXECUTER
160 1.1 jruoho ACPI_MODULE_NAME ("exdump")
161 1.1 jruoho
162 1.1 jruoho /*
163 1.1 jruoho * The following routines are used for debug output only
164 1.1 jruoho */
165 1.1 jruoho #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
166 1.1 jruoho
167 1.1 jruoho /* Local prototypes */
168 1.1 jruoho
169 1.1 jruoho static void
170 1.1 jruoho AcpiExOutString (
171 1.2 jruoho const char *Title,
172 1.2 jruoho const char *Value);
173 1.1 jruoho
174 1.1 jruoho static void
175 1.1 jruoho AcpiExOutPointer (
176 1.2 jruoho const char *Title,
177 1.9 christos const void *Value);
178 1.1 jruoho
179 1.1 jruoho static void
180 1.1 jruoho AcpiExDumpObject (
181 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
182 1.1 jruoho ACPI_EXDUMP_INFO *Info);
183 1.1 jruoho
184 1.1 jruoho static void
185 1.1 jruoho AcpiExDumpReferenceObj (
186 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc);
187 1.1 jruoho
188 1.1 jruoho static void
189 1.1 jruoho AcpiExDumpPackageObj (
190 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
191 1.1 jruoho UINT32 Level,
192 1.1 jruoho UINT32 Index);
193 1.1 jruoho
194 1.1 jruoho
195 1.1 jruoho /*******************************************************************************
196 1.1 jruoho *
197 1.1 jruoho * Object Descriptor info tables
198 1.1 jruoho *
199 1.1 jruoho * Note: The first table entry must be an INIT opcode and must contain
200 1.1 jruoho * the table length (number of table entries)
201 1.1 jruoho *
202 1.1 jruoho ******************************************************************************/
203 1.1 jruoho
204 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpInteger[2] =
205 1.1 jruoho {
206 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger), NULL},
207 1.1 jruoho {ACPI_EXD_UINT64, ACPI_EXD_OFFSET (Integer.Value), "Value"}
208 1.1 jruoho };
209 1.1 jruoho
210 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpString[4] =
211 1.1 jruoho {
212 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpString), NULL},
213 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (String.Length), "Length"},
214 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (String.Pointer), "Pointer"},
215 1.1 jruoho {ACPI_EXD_STRING, 0, NULL}
216 1.1 jruoho };
217 1.1 jruoho
218 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] =
219 1.1 jruoho {
220 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL},
221 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"},
222 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"},
223 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"},
224 1.1 jruoho {ACPI_EXD_BUFFER, 0, NULL}
225 1.1 jruoho };
226 1.1 jruoho
227 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpPackage[6] =
228 1.1 jruoho {
229 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL},
230 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Package.Node), "Parent Node"},
231 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"},
232 1.11 christos {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Element Count"},
233 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"},
234 1.1 jruoho {ACPI_EXD_PACKAGE, 0, NULL}
235 1.1 jruoho };
236 1.1 jruoho
237 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] =
238 1.1 jruoho {
239 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL},
240 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[0]), "System Notify"},
241 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"},
242 1.5 christos {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Device.Handler), "Handler"}
243 1.1 jruoho };
244 1.1 jruoho
245 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
246 1.1 jruoho {
247 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent), NULL},
248 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"}
249 1.1 jruoho };
250 1.1 jruoho
251 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] =
252 1.1 jruoho {
253 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL},
254 1.3 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.InfoFlags), "Info Flags"},
255 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"},
256 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"},
257 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"},
258 1.14 christos {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"},
259 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ThreadCount), "Thread Count"},
260 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Method.AmlLength), "Aml Length"},
261 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"}
262 1.1 jruoho };
263 1.1 jruoho
264 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpMutex[6] =
265 1.1 jruoho {
266 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL},
267 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"},
268 1.5 christos {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.OriginalSyncLevel), "Original Sync Level"},
269 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"},
270 1.1 jruoho {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"},
271 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"}
272 1.1 jruoho };
273 1.1 jruoho
274 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpRegion[8] =
275 1.1 jruoho {
276 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL},
277 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"},
278 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"},
279 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Region.Node), "Parent Node"},
280 1.1 jruoho {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"},
281 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"},
282 1.5 christos {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Region.Handler), "Handler"},
283 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"}
284 1.1 jruoho };
285 1.1 jruoho
286 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpPower[6] =
287 1.1 jruoho {
288 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL},
289 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"},
290 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"},
291 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[0]), "System Notify"},
292 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"},
293 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.Handler), "Handler"}
294 1.1 jruoho };
295 1.1 jruoho
296 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
297 1.1 jruoho {
298 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor), NULL},
299 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"},
300 1.1 jruoho {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"},
301 1.1 jruoho {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"},
302 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[0]), "System Notify"},
303 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[1]), "Device Notify"},
304 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"}
305 1.1 jruoho };
306 1.1 jruoho
307 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] =
308 1.1 jruoho {
309 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL},
310 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]), "System Notify"},
311 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]), "Device Notify"},
312 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"}
313 1.1 jruoho };
314 1.1 jruoho
315 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] =
316 1.1 jruoho {
317 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField), NULL},
318 1.1 jruoho {ACPI_EXD_FIELD, 0, NULL},
319 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"}
320 1.1 jruoho };
321 1.1 jruoho
322 1.4 christos static ACPI_EXDUMP_INFO AcpiExDumpRegionField[5] =
323 1.1 jruoho {
324 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL},
325 1.1 jruoho {ACPI_EXD_FIELD, 0, NULL},
326 1.4 christos {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Field.AccessLength), "AccessLength"},
327 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"},
328 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.ResourceBuffer), "ResourceBuffer"}
329 1.1 jruoho };
330 1.1 jruoho
331 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] =
332 1.1 jruoho {
333 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
334 1.1 jruoho {ACPI_EXD_FIELD, 0, NULL},
335 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"},
336 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"},
337 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"}
338 1.1 jruoho };
339 1.1 jruoho
340 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
341 1.1 jruoho {
342 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
343 1.1 jruoho {ACPI_EXD_FIELD, 0, NULL},
344 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"},
345 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"},
346 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
347 1.1 jruoho };
348 1.1 jruoho
349 1.7 christos static ACPI_EXDUMP_INFO AcpiExDumpReference[9] =
350 1.1 jruoho {
351 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
352 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"},
353 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
354 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"},
355 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"},
356 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Reference.Node), "Node"},
357 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"},
358 1.7 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.IndexPointer), "Index Pointer"},
359 1.1 jruoho {ACPI_EXD_REFERENCE,0, NULL}
360 1.1 jruoho };
361 1.1 jruoho
362 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
363 1.1 jruoho {
364 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
365 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"},
366 1.5 christos {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (AddressSpace.Next), "Next"},
367 1.5 christos {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"},
368 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"},
369 1.1 jruoho {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
370 1.1 jruoho };
371 1.1 jruoho
372 1.4 christos static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] =
373 1.1 jruoho {
374 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
375 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Notify.Node), "Node"},
376 1.4 christos {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Notify.HandlerType), "Handler Type"},
377 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Handler), "Handler"},
378 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"},
379 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[0]), "Next System Notify"},
380 1.4 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[1]), "Next Device Notify"}
381 1.1 jruoho };
382 1.1 jruoho
383 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpExtra[6] =
384 1.5 christos {
385 1.5 christos {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpExtra), NULL},
386 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.Method_REG), "_REG Method"},
387 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Extra.ScopeNode), "Scope Node"},
388 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.RegionContext), "Region Context"},
389 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.AmlStart), "Aml Start"},
390 1.5 christos {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Extra.AmlLength), "Aml Length"}
391 1.5 christos };
392 1.5 christos
393 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpData[3] =
394 1.5 christos {
395 1.5 christos {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpData), NULL},
396 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Handler), "Handler"},
397 1.5 christos {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Pointer), "Raw Data"}
398 1.5 christos };
399 1.1 jruoho
400 1.1 jruoho /* Miscellaneous tables */
401 1.1 jruoho
402 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpCommon[5] =
403 1.1 jruoho {
404 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL},
405 1.1 jruoho {ACPI_EXD_TYPE , 0, NULL},
406 1.1 jruoho {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"},
407 1.5 christos {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"},
408 1.5 christos {ACPI_EXD_LIST, ACPI_EXD_OFFSET (Common.NextObject), "Object List"}
409 1.1 jruoho };
410 1.1 jruoho
411 1.1 jruoho static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
412 1.1 jruoho {
413 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
414 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"},
415 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"},
416 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"},
417 1.1 jruoho {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
418 1.1 jruoho {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"},
419 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"}
420 1.1 jruoho };
421 1.1 jruoho
422 1.5 christos static ACPI_EXDUMP_INFO AcpiExDumpNode[7] =
423 1.1 jruoho {
424 1.1 jruoho {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL},
425 1.14 christos {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET (Flags), "Flags"},
426 1.14 christos {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"},
427 1.5 christos {ACPI_EXD_LIST, ACPI_EXD_NSOFFSET (Object), "Object List"},
428 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Parent), "Parent"},
429 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Child), "Child"},
430 1.5 christos {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Peer), "Peer"}
431 1.1 jruoho };
432 1.1 jruoho
433 1.1 jruoho
434 1.1 jruoho /* Dispatch table, indexed by object type */
435 1.1 jruoho
436 1.1 jruoho static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] =
437 1.1 jruoho {
438 1.1 jruoho NULL,
439 1.1 jruoho AcpiExDumpInteger,
440 1.1 jruoho AcpiExDumpString,
441 1.1 jruoho AcpiExDumpBuffer,
442 1.1 jruoho AcpiExDumpPackage,
443 1.1 jruoho NULL,
444 1.1 jruoho AcpiExDumpDevice,
445 1.1 jruoho AcpiExDumpEvent,
446 1.1 jruoho AcpiExDumpMethod,
447 1.1 jruoho AcpiExDumpMutex,
448 1.1 jruoho AcpiExDumpRegion,
449 1.1 jruoho AcpiExDumpPower,
450 1.1 jruoho AcpiExDumpProcessor,
451 1.1 jruoho AcpiExDumpThermal,
452 1.1 jruoho AcpiExDumpBufferField,
453 1.1 jruoho NULL,
454 1.1 jruoho NULL,
455 1.1 jruoho AcpiExDumpRegionField,
456 1.1 jruoho AcpiExDumpBankField,
457 1.1 jruoho AcpiExDumpIndexField,
458 1.1 jruoho AcpiExDumpReference,
459 1.1 jruoho NULL,
460 1.1 jruoho NULL,
461 1.1 jruoho AcpiExDumpNotify,
462 1.1 jruoho AcpiExDumpAddressHandler,
463 1.1 jruoho NULL,
464 1.1 jruoho NULL,
465 1.5 christos NULL,
466 1.5 christos AcpiExDumpExtra,
467 1.5 christos AcpiExDumpData
468 1.1 jruoho };
469 1.1 jruoho
470 1.1 jruoho
471 1.1 jruoho /*******************************************************************************
472 1.1 jruoho *
473 1.1 jruoho * FUNCTION: AcpiExDumpObject
474 1.1 jruoho *
475 1.1 jruoho * PARAMETERS: ObjDesc - Descriptor to dump
476 1.1 jruoho * Info - Info table corresponding to this object
477 1.1 jruoho * type
478 1.1 jruoho *
479 1.1 jruoho * RETURN: None
480 1.1 jruoho *
481 1.1 jruoho * DESCRIPTION: Walk the info table for this object
482 1.1 jruoho *
483 1.1 jruoho ******************************************************************************/
484 1.1 jruoho
485 1.1 jruoho static void
486 1.1 jruoho AcpiExDumpObject (
487 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
488 1.1 jruoho ACPI_EXDUMP_INFO *Info)
489 1.1 jruoho {
490 1.1 jruoho UINT8 *Target;
491 1.9 christos const char *Name;
492 1.1 jruoho UINT8 Count;
493 1.5 christos ACPI_OPERAND_OBJECT *Start;
494 1.5 christos ACPI_OPERAND_OBJECT *Data = NULL;
495 1.5 christos ACPI_OPERAND_OBJECT *Next;
496 1.5 christos ACPI_NAMESPACE_NODE *Node;
497 1.1 jruoho
498 1.1 jruoho
499 1.1 jruoho if (!Info)
500 1.1 jruoho {
501 1.1 jruoho AcpiOsPrintf (
502 1.1 jruoho "ExDumpObject: Display not implemented for object type %s\n",
503 1.1 jruoho AcpiUtGetObjectTypeName (ObjDesc));
504 1.1 jruoho return;
505 1.1 jruoho }
506 1.1 jruoho
507 1.1 jruoho /* First table entry must contain the table length (# of table entries) */
508 1.1 jruoho
509 1.1 jruoho Count = Info->Offset;
510 1.1 jruoho
511 1.1 jruoho while (Count)
512 1.1 jruoho {
513 1.11 christos if (!ObjDesc)
514 1.11 christos {
515 1.11 christos return;
516 1.11 christos }
517 1.11 christos
518 1.1 jruoho Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
519 1.2 jruoho Name = __UNCONST(Info->Name);
520 1.1 jruoho
521 1.1 jruoho switch (Info->Opcode)
522 1.1 jruoho {
523 1.1 jruoho case ACPI_EXD_INIT:
524 1.4 christos
525 1.1 jruoho break;
526 1.1 jruoho
527 1.1 jruoho case ACPI_EXD_TYPE:
528 1.1 jruoho
529 1.5 christos AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type",
530 1.11 christos ObjDesc->Common.Type,
531 1.11 christos AcpiUtGetObjectTypeName (ObjDesc));
532 1.1 jruoho break;
533 1.1 jruoho
534 1.1 jruoho case ACPI_EXD_UINT8:
535 1.1 jruoho
536 1.1 jruoho AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
537 1.1 jruoho break;
538 1.1 jruoho
539 1.1 jruoho case ACPI_EXD_UINT16:
540 1.1 jruoho
541 1.1 jruoho AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
542 1.1 jruoho break;
543 1.1 jruoho
544 1.1 jruoho case ACPI_EXD_UINT32:
545 1.1 jruoho
546 1.1 jruoho AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
547 1.1 jruoho break;
548 1.1 jruoho
549 1.1 jruoho case ACPI_EXD_UINT64:
550 1.1 jruoho
551 1.1 jruoho AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
552 1.1 jruoho ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
553 1.1 jruoho break;
554 1.1 jruoho
555 1.1 jruoho case ACPI_EXD_POINTER:
556 1.1 jruoho case ACPI_EXD_ADDRESS:
557 1.1 jruoho
558 1.1 jruoho AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
559 1.1 jruoho break;
560 1.1 jruoho
561 1.1 jruoho case ACPI_EXD_STRING:
562 1.1 jruoho
563 1.1 jruoho AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
564 1.1 jruoho AcpiOsPrintf ("\n");
565 1.1 jruoho break;
566 1.1 jruoho
567 1.1 jruoho case ACPI_EXD_BUFFER:
568 1.1 jruoho
569 1.8 christos ACPI_DUMP_BUFFER (
570 1.8 christos ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
571 1.1 jruoho break;
572 1.1 jruoho
573 1.1 jruoho case ACPI_EXD_PACKAGE:
574 1.1 jruoho
575 1.1 jruoho /* Dump the package contents */
576 1.1 jruoho
577 1.1 jruoho AcpiOsPrintf ("\nPackage Contents:\n");
578 1.1 jruoho AcpiExDumpPackageObj (ObjDesc, 0, 0);
579 1.1 jruoho break;
580 1.1 jruoho
581 1.1 jruoho case ACPI_EXD_FIELD:
582 1.1 jruoho
583 1.1 jruoho AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
584 1.1 jruoho break;
585 1.1 jruoho
586 1.1 jruoho case ACPI_EXD_REFERENCE:
587 1.1 jruoho
588 1.9 christos AcpiExOutString ("Class Name", AcpiUtGetReferenceName (ObjDesc));
589 1.1 jruoho AcpiExDumpReferenceObj (ObjDesc);
590 1.1 jruoho break;
591 1.1 jruoho
592 1.5 christos case ACPI_EXD_LIST:
593 1.5 christos
594 1.5 christos Start = *ACPI_CAST_PTR (void *, Target);
595 1.5 christos Next = Start;
596 1.5 christos
597 1.11 christos AcpiOsPrintf ("%20s : %p ", Name, Next);
598 1.5 christos if (Next)
599 1.5 christos {
600 1.11 christos AcpiOsPrintf ("%s (Type %2.2X)",
601 1.5 christos AcpiUtGetObjectTypeName (Next), Next->Common.Type);
602 1.5 christos
603 1.5 christos while (Next->Common.NextObject)
604 1.5 christos {
605 1.5 christos if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
606 1.5 christos !Data)
607 1.5 christos {
608 1.5 christos Data = Next;
609 1.5 christos }
610 1.5 christos
611 1.5 christos Next = Next->Common.NextObject;
612 1.5 christos AcpiOsPrintf ("->%p(%s %2.2X)", Next,
613 1.5 christos AcpiUtGetObjectTypeName (Next), Next->Common.Type);
614 1.5 christos
615 1.5 christos if ((Next == Start) || (Next == Data))
616 1.5 christos {
617 1.8 christos AcpiOsPrintf (
618 1.8 christos "\n**** Error: Object list appears to be circular linked");
619 1.5 christos break;
620 1.5 christos }
621 1.5 christos }
622 1.5 christos }
623 1.11 christos else
624 1.11 christos {
625 1.11 christos AcpiOsPrintf ("- No attached objects");
626 1.11 christos }
627 1.5 christos
628 1.5 christos AcpiOsPrintf ("\n");
629 1.5 christos break;
630 1.5 christos
631 1.5 christos case ACPI_EXD_HDLR_LIST:
632 1.5 christos
633 1.5 christos Start = *ACPI_CAST_PTR (void *, Target);
634 1.5 christos Next = Start;
635 1.5 christos
636 1.5 christos AcpiOsPrintf ("%20s : %p", Name, Next);
637 1.5 christos if (Next)
638 1.5 christos {
639 1.5 christos AcpiOsPrintf ("(%s %2.2X)",
640 1.8 christos AcpiUtGetObjectTypeName (Next),
641 1.8 christos Next->AddressSpace.SpaceId);
642 1.5 christos
643 1.5 christos while (Next->AddressSpace.Next)
644 1.5 christos {
645 1.5 christos if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
646 1.5 christos !Data)
647 1.5 christos {
648 1.5 christos Data = Next;
649 1.5 christos }
650 1.5 christos
651 1.5 christos Next = Next->AddressSpace.Next;
652 1.5 christos AcpiOsPrintf ("->%p(%s %2.2X)", Next,
653 1.8 christos AcpiUtGetObjectTypeName (Next),
654 1.8 christos Next->AddressSpace.SpaceId);
655 1.5 christos
656 1.5 christos if ((Next == Start) || (Next == Data))
657 1.5 christos {
658 1.8 christos AcpiOsPrintf (
659 1.8 christos "\n**** Error: Handler list appears to be circular linked");
660 1.5 christos break;
661 1.5 christos }
662 1.5 christos }
663 1.5 christos }
664 1.5 christos
665 1.5 christos AcpiOsPrintf ("\n");
666 1.5 christos break;
667 1.5 christos
668 1.5 christos case ACPI_EXD_RGN_LIST:
669 1.5 christos
670 1.5 christos Start = *ACPI_CAST_PTR (void *, Target);
671 1.5 christos Next = Start;
672 1.5 christos
673 1.5 christos AcpiOsPrintf ("%20s : %p", Name, Next);
674 1.5 christos if (Next)
675 1.5 christos {
676 1.5 christos AcpiOsPrintf ("(%s %2.2X)",
677 1.5 christos AcpiUtGetObjectTypeName (Next), Next->Common.Type);
678 1.5 christos
679 1.5 christos while (Next->Region.Next)
680 1.5 christos {
681 1.5 christos if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
682 1.5 christos !Data)
683 1.5 christos {
684 1.5 christos Data = Next;
685 1.5 christos }
686 1.5 christos
687 1.5 christos Next = Next->Region.Next;
688 1.5 christos AcpiOsPrintf ("->%p(%s %2.2X)", Next,
689 1.5 christos AcpiUtGetObjectTypeName (Next), Next->Common.Type);
690 1.5 christos
691 1.5 christos if ((Next == Start) || (Next == Data))
692 1.5 christos {
693 1.8 christos AcpiOsPrintf (
694 1.8 christos "\n**** Error: Region list appears to be circular linked");
695 1.5 christos break;
696 1.5 christos }
697 1.5 christos }
698 1.5 christos }
699 1.5 christos
700 1.5 christos AcpiOsPrintf ("\n");
701 1.5 christos break;
702 1.5 christos
703 1.5 christos case ACPI_EXD_NODE:
704 1.5 christos
705 1.5 christos Node = *ACPI_CAST_PTR (ACPI_NAMESPACE_NODE *, Target);
706 1.5 christos
707 1.5 christos AcpiOsPrintf ("%20s : %p", Name, Node);
708 1.5 christos if (Node)
709 1.5 christos {
710 1.5 christos AcpiOsPrintf (" [%4.4s]", Node->Name.Ascii);
711 1.5 christos }
712 1.5 christos AcpiOsPrintf ("\n");
713 1.5 christos break;
714 1.5 christos
715 1.1 jruoho default:
716 1.1 jruoho
717 1.1 jruoho AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
718 1.1 jruoho Info->Opcode);
719 1.1 jruoho return;
720 1.1 jruoho }
721 1.1 jruoho
722 1.1 jruoho Info++;
723 1.1 jruoho Count--;
724 1.1 jruoho }
725 1.1 jruoho }
726 1.1 jruoho
727 1.1 jruoho
728 1.1 jruoho /*******************************************************************************
729 1.1 jruoho *
730 1.1 jruoho * FUNCTION: AcpiExDumpOperand
731 1.1 jruoho *
732 1.1 jruoho * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
733 1.1 jruoho * Depth - Current nesting depth
734 1.1 jruoho *
735 1.1 jruoho * RETURN: None
736 1.1 jruoho *
737 1.1 jruoho * DESCRIPTION: Dump an operand object
738 1.1 jruoho *
739 1.1 jruoho ******************************************************************************/
740 1.1 jruoho
741 1.1 jruoho void
742 1.1 jruoho AcpiExDumpOperand (
743 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
744 1.1 jruoho UINT32 Depth)
745 1.1 jruoho {
746 1.1 jruoho UINT32 Length;
747 1.1 jruoho UINT32 Index;
748 1.1 jruoho
749 1.1 jruoho
750 1.12 christos ACPI_FUNCTION_NAME (ExDumpOperand);
751 1.1 jruoho
752 1.1 jruoho
753 1.4 christos /* Check if debug output enabled */
754 1.4 christos
755 1.4 christos if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_EXEC, _COMPONENT))
756 1.1 jruoho {
757 1.1 jruoho return;
758 1.1 jruoho }
759 1.1 jruoho
760 1.1 jruoho if (!ObjDesc)
761 1.1 jruoho {
762 1.1 jruoho /* This could be a null element of a package */
763 1.1 jruoho
764 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
765 1.1 jruoho return;
766 1.1 jruoho }
767 1.1 jruoho
768 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
769 1.1 jruoho {
770 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
771 1.1 jruoho ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
772 1.1 jruoho return;
773 1.1 jruoho }
774 1.1 jruoho
775 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
776 1.1 jruoho {
777 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
778 1.1 jruoho "%p is not a node or operand object: [%s]\n",
779 1.1 jruoho ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
780 1.1 jruoho ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
781 1.1 jruoho return;
782 1.1 jruoho }
783 1.1 jruoho
784 1.1 jruoho /* ObjDesc is a valid object */
785 1.1 jruoho
786 1.1 jruoho if (Depth > 0)
787 1.1 jruoho {
788 1.11 christos ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p Refs=%u ",
789 1.11 christos Depth, " ", Depth, ObjDesc, ObjDesc->Common.ReferenceCount));
790 1.1 jruoho }
791 1.1 jruoho else
792 1.1 jruoho {
793 1.11 christos ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Refs=%u ",
794 1.11 christos ObjDesc, ObjDesc->Common.ReferenceCount));
795 1.1 jruoho }
796 1.1 jruoho
797 1.1 jruoho /* Decode object type */
798 1.1 jruoho
799 1.1 jruoho switch (ObjDesc->Common.Type)
800 1.1 jruoho {
801 1.1 jruoho case ACPI_TYPE_LOCAL_REFERENCE:
802 1.1 jruoho
803 1.8 christos AcpiOsPrintf ("Reference: [%s] ",
804 1.8 christos AcpiUtGetReferenceName (ObjDesc));
805 1.1 jruoho
806 1.1 jruoho switch (ObjDesc->Reference.Class)
807 1.1 jruoho {
808 1.1 jruoho case ACPI_REFCLASS_DEBUG:
809 1.1 jruoho
810 1.1 jruoho AcpiOsPrintf ("\n");
811 1.1 jruoho break;
812 1.1 jruoho
813 1.1 jruoho case ACPI_REFCLASS_INDEX:
814 1.1 jruoho
815 1.1 jruoho AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
816 1.1 jruoho break;
817 1.1 jruoho
818 1.1 jruoho case ACPI_REFCLASS_TABLE:
819 1.1 jruoho
820 1.1 jruoho AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
821 1.1 jruoho break;
822 1.1 jruoho
823 1.1 jruoho case ACPI_REFCLASS_REFOF:
824 1.1 jruoho
825 1.1 jruoho AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
826 1.1 jruoho AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
827 1.1 jruoho ObjDesc->Reference.Object)->Common.Type));
828 1.1 jruoho break;
829 1.1 jruoho
830 1.1 jruoho case ACPI_REFCLASS_NAME:
831 1.1 jruoho
832 1.11 christos AcpiUtRepairName (ObjDesc->Reference.Node->Name.Ascii);
833 1.11 christos AcpiOsPrintf ("- [%4.4s] (Node %p)\n",
834 1.11 christos ObjDesc->Reference.Node->Name.Ascii,
835 1.11 christos ObjDesc->Reference.Node);
836 1.1 jruoho break;
837 1.1 jruoho
838 1.1 jruoho case ACPI_REFCLASS_ARG:
839 1.1 jruoho case ACPI_REFCLASS_LOCAL:
840 1.1 jruoho
841 1.1 jruoho AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
842 1.1 jruoho break;
843 1.1 jruoho
844 1.1 jruoho default: /* Unknown reference class */
845 1.1 jruoho
846 1.1 jruoho AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
847 1.1 jruoho break;
848 1.1 jruoho }
849 1.1 jruoho break;
850 1.1 jruoho
851 1.1 jruoho case ACPI_TYPE_BUFFER:
852 1.1 jruoho
853 1.1 jruoho AcpiOsPrintf ("Buffer length %.2X @ %p\n",
854 1.1 jruoho ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
855 1.1 jruoho
856 1.1 jruoho /* Debug only -- dump the buffer contents */
857 1.1 jruoho
858 1.1 jruoho if (ObjDesc->Buffer.Pointer)
859 1.1 jruoho {
860 1.1 jruoho Length = ObjDesc->Buffer.Length;
861 1.1 jruoho if (Length > 128)
862 1.1 jruoho {
863 1.1 jruoho Length = 128;
864 1.1 jruoho }
865 1.1 jruoho
866 1.8 christos AcpiOsPrintf (
867 1.8 christos "Buffer Contents: (displaying length 0x%.2X)\n", Length);
868 1.1 jruoho ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
869 1.1 jruoho }
870 1.1 jruoho break;
871 1.1 jruoho
872 1.1 jruoho case ACPI_TYPE_INTEGER:
873 1.1 jruoho
874 1.1 jruoho AcpiOsPrintf ("Integer %8.8X%8.8X\n",
875 1.1 jruoho ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
876 1.1 jruoho break;
877 1.1 jruoho
878 1.1 jruoho case ACPI_TYPE_PACKAGE:
879 1.1 jruoho
880 1.1 jruoho AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
881 1.1 jruoho ObjDesc->Package.Count, ObjDesc->Package.Elements);
882 1.1 jruoho
883 1.1 jruoho /*
884 1.1 jruoho * If elements exist, package element pointer is valid,
885 1.1 jruoho * and debug_level exceeds 1, dump package's elements.
886 1.1 jruoho */
887 1.1 jruoho if (ObjDesc->Package.Count &&
888 1.1 jruoho ObjDesc->Package.Elements &&
889 1.1 jruoho AcpiDbgLevel > 1)
890 1.1 jruoho {
891 1.1 jruoho for (Index = 0; Index < ObjDesc->Package.Count; Index++)
892 1.1 jruoho {
893 1.8 christos AcpiExDumpOperand (
894 1.8 christos ObjDesc->Package.Elements[Index], Depth + 1);
895 1.1 jruoho }
896 1.1 jruoho }
897 1.1 jruoho break;
898 1.1 jruoho
899 1.1 jruoho case ACPI_TYPE_REGION:
900 1.1 jruoho
901 1.1 jruoho AcpiOsPrintf ("Region %s (%X)",
902 1.1 jruoho AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
903 1.1 jruoho ObjDesc->Region.SpaceId);
904 1.1 jruoho
905 1.1 jruoho /*
906 1.1 jruoho * If the address and length have not been evaluated,
907 1.1 jruoho * don't print them.
908 1.1 jruoho */
909 1.1 jruoho if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
910 1.1 jruoho {
911 1.1 jruoho AcpiOsPrintf ("\n");
912 1.1 jruoho }
913 1.1 jruoho else
914 1.1 jruoho {
915 1.1 jruoho AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
916 1.6 christos ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
917 1.1 jruoho ObjDesc->Region.Length);
918 1.1 jruoho }
919 1.1 jruoho break;
920 1.1 jruoho
921 1.1 jruoho case ACPI_TYPE_STRING:
922 1.1 jruoho
923 1.1 jruoho AcpiOsPrintf ("String length %X @ %p ",
924 1.1 jruoho ObjDesc->String.Length,
925 1.1 jruoho ObjDesc->String.Pointer);
926 1.1 jruoho
927 1.1 jruoho AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
928 1.1 jruoho AcpiOsPrintf ("\n");
929 1.1 jruoho break;
930 1.1 jruoho
931 1.1 jruoho case ACPI_TYPE_LOCAL_BANK_FIELD:
932 1.1 jruoho
933 1.1 jruoho AcpiOsPrintf ("BankField\n");
934 1.1 jruoho break;
935 1.1 jruoho
936 1.1 jruoho case ACPI_TYPE_LOCAL_REGION_FIELD:
937 1.1 jruoho
938 1.1 jruoho AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
939 1.1 jruoho "byte=%X bit=%X of below:\n",
940 1.1 jruoho ObjDesc->Field.BitLength,
941 1.1 jruoho ObjDesc->Field.AccessByteWidth,
942 1.1 jruoho ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
943 1.1 jruoho ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
944 1.1 jruoho ObjDesc->Field.BaseByteOffset,
945 1.1 jruoho ObjDesc->Field.StartFieldBitOffset);
946 1.1 jruoho
947 1.8 christos AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth + 1);
948 1.1 jruoho break;
949 1.1 jruoho
950 1.1 jruoho case ACPI_TYPE_LOCAL_INDEX_FIELD:
951 1.1 jruoho
952 1.1 jruoho AcpiOsPrintf ("IndexField\n");
953 1.1 jruoho break;
954 1.1 jruoho
955 1.1 jruoho case ACPI_TYPE_BUFFER_FIELD:
956 1.1 jruoho
957 1.1 jruoho AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
958 1.1 jruoho ObjDesc->BufferField.BitLength,
959 1.1 jruoho ObjDesc->BufferField.BaseByteOffset,
960 1.1 jruoho ObjDesc->BufferField.StartFieldBitOffset);
961 1.1 jruoho
962 1.1 jruoho if (!ObjDesc->BufferField.BufferObj)
963 1.1 jruoho {
964 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
965 1.1 jruoho }
966 1.1 jruoho else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
967 1.8 christos ACPI_TYPE_BUFFER)
968 1.1 jruoho {
969 1.1 jruoho AcpiOsPrintf ("*not a Buffer*\n");
970 1.1 jruoho }
971 1.1 jruoho else
972 1.1 jruoho {
973 1.8 christos AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth + 1);
974 1.1 jruoho }
975 1.1 jruoho break;
976 1.1 jruoho
977 1.1 jruoho case ACPI_TYPE_EVENT:
978 1.1 jruoho
979 1.1 jruoho AcpiOsPrintf ("Event\n");
980 1.1 jruoho break;
981 1.1 jruoho
982 1.1 jruoho case ACPI_TYPE_METHOD:
983 1.1 jruoho
984 1.1 jruoho AcpiOsPrintf ("Method(%X) @ %p:%X\n",
985 1.1 jruoho ObjDesc->Method.ParamCount,
986 1.1 jruoho ObjDesc->Method.AmlStart,
987 1.1 jruoho ObjDesc->Method.AmlLength);
988 1.1 jruoho break;
989 1.1 jruoho
990 1.1 jruoho case ACPI_TYPE_MUTEX:
991 1.1 jruoho
992 1.1 jruoho AcpiOsPrintf ("Mutex\n");
993 1.1 jruoho break;
994 1.1 jruoho
995 1.1 jruoho case ACPI_TYPE_DEVICE:
996 1.1 jruoho
997 1.1 jruoho AcpiOsPrintf ("Device\n");
998 1.1 jruoho break;
999 1.1 jruoho
1000 1.1 jruoho case ACPI_TYPE_POWER:
1001 1.1 jruoho
1002 1.1 jruoho AcpiOsPrintf ("Power\n");
1003 1.1 jruoho break;
1004 1.1 jruoho
1005 1.1 jruoho case ACPI_TYPE_PROCESSOR:
1006 1.1 jruoho
1007 1.1 jruoho AcpiOsPrintf ("Processor\n");
1008 1.1 jruoho break;
1009 1.1 jruoho
1010 1.1 jruoho case ACPI_TYPE_THERMAL:
1011 1.1 jruoho
1012 1.1 jruoho AcpiOsPrintf ("Thermal\n");
1013 1.1 jruoho break;
1014 1.1 jruoho
1015 1.4 christos default:
1016 1.1 jruoho
1017 1.1 jruoho /* Unknown Type */
1018 1.1 jruoho
1019 1.1 jruoho AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
1020 1.1 jruoho break;
1021 1.1 jruoho }
1022 1.1 jruoho
1023 1.1 jruoho return;
1024 1.1 jruoho }
1025 1.1 jruoho
1026 1.1 jruoho
1027 1.1 jruoho /*******************************************************************************
1028 1.1 jruoho *
1029 1.1 jruoho * FUNCTION: AcpiExDumpOperands
1030 1.1 jruoho *
1031 1.1 jruoho * PARAMETERS: Operands - A list of Operand objects
1032 1.1 jruoho * OpcodeName - AML opcode name
1033 1.1 jruoho * NumOperands - Operand count for this opcode
1034 1.1 jruoho *
1035 1.1 jruoho * DESCRIPTION: Dump the operands associated with the opcode
1036 1.1 jruoho *
1037 1.1 jruoho ******************************************************************************/
1038 1.1 jruoho
1039 1.1 jruoho void
1040 1.1 jruoho AcpiExDumpOperands (
1041 1.1 jruoho ACPI_OPERAND_OBJECT **Operands,
1042 1.1 jruoho const char *OpcodeName,
1043 1.1 jruoho UINT32 NumOperands)
1044 1.1 jruoho {
1045 1.12 christos ACPI_FUNCTION_TRACE (ExDumpOperands);
1046 1.1 jruoho
1047 1.1 jruoho
1048 1.1 jruoho if (!OpcodeName)
1049 1.1 jruoho {
1050 1.1 jruoho OpcodeName = "UNKNOWN";
1051 1.1 jruoho }
1052 1.1 jruoho
1053 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1054 1.1 jruoho "**** Start operand dump for opcode [%s], %u operands\n",
1055 1.1 jruoho OpcodeName, NumOperands));
1056 1.1 jruoho
1057 1.1 jruoho if (NumOperands == 0)
1058 1.1 jruoho {
1059 1.1 jruoho NumOperands = 1;
1060 1.1 jruoho }
1061 1.1 jruoho
1062 1.1 jruoho /* Dump the individual operands */
1063 1.1 jruoho
1064 1.1 jruoho while (NumOperands)
1065 1.1 jruoho {
1066 1.1 jruoho AcpiExDumpOperand (*Operands, 0);
1067 1.1 jruoho Operands++;
1068 1.1 jruoho NumOperands--;
1069 1.1 jruoho }
1070 1.1 jruoho
1071 1.1 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1072 1.1 jruoho "**** End operand dump for [%s]\n", OpcodeName));
1073 1.12 christos return_VOID;
1074 1.1 jruoho }
1075 1.1 jruoho
1076 1.1 jruoho
1077 1.1 jruoho /*******************************************************************************
1078 1.1 jruoho *
1079 1.1 jruoho * FUNCTION: AcpiExOut* functions
1080 1.1 jruoho *
1081 1.1 jruoho * PARAMETERS: Title - Descriptive text
1082 1.1 jruoho * Value - Value to be displayed
1083 1.1 jruoho *
1084 1.4 christos * DESCRIPTION: Object dump output formatting functions. These functions
1085 1.1 jruoho * reduce the number of format strings required and keeps them
1086 1.1 jruoho * all in one place for easy modification.
1087 1.1 jruoho *
1088 1.1 jruoho ******************************************************************************/
1089 1.1 jruoho
1090 1.1 jruoho static void
1091 1.1 jruoho AcpiExOutString (
1092 1.2 jruoho const char *Title,
1093 1.2 jruoho const char *Value)
1094 1.1 jruoho {
1095 1.1 jruoho AcpiOsPrintf ("%20s : %s\n", Title, Value);
1096 1.1 jruoho }
1097 1.1 jruoho
1098 1.1 jruoho static void
1099 1.1 jruoho AcpiExOutPointer (
1100 1.2 jruoho const char *Title,
1101 1.9 christos const void *Value)
1102 1.1 jruoho {
1103 1.1 jruoho AcpiOsPrintf ("%20s : %p\n", Title, Value);
1104 1.1 jruoho }
1105 1.1 jruoho
1106 1.1 jruoho
1107 1.1 jruoho /*******************************************************************************
1108 1.1 jruoho *
1109 1.1 jruoho * FUNCTION: AcpiExDumpNamespaceNode
1110 1.1 jruoho *
1111 1.1 jruoho * PARAMETERS: Node - Descriptor to dump
1112 1.1 jruoho * Flags - Force display if TRUE
1113 1.1 jruoho *
1114 1.1 jruoho * DESCRIPTION: Dumps the members of the given.Node
1115 1.1 jruoho *
1116 1.1 jruoho ******************************************************************************/
1117 1.1 jruoho
1118 1.1 jruoho void
1119 1.1 jruoho AcpiExDumpNamespaceNode (
1120 1.1 jruoho ACPI_NAMESPACE_NODE *Node,
1121 1.1 jruoho UINT32 Flags)
1122 1.1 jruoho {
1123 1.1 jruoho
1124 1.1 jruoho ACPI_FUNCTION_ENTRY ();
1125 1.1 jruoho
1126 1.1 jruoho
1127 1.1 jruoho if (!Flags)
1128 1.1 jruoho {
1129 1.4 christos /* Check if debug output enabled */
1130 1.4 christos
1131 1.4 christos if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
1132 1.1 jruoho {
1133 1.1 jruoho return;
1134 1.1 jruoho }
1135 1.1 jruoho }
1136 1.1 jruoho
1137 1.1 jruoho AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
1138 1.5 christos AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type",
1139 1.5 christos Node->Type, AcpiUtGetTypeName (Node->Type));
1140 1.1 jruoho
1141 1.1 jruoho AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
1142 1.1 jruoho AcpiExDumpNode);
1143 1.1 jruoho }
1144 1.1 jruoho
1145 1.1 jruoho
1146 1.1 jruoho /*******************************************************************************
1147 1.1 jruoho *
1148 1.1 jruoho * FUNCTION: AcpiExDumpReferenceObj
1149 1.1 jruoho *
1150 1.1 jruoho * PARAMETERS: Object - Descriptor to dump
1151 1.1 jruoho *
1152 1.1 jruoho * DESCRIPTION: Dumps a reference object
1153 1.1 jruoho *
1154 1.1 jruoho ******************************************************************************/
1155 1.1 jruoho
1156 1.1 jruoho static void
1157 1.1 jruoho AcpiExDumpReferenceObj (
1158 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc)
1159 1.1 jruoho {
1160 1.1 jruoho ACPI_BUFFER RetBuf;
1161 1.1 jruoho ACPI_STATUS Status;
1162 1.1 jruoho
1163 1.1 jruoho
1164 1.1 jruoho RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1165 1.1 jruoho
1166 1.1 jruoho if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME)
1167 1.1 jruoho {
1168 1.1 jruoho AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
1169 1.1 jruoho
1170 1.7 christos Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node,
1171 1.8 christos &RetBuf, TRUE);
1172 1.1 jruoho if (ACPI_FAILURE (Status))
1173 1.1 jruoho {
1174 1.11 christos AcpiOsPrintf (" Could not convert name to pathname: %s\n",
1175 1.11 christos AcpiFormatException (Status));
1176 1.1 jruoho }
1177 1.1 jruoho else
1178 1.1 jruoho {
1179 1.11 christos AcpiOsPrintf ("%s: %s\n",
1180 1.11 christos AcpiUtGetTypeName (ObjDesc->Reference.Node->Type),
1181 1.11 christos (char *) RetBuf.Pointer);
1182 1.11 christos ACPI_FREE (RetBuf.Pointer);
1183 1.1 jruoho }
1184 1.1 jruoho }
1185 1.1 jruoho else if (ObjDesc->Reference.Object)
1186 1.1 jruoho {
1187 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
1188 1.1 jruoho {
1189 1.7 christos AcpiOsPrintf ("%22s %p", "Target :",
1190 1.7 christos ObjDesc->Reference.Object);
1191 1.1 jruoho if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
1192 1.1 jruoho {
1193 1.7 christos AcpiOsPrintf (" Table Index: %X\n",
1194 1.7 christos ObjDesc->Reference.Value);
1195 1.1 jruoho }
1196 1.1 jruoho else
1197 1.1 jruoho {
1198 1.7 christos AcpiOsPrintf (" [%s]\n",
1199 1.1 jruoho AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
1200 1.7 christos ObjDesc->Reference.Object)->Common.Type));
1201 1.1 jruoho }
1202 1.1 jruoho }
1203 1.1 jruoho else
1204 1.1 jruoho {
1205 1.1 jruoho AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
1206 1.1 jruoho }
1207 1.1 jruoho }
1208 1.1 jruoho }
1209 1.1 jruoho
1210 1.1 jruoho
1211 1.1 jruoho /*******************************************************************************
1212 1.1 jruoho *
1213 1.1 jruoho * FUNCTION: AcpiExDumpPackageObj
1214 1.1 jruoho *
1215 1.1 jruoho * PARAMETERS: ObjDesc - Descriptor to dump
1216 1.1 jruoho * Level - Indentation Level
1217 1.1 jruoho * Index - Package index for this object
1218 1.1 jruoho *
1219 1.1 jruoho * DESCRIPTION: Dumps the elements of the package
1220 1.1 jruoho *
1221 1.1 jruoho ******************************************************************************/
1222 1.1 jruoho
1223 1.1 jruoho static void
1224 1.1 jruoho AcpiExDumpPackageObj (
1225 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
1226 1.1 jruoho UINT32 Level,
1227 1.1 jruoho UINT32 Index)
1228 1.1 jruoho {
1229 1.1 jruoho UINT32 i;
1230 1.1 jruoho
1231 1.1 jruoho
1232 1.1 jruoho /* Indentation and index output */
1233 1.1 jruoho
1234 1.1 jruoho if (Level > 0)
1235 1.1 jruoho {
1236 1.1 jruoho for (i = 0; i < Level; i++)
1237 1.1 jruoho {
1238 1.1 jruoho AcpiOsPrintf (" ");
1239 1.1 jruoho }
1240 1.1 jruoho
1241 1.1 jruoho AcpiOsPrintf ("[%.2d] ", Index);
1242 1.1 jruoho }
1243 1.1 jruoho
1244 1.1 jruoho AcpiOsPrintf ("%p ", ObjDesc);
1245 1.1 jruoho
1246 1.1 jruoho /* Null package elements are allowed */
1247 1.1 jruoho
1248 1.1 jruoho if (!ObjDesc)
1249 1.1 jruoho {
1250 1.1 jruoho AcpiOsPrintf ("[Null Object]\n");
1251 1.1 jruoho return;
1252 1.1 jruoho }
1253 1.1 jruoho
1254 1.1 jruoho /* Packages may only contain a few object types */
1255 1.1 jruoho
1256 1.1 jruoho switch (ObjDesc->Common.Type)
1257 1.1 jruoho {
1258 1.1 jruoho case ACPI_TYPE_INTEGER:
1259 1.1 jruoho
1260 1.1 jruoho AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
1261 1.1 jruoho ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
1262 1.1 jruoho break;
1263 1.1 jruoho
1264 1.1 jruoho case ACPI_TYPE_STRING:
1265 1.1 jruoho
1266 1.1 jruoho AcpiOsPrintf ("[String] Value: ");
1267 1.4 christos AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
1268 1.1 jruoho AcpiOsPrintf ("\n");
1269 1.1 jruoho break;
1270 1.1 jruoho
1271 1.1 jruoho case ACPI_TYPE_BUFFER:
1272 1.1 jruoho
1273 1.1 jruoho AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
1274 1.1 jruoho if (ObjDesc->Buffer.Length)
1275 1.1 jruoho {
1276 1.8 christos AcpiUtDebugDumpBuffer (
1277 1.8 christos ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
1278 1.1 jruoho ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
1279 1.1 jruoho }
1280 1.1 jruoho else
1281 1.1 jruoho {
1282 1.1 jruoho AcpiOsPrintf ("\n");
1283 1.1 jruoho }
1284 1.1 jruoho break;
1285 1.1 jruoho
1286 1.1 jruoho case ACPI_TYPE_PACKAGE:
1287 1.1 jruoho
1288 1.1 jruoho AcpiOsPrintf ("[Package] Contains %u Elements:\n",
1289 1.1 jruoho ObjDesc->Package.Count);
1290 1.1 jruoho
1291 1.1 jruoho for (i = 0; i < ObjDesc->Package.Count; i++)
1292 1.1 jruoho {
1293 1.8 christos AcpiExDumpPackageObj (
1294 1.8 christos ObjDesc->Package.Elements[i], Level + 1, i);
1295 1.1 jruoho }
1296 1.1 jruoho break;
1297 1.1 jruoho
1298 1.1 jruoho case ACPI_TYPE_LOCAL_REFERENCE:
1299 1.1 jruoho
1300 1.11 christos AcpiOsPrintf ("[Object Reference] Class [%s]",
1301 1.11 christos AcpiUtGetReferenceName (ObjDesc));
1302 1.1 jruoho AcpiExDumpReferenceObj (ObjDesc);
1303 1.1 jruoho break;
1304 1.1 jruoho
1305 1.1 jruoho default:
1306 1.1 jruoho
1307 1.11 christos AcpiOsPrintf ("[%s] Type: %2.2X\n",
1308 1.11 christos AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type);
1309 1.1 jruoho break;
1310 1.1 jruoho }
1311 1.1 jruoho }
1312 1.1 jruoho
1313 1.1 jruoho
1314 1.1 jruoho /*******************************************************************************
1315 1.1 jruoho *
1316 1.1 jruoho * FUNCTION: AcpiExDumpObjectDescriptor
1317 1.1 jruoho *
1318 1.1 jruoho * PARAMETERS: ObjDesc - Descriptor to dump
1319 1.1 jruoho * Flags - Force display if TRUE
1320 1.1 jruoho *
1321 1.1 jruoho * DESCRIPTION: Dumps the members of the object descriptor given.
1322 1.1 jruoho *
1323 1.1 jruoho ******************************************************************************/
1324 1.1 jruoho
1325 1.1 jruoho void
1326 1.1 jruoho AcpiExDumpObjectDescriptor (
1327 1.1 jruoho ACPI_OPERAND_OBJECT *ObjDesc,
1328 1.1 jruoho UINT32 Flags)
1329 1.1 jruoho {
1330 1.1 jruoho ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
1331 1.1 jruoho
1332 1.1 jruoho
1333 1.1 jruoho if (!ObjDesc)
1334 1.1 jruoho {
1335 1.1 jruoho return_VOID;
1336 1.1 jruoho }
1337 1.1 jruoho
1338 1.1 jruoho if (!Flags)
1339 1.1 jruoho {
1340 1.4 christos /* Check if debug output enabled */
1341 1.4 christos
1342 1.4 christos if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
1343 1.1 jruoho {
1344 1.1 jruoho return_VOID;
1345 1.1 jruoho }
1346 1.1 jruoho }
1347 1.1 jruoho
1348 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1349 1.1 jruoho {
1350 1.1 jruoho AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
1351 1.1 jruoho
1352 1.11 christos ObjDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object;
1353 1.11 christos if (!ObjDesc)
1354 1.11 christos {
1355 1.11 christos return_VOID;
1356 1.11 christos }
1357 1.11 christos
1358 1.11 christos AcpiOsPrintf ("\nAttached Object %p", ObjDesc);
1359 1.11 christos if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1360 1.11 christos {
1361 1.11 christos AcpiOsPrintf (" - Namespace Node");
1362 1.11 christos }
1363 1.1 jruoho
1364 1.11 christos AcpiOsPrintf (":\n");
1365 1.5 christos goto DumpObject;
1366 1.1 jruoho }
1367 1.1 jruoho
1368 1.1 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
1369 1.1 jruoho {
1370 1.1 jruoho AcpiOsPrintf (
1371 1.5 christos "%p is not an ACPI operand object: [%s]\n",
1372 1.1 jruoho ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
1373 1.1 jruoho return_VOID;
1374 1.1 jruoho }
1375 1.1 jruoho
1376 1.5 christos /* Validate the object type */
1377 1.5 christos
1378 1.5 christos if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX)
1379 1.1 jruoho {
1380 1.5 christos AcpiOsPrintf ("Not a known object type: %2.2X\n",
1381 1.5 christos ObjDesc->Common.Type);
1382 1.1 jruoho return_VOID;
1383 1.1 jruoho }
1384 1.1 jruoho
1385 1.5 christos
1386 1.5 christos DumpObject:
1387 1.5 christos
1388 1.11 christos if (!ObjDesc)
1389 1.11 christos {
1390 1.11 christos return_VOID;
1391 1.11 christos }
1392 1.11 christos
1393 1.1 jruoho /* Common Fields */
1394 1.1 jruoho
1395 1.1 jruoho AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
1396 1.1 jruoho
1397 1.1 jruoho /* Object-specific fields */
1398 1.1 jruoho
1399 1.1 jruoho AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
1400 1.5 christos
1401 1.5 christos if (ObjDesc->Common.Type == ACPI_TYPE_REGION)
1402 1.5 christos {
1403 1.5 christos ObjDesc = ObjDesc->Common.NextObject;
1404 1.5 christos if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX)
1405 1.5 christos {
1406 1.8 christos AcpiOsPrintf (
1407 1.8 christos "Secondary object is not a known object type: %2.2X\n",
1408 1.5 christos ObjDesc->Common.Type);
1409 1.5 christos
1410 1.5 christos return_VOID;
1411 1.5 christos }
1412 1.5 christos
1413 1.5 christos AcpiOsPrintf ("\nExtra attached Object (%p):\n", ObjDesc);
1414 1.5 christos AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
1415 1.5 christos }
1416 1.5 christos
1417 1.1 jruoho return_VOID;
1418 1.1 jruoho }
1419 1.1 jruoho
1420 1.1 jruoho #endif
1421