xref: /onnv-gate/usr/src/uts/intel/io/acpica/disassembler/dmopcode.c (revision 9980:13d7f3eec672)
13446Smrj /*******************************************************************************
23446Smrj  *
33446Smrj  * Module Name: dmopcode - AML disassembler, specific AML opcodes
43446Smrj  *
53446Smrj  ******************************************************************************/
63446Smrj 
73446Smrj /******************************************************************************
83446Smrj  *
93446Smrj  * 1. Copyright Notice
103446Smrj  *
11*9980SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
123446Smrj  * All rights reserved.
133446Smrj  *
143446Smrj  * 2. License
153446Smrj  *
163446Smrj  * 2.1. This is your license from Intel Corp. under its intellectual property
173446Smrj  * rights.  You may have additional license terms from the party that provided
183446Smrj  * you this software, covering your right to use that party's intellectual
193446Smrj  * property rights.
203446Smrj  *
213446Smrj  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
223446Smrj  * copy of the source code appearing in this file ("Covered Code") an
233446Smrj  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
243446Smrj  * base code distributed originally by Intel ("Original Intel Code") to copy,
253446Smrj  * make derivatives, distribute, use and display any portion of the Covered
263446Smrj  * Code in any form, with the right to sublicense such rights; and
273446Smrj  *
283446Smrj  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
293446Smrj  * license (with the right to sublicense), under only those claims of Intel
303446Smrj  * patents that are infringed by the Original Intel Code, to make, use, sell,
313446Smrj  * offer to sell, and import the Covered Code and derivative works thereof
323446Smrj  * solely to the minimum extent necessary to exercise the above copyright
333446Smrj  * license, and in no event shall the patent license extend to any additions
343446Smrj  * to or modifications of the Original Intel Code.  No other license or right
353446Smrj  * is granted directly or by implication, estoppel or otherwise;
363446Smrj  *
373446Smrj  * The above copyright and patent license is granted only if the following
383446Smrj  * conditions are met:
393446Smrj  *
403446Smrj  * 3. Conditions
413446Smrj  *
423446Smrj  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
433446Smrj  * Redistribution of source code of any substantial portion of the Covered
443446Smrj  * Code or modification with rights to further distribute source must include
453446Smrj  * the above Copyright Notice, the above License, this list of Conditions,
463446Smrj  * and the following Disclaimer and Export Compliance provision.  In addition,
473446Smrj  * Licensee must cause all Covered Code to which Licensee contributes to
483446Smrj  * contain a file documenting the changes Licensee made to create that Covered
493446Smrj  * Code and the date of any change.  Licensee must include in that file the
503446Smrj  * documentation of any changes made by any predecessor Licensee.  Licensee
513446Smrj  * must include a prominent statement that the modification is derived,
523446Smrj  * directly or indirectly, from Original Intel Code.
533446Smrj  *
543446Smrj  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
553446Smrj  * Redistribution of source code of any substantial portion of the Covered
563446Smrj  * Code or modification without rights to further distribute source must
573446Smrj  * include the following Disclaimer and Export Compliance provision in the
583446Smrj  * documentation and/or other materials provided with distribution.  In
593446Smrj  * addition, Licensee may not authorize further sublicense of source of any
603446Smrj  * portion of the Covered Code, and must include terms to the effect that the
613446Smrj  * license from Licensee to its licensee is limited to the intellectual
623446Smrj  * property embodied in the software Licensee provides to its licensee, and
633446Smrj  * not to intellectual property embodied in modifications its licensee may
643446Smrj  * make.
653446Smrj  *
663446Smrj  * 3.3. Redistribution of Executable. Redistribution in executable form of any
673446Smrj  * substantial portion of the Covered Code or modification must reproduce the
683446Smrj  * above Copyright Notice, and the following Disclaimer and Export Compliance
693446Smrj  * provision in the documentation and/or other materials provided with the
703446Smrj  * distribution.
713446Smrj  *
723446Smrj  * 3.4. Intel retains all right, title, and interest in and to the Original
733446Smrj  * Intel Code.
743446Smrj  *
753446Smrj  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
763446Smrj  * Intel shall be used in advertising or otherwise to promote the sale, use or
773446Smrj  * other dealings in products derived from or relating to the Covered Code
783446Smrj  * without prior written authorization from Intel.
793446Smrj  *
803446Smrj  * 4. Disclaimer and Export Compliance
813446Smrj  *
823446Smrj  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
833446Smrj  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
843446Smrj  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
853446Smrj  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
863446Smrj  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
873446Smrj  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
883446Smrj  * PARTICULAR PURPOSE.
893446Smrj  *
903446Smrj  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
913446Smrj  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
923446Smrj  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
933446Smrj  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
943446Smrj  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
953446Smrj  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
963446Smrj  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
973446Smrj  * LIMITED REMEDY.
983446Smrj  *
993446Smrj  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1003446Smrj  * software or system incorporating such software without first obtaining any
1013446Smrj  * required license or other approval from the U. S. Department of Commerce or
1023446Smrj  * any other agency or department of the United States Government.  In the
1033446Smrj  * event Licensee exports any such software from the United States or
1043446Smrj  * re-exports any such software from a foreign destination, Licensee shall
1053446Smrj  * ensure that the distribution and export/re-export of the software is in
1063446Smrj  * compliance with all laws, regulations, orders, or other restrictions of the
1073446Smrj  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1083446Smrj  * any of its subsidiaries will export/re-export any technical data, process,
1093446Smrj  * software, or service, directly or indirectly, to any country for which the
1103446Smrj  * United States government or any agency thereof requires an export license,
1113446Smrj  * other governmental approval, or letter of assurance, without first obtaining
1123446Smrj  * such license, approval or letter.
1133446Smrj  *
1143446Smrj  *****************************************************************************/
1153446Smrj 
1163446Smrj #include "acpi.h"
117*9980SDana.Myers@Sun.COM #include "accommon.h"
1183446Smrj #include "acparser.h"
1193446Smrj #include "amlcode.h"
1203446Smrj #include "acdisasm.h"
1213446Smrj 
1223446Smrj #ifdef ACPI_DISASSEMBLER
1233446Smrj 
1243446Smrj #define _COMPONENT          ACPI_CA_DEBUGGER
1253446Smrj         ACPI_MODULE_NAME    ("dmopcode")
1263446Smrj 
1273446Smrj /* Local prototypes */
1283446Smrj 
1293446Smrj static void
1303446Smrj AcpiDmMatchKeyword (
1313446Smrj     ACPI_PARSE_OBJECT       *Op);
1323446Smrj 
1333446Smrj 
1343446Smrj /*******************************************************************************
1353446Smrj  *
1363446Smrj  * FUNCTION:    AcpiDmMethodFlags
1373446Smrj  *
1383446Smrj  * PARAMETERS:  Op              - Method Object to be examined
1393446Smrj  *
1403446Smrj  * RETURN:      None
1413446Smrj  *
1423446Smrj  * DESCRIPTION: Decode control method flags
1433446Smrj  *
1443446Smrj  ******************************************************************************/
1453446Smrj 
1463446Smrj void
AcpiDmMethodFlags(ACPI_PARSE_OBJECT * Op)1473446Smrj AcpiDmMethodFlags (
1483446Smrj     ACPI_PARSE_OBJECT       *Op)
1493446Smrj {
1503446Smrj     UINT32                  Flags;
1513446Smrj     UINT32                  Args;
1523446Smrj 
1533446Smrj 
1543446Smrj     /* The next Op contains the flags */
1553446Smrj 
1563446Smrj     Op = AcpiPsGetDepthNext (NULL, Op);
1573446Smrj     Flags = (UINT8) Op->Common.Value.Integer;
1583446Smrj     Args = Flags & 0x07;
1593446Smrj 
1603446Smrj     /* Mark the Op as completed */
1613446Smrj 
1623446Smrj     Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
1633446Smrj 
1643446Smrj     /* 1) Method argument count */
1653446Smrj 
1663446Smrj     AcpiOsPrintf (", %d, ", Args);
1673446Smrj 
1683446Smrj     /* 2) Serialize rule */
1693446Smrj 
1703446Smrj     if (!(Flags & 0x08))
1713446Smrj     {
1723446Smrj         AcpiOsPrintf ("Not");
1733446Smrj     }
1743446Smrj 
1753446Smrj     AcpiOsPrintf ("Serialized");
1763446Smrj 
1773446Smrj     /* 3) SyncLevel */
1783446Smrj 
1793446Smrj     if (Flags & 0xF0)
1803446Smrj     {
1813446Smrj         AcpiOsPrintf (", %d", Flags >> 4);
1823446Smrj     }
1833446Smrj }
1843446Smrj 
1853446Smrj 
1863446Smrj /*******************************************************************************
1873446Smrj  *
1883446Smrj  * FUNCTION:    AcpiDmFieldFlags
1893446Smrj  *
1903446Smrj  * PARAMETERS:  Op              - Field Object to be examined
1913446Smrj  *
1923446Smrj  * RETURN:      None
1933446Smrj  *
1943446Smrj  * DESCRIPTION: Decode Field definition flags
1953446Smrj  *
1963446Smrj  ******************************************************************************/
1973446Smrj 
1983446Smrj void
AcpiDmFieldFlags(ACPI_PARSE_OBJECT * Op)1993446Smrj AcpiDmFieldFlags (
2003446Smrj     ACPI_PARSE_OBJECT       *Op)
2013446Smrj {
2023446Smrj     UINT32                  Flags;
2033446Smrj 
2043446Smrj 
2053446Smrj     Op = Op->Common.Next;
2063446Smrj     Flags = (UINT8) Op->Common.Value.Integer;
2073446Smrj 
2083446Smrj     /* Mark the Op as completed */
2093446Smrj 
2103446Smrj     Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
2113446Smrj 
2123446Smrj     AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]);
2133446Smrj     AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
2143446Smrj     AcpiOsPrintf ("%s)",  AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
2153446Smrj }
2163446Smrj 
2173446Smrj 
2183446Smrj /*******************************************************************************
2193446Smrj  *
2203446Smrj  * FUNCTION:    AcpiDmAddressSpace
2213446Smrj  *
2223446Smrj  * PARAMETERS:  SpaceId         - ID to be translated
2233446Smrj  *
2243446Smrj  * RETURN:      None
2253446Smrj  *
2263446Smrj  * DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword
2273446Smrj  *
2283446Smrj  ******************************************************************************/
2293446Smrj 
2303446Smrj void
AcpiDmAddressSpace(UINT8 SpaceId)2313446Smrj AcpiDmAddressSpace (
2323446Smrj     UINT8                   SpaceId)
2333446Smrj {
2343446Smrj 
2353446Smrj     if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
2363446Smrj     {
2373446Smrj         if (SpaceId == 0x7F)
2383446Smrj         {
2393446Smrj             AcpiOsPrintf ("FFixedHW, ");
2403446Smrj         }
2413446Smrj         else
2423446Smrj         {
2433446Smrj             AcpiOsPrintf ("0x%.2X, ", SpaceId);
2443446Smrj         }
2453446Smrj     }
2463446Smrj     else
2473446Smrj     {
2483446Smrj         AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]);
2493446Smrj     }
2503446Smrj }
2513446Smrj 
2523446Smrj 
2533446Smrj /*******************************************************************************
2543446Smrj  *
2553446Smrj  * FUNCTION:    AcpiDmRegionFlags
2563446Smrj  *
2573446Smrj  * PARAMETERS:  Op              - Object to be examined
2583446Smrj  *
2593446Smrj  * RETURN:      None
2603446Smrj  *
2613446Smrj  * DESCRIPTION: Decode OperationRegion flags
2623446Smrj  *
2633446Smrj  ******************************************************************************/
2643446Smrj 
2653446Smrj void
AcpiDmRegionFlags(ACPI_PARSE_OBJECT * Op)2663446Smrj AcpiDmRegionFlags (
2673446Smrj     ACPI_PARSE_OBJECT       *Op)
2683446Smrj {
2693446Smrj 
2703446Smrj 
2713446Smrj     /* The next Op contains the SpaceId */
2723446Smrj 
2733446Smrj     Op = AcpiPsGetDepthNext (NULL, Op);
2743446Smrj 
2753446Smrj     /* Mark the Op as completed */
2763446Smrj 
2773446Smrj     Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
2783446Smrj 
2793446Smrj     AcpiOsPrintf (", ");
2803446Smrj     AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer);
2813446Smrj }
2823446Smrj 
2833446Smrj 
2843446Smrj /*******************************************************************************
2853446Smrj  *
2863446Smrj  * FUNCTION:    AcpiDmMatchOp
2873446Smrj  *
2883446Smrj  * PARAMETERS:  Op              - Match Object to be examined
2893446Smrj  *
2903446Smrj  * RETURN:      None
2913446Smrj  *
2923446Smrj  * DESCRIPTION: Decode Match opcode operands
2933446Smrj  *
2943446Smrj  ******************************************************************************/
2953446Smrj 
2963446Smrj void
AcpiDmMatchOp(ACPI_PARSE_OBJECT * Op)2973446Smrj AcpiDmMatchOp (
2983446Smrj     ACPI_PARSE_OBJECT       *Op)
2993446Smrj {
3003446Smrj     ACPI_PARSE_OBJECT       *NextOp;
3013446Smrj 
3023446Smrj 
3033446Smrj     NextOp = AcpiPsGetDepthNext (NULL, Op);
3043446Smrj     NextOp = NextOp->Common.Next;
3053446Smrj 
3063446Smrj     if (!NextOp)
3073446Smrj     {
3083446Smrj         /* Handle partial tree during single-step */
3093446Smrj 
3103446Smrj         return;
3113446Smrj     }
3123446Smrj 
3133446Smrj     /* Mark the two nodes that contain the encoding for the match keywords */
3143446Smrj 
3153446Smrj     NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
3163446Smrj 
3173446Smrj     NextOp = NextOp->Common.Next;
3183446Smrj     NextOp = NextOp->Common.Next;
3193446Smrj     NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
3203446Smrj }
3213446Smrj 
3223446Smrj 
3233446Smrj /*******************************************************************************
3243446Smrj  *
3253446Smrj  * FUNCTION:    AcpiDmMatchKeyword
3263446Smrj  *
3273446Smrj  * PARAMETERS:  Op              - Match Object to be examined
3283446Smrj  *
3293446Smrj  * RETURN:      None
3303446Smrj  *
3313446Smrj  * DESCRIPTION: Decode Match opcode operands
3323446Smrj  *
3333446Smrj  ******************************************************************************/
3343446Smrj 
3353446Smrj static void
AcpiDmMatchKeyword(ACPI_PARSE_OBJECT * Op)3363446Smrj AcpiDmMatchKeyword (
3373446Smrj     ACPI_PARSE_OBJECT       *Op)
3383446Smrj {
3393446Smrj 
3403446Smrj 
3413446Smrj     if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)
3423446Smrj     {
3433446Smrj         AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
3443446Smrj     }
3453446Smrj     else
3463446Smrj     {
3473446Smrj         AcpiOsPrintf ("%s", ACPI_CAST_PTR (char,
3483446Smrj             AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]));
3493446Smrj     }
3503446Smrj }
3513446Smrj 
3523446Smrj 
3533446Smrj /*******************************************************************************
3543446Smrj  *
3553446Smrj  * FUNCTION:    AcpiDmDisassembleOneOp
3563446Smrj  *
3573446Smrj  * PARAMETERS:  WalkState           - Current walk info
3583446Smrj  *              Info                - Parse tree walk info
3593446Smrj  *              Op                  - Op that is to be printed
3603446Smrj  *
3613446Smrj  * RETURN:      None
3623446Smrj  *
3633446Smrj  * DESCRIPTION: Disassemble a single AML opcode
3643446Smrj  *
3653446Smrj  ******************************************************************************/
3663446Smrj 
3673446Smrj void
AcpiDmDisassembleOneOp(ACPI_WALK_STATE * WalkState,ACPI_OP_WALK_INFO * Info,ACPI_PARSE_OBJECT * Op)3683446Smrj AcpiDmDisassembleOneOp (
3693446Smrj     ACPI_WALK_STATE         *WalkState,
3703446Smrj     ACPI_OP_WALK_INFO       *Info,
3713446Smrj     ACPI_PARSE_OBJECT       *Op)
3723446Smrj {
3733446Smrj     const ACPI_OPCODE_INFO  *OpInfo = NULL;
3743446Smrj     UINT32                  Offset;
3753446Smrj     UINT32                  Length;
3763446Smrj     ACPI_PARSE_OBJECT       *Child;
3777851SDana.Myers@Sun.COM     ACPI_STATUS             Status;
3783446Smrj 
3793446Smrj 
3803446Smrj     if (!Op)
3813446Smrj     {
3823446Smrj         AcpiOsPrintf ("<NULL OP PTR>");
3833446Smrj         return;
3843446Smrj     }
3853446Smrj 
3863446Smrj     switch (Op->Common.DisasmOpcode)
3873446Smrj     {
3883446Smrj     case ACPI_DASM_MATCHOP:
3893446Smrj 
3903446Smrj         AcpiDmMatchKeyword (Op);
3913446Smrj         return;
3923446Smrj 
3933446Smrj     case ACPI_DASM_LNOT_SUFFIX:
3943446Smrj         switch (Op->Common.AmlOpcode)
3953446Smrj         {
3963446Smrj         case AML_LEQUAL_OP:
3973446Smrj             AcpiOsPrintf ("LNotEqual");
3983446Smrj             break;
3993446Smrj 
4003446Smrj         case AML_LGREATER_OP:
4013446Smrj             AcpiOsPrintf ("LLessEqual");
4023446Smrj             break;
4033446Smrj 
4043446Smrj         case AML_LLESS_OP:
4053446Smrj             AcpiOsPrintf ("LGreaterEqual");
4063446Smrj             break;
4077851SDana.Myers@Sun.COM 
4087851SDana.Myers@Sun.COM         default:
4097851SDana.Myers@Sun.COM             break;
4103446Smrj         }
4113446Smrj         Op->Common.DisasmOpcode = 0;
4123446Smrj         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
4133446Smrj         return;
4143446Smrj 
4153446Smrj     default:
4163446Smrj         break;
4173446Smrj     }
4183446Smrj 
4193446Smrj 
4203446Smrj     OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
4213446Smrj 
4223446Smrj     /* The op and arguments */
4233446Smrj 
4243446Smrj     switch (Op->Common.AmlOpcode)
4253446Smrj     {
4263446Smrj     case AML_LNOT_OP:
4273446Smrj 
4283446Smrj         Child = Op->Common.Value.Arg;
4293446Smrj         if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) ||
4303446Smrj             (Child->Common.AmlOpcode == AML_LGREATER_OP) ||
4313446Smrj             (Child->Common.AmlOpcode == AML_LLESS_OP))
4323446Smrj         {
4333446Smrj             Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
4343446Smrj             Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
4353446Smrj         }
4363446Smrj         else
4373446Smrj         {
4383446Smrj             AcpiOsPrintf ("%s", OpInfo->Name);
4393446Smrj         }
4403446Smrj         break;
4413446Smrj 
4423446Smrj     case AML_BYTE_OP:
4433446Smrj 
4443446Smrj         AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
4453446Smrj         break;
4463446Smrj 
4473446Smrj 
4483446Smrj     case AML_WORD_OP:
4493446Smrj 
4503446Smrj         if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
4513446Smrj         {
4523446Smrj             AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
4533446Smrj         }
4543446Smrj         else
4553446Smrj         {
4563446Smrj             AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
4573446Smrj         }
4583446Smrj         break;
4593446Smrj 
4603446Smrj 
4613446Smrj     case AML_DWORD_OP:
4623446Smrj 
4633446Smrj         if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
4643446Smrj         {
4653446Smrj             AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
4663446Smrj         }
4673446Smrj         else
4683446Smrj         {
4693446Smrj             AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
4703446Smrj         }
4713446Smrj         break;
4723446Smrj 
4733446Smrj 
4743446Smrj     case AML_QWORD_OP:
4753446Smrj 
4763446Smrj         AcpiOsPrintf ("0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi,
4773446Smrj                                       Op->Common.Value.Integer64.Lo);
4783446Smrj         break;
4793446Smrj 
4803446Smrj 
4813446Smrj     case AML_STRING_OP:
4823446Smrj 
4833446Smrj         AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT8_MAX);
4843446Smrj         break;
4853446Smrj 
4863446Smrj 
4873446Smrj     case AML_BUFFER_OP:
4883446Smrj 
4893446Smrj         /*
4903446Smrj          * Determine the type of buffer.  We can have one of the following:
4913446Smrj          *
4923446Smrj          * 1) ResourceTemplate containing Resource Descriptors.
4933446Smrj          * 2) Unicode String buffer
4943446Smrj          * 3) ASCII String buffer
4953446Smrj          * 4) Raw data buffer (if none of the above)
4963446Smrj          *
4973446Smrj          * Since there are no special AML opcodes to differentiate these
4983446Smrj          * types of buffers, we have to closely look at the data in the
4993446Smrj          * buffer to determine the type.
5003446Smrj          */
5017851SDana.Myers@Sun.COM         Status = AcpiDmIsResourceTemplate (Op);
5027851SDana.Myers@Sun.COM         if (ACPI_SUCCESS (Status))
5033446Smrj         {
5043446Smrj             Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
5053446Smrj             AcpiOsPrintf ("ResourceTemplate");
5067851SDana.Myers@Sun.COM             break;
5073446Smrj         }
5087851SDana.Myers@Sun.COM         else if (Status == AE_AML_NO_RESOURCE_END_TAG)
5097851SDana.Myers@Sun.COM         {
5107851SDana.Myers@Sun.COM             AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
5117851SDana.Myers@Sun.COM         }
5127851SDana.Myers@Sun.COM 
5137851SDana.Myers@Sun.COM         if (AcpiDmIsUnicodeBuffer (Op))
5143446Smrj         {
5153446Smrj             Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
5163446Smrj             AcpiOsPrintf ("Unicode (");
5173446Smrj         }
5183446Smrj         else if (AcpiDmIsStringBuffer (Op))
5193446Smrj         {
5203446Smrj             Op->Common.DisasmOpcode = ACPI_DASM_STRING;
5213446Smrj             AcpiOsPrintf ("Buffer");
5223446Smrj         }
5233446Smrj         else
5243446Smrj         {
5253446Smrj             Op->Common.DisasmOpcode = ACPI_DASM_BUFFER;
5263446Smrj             AcpiOsPrintf ("Buffer");
5273446Smrj         }
5283446Smrj         break;
5293446Smrj 
5303446Smrj 
5313446Smrj     case AML_INT_STATICSTRING_OP:
5323446Smrj 
5333446Smrj         if (Op->Common.Value.String)
5343446Smrj         {
5353446Smrj             AcpiOsPrintf ("%s", Op->Common.Value.String);
5363446Smrj         }
5373446Smrj         else
5383446Smrj         {
5393446Smrj             AcpiOsPrintf ("\"<NULL STATIC STRING PTR>\"");
5403446Smrj         }
5413446Smrj         break;
5423446Smrj 
5433446Smrj 
5443446Smrj     case AML_INT_NAMEPATH_OP:
5453446Smrj 
5463446Smrj         AcpiDmNamestring (Op->Common.Value.Name);
5473446Smrj         break;
5483446Smrj 
5493446Smrj 
5503446Smrj     case AML_INT_NAMEDFIELD_OP:
5513446Smrj 
5527851SDana.Myers@Sun.COM         Length = AcpiDmDumpName (Op->Named.Name);
5533446Smrj         AcpiOsPrintf (",%*.s  %d", (int) (5 - Length), " ",
5543446Smrj             (UINT32) Op->Common.Value.Integer);
5553446Smrj         AcpiDmCommaIfFieldMember (Op);
5563446Smrj 
5573446Smrj         Info->BitOffset += (UINT32) Op->Common.Value.Integer;
5583446Smrj         break;
5593446Smrj 
5603446Smrj 
5613446Smrj     case AML_INT_RESERVEDFIELD_OP:
5623446Smrj 
5633446Smrj         /* Offset() -- Must account for previous offsets */
5643446Smrj 
5653446Smrj         Offset = (UINT32) Op->Common.Value.Integer;
5663446Smrj         Info->BitOffset += Offset;
5673446Smrj 
5683446Smrj         if (Info->BitOffset % 8 == 0)
5693446Smrj         {
5703446Smrj             AcpiOsPrintf ("        Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
5713446Smrj         }
5723446Smrj         else
5733446Smrj         {
5743446Smrj             AcpiOsPrintf ("    ,   %d", Offset);
5753446Smrj         }
5763446Smrj 
5773446Smrj         AcpiDmCommaIfFieldMember (Op);
5783446Smrj         break;
5793446Smrj 
5803446Smrj 
5813446Smrj     case AML_INT_ACCESSFIELD_OP:
5823446Smrj 
5833446Smrj         AcpiOsPrintf ("        AccessAs (%s, ",
5843446Smrj             AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]);
5853446Smrj 
5863446Smrj         AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
5873446Smrj         AcpiOsPrintf (")");
5883446Smrj         AcpiDmCommaIfFieldMember (Op);
5893446Smrj         break;
5903446Smrj 
5913446Smrj 
5923446Smrj     case AML_INT_BYTELIST_OP:
5933446Smrj 
5943446Smrj         AcpiDmByteList (Info, Op);
5953446Smrj         break;
5963446Smrj 
5973446Smrj 
5983446Smrj     case AML_INT_METHODCALL_OP:
5993446Smrj 
6003446Smrj         Op = AcpiPsGetDepthNext (NULL, Op);
6013446Smrj         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
6023446Smrj 
6033446Smrj         AcpiDmNamestring (Op->Common.Value.Name);
6043446Smrj         break;
6053446Smrj 
6063446Smrj 
6073446Smrj     default:
6083446Smrj 
6093446Smrj         /* Just get the opcode name and print it */
6103446Smrj 
6113446Smrj         AcpiOsPrintf ("%s", OpInfo->Name);
6123446Smrj 
6133446Smrj 
6143446Smrj #ifdef ACPI_DEBUGGER
6153446Smrj 
6163446Smrj         if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
6173446Smrj             (WalkState) &&
6183446Smrj             (WalkState->Results) &&
6197851SDana.Myers@Sun.COM             (WalkState->ResultCount))
6203446Smrj         {
6213446Smrj             AcpiDmDecodeInternalObject (
6223446Smrj                 WalkState->Results->Results.ObjDesc [
6237851SDana.Myers@Sun.COM                     (WalkState->ResultCount - 1) %
6247851SDana.Myers@Sun.COM                         ACPI_RESULTS_FRAME_OBJ_NUM]);
6253446Smrj         }
6263446Smrj #endif
6277851SDana.Myers@Sun.COM 
6283446Smrj         break;
6293446Smrj     }
6303446Smrj }
6313446Smrj 
6323446Smrj #endif  /* ACPI_DISASSEMBLER */
633