1 /*******************************************************************************
2 *
3 * Module Name: dmopcode - AML disassembler, specific AML opcodes
4 *
5 ******************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2015, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acparser.h>
47 #include <contrib/dev/acpica/include/amlcode.h>
48 #include <contrib/dev/acpica/include/acinterp.h>
49 #include <contrib/dev/acpica/include/acnamesp.h>
50 #include <contrib/dev/acpica/include/acdebug.h>
51
52
53 #define _COMPONENT ACPI_CA_DEBUGGER
54 ACPI_MODULE_NAME ("dmopcode")
55
56
57 /* Local prototypes */
58
59 static void
60 AcpiDmMatchKeyword (
61 ACPI_PARSE_OBJECT *Op);
62
63
64 /*******************************************************************************
65 *
66 * FUNCTION: AcpiDmDisplayTargetPathname
67 *
68 * PARAMETERS: Op - Parse object
69 *
70 * RETURN: None
71 *
72 * DESCRIPTION: For AML opcodes that have a target operand, display the full
73 * pathname for the target, in a comment field. Handles Return()
74 * statements also.
75 *
76 ******************************************************************************/
77
78 void
AcpiDmDisplayTargetPathname(ACPI_PARSE_OBJECT * Op)79 AcpiDmDisplayTargetPathname (
80 ACPI_PARSE_OBJECT *Op)
81 {
82 ACPI_PARSE_OBJECT *NextOp;
83 ACPI_PARSE_OBJECT *PrevOp = NULL;
84 char *Pathname;
85 const ACPI_OPCODE_INFO *OpInfo;
86
87
88 if (Op->Common.AmlOpcode == AML_RETURN_OP)
89 {
90 PrevOp = Op->Asl.Value.Arg;
91 }
92 else
93 {
94 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
95 if (!(OpInfo->Flags & AML_HAS_TARGET))
96 {
97 return;
98 }
99
100 /* Target is the last Op in the arg list */
101
102 NextOp = Op->Asl.Value.Arg;
103 while (NextOp)
104 {
105 PrevOp = NextOp;
106 NextOp = PrevOp->Asl.Next;
107 }
108 }
109
110 if (!PrevOp)
111 {
112 return;
113 }
114
115 /* We must have a namepath AML opcode */
116
117 if (PrevOp->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
118 {
119 return;
120 }
121
122 /* A null string is the "no target specified" case */
123
124 if (!PrevOp->Asl.Value.String)
125 {
126 return;
127 }
128
129 /* No node means "unresolved external reference" */
130
131 if (!PrevOp->Asl.Node)
132 {
133 AcpiOsPrintf (" /* External reference */");
134 return;
135 }
136
137 /* Ignore if path is already from the root */
138
139 if (*PrevOp->Asl.Value.String == '\\')
140 {
141 return;
142 }
143
144 /* Now: we can get the full pathname */
145
146 Pathname = AcpiNsGetExternalPathname (PrevOp->Asl.Node);
147 if (!Pathname)
148 {
149 return;
150 }
151
152 AcpiOsPrintf (" /* %s */", Pathname);
153 ACPI_FREE (Pathname);
154 }
155
156
157 /*******************************************************************************
158 *
159 * FUNCTION: AcpiDmNotifyDescription
160 *
161 * PARAMETERS: Op - Name() parse object
162 *
163 * RETURN: None
164 *
165 * DESCRIPTION: Emit a description comment for the value associated with a
166 * Notify() operator.
167 *
168 ******************************************************************************/
169
170 void
AcpiDmNotifyDescription(ACPI_PARSE_OBJECT * Op)171 AcpiDmNotifyDescription (
172 ACPI_PARSE_OBJECT *Op)
173 {
174 ACPI_PARSE_OBJECT *NextOp;
175 ACPI_NAMESPACE_NODE *Node;
176 UINT8 NotifyValue;
177 UINT8 Type = ACPI_TYPE_ANY;
178
179
180 /* The notify value is the second argument */
181
182 NextOp = Op->Asl.Value.Arg;
183 NextOp = NextOp->Asl.Next;
184
185 switch (NextOp->Common.AmlOpcode)
186 {
187 case AML_ZERO_OP:
188 case AML_ONE_OP:
189
190 NotifyValue = (UINT8) NextOp->Common.AmlOpcode;
191 break;
192
193 case AML_BYTE_OP:
194
195 NotifyValue = (UINT8) NextOp->Asl.Value.Integer;
196 break;
197
198 default:
199 return;
200 }
201
202 /*
203 * Attempt to get the namespace node so we can determine the object type.
204 * Some notify values are dependent on the object type (Device, Thermal,
205 * or Processor).
206 */
207 Node = Op->Asl.Node;
208 if (Node)
209 {
210 Type = Node->Type;
211 }
212
213 AcpiOsPrintf (" // %s", AcpiUtGetNotifyName (NotifyValue, Type));
214 }
215
216
217 /*******************************************************************************
218 *
219 * FUNCTION: AcpiDmPredefinedDescription
220 *
221 * PARAMETERS: Op - Name() parse object
222 *
223 * RETURN: None
224 *
225 * DESCRIPTION: Emit a description comment for a predefined ACPI name.
226 * Used for iASL compiler only.
227 *
228 ******************************************************************************/
229
230 void
AcpiDmPredefinedDescription(ACPI_PARSE_OBJECT * Op)231 AcpiDmPredefinedDescription (
232 ACPI_PARSE_OBJECT *Op)
233 {
234 #ifdef ACPI_ASL_COMPILER
235 const AH_PREDEFINED_NAME *Info;
236 char *NameString;
237 int LastCharIsDigit;
238 int LastCharsAreHex;
239
240
241 if (!Op)
242 {
243 return;
244 }
245
246 /* Ensure that the comment field is emitted only once */
247
248 if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED)
249 {
250 return;
251 }
252 Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED;
253
254 /* Predefined name must start with an underscore */
255
256 NameString = ACPI_CAST_PTR (char, &Op->Named.Name);
257 if (NameString[0] != '_')
258 {
259 return;
260 }
261
262 /*
263 * Check for the special ACPI names:
264 * _ACd, _ALd, _EJd, _Exx, _Lxx, _Qxx, _Wxx, _T_a
265 * (where d=decimal_digit, x=hex_digit, a=anything)
266 *
267 * Convert these to the generic name for table lookup.
268 * Note: NameString is guaranteed to be upper case here.
269 */
270 LastCharIsDigit =
271 (isdigit ((int) NameString[3])); /* d */
272 LastCharsAreHex =
273 (isxdigit ((int) NameString[2]) && /* xx */
274 isxdigit ((int) NameString[3]));
275
276 switch (NameString[1])
277 {
278 case 'A':
279
280 if ((NameString[2] == 'C') && (LastCharIsDigit))
281 {
282 NameString = "_ACx";
283 }
284 else if ((NameString[2] == 'L') && (LastCharIsDigit))
285 {
286 NameString = "_ALx";
287 }
288 break;
289
290 case 'E':
291
292 if ((NameString[2] == 'J') && (LastCharIsDigit))
293 {
294 NameString = "_EJx";
295 }
296 else if (LastCharsAreHex)
297 {
298 NameString = "_Exx";
299 }
300 break;
301
302 case 'L':
303
304 if (LastCharsAreHex)
305 {
306 NameString = "_Lxx";
307 }
308 break;
309
310 case 'Q':
311
312 if (LastCharsAreHex)
313 {
314 NameString = "_Qxx";
315 }
316 break;
317
318 case 'T':
319
320 if (NameString[2] == '_')
321 {
322 NameString = "_T_x";
323 }
324 break;
325
326 case 'W':
327
328 if (LastCharsAreHex)
329 {
330 NameString = "_Wxx";
331 }
332 break;
333
334 default:
335
336 break;
337 }
338
339 /* Match the name in the info table */
340
341 Info = AcpiAhMatchPredefinedName (NameString);
342 if (Info)
343 {
344 AcpiOsPrintf (" // %4.4s: %s",
345 NameString, ACPI_CAST_PTR (char, Info->Description));
346 }
347
348 #endif
349 return;
350 }
351
352
353 /*******************************************************************************
354 *
355 * FUNCTION: AcpiDmFieldPredefinedDescription
356 *
357 * PARAMETERS: Op - Parse object
358 *
359 * RETURN: None
360 *
361 * DESCRIPTION: Emit a description comment for a resource descriptor tag
362 * (which is a predefined ACPI name.) Used for iASL compiler only.
363 *
364 ******************************************************************************/
365
366 void
AcpiDmFieldPredefinedDescription(ACPI_PARSE_OBJECT * Op)367 AcpiDmFieldPredefinedDescription (
368 ACPI_PARSE_OBJECT *Op)
369 {
370 #ifdef ACPI_ASL_COMPILER
371 ACPI_PARSE_OBJECT *IndexOp;
372 char *Tag;
373 const ACPI_OPCODE_INFO *OpInfo;
374 const AH_PREDEFINED_NAME *Info;
375
376
377 if (!Op)
378 {
379 return;
380 }
381
382 /* Ensure that the comment field is emitted only once */
383
384 if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED)
385 {
386 return;
387 }
388 Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED;
389
390 /*
391 * Op must be one of the Create* operators: CreateField, CreateBitField,
392 * CreateByteField, CreateWordField, CreateDwordField, CreateQwordField
393 */
394 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
395 if (!(OpInfo->Flags & AML_CREATE))
396 {
397 return;
398 }
399
400 /* Second argument is the Index argument */
401
402 IndexOp = Op->Common.Value.Arg;
403 IndexOp = IndexOp->Common.Next;
404
405 /* Index argument must be a namepath */
406
407 if (IndexOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)
408 {
409 return;
410 }
411
412 /* Major cheat: We previously put the Tag ptr in the Node field */
413
414 Tag = ACPI_CAST_PTR (char, IndexOp->Common.Node);
415 if (!Tag)
416 {
417 return;
418 }
419
420 /* Match the name in the info table */
421
422 Info = AcpiAhMatchPredefinedName (Tag);
423 if (Info)
424 {
425 AcpiOsPrintf (" // %4.4s: %s", Tag,
426 ACPI_CAST_PTR (char, Info->Description));
427 }
428
429 #endif
430 return;
431 }
432
433
434 /*******************************************************************************
435 *
436 * FUNCTION: AcpiDmMethodFlags
437 *
438 * PARAMETERS: Op - Method Object to be examined
439 *
440 * RETURN: None
441 *
442 * DESCRIPTION: Decode control method flags
443 *
444 ******************************************************************************/
445
446 void
AcpiDmMethodFlags(ACPI_PARSE_OBJECT * Op)447 AcpiDmMethodFlags (
448 ACPI_PARSE_OBJECT *Op)
449 {
450 UINT32 Flags;
451 UINT32 Args;
452
453
454 /* The next Op contains the flags */
455
456 Op = AcpiPsGetDepthNext (NULL, Op);
457 Flags = (UINT8) Op->Common.Value.Integer;
458 Args = Flags & 0x07;
459
460 /* Mark the Op as completed */
461
462 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
463
464 /* 1) Method argument count */
465
466 AcpiOsPrintf (", %u, ", Args);
467
468 /* 2) Serialize rule */
469
470 if (!(Flags & 0x08))
471 {
472 AcpiOsPrintf ("Not");
473 }
474
475 AcpiOsPrintf ("Serialized");
476
477 /* 3) SyncLevel */
478
479 if (Flags & 0xF0)
480 {
481 AcpiOsPrintf (", %u", Flags >> 4);
482 }
483 }
484
485
486 /*******************************************************************************
487 *
488 * FUNCTION: AcpiDmFieldFlags
489 *
490 * PARAMETERS: Op - Field Object to be examined
491 *
492 * RETURN: None
493 *
494 * DESCRIPTION: Decode Field definition flags
495 *
496 ******************************************************************************/
497
498 void
AcpiDmFieldFlags(ACPI_PARSE_OBJECT * Op)499 AcpiDmFieldFlags (
500 ACPI_PARSE_OBJECT *Op)
501 {
502 UINT32 Flags;
503
504
505 Op = Op->Common.Next;
506 Flags = (UINT8) Op->Common.Value.Integer;
507
508 /* Mark the Op as completed */
509
510 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
511
512 AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]);
513 AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
514 AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
515 }
516
517
518 /*******************************************************************************
519 *
520 * FUNCTION: AcpiDmAddressSpace
521 *
522 * PARAMETERS: SpaceId - ID to be translated
523 *
524 * RETURN: None
525 *
526 * DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword
527 *
528 ******************************************************************************/
529
530 void
AcpiDmAddressSpace(UINT8 SpaceId)531 AcpiDmAddressSpace (
532 UINT8 SpaceId)
533 {
534
535 if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
536 {
537 if (SpaceId == 0x7F)
538 {
539 AcpiOsPrintf ("FFixedHW, ");
540 }
541 else
542 {
543 AcpiOsPrintf ("0x%.2X, ", SpaceId);
544 }
545 }
546 else
547 {
548 AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]);
549 }
550 }
551
552
553 /*******************************************************************************
554 *
555 * FUNCTION: AcpiDmRegionFlags
556 *
557 * PARAMETERS: Op - Object to be examined
558 *
559 * RETURN: None
560 *
561 * DESCRIPTION: Decode OperationRegion flags
562 *
563 ******************************************************************************/
564
565 void
AcpiDmRegionFlags(ACPI_PARSE_OBJECT * Op)566 AcpiDmRegionFlags (
567 ACPI_PARSE_OBJECT *Op)
568 {
569
570 /* The next Op contains the SpaceId */
571
572 Op = AcpiPsGetDepthNext (NULL, Op);
573
574 /* Mark the Op as completed */
575
576 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
577
578 AcpiOsPrintf (", ");
579 AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer);
580 }
581
582
583 /*******************************************************************************
584 *
585 * FUNCTION: AcpiDmMatchOp
586 *
587 * PARAMETERS: Op - Match Object to be examined
588 *
589 * RETURN: None
590 *
591 * DESCRIPTION: Decode Match opcode operands
592 *
593 ******************************************************************************/
594
595 void
AcpiDmMatchOp(ACPI_PARSE_OBJECT * Op)596 AcpiDmMatchOp (
597 ACPI_PARSE_OBJECT *Op)
598 {
599 ACPI_PARSE_OBJECT *NextOp;
600
601
602 NextOp = AcpiPsGetDepthNext (NULL, Op);
603 NextOp = NextOp->Common.Next;
604
605 if (!NextOp)
606 {
607 /* Handle partial tree during single-step */
608
609 return;
610 }
611
612 /* Mark the two nodes that contain the encoding for the match keywords */
613
614 NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
615
616 NextOp = NextOp->Common.Next;
617 NextOp = NextOp->Common.Next;
618 NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
619 }
620
621
622 /*******************************************************************************
623 *
624 * FUNCTION: AcpiDmMatchKeyword
625 *
626 * PARAMETERS: Op - Match Object to be examined
627 *
628 * RETURN: None
629 *
630 * DESCRIPTION: Decode Match opcode operands
631 *
632 ******************************************************************************/
633
634 static void
AcpiDmMatchKeyword(ACPI_PARSE_OBJECT * Op)635 AcpiDmMatchKeyword (
636 ACPI_PARSE_OBJECT *Op)
637 {
638
639 if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)
640 {
641 AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
642 }
643 else
644 {
645 AcpiOsPrintf ("%s", ACPI_CAST_PTR (char,
646 AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]));
647 }
648 }
649
650
651 /*******************************************************************************
652 *
653 * FUNCTION: AcpiDmDisassembleOneOp
654 *
655 * PARAMETERS: WalkState - Current walk info
656 * Info - Parse tree walk info
657 * Op - Op that is to be printed
658 *
659 * RETURN: None
660 *
661 * DESCRIPTION: Disassemble a single AML opcode
662 *
663 ******************************************************************************/
664
665 void
AcpiDmDisassembleOneOp(ACPI_WALK_STATE * WalkState,ACPI_OP_WALK_INFO * Info,ACPI_PARSE_OBJECT * Op)666 AcpiDmDisassembleOneOp (
667 ACPI_WALK_STATE *WalkState,
668 ACPI_OP_WALK_INFO *Info,
669 ACPI_PARSE_OBJECT *Op)
670 {
671 const ACPI_OPCODE_INFO *OpInfo = NULL;
672 UINT32 Offset;
673 UINT32 Length;
674 ACPI_PARSE_OBJECT *Child;
675 ACPI_STATUS Status;
676 UINT8 *Aml;
677 const AH_DEVICE_ID *IdInfo;
678
679
680 if (!Op)
681 {
682 AcpiOsPrintf ("<NULL OP PTR>");
683 return;
684 }
685
686 switch (Op->Common.DisasmOpcode)
687 {
688 case ACPI_DASM_MATCHOP:
689
690 AcpiDmMatchKeyword (Op);
691 return;
692
693 case ACPI_DASM_LNOT_SUFFIX:
694
695 if (!AcpiGbl_CstyleDisassembly)
696 {
697 switch (Op->Common.AmlOpcode)
698 {
699 case AML_LEQUAL_OP:
700 AcpiOsPrintf ("LNotEqual");
701 break;
702
703 case AML_LGREATER_OP:
704 AcpiOsPrintf ("LLessEqual");
705 break;
706
707 case AML_LLESS_OP:
708 AcpiOsPrintf ("LGreaterEqual");
709 break;
710
711 default:
712 break;
713 }
714 }
715
716 Op->Common.DisasmOpcode = 0;
717 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
718 return;
719
720 default:
721 break;
722 }
723
724 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
725
726 /* The op and arguments */
727
728 switch (Op->Common.AmlOpcode)
729 {
730 case AML_LNOT_OP:
731
732 Child = Op->Common.Value.Arg;
733 if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) ||
734 (Child->Common.AmlOpcode == AML_LGREATER_OP) ||
735 (Child->Common.AmlOpcode == AML_LLESS_OP))
736 {
737 Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
738 Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
739 }
740 else
741 {
742 AcpiOsPrintf ("%s", OpInfo->Name);
743 }
744 break;
745
746 case AML_BYTE_OP:
747
748 AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
749 break;
750
751 case AML_WORD_OP:
752
753 if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
754 {
755 AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
756 }
757 else
758 {
759 AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
760 }
761 break;
762
763 case AML_DWORD_OP:
764
765 if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
766 {
767 AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
768 }
769 else
770 {
771 AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
772 }
773 break;
774
775 case AML_QWORD_OP:
776
777 AcpiOsPrintf ("0x%8.8X%8.8X",
778 ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
779 break;
780
781 case AML_STRING_OP:
782
783 AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
784
785 /* For _HID/_CID strings, attempt to output a descriptive comment */
786
787 if (Op->Common.DisasmOpcode == ACPI_DASM_HID_STRING)
788 {
789 /* If we know about the ID, emit the description */
790
791 IdInfo = AcpiAhMatchHardwareId (Op->Common.Value.String);
792 if (IdInfo)
793 {
794 AcpiOsPrintf (" /* %s */", IdInfo->Description);
795 }
796 }
797 break;
798
799 case AML_BUFFER_OP:
800 /*
801 * Determine the type of buffer. We can have one of the following:
802 *
803 * 1) ResourceTemplate containing Resource Descriptors.
804 * 2) Unicode String buffer
805 * 3) ASCII String buffer
806 * 4) Raw data buffer (if none of the above)
807 *
808 * Since there are no special AML opcodes to differentiate these
809 * types of buffers, we have to closely look at the data in the
810 * buffer to determine the type.
811 */
812 if (!AcpiGbl_NoResourceDisassembly)
813 {
814 Status = AcpiDmIsResourceTemplate (WalkState, Op);
815 if (ACPI_SUCCESS (Status))
816 {
817 Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
818 AcpiOsPrintf ("ResourceTemplate");
819 break;
820 }
821 else if (Status == AE_AML_NO_RESOURCE_END_TAG)
822 {
823 AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
824 }
825 }
826
827 if (AcpiDmIsUuidBuffer (Op))
828 {
829 Op->Common.DisasmOpcode = ACPI_DASM_UUID;
830 AcpiOsPrintf ("ToUUID (");
831 }
832 else if (AcpiDmIsUnicodeBuffer (Op))
833 {
834 Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
835 AcpiOsPrintf ("Unicode (");
836 }
837 else if (AcpiDmIsStringBuffer (Op))
838 {
839 Op->Common.DisasmOpcode = ACPI_DASM_STRING;
840 AcpiOsPrintf ("Buffer");
841 }
842 else if (AcpiDmIsPldBuffer (Op))
843 {
844 Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD;
845 AcpiOsPrintf ("ToPLD (");
846 }
847 else
848 {
849 Op->Common.DisasmOpcode = ACPI_DASM_BUFFER;
850 AcpiOsPrintf ("Buffer");
851 }
852 break;
853
854 case AML_INT_NAMEPATH_OP:
855
856 AcpiDmNamestring (Op->Common.Value.Name);
857 break;
858
859 case AML_INT_NAMEDFIELD_OP:
860
861 Length = AcpiDmDumpName (Op->Named.Name);
862 AcpiOsPrintf (",%*.s %u", (unsigned) (5 - Length), " ",
863 (UINT32) Op->Common.Value.Integer);
864 AcpiDmCommaIfFieldMember (Op);
865
866 Info->BitOffset += (UINT32) Op->Common.Value.Integer;
867 break;
868
869 case AML_INT_RESERVEDFIELD_OP:
870
871 /* Offset() -- Must account for previous offsets */
872
873 Offset = (UINT32) Op->Common.Value.Integer;
874 Info->BitOffset += Offset;
875
876 if (Info->BitOffset % 8 == 0)
877 {
878 AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
879 }
880 else
881 {
882 AcpiOsPrintf (" , %u", Offset);
883 }
884
885 AcpiDmCommaIfFieldMember (Op);
886 break;
887
888 case AML_INT_ACCESSFIELD_OP:
889 case AML_INT_EXTACCESSFIELD_OP:
890
891 AcpiOsPrintf ("AccessAs (%s, ",
892 AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer & 0x7)]);
893
894 AcpiDmDecodeAttribute ((UINT8) (Op->Common.Value.Integer >> 8));
895
896 if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP)
897 {
898 AcpiOsPrintf (" (0x%2.2X)", (unsigned) ((Op->Common.Value.Integer >> 16) & 0xFF));
899 }
900
901 AcpiOsPrintf (")");
902 AcpiDmCommaIfFieldMember (Op);
903 break;
904
905 case AML_INT_CONNECTION_OP:
906 /*
907 * Two types of Connection() - one with a buffer object, the
908 * other with a namestring that points to a buffer object.
909 */
910 AcpiOsPrintf ("Connection (");
911 Child = Op->Common.Value.Arg;
912
913 if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
914 {
915 AcpiOsPrintf ("\n");
916
917 Aml = Child->Named.Data;
918 Length = (UINT32) Child->Common.Value.Integer;
919
920 Info->Level += 1;
921 Info->MappingOp = Op;
922 Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
923
924 AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length);
925
926 Info->Level -= 1;
927 AcpiDmIndent (Info->Level);
928 }
929 else
930 {
931 AcpiDmNamestring (Child->Common.Value.Name);
932 }
933
934 AcpiOsPrintf (")");
935 AcpiDmCommaIfFieldMember (Op);
936 AcpiOsPrintf ("\n");
937
938 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; /* for now, ignore in AcpiDmAscendingOp */
939 Child->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
940 break;
941
942 case AML_INT_BYTELIST_OP:
943
944 AcpiDmByteList (Info, Op);
945 break;
946
947 case AML_INT_METHODCALL_OP:
948
949 Op = AcpiPsGetDepthNext (NULL, Op);
950 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
951
952 AcpiDmNamestring (Op->Common.Value.Name);
953 break;
954
955 default:
956
957 /* Just get the opcode name and print it */
958
959 AcpiOsPrintf ("%s", OpInfo->Name);
960
961
962 #ifdef ACPI_DEBUGGER
963
964 if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
965 (WalkState) &&
966 (WalkState->Results) &&
967 (WalkState->ResultCount))
968 {
969 AcpiDbDecodeInternalObject (
970 WalkState->Results->Results.ObjDesc [
971 (WalkState->ResultCount - 1) %
972 ACPI_RESULTS_FRAME_OBJ_NUM]);
973 }
974 #endif
975
976 break;
977 }
978 }
979