Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/namespace/nsdump.c
+++ new/usr/src/common/acpica/components/namespace/nsdump.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: nsdump - table dumping routines for debug
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44 #define __NSDUMP_C__
45 45
46 46 #include "acpi.h"
47 47 #include "accommon.h"
48 48 #include "acnamesp.h"
49 +#include "acoutput.h"
49 50
50 51
51 52 #define _COMPONENT ACPI_NAMESPACE
52 53 ACPI_MODULE_NAME ("nsdump")
53 54
54 55 /* Local prototypes */
55 56
56 57 #ifdef ACPI_OBSOLETE_FUNCTIONS
57 58 void
58 59 AcpiNsDumpRootDevices (
59 60 void);
60 61
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
61 62 static ACPI_STATUS
62 63 AcpiNsDumpOneDevice (
63 64 ACPI_HANDLE ObjHandle,
64 65 UINT32 Level,
65 66 void *Context,
66 67 void **ReturnValue);
67 68 #endif
68 69
69 70
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 +
71 88 /*******************************************************************************
72 89 *
73 90 * FUNCTION: AcpiNsPrintPathname
74 91 *
75 92 * PARAMETERS: NumSegments - Number of ACPI name segments
76 93 * Pathname - The compressed (internal) path
77 94 *
78 95 * RETURN: None
79 96 *
80 97 * DESCRIPTION: Print an object's full namespace pathname
81 98 *
82 99 ******************************************************************************/
83 100
84 101 void
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
85 102 AcpiNsPrintPathname (
86 103 UINT32 NumSegments,
87 104 char *Pathname)
88 105 {
89 106 UINT32 i;
90 107
91 108
92 109 ACPI_FUNCTION_NAME (NsPrintPathname);
93 110
94 111
95 - if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
112 + /* Check if debug output enabled */
113 +
114 + if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
96 115 {
97 116 return;
98 117 }
99 118
100 119 /* Print the entire name */
101 120
102 121 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
103 122
104 123 while (NumSegments)
105 124 {
106 125 for (i = 0; i < 4; i++)
107 126 {
108 127 ACPI_IS_PRINT (Pathname[i]) ?
109 128 AcpiOsPrintf ("%c", Pathname[i]) :
110 129 AcpiOsPrintf ("?");
111 130 }
112 131
113 132 Pathname += ACPI_NAME_SIZE;
114 133 NumSegments--;
115 134 if (NumSegments)
116 135 {
117 136 AcpiOsPrintf (".");
118 137 }
119 138 }
120 139
121 140 AcpiOsPrintf ("]\n");
122 141 }
123 142
124 143
125 144 /*******************************************************************************
126 145 *
127 146 * FUNCTION: AcpiNsDumpPathname
128 147 *
129 148 * PARAMETERS: Handle - Object
130 149 * Msg - Prefix message
131 150 * Level - Desired debug level
132 151 * Component - Caller's component ID
133 152 *
134 153 * RETURN: None
135 154 *
136 155 * DESCRIPTION: Print an object's full namespace pathname
137 156 * Manages allocation/freeing of a pathname buffer
138 157 *
139 158 ******************************************************************************/
140 159
141 160 void
142 161 AcpiNsDumpPathname (
143 162 ACPI_HANDLE Handle,
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
144 163 char *Msg,
145 164 UINT32 Level,
146 165 UINT32 Component)
147 166 {
148 167
149 168 ACPI_FUNCTION_TRACE (NsDumpPathname);
150 169
151 170
152 171 /* Do this only if the requested debug level and component are enabled */
153 172
154 - if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
173 + if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
155 174 {
156 175 return_VOID;
157 176 }
158 177
159 178 /* Convert handle to a full pathname and print it (with supplied message) */
160 179
161 180 AcpiNsPrintNodePathname (Handle, Msg);
162 181 AcpiOsPrintf ("\n");
163 182 return_VOID;
164 183 }
165 184
166 185
167 186 /*******************************************************************************
168 187 *
169 188 * FUNCTION: AcpiNsDumpOneObject
170 189 *
171 190 * PARAMETERS: ObjHandle - Node to be dumped
172 191 * Level - Nesting level of the handle
173 192 * Context - Passed into WalkNamespace
174 193 * ReturnValue - Not used
175 194 *
176 195 * RETURN: Status
177 196 *
178 197 * DESCRIPTION: Dump a single Node
179 198 * This procedure is a UserFunction called by AcpiNsWalkNamespace.
180 199 *
181 200 ******************************************************************************/
182 201
183 202 ACPI_STATUS
184 203 AcpiNsDumpOneObject (
185 204 ACPI_HANDLE ObjHandle,
186 205 UINT32 Level,
187 206 void *Context,
188 207 void **ReturnValue)
189 208 {
190 209 ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
191 210 ACPI_NAMESPACE_NODE *ThisNode;
192 211 ACPI_OPERAND_OBJECT *ObjDesc = NULL;
193 212 ACPI_OBJECT_TYPE ObjType;
194 213 ACPI_OBJECT_TYPE Type;
195 214 UINT32 BytesToDump;
196 215 UINT32 DbgLevel;
197 216 UINT32 i;
198 217
199 218
200 219 ACPI_FUNCTION_NAME (NsDumpOneObject);
201 220
202 221
203 222 /* Is output enabled? */
204 223
205 224 if (!(AcpiDbgLevel & Info->DebugLevel))
206 225 {
207 226 return (AE_OK);
208 227 }
209 228
210 229 if (!ObjHandle)
211 230 {
212 231 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
213 232 return (AE_OK);
214 233 }
215 234
216 235 ThisNode = AcpiNsValidateHandle (ObjHandle);
217 236 if (!ThisNode)
218 237 {
219 238 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
220 239 ObjHandle));
221 240 return (AE_OK);
222 241 }
223 242
224 243 Type = ThisNode->Type;
225 244
226 245 /* Check if the owner matches */
227 246
228 247 if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
229 248 (Info->OwnerId != ThisNode->OwnerId))
230 249 {
231 250 return (AE_OK);
232 251 }
233 252
234 253 if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
235 254 {
236 255 /* Indent the object according to the level */
237 256
238 257 AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
239 258
240 259 /* Check the node type and name */
241 260
242 261 if (Type > ACPI_TYPE_LOCAL_MAX)
243 262 {
244 263 ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type));
245 264 }
246 265
247 266 AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
248 267 }
249 268
250 269 /* Now we can print out the pertinent information */
251 270
252 271 AcpiOsPrintf (" %-12s %p %2.2X ",
253 272 AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
254 273
255 274 DbgLevel = AcpiDbgLevel;
256 275 AcpiDbgLevel = 0;
257 276 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
258 277 AcpiDbgLevel = DbgLevel;
259 278
260 279 /* Temp nodes are those nodes created by a control method */
261 280
262 281 if (ThisNode->Flags & ANOBJ_TEMPORARY)
↓ open down ↓ |
98 lines elided |
↑ open up ↑ |
263 282 {
264 283 AcpiOsPrintf ("(T) ");
265 284 }
266 285
267 286 switch (Info->DisplayType & ACPI_DISPLAY_MASK)
268 287 {
269 288 case ACPI_DISPLAY_SUMMARY:
270 289
271 290 if (!ObjDesc)
272 291 {
273 - /* No attached object, we are done */
292 + /* No attached object. Some types should always have an object */
274 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 +
275 310 AcpiOsPrintf ("\n");
276 311 return (AE_OK);
277 312 }
278 313
279 314 switch (Type)
280 315 {
281 316 case ACPI_TYPE_PROCESSOR:
282 317
283 - AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
318 + AcpiOsPrintf ("ID %02X Len %02X Addr %p\n",
284 319 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
285 320 ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
286 321 break;
287 322
288 -
289 323 case ACPI_TYPE_DEVICE:
290 324
291 325 AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
292 326 break;
293 327
294 -
295 328 case ACPI_TYPE_METHOD:
296 329
297 330 AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
298 331 (UINT32) ObjDesc->Method.ParamCount,
299 332 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
300 333 break;
301 334
302 -
303 335 case ACPI_TYPE_INTEGER:
304 336
305 337 AcpiOsPrintf ("= %8.8X%8.8X\n",
306 338 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
307 339 break;
308 340
309 -
310 341 case ACPI_TYPE_PACKAGE:
311 342
312 343 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
313 344 {
314 345 AcpiOsPrintf ("Elements %.2X\n",
315 346 ObjDesc->Package.Count);
316 347 }
317 348 else
318 349 {
319 350 AcpiOsPrintf ("[Length not yet evaluated]\n");
320 351 }
321 352 break;
322 353
323 -
324 354 case ACPI_TYPE_BUFFER:
325 355
326 356 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
327 357 {
328 358 AcpiOsPrintf ("Len %.2X",
329 359 ObjDesc->Buffer.Length);
330 360
331 361 /* Dump some of the buffer */
332 362
333 363 if (ObjDesc->Buffer.Length > 0)
334 364 {
335 365 AcpiOsPrintf (" =");
336 366 for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
337 367 {
338 368 AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
339 369 }
340 370 }
341 371 AcpiOsPrintf ("\n");
342 372 }
343 373 else
344 374 {
345 375 AcpiOsPrintf ("[Length not yet evaluated]\n");
346 376 }
347 377 break;
348 378
349 -
350 379 case ACPI_TYPE_STRING:
351 380
352 381 AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
353 382 AcpiUtPrintString (ObjDesc->String.Pointer, 32);
354 383 AcpiOsPrintf ("\n");
355 384 break;
356 385
357 -
358 386 case ACPI_TYPE_REGION:
359 387
360 388 AcpiOsPrintf ("[%s]",
361 389 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
362 390 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
363 391 {
364 392 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
365 393 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
366 394 ObjDesc->Region.Length);
367 395 }
368 396 else
369 397 {
370 398 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
371 399 }
372 400 break;
373 401
374 -
375 402 case ACPI_TYPE_LOCAL_REFERENCE:
376 403
377 404 AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
378 405 break;
379 406
380 -
381 407 case ACPI_TYPE_BUFFER_FIELD:
382 408
383 409 if (ObjDesc->BufferField.BufferObj &&
384 410 ObjDesc->BufferField.BufferObj->Buffer.Node)
385 411 {
386 412 AcpiOsPrintf ("Buf [%4.4s]",
387 413 AcpiUtGetNodeName (
388 414 ObjDesc->BufferField.BufferObj->Buffer.Node));
389 415 }
390 416 break;
391 417
392 -
393 418 case ACPI_TYPE_LOCAL_REGION_FIELD:
394 419
395 420 AcpiOsPrintf ("Rgn [%4.4s]",
396 421 AcpiUtGetNodeName (
397 422 ObjDesc->CommonField.RegionObj->Region.Node));
398 423 break;
399 424
400 -
401 425 case ACPI_TYPE_LOCAL_BANK_FIELD:
402 426
403 427 AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
404 428 AcpiUtGetNodeName (
405 429 ObjDesc->CommonField.RegionObj->Region.Node),
406 430 AcpiUtGetNodeName (
407 431 ObjDesc->BankField.BankObj->CommonField.Node));
408 432 break;
409 433
410 -
411 434 case ACPI_TYPE_LOCAL_INDEX_FIELD:
412 435
413 436 AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
414 437 AcpiUtGetNodeName (
415 438 ObjDesc->IndexField.IndexObj->CommonField.Node),
416 439 AcpiUtGetNodeName (
417 440 ObjDesc->IndexField.DataObj->CommonField.Node));
418 441 break;
419 442
420 -
421 443 case ACPI_TYPE_LOCAL_ALIAS:
422 444 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
423 445
424 446 AcpiOsPrintf ("Target %4.4s (%p)\n",
425 447 AcpiUtGetNodeName (ObjDesc), ObjDesc);
426 448 break;
427 449
428 450 default:
429 451
430 452 AcpiOsPrintf ("Object %p\n", ObjDesc);
431 453 break;
432 454 }
433 455
434 456 /* Common field handling */
435 457
436 458 switch (Type)
437 459 {
438 460 case ACPI_TYPE_BUFFER_FIELD:
439 461 case ACPI_TYPE_LOCAL_REGION_FIELD:
440 462 case ACPI_TYPE_LOCAL_BANK_FIELD:
↓ open down ↓ |
10 lines elided |
↑ open up ↑ |
441 463 case ACPI_TYPE_LOCAL_INDEX_FIELD:
442 464
443 465 AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
444 466 (ObjDesc->CommonField.BaseByteOffset * 8)
445 467 + ObjDesc->CommonField.StartFieldBitOffset,
446 468 ObjDesc->CommonField.BitLength,
447 469 ObjDesc->CommonField.AccessByteWidth);
448 470 break;
449 471
450 472 default:
473 +
451 474 break;
452 475 }
453 476 break;
454 477
455 -
456 478 case ACPI_DISPLAY_OBJECTS:
457 479
458 480 AcpiOsPrintf ("O:%p", ObjDesc);
459 481 if (!ObjDesc)
460 482 {
461 483 /* No attached object, we are done */
462 484
463 485 AcpiOsPrintf ("\n");
464 486 return (AE_OK);
465 487 }
466 488
467 489 AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
468 490
469 491 switch (Type)
470 492 {
471 493 case ACPI_TYPE_METHOD:
472 494
473 495 /* Name is a Method and its AML offset/length are set */
474 496
475 497 AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
476 498 ObjDesc->Method.AmlLength);
477 499 break;
478 500
479 501 case ACPI_TYPE_INTEGER:
480 502
481 503 AcpiOsPrintf (" I:%8.8X8.8%X\n",
482 504 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
483 505 break;
484 506
485 507 case ACPI_TYPE_STRING:
486 508
487 509 AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
488 510 ObjDesc->String.Length);
489 511 break;
490 512
491 513 case ACPI_TYPE_BUFFER:
492 514
493 515 AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
494 516 ObjDesc->Buffer.Length);
495 517 break;
496 518
497 519 default:
498 520
499 521 AcpiOsPrintf ("\n");
500 522 break;
501 523 }
502 524 break;
503 525
504 -
505 526 default:
506 527 AcpiOsPrintf ("\n");
507 528 break;
508 529 }
509 530
510 531 /* If debug turned off, done */
511 532
512 533 if (!(AcpiDbgLevel & ACPI_LV_VALUES))
513 534 {
514 535 return (AE_OK);
515 536 }
516 537
517 538 /* If there is an attached object, display it */
518 539
519 540 DbgLevel = AcpiDbgLevel;
520 541 AcpiDbgLevel = 0;
521 542 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
522 543 AcpiDbgLevel = DbgLevel;
523 544
524 545 /* Dump attached objects */
525 546
526 547 while (ObjDesc)
527 548 {
528 549 ObjType = ACPI_TYPE_INVALID;
529 550 AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
530 551
531 552 /* Decode the type of attached object and dump the contents */
532 553
533 554 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
534 555 {
535 556 case ACPI_DESC_TYPE_NAMED:
536 557
537 558 AcpiOsPrintf ("(Ptr to Node)\n");
538 559 BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
539 560 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
540 561 break;
541 562
542 563 case ACPI_DESC_TYPE_OPERAND:
543 564
544 565 ObjType = ObjDesc->Common.Type;
545 566
546 567 if (ObjType > ACPI_TYPE_LOCAL_MAX)
547 568 {
548 569 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
549 570 ObjType);
550 571 BytesToDump = 32;
551 572 }
552 573 else
553 574 {
554 575 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n",
555 576 ObjType, AcpiUtGetTypeName (ObjType));
556 577 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
557 578 }
558 579
559 580 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
560 581 break;
561 582
562 583 default:
563 584
564 585 break;
565 586 }
566 587
567 588 /* If value is NOT an internal object, we are done */
568 589
569 590 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
570 591 {
571 592 goto Cleanup;
572 593 }
573 594
574 595 /* Valid object, get the pointer to next level, if any */
575 596
576 597 switch (ObjType)
577 598 {
578 599 case ACPI_TYPE_BUFFER:
579 600 case ACPI_TYPE_STRING:
580 601 /*
↓ open down ↓ |
66 lines elided |
↑ open up ↑ |
581 602 * NOTE: takes advantage of common fields between string/buffer
582 603 */
583 604 BytesToDump = ObjDesc->String.Length;
584 605 ObjDesc = (void *) ObjDesc->String.Pointer;
585 606 AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
586 607 ObjDesc, BytesToDump);
587 608 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
588 609 goto Cleanup;
589 610
590 611 case ACPI_TYPE_BUFFER_FIELD:
612 +
591 613 ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
592 614 break;
593 615
594 616 case ACPI_TYPE_PACKAGE:
617 +
595 618 ObjDesc = (void *) ObjDesc->Package.Elements;
596 619 break;
597 620
598 621 case ACPI_TYPE_METHOD:
622 +
599 623 ObjDesc = (void *) ObjDesc->Method.AmlStart;
600 624 break;
601 625
602 626 case ACPI_TYPE_LOCAL_REGION_FIELD:
627 +
603 628 ObjDesc = (void *) ObjDesc->Field.RegionObj;
604 629 break;
605 630
606 631 case ACPI_TYPE_LOCAL_BANK_FIELD:
632 +
607 633 ObjDesc = (void *) ObjDesc->BankField.RegionObj;
608 634 break;
609 635
610 636 case ACPI_TYPE_LOCAL_INDEX_FIELD:
637 +
611 638 ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
612 639 break;
613 640
614 641 default:
642 +
615 643 goto Cleanup;
616 644 }
617 645
618 646 ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
619 647 }
620 648
621 649 Cleanup:
622 650 AcpiOsPrintf ("\n");
623 651 return (AE_OK);
624 652 }
625 653
626 654
627 655 /*******************************************************************************
628 656 *
629 657 * FUNCTION: AcpiNsDumpObjects
630 658 *
631 659 * PARAMETERS: Type - Object type to be dumped
632 660 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
633 661 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
634 662 * for an effectively unlimited depth.
635 663 * OwnerId - Dump only objects owned by this ID. Use
636 664 * ACPI_UINT32_MAX to match all owners.
637 665 * StartHandle - Where in namespace to start/end search
638 666 *
639 667 * RETURN: None
640 668 *
641 669 * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
642 670 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
643 671 *
644 672 ******************************************************************************/
645 673
646 674 void
647 675 AcpiNsDumpObjects (
648 676 ACPI_OBJECT_TYPE Type,
649 677 UINT8 DisplayType,
650 678 UINT32 MaxDepth,
651 679 ACPI_OWNER_ID OwnerId,
652 680 ACPI_HANDLE StartHandle)
653 681 {
654 682 ACPI_WALK_INFO Info;
655 683 ACPI_STATUS Status;
656 684
657 685
658 686 ACPI_FUNCTION_ENTRY ();
659 687
660 688
661 689 /*
662 690 * Just lock the entire namespace for the duration of the dump.
663 691 * We don't want any changes to the namespace during this time,
664 692 * especially the temporary nodes since we are going to display
665 693 * them also.
666 694 */
667 695 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
668 696 if (ACPI_FAILURE (Status))
669 697 {
670 698 AcpiOsPrintf ("Could not acquire namespace mutex\n");
671 699 return;
672 700 }
673 701
674 702 Info.DebugLevel = ACPI_LV_TABLES;
675 703 Info.OwnerId = OwnerId;
676 704 Info.DisplayType = DisplayType;
677 705
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
678 706 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
679 707 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
680 708 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
681 709
682 710 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
683 711 }
684 712
685 713
686 714 /*******************************************************************************
687 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 + *
688 859 * FUNCTION: AcpiNsDumpEntry
689 860 *
690 861 * PARAMETERS: Handle - Node to be dumped
691 862 * DebugLevel - Output level
692 863 *
693 864 * RETURN: None
694 865 *
695 866 * DESCRIPTION: Dump a single Node
696 867 *
697 868 ******************************************************************************/
698 869
699 870 void
700 871 AcpiNsDumpEntry (
701 872 ACPI_HANDLE Handle,
702 873 UINT32 DebugLevel)
703 874 {
704 875 ACPI_WALK_INFO Info;
705 876
706 877
707 878 ACPI_FUNCTION_ENTRY ();
708 879
709 880
710 881 Info.DebugLevel = DebugLevel;
711 882 Info.OwnerId = ACPI_OWNER_ID_MAX;
712 883 Info.DisplayType = ACPI_DISPLAY_SUMMARY;
713 884
714 885 (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
715 886 }
716 887
717 888
718 889 #ifdef ACPI_ASL_COMPILER
719 890 /*******************************************************************************
720 891 *
721 892 * FUNCTION: AcpiNsDumpTables
722 893 *
723 894 * PARAMETERS: SearchBase - Root of subtree to be dumped, or
724 895 * NS_ALL to dump the entire namespace
725 - * MaxDepth - Maximum depth of dump. Use INT_MAX
896 + * MaxDepth - Maximum depth of dump. Use INT_MAX
726 897 * for an effectively unlimited depth.
727 898 *
728 899 * RETURN: None
729 900 *
730 901 * DESCRIPTION: Dump the name space, or a portion of it.
731 902 *
732 903 ******************************************************************************/
733 904
734 905 void
735 906 AcpiNsDumpTables (
736 907 ACPI_HANDLE SearchBase,
737 908 UINT32 MaxDepth)
738 909 {
739 910 ACPI_HANDLE SearchHandle = SearchBase;
740 911
741 912
742 913 ACPI_FUNCTION_TRACE (NsDumpTables);
743 914
744 915
745 916 if (!AcpiGbl_RootNode)
746 917 {
747 918 /*
748 919 * If the name space has not been initialized,
749 920 * there is nothing to dump.
750 921 */
751 922 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
752 923 return_VOID;
753 924 }
754 925
755 926 if (ACPI_NS_ALL == SearchBase)
756 927 {
757 928 /* Entire namespace */
758 929
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
759 930 SearchHandle = AcpiGbl_RootNode;
760 931 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
761 932 }
762 933
763 934 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
764 935 ACPI_OWNER_ID_MAX, SearchHandle);
765 936 return_VOID;
766 937 }
767 938 #endif
768 939 #endif
769 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX