1 /*******************************************************************************
2  *
3  * Module Name: dmopcode - AML disassembler, specific AML opcodes
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2014, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acparser.h"
47 #include "amlcode.h"
48 #include "acdisasm.h"
49 #include "acinterp.h"
50 #include "acnamesp.h"
51 
52 #ifdef ACPI_DISASSEMBLER
53 
54 #define _COMPONENT          ACPI_CA_DEBUGGER
55         ACPI_MODULE_NAME    ("dmopcode")
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
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
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
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         (ACPI_IS_DIGIT (NameString[3]));    /* d */
272     LastCharsAreHex =
273         (ACPI_IS_XDIGIT (NameString[2]) &&  /* xx */
274          ACPI_IS_XDIGIT (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
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
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
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
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
566 AcpiDmRegionFlags (
567     ACPI_PARSE_OBJECT       *Op)
568 {
569 
570 
571     /* The next Op contains the SpaceId */
572 
573     Op = AcpiPsGetDepthNext (NULL, Op);
574 
575     /* Mark the Op as completed */
576 
577     Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
578 
579     AcpiOsPrintf (", ");
580     AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer);
581 }
582 
583 
584 /*******************************************************************************
585  *
586  * FUNCTION:    AcpiDmMatchOp
587  *
588  * PARAMETERS:  Op              - Match Object to be examined
589  *
590  * RETURN:      None
591  *
592  * DESCRIPTION: Decode Match opcode operands
593  *
594  ******************************************************************************/
595 
596 void
597 AcpiDmMatchOp (
598     ACPI_PARSE_OBJECT       *Op)
599 {
600     ACPI_PARSE_OBJECT       *NextOp;
601 
602 
603     NextOp = AcpiPsGetDepthNext (NULL, Op);
604     NextOp = NextOp->Common.Next;
605 
606     if (!NextOp)
607     {
608         /* Handle partial tree during single-step */
609 
610         return;
611     }
612 
613     /* Mark the two nodes that contain the encoding for the match keywords */
614 
615     NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
616 
617     NextOp = NextOp->Common.Next;
618     NextOp = NextOp->Common.Next;
619     NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
620 }
621 
622 
623 /*******************************************************************************
624  *
625  * FUNCTION:    AcpiDmMatchKeyword
626  *
627  * PARAMETERS:  Op              - Match Object to be examined
628  *
629  * RETURN:      None
630  *
631  * DESCRIPTION: Decode Match opcode operands
632  *
633  ******************************************************************************/
634 
635 static void
636 AcpiDmMatchKeyword (
637     ACPI_PARSE_OBJECT       *Op)
638 {
639 
640 
641     if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)
642     {
643         AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
644     }
645     else
646     {
647         AcpiOsPrintf ("%s", ACPI_CAST_PTR (char,
648             AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]));
649     }
650 }
651 
652 
653 /*******************************************************************************
654  *
655  * FUNCTION:    AcpiDmDisassembleOneOp
656  *
657  * PARAMETERS:  WalkState           - Current walk info
658  *              Info                - Parse tree walk info
659  *              Op                  - Op that is to be printed
660  *
661  * RETURN:      None
662  *
663  * DESCRIPTION: Disassemble a single AML opcode
664  *
665  ******************************************************************************/
666 
667 void
668 AcpiDmDisassembleOneOp (
669     ACPI_WALK_STATE         *WalkState,
670     ACPI_OP_WALK_INFO       *Info,
671     ACPI_PARSE_OBJECT       *Op)
672 {
673     const ACPI_OPCODE_INFO  *OpInfo = NULL;
674     UINT32                  Offset;
675     UINT32                  Length;
676     ACPI_PARSE_OBJECT       *Child;
677     ACPI_STATUS             Status;
678     UINT8                   *Aml;
679     const AH_DEVICE_ID      *IdInfo;
680 
681 
682     if (!Op)
683     {
684         AcpiOsPrintf ("<NULL OP PTR>");
685         return;
686     }
687 
688     switch (Op->Common.DisasmOpcode)
689     {
690     case ACPI_DASM_MATCHOP:
691 
692         AcpiDmMatchKeyword (Op);
693         return;
694 
695     case ACPI_DASM_LNOT_SUFFIX:
696 
697         switch (Op->Common.AmlOpcode)
698         {
699         case AML_LEQUAL_OP:
700 
701             AcpiOsPrintf ("LNotEqual");
702             break;
703 
704         case AML_LGREATER_OP:
705 
706             AcpiOsPrintf ("LLessEqual");
707             break;
708 
709         case AML_LLESS_OP:
710 
711             AcpiOsPrintf ("LGreaterEqual");
712             break;
713 
714         default:
715 
716             break;
717         }
718         Op->Common.DisasmOpcode = 0;
719         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
720         return;
721 
722     default:
723         break;
724     }
725 
726 
727     OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
728 
729     /* The op and arguments */
730 
731     switch (Op->Common.AmlOpcode)
732     {
733     case AML_LNOT_OP:
734 
735         Child = Op->Common.Value.Arg;
736         if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) ||
737             (Child->Common.AmlOpcode == AML_LGREATER_OP) ||
738             (Child->Common.AmlOpcode == AML_LLESS_OP))
739         {
740             Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
741             Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
742         }
743         else
744         {
745             AcpiOsPrintf ("%s", OpInfo->Name);
746         }
747         break;
748 
749     case AML_BYTE_OP:
750 
751         AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
752         break;
753 
754     case AML_WORD_OP:
755 
756         if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
757         {
758             AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
759         }
760         else
761         {
762             AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
763         }
764         break;
765 
766     case AML_DWORD_OP:
767 
768         if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
769         {
770             AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
771         }
772         else
773         {
774             AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
775         }
776         break;
777 
778     case AML_QWORD_OP:
779 
780         AcpiOsPrintf ("0x%8.8X%8.8X",
781             ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
782         break;
783 
784     case AML_STRING_OP:
785 
786         AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
787 
788         /* For _HID/_CID strings, attempt to output a descriptive comment */
789 
790         if (Op->Common.DisasmOpcode == ACPI_DASM_HID_STRING)
791         {
792             /* If we know about the ID, emit the description */
793 
794             IdInfo = AcpiAhMatchHardwareId (Op->Common.Value.String);
795             if (IdInfo)
796             {
797                 AcpiOsPrintf (" /* %s */", IdInfo->Description);
798             }
799         }
800         break;
801 
802     case AML_BUFFER_OP:
803         /*
804          * Determine the type of buffer. We can have one of the following:
805          *
806          * 1) ResourceTemplate containing Resource Descriptors.
807          * 2) Unicode String buffer
808          * 3) ASCII String buffer
809          * 4) Raw data buffer (if none of the above)
810          *
811          * Since there are no special AML opcodes to differentiate these
812          * types of buffers, we have to closely look at the data in the
813          * buffer to determine the type.
814          */
815         if (!AcpiGbl_NoResourceDisassembly)
816         {
817             Status = AcpiDmIsResourceTemplate (WalkState, Op);
818             if (ACPI_SUCCESS (Status))
819             {
820                 Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
821                 AcpiOsPrintf ("ResourceTemplate");
822                 break;
823             }
824             else if (Status == AE_AML_NO_RESOURCE_END_TAG)
825             {
826                 AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
827             }
828         }
829 
830         if (AcpiDmIsUnicodeBuffer (Op))
831         {
832             Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
833             AcpiOsPrintf ("Unicode (");
834         }
835         else if (AcpiDmIsStringBuffer (Op))
836         {
837             Op->Common.DisasmOpcode = ACPI_DASM_STRING;
838             AcpiOsPrintf ("Buffer");
839         }
840         else if (AcpiDmIsPldBuffer (Op))
841         {
842             Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD;
843             AcpiOsPrintf ("Buffer");
844         }
845         else
846         {
847             Op->Common.DisasmOpcode = ACPI_DASM_BUFFER;
848             AcpiOsPrintf ("Buffer");
849         }
850         break;
851 
852     case AML_INT_STATICSTRING_OP:
853 
854         if (Op->Common.Value.String)
855         {
856             AcpiOsPrintf ("%s", Op->Common.Value.String);
857         }
858         else
859         {
860             AcpiOsPrintf ("\"<NULL STATIC STRING PTR>\"");
861         }
862         break;
863 
864     case AML_INT_NAMEPATH_OP:
865 
866         AcpiDmNamestring (Op->Common.Value.Name);
867         break;
868 
869     case AML_INT_NAMEDFIELD_OP:
870 
871         Length = AcpiDmDumpName (Op->Named.Name);
872         AcpiOsPrintf (",%*.s  %u", (unsigned) (5 - Length), " ",
873             (UINT32) Op->Common.Value.Integer);
874         AcpiDmCommaIfFieldMember (Op);
875 
876         Info->BitOffset += (UINT32) Op->Common.Value.Integer;
877         break;
878 
879     case AML_INT_RESERVEDFIELD_OP:
880 
881         /* Offset() -- Must account for previous offsets */
882 
883         Offset = (UINT32) Op->Common.Value.Integer;
884         Info->BitOffset += Offset;
885 
886         if (Info->BitOffset % 8 == 0)
887         {
888             AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
889         }
890         else
891         {
892             AcpiOsPrintf ("    ,   %u", Offset);
893         }
894 
895         AcpiDmCommaIfFieldMember (Op);
896         break;
897 
898     case AML_INT_ACCESSFIELD_OP:
899     case AML_INT_EXTACCESSFIELD_OP:
900 
901         AcpiOsPrintf ("AccessAs (%s, ",
902             AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer & 0x7)]);
903 
904         AcpiDmDecodeAttribute ((UINT8) (Op->Common.Value.Integer >> 8));
905 
906         if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP)
907         {
908             AcpiOsPrintf (" (0x%2.2X)", (unsigned) ((Op->Common.Value.Integer >> 16) & 0xFF));
909         }
910 
911         AcpiOsPrintf (")");
912         AcpiDmCommaIfFieldMember (Op);
913         break;
914 
915     case AML_INT_CONNECTION_OP:
916         /*
917          * Two types of Connection() - one with a buffer object, the
918          * other with a namestring that points to a buffer object.
919          */
920         AcpiOsPrintf ("Connection (");
921         Child = Op->Common.Value.Arg;
922 
923         if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
924         {
925             AcpiOsPrintf ("\n");
926 
927             Aml = Child->Named.Data;
928             Length = (UINT32) Child->Common.Value.Integer;
929 
930             Info->Level += 1;
931             Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
932             AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length);
933 
934             Info->Level -= 1;
935             AcpiDmIndent (Info->Level);
936         }
937         else
938         {
939             AcpiDmNamestring (Child->Common.Value.Name);
940         }
941 
942         AcpiOsPrintf (")");
943         AcpiDmCommaIfFieldMember (Op);
944         AcpiOsPrintf ("\n");
945 
946         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; /* for now, ignore in AcpiDmAscendingOp */
947         Child->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
948         break;
949 
950     case AML_INT_BYTELIST_OP:
951 
952         AcpiDmByteList (Info, Op);
953         break;
954 
955     case AML_INT_METHODCALL_OP:
956 
957         Op = AcpiPsGetDepthNext (NULL, Op);
958         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
959 
960         AcpiDmNamestring (Op->Common.Value.Name);
961         break;
962 
963     default:
964 
965         /* Just get the opcode name and print it */
966 
967         AcpiOsPrintf ("%s", OpInfo->Name);
968 
969 
970 #ifdef ACPI_DEBUGGER
971 
972         if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
973             (WalkState) &&
974             (WalkState->Results) &&
975             (WalkState->ResultCount))
976         {
977             AcpiDmDecodeInternalObject (
978                 WalkState->Results->Results.ObjDesc [
979                     (WalkState->ResultCount - 1) %
980                         ACPI_RESULTS_FRAME_OBJ_NUM]);
981         }
982 #endif
983 
984         break;
985     }
986 }
987 
988 #endif  /* ACPI_DISASSEMBLER */
989