Print this page
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/disassembler/dmwalk.c
+++ new/usr/src/common/acpica/components/disassembler/dmwalk.c
1 1 /*******************************************************************************
2 2 *
3 3 * Module Name: dmwalk - AML disassembly tree walk
4 4 *
5 5 ******************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2013, 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,
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 "acparser.h"
48 48 #include "amlcode.h"
49 49 #include "acdisasm.h"
50 50 #include "acdebug.h"
51 51
52 52
53 53 #ifdef ACPI_DISASSEMBLER
54 54
55 55 #define _COMPONENT ACPI_CA_DEBUGGER
56 56 ACPI_MODULE_NAME ("dmwalk")
57 57
58 58
59 59 #define DB_FULL_OP_INFO "[%4.4s] @%5.5X #%4.4X: "
60 60
61 61 /* Stub for non-compiler code */
62 62
63 63 #ifndef ACPI_ASL_COMPILER
64 64 void
65 65 AcpiDmEmitExternals (
66 66 void)
67 67 {
68 68 return;
69 69 }
70 70 #endif
71 71
72 72 /* Local prototypes */
73 73
74 74 static ACPI_STATUS
75 75 AcpiDmDescendingOp (
76 76 ACPI_PARSE_OBJECT *Op,
77 77 UINT32 Level,
78 78 void *Context);
79 79
80 80 static ACPI_STATUS
81 81 AcpiDmAscendingOp (
82 82 ACPI_PARSE_OBJECT *Op,
83 83 UINT32 Level,
84 84 void *Context);
85 85
86 86 static UINT32
87 87 AcpiDmBlockType (
88 88 ACPI_PARSE_OBJECT *Op);
89 89
90 90
↓ open down ↓ |
72 lines elided |
↑ open up ↑ |
91 91 /*******************************************************************************
92 92 *
93 93 * FUNCTION: AcpiDmDisassemble
94 94 *
95 95 * PARAMETERS: WalkState - Current state
96 96 * Origin - Starting object
97 97 * NumOpcodes - Max number of opcodes to be displayed
98 98 *
99 99 * RETURN: None
100 100 *
101 - * DESCRIPTION: Disassemble parser object and its children. This is the
101 + * DESCRIPTION: Disassemble parser object and its children. This is the
102 102 * main entry point of the disassembler.
103 103 *
104 104 ******************************************************************************/
105 105
106 106 void
107 107 AcpiDmDisassemble (
108 108 ACPI_WALK_STATE *WalkState,
109 109 ACPI_PARSE_OBJECT *Origin,
110 110 UINT32 NumOpcodes)
111 111 {
112 112 ACPI_PARSE_OBJECT *Op = Origin;
113 113 ACPI_OP_WALK_INFO Info;
114 114
115 115
116 116 if (!Op)
117 117 {
118 118 return;
119 119 }
120 120
121 121 Info.Flags = 0;
122 122 Info.Level = 0;
123 123 Info.Count = 0;
124 124 Info.WalkState = WalkState;
125 125 AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
126 126 return;
127 127 }
128 128
129 129
130 130 /*******************************************************************************
131 131 *
132 132 * FUNCTION: AcpiDmWalkParseTree
133 133 *
134 134 * PARAMETERS: Op - Root Op object
135 135 * DescendingCallback - Called during tree descent
136 136 * AscendingCallback - Called during tree ascent
137 137 * Context - To be passed to the callbacks
138 138 *
139 139 * RETURN: Status from callback(s)
140 140 *
141 141 * DESCRIPTION: Walk the entire parse tree.
142 142 *
143 143 ******************************************************************************/
144 144
145 145 void
146 146 AcpiDmWalkParseTree (
147 147 ACPI_PARSE_OBJECT *Op,
148 148 ASL_WALK_CALLBACK DescendingCallback,
149 149 ASL_WALK_CALLBACK AscendingCallback,
150 150 void *Context)
151 151 {
152 152 BOOLEAN NodePreviouslyVisited;
153 153 ACPI_PARSE_OBJECT *StartOp = Op;
154 154 ACPI_STATUS Status;
155 155 ACPI_PARSE_OBJECT *Next;
156 156 ACPI_OP_WALK_INFO *Info = Context;
157 157
158 158
159 159 Info->Level = 0;
160 160 NodePreviouslyVisited = FALSE;
161 161
162 162 while (Op)
163 163 {
164 164 if (NodePreviouslyVisited)
165 165 {
166 166 if (AscendingCallback)
167 167 {
168 168 Status = AscendingCallback (Op, Info->Level, Context);
169 169 if (ACPI_FAILURE (Status))
170 170 {
171 171 return;
172 172 }
173 173 }
174 174 }
175 175 else
176 176 {
177 177 /* Let the callback process the node */
178 178
179 179 Status = DescendingCallback (Op, Info->Level, Context);
180 180 if (ACPI_SUCCESS (Status))
181 181 {
182 182 /* Visit children first, once */
183 183
184 184 Next = AcpiPsGetArg (Op, 0);
185 185 if (Next)
186 186 {
187 187 Info->Level++;
188 188 Op = Next;
189 189 continue;
190 190 }
191 191 }
192 192 else if (Status != AE_CTRL_DEPTH)
193 193 {
194 194 /* Exit immediately on any error */
195 195
196 196 return;
197 197 }
198 198 }
199 199
200 200 /* Terminate walk at start op */
201 201
202 202 if (Op == StartOp)
203 203 {
204 204 break;
205 205 }
206 206
207 207 /* No more children, re-visit this node */
208 208
209 209 if (!NodePreviouslyVisited)
210 210 {
211 211 NodePreviouslyVisited = TRUE;
212 212 continue;
213 213 }
214 214
215 215 /* No more children, visit peers */
216 216
217 217 if (Op->Common.Next)
218 218 {
219 219 Op = Op->Common.Next;
220 220 NodePreviouslyVisited = FALSE;
221 221 }
222 222 else
223 223 {
224 224 /* No peers, re-visit parent */
225 225
226 226 if (Info->Level != 0 )
227 227 {
228 228 Info->Level--;
229 229 }
230 230
231 231 Op = Op->Common.Parent;
232 232 NodePreviouslyVisited = TRUE;
233 233 }
234 234 }
235 235
236 236 /* If we get here, the walk completed with no errors */
237 237
238 238 return;
239 239 }
240 240
241 241
242 242 /*******************************************************************************
243 243 *
244 244 * FUNCTION: AcpiDmBlockType
245 245 *
246 246 * PARAMETERS: Op - Object to be examined
247 247 *
248 248 * RETURN: BlockType - not a block, parens, braces, or even both.
249 249 *
250 250 * DESCRIPTION: Type of block for this op (parens or braces)
251 251 *
252 252 ******************************************************************************/
253 253
254 254 static UINT32
255 255 AcpiDmBlockType (
256 256 ACPI_PARSE_OBJECT *Op)
257 257 {
258 258 const ACPI_OPCODE_INFO *OpInfo;
259 259
260 260
261 261 if (!Op)
262 262 {
263 263 return (BLOCK_NONE);
264 264 }
265 265
266 266 switch (Op->Common.AmlOpcode)
267 267 {
268 268 case AML_ELSE_OP:
269 269
270 270 return (BLOCK_BRACE);
271 271
272 272 case AML_METHOD_OP:
273 273 case AML_DEVICE_OP:
274 274 case AML_SCOPE_OP:
275 275 case AML_PROCESSOR_OP:
276 276 case AML_POWER_RES_OP:
277 277 case AML_THERMAL_ZONE_OP:
278 278 case AML_IF_OP:
279 279 case AML_WHILE_OP:
280 280 case AML_FIELD_OP:
281 281 case AML_INDEX_FIELD_OP:
282 282 case AML_BANK_FIELD_OP:
283 283
284 284 return (BLOCK_PAREN | BLOCK_BRACE);
285 285
286 286 case AML_BUFFER_OP:
287 287
288 288 if (Op->Common.DisasmOpcode == ACPI_DASM_UNICODE)
289 289 {
290 290 return (BLOCK_NONE);
291 291 }
292 292
293 293 /*lint -fallthrough */
294 294
295 295 case AML_PACKAGE_OP:
296 296 case AML_VAR_PACKAGE_OP:
297 297
298 298 return (BLOCK_PAREN | BLOCK_BRACE);
299 299
300 300 case AML_EVENT_OP:
301 301
302 302 return (BLOCK_PAREN);
303 303
304 304 default:
305 305
306 306 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
307 307 if (OpInfo->Flags & AML_HAS_ARGS)
308 308 {
309 309 return (BLOCK_PAREN);
310 310 }
311 311
312 312 return (BLOCK_NONE);
313 313 }
314 314 }
315 315
316 316
317 317 /*******************************************************************************
318 318 *
319 319 * FUNCTION: AcpiDmListType
320 320 *
321 321 * PARAMETERS: Op - Object to be examined
322 322 *
323 323 * RETURN: ListType - has commas or not.
324 324 *
325 325 * DESCRIPTION: Type of block for this op (parens or braces)
326 326 *
327 327 ******************************************************************************/
328 328
329 329 UINT32
330 330 AcpiDmListType (
331 331 ACPI_PARSE_OBJECT *Op)
332 332 {
333 333 const ACPI_OPCODE_INFO *OpInfo;
334 334
335 335
336 336 if (!Op)
337 337 {
338 338 return (BLOCK_NONE);
339 339 }
340 340
341 341 switch (Op->Common.AmlOpcode)
342 342 {
343 343
344 344 case AML_ELSE_OP:
345 345 case AML_METHOD_OP:
346 346 case AML_DEVICE_OP:
347 347 case AML_SCOPE_OP:
348 348 case AML_POWER_RES_OP:
349 349 case AML_PROCESSOR_OP:
350 350 case AML_THERMAL_ZONE_OP:
351 351 case AML_IF_OP:
352 352 case AML_WHILE_OP:
353 353 case AML_FIELD_OP:
354 354 case AML_INDEX_FIELD_OP:
355 355 case AML_BANK_FIELD_OP:
356 356
357 357 return (BLOCK_NONE);
358 358
359 359 case AML_BUFFER_OP:
360 360 case AML_PACKAGE_OP:
361 361 case AML_VAR_PACKAGE_OP:
362 362
363 363 return (BLOCK_COMMA_LIST);
364 364
365 365 default:
366 366
367 367 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
368 368 if (OpInfo->Flags & AML_HAS_ARGS)
369 369 {
370 370 return (BLOCK_COMMA_LIST);
371 371 }
372 372
373 373 return (BLOCK_NONE);
374 374 }
375 375 }
376 376
377 377
378 378 /*******************************************************************************
379 379 *
380 380 * FUNCTION: AcpiDmDescendingOp
381 381 *
382 382 * PARAMETERS: ASL_WALK_CALLBACK
383 383 *
384 384 * RETURN: Status
385 385 *
386 386 * DESCRIPTION: First visitation of a parse object during tree descent.
387 387 * Decode opcode name and begin parameter list(s), if any.
388 388 *
389 389 ******************************************************************************/
390 390
391 391 static ACPI_STATUS
392 392 AcpiDmDescendingOp (
393 393 ACPI_PARSE_OBJECT *Op,
394 394 UINT32 Level,
395 395 void *Context)
396 396 {
397 397 ACPI_OP_WALK_INFO *Info = Context;
398 398 const ACPI_OPCODE_INFO *OpInfo;
399 399 UINT32 Name;
400 400 ACPI_PARSE_OBJECT *NextOp;
401 401
402 402
403 403 if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
404 404 {
405 405 /* Ignore this op -- it was handled elsewhere */
406 406
407 407 return (AE_CTRL_DEPTH);
408 408 }
409 409
410 410 /* Level 0 is at the Definition Block level */
411 411
412 412 if (Level == 0)
413 413 {
414 414 /* In verbose mode, print the AML offset, opcode and depth count */
415 415
416 416 if (Info->WalkState)
417 417 {
418 418 VERBOSE_PRINT ((DB_FULL_OP_INFO,
419 419 (Info->WalkState->MethodNode ?
420 420 Info->WalkState->MethodNode->Name.Ascii : " "),
421 421 Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode));
422 422 }
423 423
424 424 if (Op->Common.AmlOpcode == AML_SCOPE_OP)
425 425 {
426 426 /* This is the beginning of the Definition Block */
427 427
428 428 AcpiOsPrintf ("{\n");
429 429
430 430 /* Emit all External() declarations here */
431 431
432 432 AcpiDmEmitExternals ();
433 433 return (AE_OK);
↓ open down ↓ |
322 lines elided |
↑ open up ↑ |
434 434 }
435 435 }
436 436 else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
437 437 (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
438 438 (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
439 439 {
440 440 /*
441 441 * This is a first-level element of a term list,
442 442 * indent a new line
443 443 */
444 - AcpiDmIndent (Level);
444 + switch (Op->Common.AmlOpcode)
445 + {
446 + case AML_NOOP_OP:
447 + /*
448 + * Optionally just ignore this opcode. Some tables use
449 + * NoOp opcodes for "padding" out packages that the BIOS
450 + * changes dynamically. This can leave hundreds or
451 + * thousands of NoOp opcodes that if disassembled,
452 + * cannot be compiled because they are syntactically
453 + * incorrect.
454 + */
455 + if (AcpiGbl_IgnoreNoopOperator)
456 + {
457 + Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
458 + return (AE_OK);
459 + }
460 +
461 + /* Fallthrough */
462 +
463 + default:
464 +
465 + AcpiDmIndent (Level);
466 + break;
467 + }
468 +
445 469 Info->LastLevel = Level;
446 470 Info->Count = 0;
447 471 }
448 472
449 473 /*
450 474 * This is an inexpensive mechanism to try and keep lines from getting
451 475 * too long. When the limit is hit, start a new line at the previous
452 476 * indent plus one. A better but more expensive mechanism would be to
453 477 * keep track of the current column.
454 478 */
455 479 Info->Count++;
456 - if (Info->Count /*+Info->LastLevel*/ > 10)
480 + if (Info->Count /* +Info->LastLevel */ > 10)
457 481 {
458 482 Info->Count = 0;
459 483 AcpiOsPrintf ("\n");
460 484 AcpiDmIndent (Info->LastLevel + 1);
461 485 }
462 486
463 487 /* Print the opcode name */
464 488
465 489 AcpiDmDisassembleOneOp (NULL, Info, Op);
466 490
467 - if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX)
491 + if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) ||
492 + (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP))
468 493 {
469 494 return (AE_OK);
470 495 }
471 496
472 497 if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
473 498 (Op->Common.AmlOpcode == AML_RETURN_OP))
474 499 {
475 500 Info->Level--;
476 501 }
477 502
478 503 /* Start the opcode argument list if necessary */
479 504
480 505 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
481 506
482 507 if ((OpInfo->Flags & AML_HAS_ARGS) ||
483 508 (Op->Common.AmlOpcode == AML_EVENT_OP))
484 509 {
485 510 /* This opcode has an argument list */
486 511
487 512 if (AcpiDmBlockType (Op) & BLOCK_PAREN)
488 513 {
489 514 AcpiOsPrintf (" (");
490 515 }
491 516
492 517 /* If this is a named opcode, print the associated name value */
493 518
494 519 if (OpInfo->Flags & AML_NAMED)
495 520 {
496 521 switch (Op->Common.AmlOpcode)
497 522 {
498 523 case AML_ALIAS_OP:
499 524
500 525 NextOp = AcpiPsGetDepthNext (NULL, Op);
501 526 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
502 527 AcpiDmNamestring (NextOp->Common.Value.Name);
503 528 AcpiOsPrintf (", ");
504 529
505 530 /*lint -fallthrough */
506 531
507 532 default:
508 533
509 534 Name = AcpiPsGetName (Op);
510 535 if (Op->Named.Path)
511 536 {
512 537 AcpiDmNamestring ((char *) Op->Named.Path);
513 538 }
514 539 else
515 540 {
516 541 AcpiDmDumpName (Name);
517 542 }
518 543
519 544 if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
520 545 {
521 546 if (AcpiGbl_DbOpt_verbose)
522 547 {
523 548 (void) AcpiPsDisplayObjectPathname (NULL, Op);
524 549 }
↓ open down ↓ |
47 lines elided |
↑ open up ↑ |
525 550 }
526 551 break;
527 552 }
528 553
529 554 switch (Op->Common.AmlOpcode)
530 555 {
531 556 case AML_METHOD_OP:
532 557
533 558 AcpiDmMethodFlags (Op);
534 559 AcpiOsPrintf (")");
560 +
561 + /* Emit description comment for Method() with a predefined ACPI name */
562 +
563 + AcpiDmPredefinedDescription (Op);
535 564 break;
536 565
537 566
538 567 case AML_NAME_OP:
539 568
540 569 /* Check for _HID and related EISAID() */
541 570
542 571 AcpiDmIsEisaId (Op);
543 572 AcpiOsPrintf (", ");
544 573 break;
545 574
546 575
547 576 case AML_REGION_OP:
548 577
549 578 AcpiDmRegionFlags (Op);
550 579 break;
551 580
552 581
553 582 case AML_POWER_RES_OP:
554 583
555 584 /* Mark the next two Ops as part of the parameter list */
556 585
557 586 AcpiOsPrintf (", ");
558 587 NextOp = AcpiPsGetDepthNext (NULL, Op);
559 588 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
560 589
561 590 NextOp = NextOp->Common.Next;
562 591 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
563 592 return (AE_OK);
564 593
565 594
566 595 case AML_PROCESSOR_OP:
567 596
568 597 /* Mark the next three Ops as part of the parameter list */
569 598
570 599 AcpiOsPrintf (", ");
571 600 NextOp = AcpiPsGetDepthNext (NULL, Op);
572 601 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
573 602
574 603 NextOp = NextOp->Common.Next;
575 604 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
576 605
577 606 NextOp = NextOp->Common.Next;
578 607 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
579 608 return (AE_OK);
580 609
581 610
582 611 case AML_MUTEX_OP:
583 612 case AML_DATA_REGION_OP:
584 613
585 614 AcpiOsPrintf (", ");
586 615 return (AE_OK);
587 616
588 617
589 618 case AML_EVENT_OP:
590 619 case AML_ALIAS_OP:
591 620
592 621 return (AE_OK);
593 622
594 623
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
595 624 case AML_SCOPE_OP:
596 625 case AML_DEVICE_OP:
597 626 case AML_THERMAL_ZONE_OP:
598 627
599 628 AcpiOsPrintf (")");
600 629 break;
601 630
602 631
603 632 default:
604 633
605 - AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode);
634 + AcpiOsPrintf ("*** Unhandled named opcode %X\n",
635 + Op->Common.AmlOpcode);
606 636 break;
607 637 }
608 638 }
609 639
610 640 else switch (Op->Common.AmlOpcode)
611 641 {
612 642 case AML_FIELD_OP:
613 643 case AML_BANK_FIELD_OP:
614 644 case AML_INDEX_FIELD_OP:
615 645
616 646 Info->BitOffset = 0;
617 647
618 648 /* Name of the parent OperationRegion */
619 649
620 650 NextOp = AcpiPsGetDepthNext (NULL, Op);
621 651 AcpiDmNamestring (NextOp->Common.Value.Name);
622 652 AcpiOsPrintf (", ");
623 653 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
624 654
625 655 switch (Op->Common.AmlOpcode)
626 656 {
627 657 case AML_BANK_FIELD_OP:
628 658
629 659 /* Namestring - Bank Name */
630 660
631 661 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
632 662 AcpiDmNamestring (NextOp->Common.Value.Name);
633 663 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
634 664 AcpiOsPrintf (", ");
635 665
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
636 666 /*
637 667 * Bank Value. This is a TermArg in the middle of the parameter
638 668 * list, must handle it here.
639 669 *
640 670 * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST
641 671 * eliminates newline in the output.
642 672 */
643 673 NextOp = NextOp->Common.Next;
644 674
645 675 Info->Flags = ACPI_PARSEOP_PARAMLIST;
646 - AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info);
676 + AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp,
677 + AcpiDmAscendingOp, Info);
647 678 Info->Flags = 0;
648 679 Info->Level = Level;
649 680
650 681 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
651 682 AcpiOsPrintf (", ");
652 683 break;
653 684
654 685 case AML_INDEX_FIELD_OP:
655 686
656 687 /* Namestring - Data Name */
657 688
658 689 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
659 690 AcpiDmNamestring (NextOp->Common.Value.Name);
660 691 AcpiOsPrintf (", ");
661 692 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
662 693 break;
663 694
664 695 default:
665 696
666 697 break;
667 698 }
668 699
669 700 AcpiDmFieldFlags (NextOp);
670 701 break;
671 702
672 -
673 703 case AML_BUFFER_OP:
674 704
675 705 /* The next op is the size parameter */
676 706
677 707 NextOp = AcpiPsGetDepthNext (NULL, Op);
678 708 if (!NextOp)
679 709 {
680 710 /* Single-step support */
681 711
682 712 return (AE_OK);
683 713 }
684 714
685 715 if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE)
686 716 {
687 717 /*
688 - * We have a resource list. Don't need to output
689 - * the buffer size Op. Open up a new block
718 + * We have a resource list. Don't need to output
719 + * the buffer size Op. Open up a new block
690 720 */
691 721 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
692 722 NextOp = NextOp->Common.Next;
693 - AcpiOsPrintf (")\n");
723 + AcpiOsPrintf (")");
724 +
725 + /* Emit description comment for Name() with a predefined ACPI name */
726 +
727 + AcpiDmPredefinedDescription (Op->Asl.Parent);
728 +
729 + AcpiOsPrintf ("\n");
694 730 AcpiDmIndent (Info->Level);
695 731 AcpiOsPrintf ("{\n");
696 732 return (AE_OK);
697 733 }
698 734
699 735 /* Normal Buffer, mark size as in the parameter list */
700 736
701 737 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
702 738 return (AE_OK);
703 739
704 -
705 740 case AML_VAR_PACKAGE_OP:
706 741 case AML_IF_OP:
707 742 case AML_WHILE_OP:
708 743
709 744 /* The next op is the size or predicate parameter */
710 745
711 746 NextOp = AcpiPsGetDepthNext (NULL, Op);
712 747 if (NextOp)
713 748 {
714 749 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
715 750 }
716 751 return (AE_OK);
717 752
718 -
719 753 case AML_PACKAGE_OP:
720 754
721 - /* The next op is the size or predicate parameter */
755 + /* The next op is the size parameter */
722 756
723 757 NextOp = AcpiPsGetDepthNext (NULL, Op);
724 758 if (NextOp)
725 759 {
726 760 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
727 761 }
728 762 return (AE_OK);
729 763
730 -
731 764 case AML_MATCH_OP:
732 765
733 766 AcpiDmMatchOp (Op);
734 767 break;
735 768
736 -
737 769 default:
738 770
739 771 break;
740 772 }
741 773
742 774 if (AcpiDmBlockType (Op) & BLOCK_BRACE)
743 775 {
744 776 AcpiOsPrintf ("\n");
745 777 AcpiDmIndent (Level);
746 778 AcpiOsPrintf ("{\n");
747 779 }
748 780 }
749 781
750 782 return (AE_OK);
751 783 }
752 784
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
753 785
754 786 /*******************************************************************************
755 787 *
756 788 * FUNCTION: AcpiDmAscendingOp
757 789 *
758 790 * PARAMETERS: ASL_WALK_CALLBACK
759 791 *
760 792 * RETURN: Status
761 793 *
762 794 * DESCRIPTION: Second visitation of a parse object, during ascent of parse
763 - * tree. Close out any parameter lists and complete the opcode.
795 + * tree. Close out any parameter lists and complete the opcode.
764 796 *
765 797 ******************************************************************************/
766 798
767 799 static ACPI_STATUS
768 800 AcpiDmAscendingOp (
769 801 ACPI_PARSE_OBJECT *Op,
770 802 UINT32 Level,
771 803 void *Context)
772 804 {
773 805 ACPI_OP_WALK_INFO *Info = Context;
806 + ACPI_PARSE_OBJECT *ParentOp;
774 807
775 808
776 809 if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
777 810 {
778 811 /* Ignore this op -- it was handled elsewhere */
779 812
780 813 return (AE_OK);
781 814 }
782 815
783 816 if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
784 817 {
785 818 /* Indicates the end of the current descriptor block (table) */
786 819
787 820 AcpiOsPrintf ("}\n\n");
788 821 return (AE_OK);
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
789 822 }
790 823
791 824 switch (AcpiDmBlockType (Op))
792 825 {
793 826 case BLOCK_PAREN:
794 827
795 828 /* Completed an op that has arguments, add closing paren */
796 829
797 830 AcpiOsPrintf (")");
798 831
832 + if (Op->Common.AmlOpcode == AML_NAME_OP)
833 + {
834 + /* Emit description comment for Name() with a predefined ACPI name */
835 +
836 + AcpiDmPredefinedDescription (Op);
837 + }
838 + else
839 + {
840 + /* For Create* operators, attempt to emit resource tag description */
841 +
842 + AcpiDmFieldPredefinedDescription (Op);
843 + }
844 +
799 845 /* Could be a nested operator, check if comma required */
800 846
801 847 if (!AcpiDmCommaIfListMember (Op))
802 848 {
803 849 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
804 850 (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
805 851 (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
806 852 {
807 853 /*
808 854 * This is a first-level element of a term list
809 855 * start a new line
810 856 */
811 857 if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST))
812 858 {
813 859 AcpiOsPrintf ("\n");
814 860 }
815 861 }
816 862 }
817 863 break;
818 864
819 -
820 865 case BLOCK_BRACE:
821 866 case (BLOCK_BRACE | BLOCK_PAREN):
822 867
823 868 /* Completed an op that has a term list, add closing brace */
824 869
825 870 if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
826 871 {
827 872 AcpiOsPrintf ("}");
828 873 }
829 874 else
830 875 {
831 876 AcpiDmIndent (Level);
832 877 AcpiOsPrintf ("}");
833 878 }
834 879
835 880 AcpiDmCommaIfListMember (Op);
836 881
837 882 if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
838 883 {
839 884 AcpiOsPrintf ("\n");
840 885 if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
841 886 {
842 887 if ((Op->Common.AmlOpcode == AML_IF_OP) &&
843 888 (Op->Common.Next) &&
844 889 (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
845 890 {
846 891 break;
847 892 }
848 893
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
849 894 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
850 895 (!Op->Common.Next))
851 896 {
852 897 break;
853 898 }
854 899 AcpiOsPrintf ("\n");
855 900 }
856 901 }
857 902 break;
858 903
859 -
860 904 case BLOCK_NONE:
861 905 default:
862 906
863 907 /* Could be a nested operator, check if comma required */
864 908
865 909 if (!AcpiDmCommaIfListMember (Op))
866 910 {
867 911 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
868 912 (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
869 913 (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
870 914 {
871 915 /*
872 916 * This is a first-level element of a term list
873 917 * start a new line
874 918 */
875 919 AcpiOsPrintf ("\n");
876 920 }
877 921 }
878 922 else if (Op->Common.Parent)
879 923 {
880 924 switch (Op->Common.Parent->Common.AmlOpcode)
881 925 {
882 926 case AML_PACKAGE_OP:
883 927 case AML_VAR_PACKAGE_OP:
884 928
885 929 if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
886 930 {
887 931 AcpiOsPrintf ("\n");
888 932 }
889 933 break;
890 934
891 935 default:
892 936
893 937 break;
894 938 }
895 939 }
896 940 break;
897 941 }
898 942
899 943 if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)
900 944 {
901 945 if ((Op->Common.Next) &&
902 946 (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
903 947 {
904 948 return (AE_OK);
905 949 }
906 950
907 951 /*
908 952 * Just completed a parameter node for something like "Buffer (param)".
909 953 * Close the paren and open up the term list block with a brace
910 954 */
911 955 if (Op->Common.Next)
912 956 {
913 - AcpiOsPrintf (")\n");
957 + AcpiOsPrintf (")");
958 +
959 + /* Emit description comment for Name() with a predefined ACPI name */
960 +
961 + ParentOp = Op->Common.Parent;
962 + if (ParentOp)
963 + {
964 + ParentOp = ParentOp->Common.Parent;
965 + if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP)
966 + {
967 + AcpiDmPredefinedDescription (ParentOp);
968 + }
969 + }
970 + AcpiOsPrintf ("\n");
914 971 AcpiDmIndent (Level - 1);
915 972 AcpiOsPrintf ("{\n");
916 973 }
917 974 else
918 975 {
919 976 Op->Common.Parent->Common.DisasmFlags |=
920 977 ACPI_PARSEOP_EMPTY_TERMLIST;
921 978 AcpiOsPrintf (") {");
922 979 }
923 980 }
924 981
925 982 if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
926 983 (Op->Common.AmlOpcode == AML_RETURN_OP))
927 984 {
928 985 Info->Level++;
929 986 }
930 987 return (AE_OK);
931 988 }
932 989
933 990
934 991 #endif /* ACPI_DISASSEMBLER */
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX