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