1 /******************************************************************************
2 *
3 * Module Name: nsdump - table dumping routines for debug
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2011, 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 #define __NSDUMP_C__
45
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acnamesp.h"
49
50
51 #define _COMPONENT ACPI_NAMESPACE
52 ACPI_MODULE_NAME ("nsdump")
53
54 /* Local prototypes */
55
56 #ifdef ACPI_OBSOLETE_FUNCTIONS
57 void
58 AcpiNsDumpRootDevices (
59 void);
60
61 static ACPI_STATUS
62 AcpiNsDumpOneDevice (
63 ACPI_HANDLE ObjHandle,
64 UINT32 Level,
65 void *Context,
66 void **ReturnValue);
67 #endif
68
69
70 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
71 /*******************************************************************************
72 *
73 * FUNCTION: AcpiNsPrintPathname
74 *
75 * PARAMETERS: NumSegments - Number of ACPI name segments
76 * Pathname - The compressed (internal) path
77 *
78 * RETURN: None
79 *
80 * DESCRIPTION: Print an object's full namespace pathname
81 *
82 ******************************************************************************/
83
84 void
85 AcpiNsPrintPathname (
86 UINT32 NumSegments,
87 char *Pathname)
88 {
89 UINT32 i;
90
91
92 ACPI_FUNCTION_NAME (NsPrintPathname);
93
94
95 if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
96 {
97 return;
98 }
99
100 /* Print the entire name */
101
102 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
103
104 while (NumSegments)
105 {
106 for (i = 0; i < 4; i++)
107 {
108 ACPI_IS_PRINT (Pathname[i]) ?
109 AcpiOsPrintf ("%c", Pathname[i]) :
110 AcpiOsPrintf ("?");
111 }
112
113 Pathname += ACPI_NAME_SIZE;
114 NumSegments--;
115 if (NumSegments)
134 * RETURN: None
135 *
136 * DESCRIPTION: Print an object's full namespace pathname
137 * Manages allocation/freeing of a pathname buffer
138 *
139 ******************************************************************************/
140
141 void
142 AcpiNsDumpPathname (
143 ACPI_HANDLE Handle,
144 char *Msg,
145 UINT32 Level,
146 UINT32 Component)
147 {
148
149 ACPI_FUNCTION_TRACE (NsDumpPathname);
150
151
152 /* Do this only if the requested debug level and component are enabled */
153
154 if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
155 {
156 return_VOID;
157 }
158
159 /* Convert handle to a full pathname and print it (with supplied message) */
160
161 AcpiNsPrintNodePathname (Handle, Msg);
162 AcpiOsPrintf ("\n");
163 return_VOID;
164 }
165
166
167 /*******************************************************************************
168 *
169 * FUNCTION: AcpiNsDumpOneObject
170 *
171 * PARAMETERS: ObjHandle - Node to be dumped
172 * Level - Nesting level of the handle
173 * Context - Passed into WalkNamespace
174 * ReturnValue - Not used
253 AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
254
255 DbgLevel = AcpiDbgLevel;
256 AcpiDbgLevel = 0;
257 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
258 AcpiDbgLevel = DbgLevel;
259
260 /* Temp nodes are those nodes created by a control method */
261
262 if (ThisNode->Flags & ANOBJ_TEMPORARY)
263 {
264 AcpiOsPrintf ("(T) ");
265 }
266
267 switch (Info->DisplayType & ACPI_DISPLAY_MASK)
268 {
269 case ACPI_DISPLAY_SUMMARY:
270
271 if (!ObjDesc)
272 {
273 /* No attached object, we are done */
274
275 AcpiOsPrintf ("\n");
276 return (AE_OK);
277 }
278
279 switch (Type)
280 {
281 case ACPI_TYPE_PROCESSOR:
282
283 AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
284 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
285 ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
286 break;
287
288
289 case ACPI_TYPE_DEVICE:
290
291 AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
292 break;
293
294
295 case ACPI_TYPE_METHOD:
296
297 AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
298 (UINT32) ObjDesc->Method.ParamCount,
299 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
300 break;
301
302
303 case ACPI_TYPE_INTEGER:
304
305 AcpiOsPrintf ("= %8.8X%8.8X\n",
306 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
307 break;
308
309
310 case ACPI_TYPE_PACKAGE:
311
312 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
313 {
314 AcpiOsPrintf ("Elements %.2X\n",
315 ObjDesc->Package.Count);
316 }
317 else
318 {
319 AcpiOsPrintf ("[Length not yet evaluated]\n");
320 }
321 break;
322
323
324 case ACPI_TYPE_BUFFER:
325
326 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
327 {
328 AcpiOsPrintf ("Len %.2X",
329 ObjDesc->Buffer.Length);
330
331 /* Dump some of the buffer */
332
333 if (ObjDesc->Buffer.Length > 0)
334 {
335 AcpiOsPrintf (" =");
336 for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
337 {
338 AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
339 }
340 }
341 AcpiOsPrintf ("\n");
342 }
343 else
344 {
345 AcpiOsPrintf ("[Length not yet evaluated]\n");
346 }
347 break;
348
349
350 case ACPI_TYPE_STRING:
351
352 AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
353 AcpiUtPrintString (ObjDesc->String.Pointer, 32);
354 AcpiOsPrintf ("\n");
355 break;
356
357
358 case ACPI_TYPE_REGION:
359
360 AcpiOsPrintf ("[%s]",
361 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
362 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
363 {
364 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
365 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
366 ObjDesc->Region.Length);
367 }
368 else
369 {
370 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
371 }
372 break;
373
374
375 case ACPI_TYPE_LOCAL_REFERENCE:
376
377 AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
378 break;
379
380
381 case ACPI_TYPE_BUFFER_FIELD:
382
383 if (ObjDesc->BufferField.BufferObj &&
384 ObjDesc->BufferField.BufferObj->Buffer.Node)
385 {
386 AcpiOsPrintf ("Buf [%4.4s]",
387 AcpiUtGetNodeName (
388 ObjDesc->BufferField.BufferObj->Buffer.Node));
389 }
390 break;
391
392
393 case ACPI_TYPE_LOCAL_REGION_FIELD:
394
395 AcpiOsPrintf ("Rgn [%4.4s]",
396 AcpiUtGetNodeName (
397 ObjDesc->CommonField.RegionObj->Region.Node));
398 break;
399
400
401 case ACPI_TYPE_LOCAL_BANK_FIELD:
402
403 AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
404 AcpiUtGetNodeName (
405 ObjDesc->CommonField.RegionObj->Region.Node),
406 AcpiUtGetNodeName (
407 ObjDesc->BankField.BankObj->CommonField.Node));
408 break;
409
410
411 case ACPI_TYPE_LOCAL_INDEX_FIELD:
412
413 AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
414 AcpiUtGetNodeName (
415 ObjDesc->IndexField.IndexObj->CommonField.Node),
416 AcpiUtGetNodeName (
417 ObjDesc->IndexField.DataObj->CommonField.Node));
418 break;
419
420
421 case ACPI_TYPE_LOCAL_ALIAS:
422 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
423
424 AcpiOsPrintf ("Target %4.4s (%p)\n",
425 AcpiUtGetNodeName (ObjDesc), ObjDesc);
426 break;
427
428 default:
429
430 AcpiOsPrintf ("Object %p\n", ObjDesc);
431 break;
432 }
433
434 /* Common field handling */
435
436 switch (Type)
437 {
438 case ACPI_TYPE_BUFFER_FIELD:
439 case ACPI_TYPE_LOCAL_REGION_FIELD:
440 case ACPI_TYPE_LOCAL_BANK_FIELD:
441 case ACPI_TYPE_LOCAL_INDEX_FIELD:
442
443 AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
444 (ObjDesc->CommonField.BaseByteOffset * 8)
445 + ObjDesc->CommonField.StartFieldBitOffset,
446 ObjDesc->CommonField.BitLength,
447 ObjDesc->CommonField.AccessByteWidth);
448 break;
449
450 default:
451 break;
452 }
453 break;
454
455
456 case ACPI_DISPLAY_OBJECTS:
457
458 AcpiOsPrintf ("O:%p", ObjDesc);
459 if (!ObjDesc)
460 {
461 /* No attached object, we are done */
462
463 AcpiOsPrintf ("\n");
464 return (AE_OK);
465 }
466
467 AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
468
469 switch (Type)
470 {
471 case ACPI_TYPE_METHOD:
472
473 /* Name is a Method and its AML offset/length are set */
474
475 AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
484
485 case ACPI_TYPE_STRING:
486
487 AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
488 ObjDesc->String.Length);
489 break;
490
491 case ACPI_TYPE_BUFFER:
492
493 AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
494 ObjDesc->Buffer.Length);
495 break;
496
497 default:
498
499 AcpiOsPrintf ("\n");
500 break;
501 }
502 break;
503
504
505 default:
506 AcpiOsPrintf ("\n");
507 break;
508 }
509
510 /* If debug turned off, done */
511
512 if (!(AcpiDbgLevel & ACPI_LV_VALUES))
513 {
514 return (AE_OK);
515 }
516
517 /* If there is an attached object, display it */
518
519 DbgLevel = AcpiDbgLevel;
520 AcpiDbgLevel = 0;
521 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
522 AcpiDbgLevel = DbgLevel;
523
524 /* Dump attached objects */
571 goto Cleanup;
572 }
573
574 /* Valid object, get the pointer to next level, if any */
575
576 switch (ObjType)
577 {
578 case ACPI_TYPE_BUFFER:
579 case ACPI_TYPE_STRING:
580 /*
581 * NOTE: takes advantage of common fields between string/buffer
582 */
583 BytesToDump = ObjDesc->String.Length;
584 ObjDesc = (void *) ObjDesc->String.Pointer;
585 AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
586 ObjDesc, BytesToDump);
587 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
588 goto Cleanup;
589
590 case ACPI_TYPE_BUFFER_FIELD:
591 ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
592 break;
593
594 case ACPI_TYPE_PACKAGE:
595 ObjDesc = (void *) ObjDesc->Package.Elements;
596 break;
597
598 case ACPI_TYPE_METHOD:
599 ObjDesc = (void *) ObjDesc->Method.AmlStart;
600 break;
601
602 case ACPI_TYPE_LOCAL_REGION_FIELD:
603 ObjDesc = (void *) ObjDesc->Field.RegionObj;
604 break;
605
606 case ACPI_TYPE_LOCAL_BANK_FIELD:
607 ObjDesc = (void *) ObjDesc->BankField.RegionObj;
608 break;
609
610 case ACPI_TYPE_LOCAL_INDEX_FIELD:
611 ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
612 break;
613
614 default:
615 goto Cleanup;
616 }
617
618 ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
619 }
620
621 Cleanup:
622 AcpiOsPrintf ("\n");
623 return (AE_OK);
624 }
625
626
627 /*******************************************************************************
628 *
629 * FUNCTION: AcpiNsDumpObjects
630 *
631 * PARAMETERS: Type - Object type to be dumped
632 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
633 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
634 * for an effectively unlimited depth.
668 if (ACPI_FAILURE (Status))
669 {
670 AcpiOsPrintf ("Could not acquire namespace mutex\n");
671 return;
672 }
673
674 Info.DebugLevel = ACPI_LV_TABLES;
675 Info.OwnerId = OwnerId;
676 Info.DisplayType = DisplayType;
677
678 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
679 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
680 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
681
682 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
683 }
684
685
686 /*******************************************************************************
687 *
688 * FUNCTION: AcpiNsDumpEntry
689 *
690 * PARAMETERS: Handle - Node to be dumped
691 * DebugLevel - Output level
692 *
693 * RETURN: None
694 *
695 * DESCRIPTION: Dump a single Node
696 *
697 ******************************************************************************/
698
699 void
700 AcpiNsDumpEntry (
701 ACPI_HANDLE Handle,
702 UINT32 DebugLevel)
703 {
704 ACPI_WALK_INFO Info;
705
706
707 ACPI_FUNCTION_ENTRY ();
749 * there is nothing to dump.
750 */
751 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
752 return_VOID;
753 }
754
755 if (ACPI_NS_ALL == SearchBase)
756 {
757 /* Entire namespace */
758
759 SearchHandle = AcpiGbl_RootNode;
760 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
761 }
762
763 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
764 ACPI_OWNER_ID_MAX, SearchHandle);
765 return_VOID;
766 }
767 #endif
768 #endif
769
|
1 /******************************************************************************
2 *
3 * Module Name: nsdump - table dumping routines for debug
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2014, 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 #define __NSDUMP_C__
45
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acnamesp.h"
49 #include "acoutput.h"
50
51
52 #define _COMPONENT ACPI_NAMESPACE
53 ACPI_MODULE_NAME ("nsdump")
54
55 /* Local prototypes */
56
57 #ifdef ACPI_OBSOLETE_FUNCTIONS
58 void
59 AcpiNsDumpRootDevices (
60 void);
61
62 static ACPI_STATUS
63 AcpiNsDumpOneDevice (
64 ACPI_HANDLE ObjHandle,
65 UINT32 Level,
66 void *Context,
67 void **ReturnValue);
68 #endif
69
70
71 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
72
73 static ACPI_STATUS
74 AcpiNsDumpOneObjectPath (
75 ACPI_HANDLE ObjHandle,
76 UINT32 Level,
77 void *Context,
78 void **ReturnValue);
79
80 static ACPI_STATUS
81 AcpiNsGetMaxDepth (
82 ACPI_HANDLE ObjHandle,
83 UINT32 Level,
84 void *Context,
85 void **ReturnValue);
86
87
88 /*******************************************************************************
89 *
90 * FUNCTION: AcpiNsPrintPathname
91 *
92 * PARAMETERS: NumSegments - Number of ACPI name segments
93 * Pathname - The compressed (internal) path
94 *
95 * RETURN: None
96 *
97 * DESCRIPTION: Print an object's full namespace pathname
98 *
99 ******************************************************************************/
100
101 void
102 AcpiNsPrintPathname (
103 UINT32 NumSegments,
104 char *Pathname)
105 {
106 UINT32 i;
107
108
109 ACPI_FUNCTION_NAME (NsPrintPathname);
110
111
112 /* Check if debug output enabled */
113
114 if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
115 {
116 return;
117 }
118
119 /* Print the entire name */
120
121 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
122
123 while (NumSegments)
124 {
125 for (i = 0; i < 4; i++)
126 {
127 ACPI_IS_PRINT (Pathname[i]) ?
128 AcpiOsPrintf ("%c", Pathname[i]) :
129 AcpiOsPrintf ("?");
130 }
131
132 Pathname += ACPI_NAME_SIZE;
133 NumSegments--;
134 if (NumSegments)
153 * RETURN: None
154 *
155 * DESCRIPTION: Print an object's full namespace pathname
156 * Manages allocation/freeing of a pathname buffer
157 *
158 ******************************************************************************/
159
160 void
161 AcpiNsDumpPathname (
162 ACPI_HANDLE Handle,
163 char *Msg,
164 UINT32 Level,
165 UINT32 Component)
166 {
167
168 ACPI_FUNCTION_TRACE (NsDumpPathname);
169
170
171 /* Do this only if the requested debug level and component are enabled */
172
173 if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
174 {
175 return_VOID;
176 }
177
178 /* Convert handle to a full pathname and print it (with supplied message) */
179
180 AcpiNsPrintNodePathname (Handle, Msg);
181 AcpiOsPrintf ("\n");
182 return_VOID;
183 }
184
185
186 /*******************************************************************************
187 *
188 * FUNCTION: AcpiNsDumpOneObject
189 *
190 * PARAMETERS: ObjHandle - Node to be dumped
191 * Level - Nesting level of the handle
192 * Context - Passed into WalkNamespace
193 * ReturnValue - Not used
272 AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
273
274 DbgLevel = AcpiDbgLevel;
275 AcpiDbgLevel = 0;
276 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
277 AcpiDbgLevel = DbgLevel;
278
279 /* Temp nodes are those nodes created by a control method */
280
281 if (ThisNode->Flags & ANOBJ_TEMPORARY)
282 {
283 AcpiOsPrintf ("(T) ");
284 }
285
286 switch (Info->DisplayType & ACPI_DISPLAY_MASK)
287 {
288 case ACPI_DISPLAY_SUMMARY:
289
290 if (!ObjDesc)
291 {
292 /* No attached object. Some types should always have an object */
293
294 switch (Type)
295 {
296 case ACPI_TYPE_INTEGER:
297 case ACPI_TYPE_PACKAGE:
298 case ACPI_TYPE_BUFFER:
299 case ACPI_TYPE_STRING:
300 case ACPI_TYPE_METHOD:
301
302 AcpiOsPrintf ("<No attached object>");
303 break;
304
305 default:
306
307 break;
308 }
309
310 AcpiOsPrintf ("\n");
311 return (AE_OK);
312 }
313
314 switch (Type)
315 {
316 case ACPI_TYPE_PROCESSOR:
317
318 AcpiOsPrintf ("ID %02X Len %02X Addr %p\n",
319 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
320 ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
321 break;
322
323 case ACPI_TYPE_DEVICE:
324
325 AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
326 break;
327
328 case ACPI_TYPE_METHOD:
329
330 AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
331 (UINT32) ObjDesc->Method.ParamCount,
332 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
333 break;
334
335 case ACPI_TYPE_INTEGER:
336
337 AcpiOsPrintf ("= %8.8X%8.8X\n",
338 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
339 break;
340
341 case ACPI_TYPE_PACKAGE:
342
343 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
344 {
345 AcpiOsPrintf ("Elements %.2X\n",
346 ObjDesc->Package.Count);
347 }
348 else
349 {
350 AcpiOsPrintf ("[Length not yet evaluated]\n");
351 }
352 break;
353
354 case ACPI_TYPE_BUFFER:
355
356 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
357 {
358 AcpiOsPrintf ("Len %.2X",
359 ObjDesc->Buffer.Length);
360
361 /* Dump some of the buffer */
362
363 if (ObjDesc->Buffer.Length > 0)
364 {
365 AcpiOsPrintf (" =");
366 for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
367 {
368 AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
369 }
370 }
371 AcpiOsPrintf ("\n");
372 }
373 else
374 {
375 AcpiOsPrintf ("[Length not yet evaluated]\n");
376 }
377 break;
378
379 case ACPI_TYPE_STRING:
380
381 AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
382 AcpiUtPrintString (ObjDesc->String.Pointer, 32);
383 AcpiOsPrintf ("\n");
384 break;
385
386 case ACPI_TYPE_REGION:
387
388 AcpiOsPrintf ("[%s]",
389 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
390 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
391 {
392 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
393 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
394 ObjDesc->Region.Length);
395 }
396 else
397 {
398 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
399 }
400 break;
401
402 case ACPI_TYPE_LOCAL_REFERENCE:
403
404 AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
405 break;
406
407 case ACPI_TYPE_BUFFER_FIELD:
408
409 if (ObjDesc->BufferField.BufferObj &&
410 ObjDesc->BufferField.BufferObj->Buffer.Node)
411 {
412 AcpiOsPrintf ("Buf [%4.4s]",
413 AcpiUtGetNodeName (
414 ObjDesc->BufferField.BufferObj->Buffer.Node));
415 }
416 break;
417
418 case ACPI_TYPE_LOCAL_REGION_FIELD:
419
420 AcpiOsPrintf ("Rgn [%4.4s]",
421 AcpiUtGetNodeName (
422 ObjDesc->CommonField.RegionObj->Region.Node));
423 break;
424
425 case ACPI_TYPE_LOCAL_BANK_FIELD:
426
427 AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
428 AcpiUtGetNodeName (
429 ObjDesc->CommonField.RegionObj->Region.Node),
430 AcpiUtGetNodeName (
431 ObjDesc->BankField.BankObj->CommonField.Node));
432 break;
433
434 case ACPI_TYPE_LOCAL_INDEX_FIELD:
435
436 AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
437 AcpiUtGetNodeName (
438 ObjDesc->IndexField.IndexObj->CommonField.Node),
439 AcpiUtGetNodeName (
440 ObjDesc->IndexField.DataObj->CommonField.Node));
441 break;
442
443 case ACPI_TYPE_LOCAL_ALIAS:
444 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
445
446 AcpiOsPrintf ("Target %4.4s (%p)\n",
447 AcpiUtGetNodeName (ObjDesc), ObjDesc);
448 break;
449
450 default:
451
452 AcpiOsPrintf ("Object %p\n", ObjDesc);
453 break;
454 }
455
456 /* Common field handling */
457
458 switch (Type)
459 {
460 case ACPI_TYPE_BUFFER_FIELD:
461 case ACPI_TYPE_LOCAL_REGION_FIELD:
462 case ACPI_TYPE_LOCAL_BANK_FIELD:
463 case ACPI_TYPE_LOCAL_INDEX_FIELD:
464
465 AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
466 (ObjDesc->CommonField.BaseByteOffset * 8)
467 + ObjDesc->CommonField.StartFieldBitOffset,
468 ObjDesc->CommonField.BitLength,
469 ObjDesc->CommonField.AccessByteWidth);
470 break;
471
472 default:
473
474 break;
475 }
476 break;
477
478 case ACPI_DISPLAY_OBJECTS:
479
480 AcpiOsPrintf ("O:%p", ObjDesc);
481 if (!ObjDesc)
482 {
483 /* No attached object, we are done */
484
485 AcpiOsPrintf ("\n");
486 return (AE_OK);
487 }
488
489 AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
490
491 switch (Type)
492 {
493 case ACPI_TYPE_METHOD:
494
495 /* Name is a Method and its AML offset/length are set */
496
497 AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
506
507 case ACPI_TYPE_STRING:
508
509 AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
510 ObjDesc->String.Length);
511 break;
512
513 case ACPI_TYPE_BUFFER:
514
515 AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
516 ObjDesc->Buffer.Length);
517 break;
518
519 default:
520
521 AcpiOsPrintf ("\n");
522 break;
523 }
524 break;
525
526 default:
527 AcpiOsPrintf ("\n");
528 break;
529 }
530
531 /* If debug turned off, done */
532
533 if (!(AcpiDbgLevel & ACPI_LV_VALUES))
534 {
535 return (AE_OK);
536 }
537
538 /* If there is an attached object, display it */
539
540 DbgLevel = AcpiDbgLevel;
541 AcpiDbgLevel = 0;
542 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
543 AcpiDbgLevel = DbgLevel;
544
545 /* Dump attached objects */
592 goto Cleanup;
593 }
594
595 /* Valid object, get the pointer to next level, if any */
596
597 switch (ObjType)
598 {
599 case ACPI_TYPE_BUFFER:
600 case ACPI_TYPE_STRING:
601 /*
602 * NOTE: takes advantage of common fields between string/buffer
603 */
604 BytesToDump = ObjDesc->String.Length;
605 ObjDesc = (void *) ObjDesc->String.Pointer;
606 AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
607 ObjDesc, BytesToDump);
608 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
609 goto Cleanup;
610
611 case ACPI_TYPE_BUFFER_FIELD:
612
613 ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
614 break;
615
616 case ACPI_TYPE_PACKAGE:
617
618 ObjDesc = (void *) ObjDesc->Package.Elements;
619 break;
620
621 case ACPI_TYPE_METHOD:
622
623 ObjDesc = (void *) ObjDesc->Method.AmlStart;
624 break;
625
626 case ACPI_TYPE_LOCAL_REGION_FIELD:
627
628 ObjDesc = (void *) ObjDesc->Field.RegionObj;
629 break;
630
631 case ACPI_TYPE_LOCAL_BANK_FIELD:
632
633 ObjDesc = (void *) ObjDesc->BankField.RegionObj;
634 break;
635
636 case ACPI_TYPE_LOCAL_INDEX_FIELD:
637
638 ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
639 break;
640
641 default:
642
643 goto Cleanup;
644 }
645
646 ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
647 }
648
649 Cleanup:
650 AcpiOsPrintf ("\n");
651 return (AE_OK);
652 }
653
654
655 /*******************************************************************************
656 *
657 * FUNCTION: AcpiNsDumpObjects
658 *
659 * PARAMETERS: Type - Object type to be dumped
660 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
661 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
662 * for an effectively unlimited depth.
696 if (ACPI_FAILURE (Status))
697 {
698 AcpiOsPrintf ("Could not acquire namespace mutex\n");
699 return;
700 }
701
702 Info.DebugLevel = ACPI_LV_TABLES;
703 Info.OwnerId = OwnerId;
704 Info.DisplayType = DisplayType;
705
706 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
707 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
708 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
709
710 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
711 }
712
713
714 /*******************************************************************************
715 *
716 * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
717 *
718 * PARAMETERS: ObjHandle - Node to be dumped
719 * Level - Nesting level of the handle
720 * Context - Passed into WalkNamespace
721 * ReturnValue - Not used
722 *
723 * RETURN: Status
724 *
725 * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
726 * computes the maximum nesting depth in the namespace tree, in
727 * order to simplify formatting in AcpiNsDumpOneObjectPath.
728 * These procedures are UserFunctions called by AcpiNsWalkNamespace.
729 *
730 ******************************************************************************/
731
732 static ACPI_STATUS
733 AcpiNsDumpOneObjectPath (
734 ACPI_HANDLE ObjHandle,
735 UINT32 Level,
736 void *Context,
737 void **ReturnValue)
738 {
739 UINT32 MaxLevel = *((UINT32 *) Context);
740 char *Pathname;
741 ACPI_NAMESPACE_NODE *Node;
742 int PathIndent;
743
744
745 if (!ObjHandle)
746 {
747 return (AE_OK);
748 }
749
750 Node = AcpiNsValidateHandle (ObjHandle);
751 if (!Node)
752 {
753 /* Ignore bad node during namespace walk */
754
755 return (AE_OK);
756 }
757
758 Pathname = AcpiNsGetExternalPathname (Node);
759
760 PathIndent = 1;
761 if (Level <= MaxLevel)
762 {
763 PathIndent = MaxLevel - Level + 1;
764 }
765
766 AcpiOsPrintf ("%2d%*s%-12s%*s",
767 Level, Level, " ", AcpiUtGetTypeName (Node->Type),
768 PathIndent, " ");
769
770 AcpiOsPrintf ("%s\n", &Pathname[1]);
771 ACPI_FREE (Pathname);
772 return (AE_OK);
773 }
774
775
776 static ACPI_STATUS
777 AcpiNsGetMaxDepth (
778 ACPI_HANDLE ObjHandle,
779 UINT32 Level,
780 void *Context,
781 void **ReturnValue)
782 {
783 UINT32 *MaxLevel = (UINT32 *) Context;
784
785
786 if (Level > *MaxLevel)
787 {
788 *MaxLevel = Level;
789 }
790 return (AE_OK);
791 }
792
793
794 /*******************************************************************************
795 *
796 * FUNCTION: AcpiNsDumpObjectPaths
797 *
798 * PARAMETERS: Type - Object type to be dumped
799 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
800 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
801 * for an effectively unlimited depth.
802 * OwnerId - Dump only objects owned by this ID. Use
803 * ACPI_UINT32_MAX to match all owners.
804 * StartHandle - Where in namespace to start/end search
805 *
806 * RETURN: None
807 *
808 * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
809 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
810 *
811 ******************************************************************************/
812
813 void
814 AcpiNsDumpObjectPaths (
815 ACPI_OBJECT_TYPE Type,
816 UINT8 DisplayType,
817 UINT32 MaxDepth,
818 ACPI_OWNER_ID OwnerId,
819 ACPI_HANDLE StartHandle)
820 {
821 ACPI_STATUS Status;
822 UINT32 MaxLevel = 0;
823
824
825 ACPI_FUNCTION_ENTRY ();
826
827
828 /*
829 * Just lock the entire namespace for the duration of the dump.
830 * We don't want any changes to the namespace during this time,
831 * especially the temporary nodes since we are going to display
832 * them also.
833 */
834 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
835 if (ACPI_FAILURE (Status))
836 {
837 AcpiOsPrintf ("Could not acquire namespace mutex\n");
838 return;
839 }
840
841 /* Get the max depth of the namespace tree, for formatting later */
842
843 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
844 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
845 AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
846
847 /* Now dump the entire namespace */
848
849 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
850 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
851 AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
852
853 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
854 }
855
856
857 /*******************************************************************************
858 *
859 * FUNCTION: AcpiNsDumpEntry
860 *
861 * PARAMETERS: Handle - Node to be dumped
862 * DebugLevel - Output level
863 *
864 * RETURN: None
865 *
866 * DESCRIPTION: Dump a single Node
867 *
868 ******************************************************************************/
869
870 void
871 AcpiNsDumpEntry (
872 ACPI_HANDLE Handle,
873 UINT32 DebugLevel)
874 {
875 ACPI_WALK_INFO Info;
876
877
878 ACPI_FUNCTION_ENTRY ();
920 * there is nothing to dump.
921 */
922 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
923 return_VOID;
924 }
925
926 if (ACPI_NS_ALL == SearchBase)
927 {
928 /* Entire namespace */
929
930 SearchHandle = AcpiGbl_RootNode;
931 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
932 }
933
934 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
935 ACPI_OWNER_ID_MAX, SearchHandle);
936 return_VOID;
937 }
938 #endif
939 #endif
|