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/debugger/dbnames.c
+++ new/usr/src/common/acpica/components/debugger/dbnames.c
1 1 /*******************************************************************************
2 2 *
3 3 * Module Name: dbnames - Debugger commands for the acpi namespace
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
45 45 #include "acpi.h"
46 46 #include "accommon.h"
47 47 #include "acnamesp.h"
48 48 #include "acdebug.h"
49 +#include "acpredef.h"
49 50
50 51
51 52 #ifdef ACPI_DEBUGGER
52 53
53 54 #define _COMPONENT ACPI_CA_DEBUGGER
54 55 ACPI_MODULE_NAME ("dbnames")
55 56
56 57
57 58 /* Local prototypes */
58 59
59 60 static ACPI_STATUS
60 61 AcpiDbWalkAndMatchName (
61 62 ACPI_HANDLE ObjHandle,
62 63 UINT32 NestingLevel,
63 64 void *Context,
64 65 void **ReturnValue);
65 66
66 67 static ACPI_STATUS
67 68 AcpiDbWalkForPredefinedNames (
68 69 ACPI_HANDLE ObjHandle,
69 70 UINT32 NestingLevel,
70 71 void *Context,
71 72 void **ReturnValue);
72 73
73 74 static ACPI_STATUS
74 75 AcpiDbWalkForSpecificObjects (
75 76 ACPI_HANDLE ObjHandle,
76 77 UINT32 NestingLevel,
77 78 void *Context,
78 79 void **ReturnValue);
79 80
80 81 static ACPI_STATUS
81 82 AcpiDbIntegrityWalk (
82 83 ACPI_HANDLE ObjHandle,
83 84 UINT32 NestingLevel,
84 85 void *Context,
85 86 void **ReturnValue);
86 87
87 88 static ACPI_STATUS
88 89 AcpiDbWalkForReferences (
89 90 ACPI_HANDLE ObjHandle,
90 91 UINT32 NestingLevel,
91 92 void *Context,
92 93 void **ReturnValue);
93 94
94 95 static ACPI_STATUS
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
95 96 AcpiDbBusWalk (
96 97 ACPI_HANDLE ObjHandle,
97 98 UINT32 NestingLevel,
98 99 void *Context,
99 100 void **ReturnValue);
100 101
101 102 /*
102 103 * Arguments for the Objects command
103 104 * These object types map directly to the ACPI_TYPES
104 105 */
105 -static ARGUMENT_INFO AcpiDbObjectTypes [] =
106 +static ACPI_DB_ARGUMENT_INFO AcpiDbObjectTypes [] =
106 107 {
107 108 {"ANY"},
108 109 {"INTEGERS"},
109 110 {"STRINGS"},
110 111 {"BUFFERS"},
111 112 {"PACKAGES"},
112 113 {"FIELDS"},
113 114 {"DEVICES"},
114 115 {"EVENTS"},
115 116 {"METHODS"},
116 117 {"MUTEXES"},
117 118 {"REGIONS"},
118 119 {"POWERRESOURCES"},
119 120 {"PROCESSORS"},
120 121 {"THERMALZONES"},
121 122 {"BUFFERFIELDS"},
122 123 {"DDBHANDLES"},
123 124 {"DEBUG"},
124 125 {"REGIONFIELDS"},
125 126 {"BANKFIELDS"},
126 127 {"INDEXFIELDS"},
127 128 {"REFERENCES"},
128 129 {"ALIAS"},
129 130 {NULL} /* Must be null terminated */
130 131 };
131 132
132 133
133 134 /*******************************************************************************
134 135 *
135 136 * FUNCTION: AcpiDbSetScope
136 137 *
137 138 * PARAMETERS: Name - New scope path
138 139 *
139 140 * RETURN: Status
140 141 *
141 142 * DESCRIPTION: Set the "current scope" as maintained by this utility.
142 143 * The scope is used as a prefix to ACPI paths.
143 144 *
144 145 ******************************************************************************/
145 146
146 147 void
147 148 AcpiDbSetScope (
148 149 char *Name)
149 150 {
150 151 ACPI_STATUS Status;
151 152 ACPI_NAMESPACE_NODE *Node;
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
152 153
153 154
154 155 if (!Name || Name[0] == 0)
155 156 {
156 157 AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
157 158 return;
158 159 }
159 160
160 161 AcpiDbPrepNamestring (Name);
161 162
162 - if (Name[0] == '\\')
163 + if (ACPI_IS_ROOT_PREFIX (Name[0]))
163 164 {
164 165 /* Validate new scope from the root */
165 166
166 167 Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
167 168 &Node);
168 169 if (ACPI_FAILURE (Status))
169 170 {
170 171 goto ErrorExit;
171 172 }
172 173
173 - ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
174 - ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
174 + AcpiGbl_DbScopeBuf[0] = 0;
175 175 }
176 176 else
177 177 {
178 178 /* Validate new scope relative to old scope */
179 179
180 180 Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
181 181 &Node);
182 182 if (ACPI_FAILURE (Status))
183 183 {
184 184 goto ErrorExit;
185 185 }
186 + }
186 187
187 - ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
188 - ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
188 + /* Build the final pathname */
189 +
190 + if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
191 + Name))
192 + {
193 + Status = AE_BUFFER_OVERFLOW;
194 + goto ErrorExit;
189 195 }
190 196
197 + if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
198 + "\\"))
199 + {
200 + Status = AE_BUFFER_OVERFLOW;
201 + goto ErrorExit;
202 + }
203 +
191 204 AcpiGbl_DbScopeNode = Node;
192 205 AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
193 206 return;
194 207
195 208 ErrorExit:
196 209
197 210 AcpiOsPrintf ("Could not attach scope: %s, %s\n",
198 211 Name, AcpiFormatException (Status));
199 212 }
200 213
201 214
202 215 /*******************************************************************************
203 216 *
204 217 * FUNCTION: AcpiDbDumpNamespace
205 218 *
206 219 * PARAMETERS: StartArg - Node to begin namespace dump
207 220 * DepthArg - Maximum tree depth to be dumped
208 221 *
209 222 * RETURN: None
210 223 *
211 - * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
224 + * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
212 225 * with type and other information.
213 226 *
214 227 ******************************************************************************/
215 228
216 229 void
217 230 AcpiDbDumpNamespace (
218 231 char *StartArg,
219 232 char *DepthArg)
220 233 {
221 234 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
222 235 UINT32 MaxDepth = ACPI_UINT32_MAX;
223 236
224 237
225 238 /* No argument given, just start at the root and dump entire namespace */
226 239
227 240 if (StartArg)
228 241 {
229 242 SubtreeEntry = AcpiDbConvertToNode (StartArg);
230 243 if (!SubtreeEntry)
231 244 {
232 245 return;
233 246 }
234 247
235 248 /* Now we can check for the depth argument */
236 249
237 250 if (DepthArg)
238 251 {
239 252 MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
240 253 }
241 254 }
242 255
243 256 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
244 257 AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
245 258 ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
246 259
247 260 /* Display the subtree */
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
248 261
249 262 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
250 263 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
251 264 ACPI_OWNER_ID_MAX, SubtreeEntry);
252 265 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
253 266 }
254 267
255 268
256 269 /*******************************************************************************
257 270 *
271 + * FUNCTION: AcpiDbDumpNamespacePaths
272 + *
273 + * PARAMETERS: None
274 + *
275 + * RETURN: None
276 + *
277 + * DESCRIPTION: Dump entire namespace with full object pathnames and object
278 + * type information. Alternative to "namespace" command.
279 + *
280 + ******************************************************************************/
281 +
282 +void
283 +AcpiDbDumpNamespacePaths (
284 + void)
285 +{
286 +
287 + AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
288 + AcpiOsPrintf ("ACPI Namespace (from root):\n");
289 +
290 + /* Display the entire namespace */
291 +
292 + AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
293 + AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY,
294 + ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode);
295 +
296 + AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
297 +}
298 +
299 +
300 +/*******************************************************************************
301 + *
258 302 * FUNCTION: AcpiDbDumpNamespaceByOwner
259 303 *
260 304 * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
261 305 * DepthArg - Maximum tree depth to be dumped
262 306 *
263 307 * RETURN: None
264 308 *
265 309 * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
266 310 *
267 311 ******************************************************************************/
268 312
269 313 void
270 314 AcpiDbDumpNamespaceByOwner (
271 315 char *OwnerArg,
272 316 char *DepthArg)
273 317 {
274 318 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
275 319 UINT32 MaxDepth = ACPI_UINT32_MAX;
276 320 ACPI_OWNER_ID OwnerId;
277 321
278 322
279 323 OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
280 324
281 325 /* Now we can check for the depth argument */
282 326
283 327 if (DepthArg)
284 328 {
285 329 MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
286 330 }
287 331
288 332 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
289 333 AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
290 334
291 335 /* Display the subtree */
292 336
293 337 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
294 338 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
295 339 SubtreeEntry);
296 340 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
297 341 }
↓ open down ↓ |
30 lines elided |
↑ open up ↑ |
298 342
299 343
300 344 /*******************************************************************************
301 345 *
302 346 * FUNCTION: AcpiDbWalkAndMatchName
303 347 *
304 348 * PARAMETERS: Callback from WalkNamespace
305 349 *
306 350 * RETURN: Status
307 351 *
308 - * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
352 + * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
309 353 * are supported -- '?' matches any character.
310 354 *
311 355 ******************************************************************************/
312 356
313 357 static ACPI_STATUS
314 358 AcpiDbWalkAndMatchName (
315 359 ACPI_HANDLE ObjHandle,
316 360 UINT32 NestingLevel,
317 361 void *Context,
318 362 void **ReturnValue)
319 363 {
320 364 ACPI_STATUS Status;
321 365 char *RequestedName = (char *) Context;
322 366 UINT32 i;
323 367 ACPI_BUFFER Buffer;
324 368 ACPI_WALK_INFO Info;
325 369
326 370
327 371 /* Check for a name match */
328 372
329 373 for (i = 0; i < 4; i++)
330 374 {
331 375 /* Wildcard support */
332 376
333 377 if ((RequestedName[i] != '?') &&
334 378 (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
335 379 {
336 380 /* No match, just exit */
337 381
338 382 return (AE_OK);
339 383 }
340 384 }
341 385
342 386 /* Get the full pathname to this object */
343 387
344 388 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
345 389 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
346 390 if (ACPI_FAILURE (Status))
347 391 {
348 392 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
349 393 }
350 394 else
351 395 {
352 396 Info.OwnerId = ACPI_OWNER_ID_MAX;
353 397 Info.DebugLevel = ACPI_UINT32_MAX;
354 398 Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
355 399
356 400 AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
357 401 (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
358 402 ACPI_FREE (Buffer.Pointer);
359 403 }
360 404
361 405 return (AE_OK);
362 406 }
363 407
364 408
365 409 /*******************************************************************************
366 410 *
367 411 * FUNCTION: AcpiDbFindNameInNamespace
368 412 *
369 413 * PARAMETERS: NameArg - The 4-character ACPI name to find.
370 414 * wildcards are supported.
371 415 *
372 416 * RETURN: None
373 417 *
374 418 * DESCRIPTION: Search the namespace for a given name (with wildcards)
375 419 *
376 420 ******************************************************************************/
377 421
378 422 ACPI_STATUS
379 423 AcpiDbFindNameInNamespace (
380 424 char *NameArg)
381 425 {
382 426 char AcpiName[5] = "____";
383 427 char *AcpiNamePtr = AcpiName;
384 428
385 429
386 430 if (ACPI_STRLEN (NameArg) > 4)
387 431 {
388 432 AcpiOsPrintf ("Name must be no longer than 4 characters\n");
389 433 return (AE_OK);
390 434 }
391 435
392 436 /* Pad out name with underscores as necessary to create a 4-char name */
393 437
394 438 AcpiUtStrupr (NameArg);
395 439 while (*NameArg)
396 440 {
397 441 *AcpiNamePtr = *NameArg;
398 442 AcpiNamePtr++;
399 443 NameArg++;
400 444 }
401 445
402 446 /* Walk the namespace from the root */
403 447
404 448 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
405 449 AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
406 450
407 451 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
408 452 return (AE_OK);
409 453 }
410 454
411 455
412 456 /*******************************************************************************
413 457 *
414 458 * FUNCTION: AcpiDbWalkForPredefinedNames
415 459 *
416 460 * PARAMETERS: Callback from WalkNamespace
417 461 *
418 462 * RETURN: Status
419 463 *
420 464 * DESCRIPTION: Detect and display predefined ACPI names (names that start with
421 465 * an underscore)
422 466 *
423 467 ******************************************************************************/
424 468
425 469 static ACPI_STATUS
426 470 AcpiDbWalkForPredefinedNames (
↓ open down ↓ |
108 lines elided |
↑ open up ↑ |
427 471 ACPI_HANDLE ObjHandle,
428 472 UINT32 NestingLevel,
429 473 void *Context,
430 474 void **ReturnValue)
431 475 {
432 476 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
433 477 UINT32 *Count = (UINT32 *) Context;
434 478 const ACPI_PREDEFINED_INFO *Predefined;
435 479 const ACPI_PREDEFINED_INFO *Package = NULL;
436 480 char *Pathname;
481 + char StringBuffer[48];
437 482
438 483
439 - Predefined = AcpiNsCheckForPredefinedName (Node);
484 + Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
440 485 if (!Predefined)
441 486 {
442 487 return (AE_OK);
443 488 }
444 489
445 490 Pathname = AcpiNsGetExternalPathname (Node);
446 491 if (!Pathname)
447 492 {
448 493 return (AE_OK);
449 494 }
450 495
451 496 /* If method returns a package, the info is in the next table entry */
452 497
453 - if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
498 + if (Predefined->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE)
454 499 {
455 500 Package = Predefined + 1;
456 501 }
457 502
458 - AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
459 - Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
503 + AcpiUtGetExpectedReturnTypes (StringBuffer,
504 + Predefined->Info.ExpectedBtypes);
460 505
506 + AcpiOsPrintf ("%-32s Arguments %X, Return Types: %s", Pathname,
507 + METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList),
508 + StringBuffer);
509 +
461 510 if (Package)
462 511 {
463 - AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
512 + AcpiOsPrintf (" (PkgType %2.2X, ObjType %2.2X, Count %2.2X)",
464 513 Package->RetInfo.Type, Package->RetInfo.ObjectType1,
465 514 Package->RetInfo.Count1);
466 515 }
467 516
468 517 AcpiOsPrintf("\n");
469 518
470 - AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
519 + /* Check that the declared argument count matches the ACPI spec */
520 +
521 + AcpiNsCheckAcpiCompliance (Pathname, Node, Predefined);
522 +
471 523 ACPI_FREE (Pathname);
472 524 (*Count)++;
473 -
474 525 return (AE_OK);
475 526 }
476 527
477 528
478 529 /*******************************************************************************
479 530 *
480 531 * FUNCTION: AcpiDbCheckPredefinedNames
481 532 *
482 533 * PARAMETERS: None
483 534 *
484 535 * RETURN: None
485 536 *
486 537 * DESCRIPTION: Validate all predefined names in the namespace
487 538 *
488 539 ******************************************************************************/
489 540
490 541 void
491 542 AcpiDbCheckPredefinedNames (
492 543 void)
493 544 {
494 545 UINT32 Count = 0;
495 546
496 547
497 548 /* Search all nodes in namespace */
498 549
499 550 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
500 551 AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
501 552
502 553 AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
503 554 }
504 555
505 556
506 557 /*******************************************************************************
507 558 *
508 559 * FUNCTION: AcpiDbWalkForSpecificObjects
509 560 *
510 561 * PARAMETERS: Callback from WalkNamespace
511 562 *
512 563 * RETURN: Status
513 564 *
514 565 * DESCRIPTION: Display short info about objects in the namespace
515 566 *
516 567 ******************************************************************************/
517 568
518 569 static ACPI_STATUS
519 570 AcpiDbWalkForSpecificObjects (
520 571 ACPI_HANDLE ObjHandle,
521 572 UINT32 NestingLevel,
522 573 void *Context,
523 574 void **ReturnValue)
524 575 {
525 576 ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
526 577 ACPI_BUFFER Buffer;
527 578 ACPI_STATUS Status;
528 579
529 580
530 581 Info->Count++;
531 582
532 583 /* Get and display the full pathname to this object */
533 584
534 585 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
535 586 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
536 587 if (ACPI_FAILURE (Status))
537 588 {
538 589 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
539 590 return (AE_OK);
540 591 }
541 592
542 593 AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
543 594 ACPI_FREE (Buffer.Pointer);
544 595
545 596 /* Dump short info about the object */
546 597
547 598 (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
548 599 return (AE_OK);
549 600 }
550 601
551 602
552 603 /*******************************************************************************
553 604 *
554 605 * FUNCTION: AcpiDbDisplayObjects
555 606 *
556 607 * PARAMETERS: ObjTypeArg - Type of object to display
557 608 * DisplayCountArg - Max depth to display
558 609 *
559 610 * RETURN: None
560 611 *
561 612 * DESCRIPTION: Display objects in the namespace of the requested type
562 613 *
563 614 ******************************************************************************/
564 615
565 616 ACPI_STATUS
566 617 AcpiDbDisplayObjects (
567 618 char *ObjTypeArg,
568 619 char *DisplayCountArg)
569 620 {
570 621 ACPI_WALK_INFO Info;
571 622 ACPI_OBJECT_TYPE Type;
572 623
573 624
574 625 /* Get the object type */
575 626
576 627 Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
577 628 if (Type == ACPI_TYPE_NOT_FOUND)
578 629 {
579 630 AcpiOsPrintf ("Invalid or unsupported argument\n");
580 631 return (AE_OK);
581 632 }
582 633
583 634 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
584 635 AcpiOsPrintf (
585 636 "Objects of type [%s] defined in the current ACPI Namespace:\n",
586 637 AcpiUtGetTypeName (Type));
587 638
588 639 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
589 640
590 641 Info.Count = 0;
591 642 Info.OwnerId = ACPI_OWNER_ID_MAX;
592 643 Info.DebugLevel = ACPI_UINT32_MAX;
593 644 Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
594 645
595 646 /* Walk the namespace from the root */
596 647
597 648 (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
598 649 AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
599 650
600 651 AcpiOsPrintf (
601 652 "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
602 653 Info.Count, AcpiUtGetTypeName (Type));
603 654
604 655 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
605 656 return (AE_OK);
606 657 }
607 658
608 659
609 660 /*******************************************************************************
610 661 *
611 662 * FUNCTION: AcpiDbIntegrityWalk
612 663 *
613 664 * PARAMETERS: Callback from WalkNamespace
614 665 *
615 666 * RETURN: Status
616 667 *
617 668 * DESCRIPTION: Examine one NS node for valid values.
618 669 *
619 670 ******************************************************************************/
620 671
621 672 static ACPI_STATUS
622 673 AcpiDbIntegrityWalk (
623 674 ACPI_HANDLE ObjHandle,
624 675 UINT32 NestingLevel,
625 676 void *Context,
626 677 void **ReturnValue)
627 678 {
628 679 ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
629 680 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
630 681 ACPI_OPERAND_OBJECT *Object;
631 682 BOOLEAN Alias = TRUE;
632 683
633 684
634 685 Info->Nodes++;
635 686
636 687 /* Verify the NS node, and dereference aliases */
637 688
638 689 while (Alias)
639 690 {
640 691 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
641 692 {
642 693 AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
643 694 Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node),
644 695 ACPI_DESC_TYPE_NAMED);
645 696 return (AE_OK);
646 697 }
647 698
648 699 if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) ||
649 700 (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
650 701 {
651 702 Node = (ACPI_NAMESPACE_NODE *) Node->Object;
652 703 }
653 704 else
654 705 {
655 706 Alias = FALSE;
↓ open down ↓ |
172 lines elided |
↑ open up ↑ |
656 707 }
657 708 }
658 709
659 710 if (Node->Type > ACPI_TYPE_LOCAL_MAX)
660 711 {
661 712 AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
662 713 Node, Node->Type);
663 714 return (AE_OK);
664 715 }
665 716
666 - if (!AcpiUtValidAcpiName (Node->Name.Integer))
717 + if (!AcpiUtValidAcpiName (Node->Name.Ascii))
667 718 {
668 719 AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
669 720 return (AE_OK);
670 721 }
671 722
672 723 Object = AcpiNsGetAttachedObject (Node);
673 724 if (Object)
674 725 {
675 726 Info->Objects++;
676 727 if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
677 728 {
678 729 AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
679 730 Object, AcpiUtGetDescriptorName (Object));
680 731 }
681 732 }
682 733
683 734 return (AE_OK);
684 735 }
685 736
686 737
687 738 /*******************************************************************************
688 739 *
689 740 * FUNCTION: AcpiDbCheckIntegrity
690 741 *
691 742 * PARAMETERS: None
692 743 *
693 744 * RETURN: None
694 745 *
695 746 * DESCRIPTION: Check entire namespace for data structure integrity
696 747 *
697 748 ******************************************************************************/
698 749
699 750 void
700 751 AcpiDbCheckIntegrity (
701 752 void)
702 753 {
703 754 ACPI_INTEGRITY_INFO Info = {0,0};
704 755
705 756 /* Search all nodes in namespace */
706 757
707 758 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
708 759 AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
709 760
710 761 AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
711 762 Info.Nodes, Info.Objects);
712 763 }
713 764
714 765
715 766 /*******************************************************************************
716 767 *
717 768 * FUNCTION: AcpiDbWalkForReferences
718 769 *
719 770 * PARAMETERS: Callback from WalkNamespace
720 771 *
721 772 * RETURN: Status
722 773 *
723 774 * DESCRIPTION: Check if this namespace object refers to the target object
724 775 * that is passed in as the context value.
725 776 *
726 777 * Note: Currently doesn't check subobjects within the Node's object
727 778 *
728 779 ******************************************************************************/
729 780
730 781 static ACPI_STATUS
731 782 AcpiDbWalkForReferences (
732 783 ACPI_HANDLE ObjHandle,
733 784 UINT32 NestingLevel,
734 785 void *Context,
735 786 void **ReturnValue)
736 787 {
737 788 ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
738 789 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
739 790
740 791
741 792 /* Check for match against the namespace node itself */
742 793
743 794 if (Node == (void *) ObjDesc)
744 795 {
745 796 AcpiOsPrintf ("Object is a Node [%4.4s]\n",
746 797 AcpiUtGetNodeName (Node));
747 798 }
748 799
749 800 /* Check for match against the object attached to the node */
750 801
751 802 if (AcpiNsGetAttachedObject (Node) == ObjDesc)
752 803 {
753 804 AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
754 805 Node, AcpiUtGetNodeName (Node));
755 806 }
756 807
757 808 return (AE_OK);
758 809 }
759 810
760 811
761 812 /*******************************************************************************
762 813 *
763 814 * FUNCTION: AcpiDbFindReferences
764 815 *
765 816 * PARAMETERS: ObjectArg - String with hex value of the object
766 817 *
767 818 * RETURN: None
↓ open down ↓ |
91 lines elided |
↑ open up ↑ |
768 819 *
769 820 * DESCRIPTION: Search namespace for all references to the input object
770 821 *
771 822 ******************************************************************************/
772 823
773 824 void
774 825 AcpiDbFindReferences (
775 826 char *ObjectArg)
776 827 {
777 828 ACPI_OPERAND_OBJECT *ObjDesc;
829 + ACPI_SIZE Address;
778 830
779 831
780 832 /* Convert string to object pointer */
781 833
782 - ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
834 + Address = ACPI_STRTOUL (ObjectArg, NULL, 16);
835 + ObjDesc = ACPI_TO_POINTER (Address);
783 836
784 837 /* Search all nodes in namespace */
785 838
786 839 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
787 840 AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
788 841 }
789 842
790 843
791 844 /*******************************************************************************
792 845 *
793 846 * FUNCTION: AcpiDbBusWalk
794 847 *
795 848 * PARAMETERS: Callback from WalkNamespace
796 849 *
797 850 * RETURN: Status
798 851 *
799 852 * DESCRIPTION: Display info about device objects that have a corresponding
800 853 * _PRT method.
801 854 *
802 855 ******************************************************************************/
803 856
804 857 static ACPI_STATUS
805 858 AcpiDbBusWalk (
806 859 ACPI_HANDLE ObjHandle,
807 860 UINT32 NestingLevel,
808 861 void *Context,
809 862 void **ReturnValue)
810 863 {
811 864 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
812 865 ACPI_STATUS Status;
813 866 ACPI_BUFFER Buffer;
814 867 ACPI_NAMESPACE_NODE *TempNode;
815 868 ACPI_DEVICE_INFO *Info;
816 869 UINT32 i;
817 870
818 871
819 872 if ((Node->Type != ACPI_TYPE_DEVICE) &&
820 873 (Node->Type != ACPI_TYPE_PROCESSOR))
821 874 {
822 875 return (AE_OK);
823 876 }
824 877
825 878 /* Exit if there is no _PRT under this device */
826 879
827 880 Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
828 881 ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
829 882 if (ACPI_FAILURE (Status))
830 883 {
831 884 return (AE_OK);
832 885 }
833 886
834 887 /* Get the full path to this device object */
835 888
836 889 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
837 890 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
838 891 if (ACPI_FAILURE (Status))
839 892 {
840 893 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
841 894 return (AE_OK);
842 895 }
843 896
844 897 Status = AcpiGetObjectInfo (ObjHandle, &Info);
845 898 if (ACPI_FAILURE (Status))
846 899 {
847 900 return (AE_OK);
848 901 }
849 902
850 903 /* Display the full path */
851 904
852 905 AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
853 906 ACPI_FREE (Buffer.Pointer);
854 907
855 908 if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
856 909 {
857 910 AcpiOsPrintf (" - Is PCI Root Bridge");
858 911 }
859 912 AcpiOsPrintf ("\n");
860 913
861 914 /* _PRT info */
862 915
863 916 AcpiOsPrintf ("_PRT: %p\n", TempNode);
864 917
865 918 /* Dump _ADR, _HID, _UID, _CID */
866 919
867 920 if (Info->Valid & ACPI_VALID_ADR)
868 921 {
869 922 AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
870 923 }
871 924 else
872 925 {
873 926 AcpiOsPrintf ("_ADR: <Not Present>\n");
874 927 }
875 928
876 929 if (Info->Valid & ACPI_VALID_HID)
877 930 {
878 931 AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
879 932 }
880 933 else
881 934 {
882 935 AcpiOsPrintf ("_HID: <Not Present>\n");
883 936 }
884 937
885 938 if (Info->Valid & ACPI_VALID_UID)
886 939 {
887 940 AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
888 941 }
889 942 else
890 943 {
891 944 AcpiOsPrintf ("_UID: <Not Present>\n");
892 945 }
893 946
894 947 if (Info->Valid & ACPI_VALID_CID)
895 948 {
896 949 for (i = 0; i < Info->CompatibleIdList.Count; i++)
897 950 {
898 951 AcpiOsPrintf ("_CID: %s\n",
899 952 Info->CompatibleIdList.Ids[i].String);
900 953 }
901 954 }
902 955 else
903 956 {
904 957 AcpiOsPrintf ("_CID: <Not Present>\n");
905 958 }
906 959
907 960 ACPI_FREE (Info);
908 961 return (AE_OK);
909 962 }
910 963
911 964
912 965 /*******************************************************************************
913 966 *
914 967 * FUNCTION: AcpiDbGetBusInfo
915 968 *
916 969 * PARAMETERS: None
917 970 *
918 971 * RETURN: None
919 972 *
920 973 * DESCRIPTION: Display info about system busses.
921 974 *
922 975 ******************************************************************************/
923 976
924 977 void
925 978 AcpiDbGetBusInfo (
926 979 void)
927 980 {
928 981 /* Search all nodes in namespace */
929 982
930 983 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
931 984 AcpiDbBusWalk, NULL, NULL, NULL);
932 985 }
933 986
934 987 #endif /* ACPI_DEBUGGER */
↓ open down ↓ |
142 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX