Print this page
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/parser/psopcode.c
          +++ new/usr/src/common/acpica/components/parser/psopcode.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: psopcode - Parser/Interpreter opcode information table
   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
↓ open down ↓ 18 lines elided ↑ open up ↑
  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      -#include "acparser.h"
  48   47  #include "acopcode.h"
  49   48  #include "amlcode.h"
  50   49  
  51   50  
  52   51  #define _COMPONENT          ACPI_PARSER
  53   52          ACPI_MODULE_NAME    ("psopcode")
  54   53  
  55   54  
  56      -static const UINT8          AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6};
  57      -
  58      -
  59   55  /*******************************************************************************
  60   56   *
  61   57   * NAME:        AcpiGbl_AmlOpInfo
  62   58   *
  63   59   * DESCRIPTION: Opcode table. Each entry contains <opcode, type, name, operands>
  64   60   *              The name is a simple ascii string, the operand specifier is an
  65      - *              ascii string with one letter per operand.  The letter specifies
       61 + *              ascii string with one letter per operand. The letter specifies
  66   62   *              the operand type.
  67   63   *
  68   64   ******************************************************************************/
  69   65  
  70   66  /*
  71   67   * Summary of opcode types/flags
  72   68   *
  73   69  
  74   70   Opcodes that have associated namespace objects (AML_NSOBJECT flag)
  75   71  
↓ open down ↓ 104 lines elided ↑ open up ↑
 180  176      AML_CREATE_BIT_FIELD_OP
 181  177      AML_CREATE_BYTE_FIELD_OP
 182  178      AML_CREATE_WORD_FIELD_OP
 183  179      AML_CREATE_DWORD_FIELD_OP
 184  180      AML_CREATE_QWORD_FIELD_OP
 185  181  
 186  182   ******************************************************************************/
 187  183  
 188  184  
 189  185  /*
 190      - * Master Opcode information table.  A summary of everything we know about each
      186 + * Master Opcode information table. A summary of everything we know about each
 191  187   * opcode, all in one place.
 192  188   */
 193  189  const ACPI_OPCODE_INFO    AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
 194  190  {
 195  191  /*! [Begin] no source code translation */
 196  192  /* Index           Name                 Parser Args               Interpreter Args                ObjectType                    Class                      Type                  Flags */
 197  193  
 198  194  /* 00 */ ACPI_OP ("Zero",               ARGP_ZERO_OP,              ARGI_ZERO_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
 199  195  /* 01 */ ACPI_OP ("One",                ARGP_ONE_OP,               ARGI_ONE_OP,                ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
 200  196  /* 02 */ ACPI_OP ("Alias",              ARGP_ALIAS_OP,             ARGI_ALIAS_OP,              ACPI_TYPE_LOCAL_ALIAS,       AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
↓ open down ↓ 120 lines elided ↑ open up ↑
 321  317  /* 72 */ ACPI_OP ("CreateQWordField",   ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
 322  318  /* 73 */ ACPI_OP ("ToBuffer",           ARGP_TO_BUFFER_OP,         ARGI_TO_BUFFER_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
 323  319  /* 74 */ ACPI_OP ("ToDecimalString",    ARGP_TO_DEC_STR_OP,        ARGI_TO_DEC_STR_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
 324  320  /* 75 */ ACPI_OP ("ToHexString",        ARGP_TO_HEX_STR_OP,        ARGI_TO_HEX_STR_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
 325  321  /* 76 */ ACPI_OP ("ToInteger",          ARGP_TO_INTEGER_OP,        ARGI_TO_INTEGER_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
 326  322  /* 77 */ ACPI_OP ("ToString",           ARGP_TO_STRING_OP,         ARGI_TO_STRING_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
 327  323  /* 78 */ ACPI_OP ("CopyObject",         ARGP_COPY_OP,              ARGI_COPY_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R),
 328  324  /* 79 */ ACPI_OP ("Mid",                ARGP_MID_OP,               ARGI_MID_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_3A_1T_1R,   AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
 329  325  /* 7A */ ACPI_OP ("Continue",           ARGP_CONTINUE_OP,          ARGI_CONTINUE_OP,           ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
 330  326  /* 7B */ ACPI_OP ("LoadTable",          ARGP_LOAD_TABLE_OP,        ARGI_LOAD_TABLE_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_6A_0T_1R,   AML_FLAGS_EXEC_6A_0T_1R),
 331      -/* 7C */ ACPI_OP ("DataTableRegion",    ARGP_DATA_REGION_OP,       ARGI_DATA_REGION_OP,        ACPI_TYPE_REGION,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
      327 +/* 7C */ ACPI_OP ("DataTableRegion",    ARGP_DATA_REGION_OP,       ARGI_DATA_REGION_OP,        ACPI_TYPE_REGION,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,   AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
 332  328  /* 7D */ ACPI_OP ("[EvalSubTree]",      ARGP_SCOPE_OP,             ARGI_SCOPE_OP,              ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
 333  329  
 334  330  /* ACPI 3.0 opcodes */
 335  331  
 336      -/* 7E */ ACPI_OP ("Timer",              ARGP_TIMER_OP,             ARGI_TIMER_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_0A_0T_1R,   AML_FLAGS_EXEC_0A_0T_1R)
      332 +/* 7E */ ACPI_OP ("Timer",              ARGP_TIMER_OP,             ARGI_TIMER_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_0A_0T_1R,   AML_FLAGS_EXEC_0A_0T_1R),
 337  333  
 338      -/*! [End] no source code translation !*/
 339      -};
      334 +/* ACPI 5.0 opcodes */
 340  335  
 341      -/*
 342      - * This table is directly indexed by the opcodes, and returns an
 343      - * index into the table above
 344      - */
 345      -static const UINT8 AcpiGbl_ShortOpIndex[256] =
 346      -{
 347      -/*              0     1     2     3     4     5     6     7  */
 348      -/*              8     9     A     B     C     D     E     F  */
 349      -/* 0x00 */    0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
 350      -/* 0x08 */    0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
 351      -/* 0x10 */    0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
 352      -/* 0x18 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 353      -/* 0x20 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 354      -/* 0x28 */    _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
 355      -/* 0x30 */    0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
 356      -/* 0x38 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 357      -/* 0x40 */    _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
 358      -/* 0x48 */    _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
 359      -/* 0x50 */    _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
 360      -/* 0x58 */    _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
 361      -/* 0x60 */    0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
 362      -/* 0x68 */    0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
 363      -/* 0x70 */    0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
 364      -/* 0x78 */    0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
 365      -/* 0x80 */    0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
 366      -/* 0x88 */    0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
 367      -/* 0x90 */    0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
 368      -/* 0x98 */    0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
 369      -/* 0xA0 */    0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
 370      -/* 0xA8 */    0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 371      -/* 0xB0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 372      -/* 0xB8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 373      -/* 0xC0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 374      -/* 0xC8 */    _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
 375      -/* 0xD0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 376      -/* 0xD8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 377      -/* 0xE0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 378      -/* 0xE8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 379      -/* 0xF0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 380      -/* 0xF8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
 381      -};
      336 +/* 7F */ ACPI_OP ("-ConnectField-",     ARGP_CONNECTFIELD_OP,      ARGI_CONNECTFIELD_OP,       ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_HAS_ARGS),
      337 +/* 80 */ ACPI_OP ("-ExtAccessField-",   ARGP_CONNECTFIELD_OP,      ARGI_CONNECTFIELD_OP,       ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           0)
 382  338  
 383      -/*
 384      - * This table is indexed by the second opcode of the extended opcode
 385      - * pair.  It returns an index into the opcode table (AcpiGbl_AmlOpInfo)
 386      - */
 387      -static const UINT8 AcpiGbl_LongOpIndex[NUM_EXTENDED_OPCODE] =
 388      -{
 389      -/*              0     1     2     3     4     5     6     7  */
 390      -/*              8     9     A     B     C     D     E     F  */
 391      -/* 0x00 */    _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
 392      -/* 0x08 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 393      -/* 0x10 */    _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
 394      -/* 0x18 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
 395      -/* 0x20 */    0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
 396      -/* 0x28 */    0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
 397      -/* 0x30 */    0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
 398      -/* 0x38 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 399      -/* 0x40 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 400      -/* 0x48 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 401      -/* 0x50 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 402      -/* 0x58 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 403      -/* 0x60 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 404      -/* 0x68 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 405      -/* 0x70 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 406      -/* 0x78 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 407      -/* 0x80 */    0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
 408      -/* 0x88 */    0x7C,
      339 +/*! [End] no source code translation !*/
 409  340  };
 410      -
 411      -
 412      -/*******************************************************************************
 413      - *
 414      - * FUNCTION:    AcpiPsGetOpcodeInfo
 415      - *
 416      - * PARAMETERS:  Opcode              - The AML opcode
 417      - *
 418      - * RETURN:      A pointer to the info about the opcode.
 419      - *
 420      - * DESCRIPTION: Find AML opcode description based on the opcode.
 421      - *              NOTE: This procedure must ALWAYS return a valid pointer!
 422      - *
 423      - ******************************************************************************/
 424      -
 425      -const ACPI_OPCODE_INFO *
 426      -AcpiPsGetOpcodeInfo (
 427      -    UINT16                  Opcode)
 428      -{
 429      -    ACPI_FUNCTION_NAME (PsGetOpcodeInfo);
 430      -
 431      -
 432      -    /*
 433      -     * Detect normal 8-bit opcode or extended 16-bit opcode
 434      -     */
 435      -    if (!(Opcode & 0xFF00))
 436      -    {
 437      -        /* Simple (8-bit) opcode: 0-255, can't index beyond table  */
 438      -
 439      -        return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]);
 440      -    }
 441      -
 442      -    if (((Opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
 443      -        (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE))
 444      -    {
 445      -        /* Valid extended (16-bit) opcode */
 446      -
 447      -        return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
 448      -    }
 449      -
 450      -    /* Unknown AML opcode */
 451      -
 452      -    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
 453      -        "Unknown AML opcode [%4.4X]\n", Opcode));
 454      -
 455      -    return (&AcpiGbl_AmlOpInfo [_UNK]);
 456      -}
 457      -
 458      -
 459      -/*******************************************************************************
 460      - *
 461      - * FUNCTION:    AcpiPsGetOpcodeName
 462      - *
 463      - * PARAMETERS:  Opcode              - The AML opcode
 464      - *
 465      - * RETURN:      A pointer to the name of the opcode (ASCII String)
 466      - *              Note: Never returns NULL.
 467      - *
 468      - * DESCRIPTION: Translate an opcode into a human-readable string
 469      - *
 470      - ******************************************************************************/
 471      -
 472      -char *
 473      -AcpiPsGetOpcodeName (
 474      -    UINT16                  Opcode)
 475      -{
 476      -#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
 477      -
 478      -    const ACPI_OPCODE_INFO  *Op;
 479      -
 480      -
 481      -    Op = AcpiPsGetOpcodeInfo (Opcode);
 482      -
 483      -    /* Always guaranteed to return a valid pointer */
 484      -
 485      -    return (Op->Name);
 486      -
 487      -#else
 488      -    return ("OpcodeName unavailable");
 489      -
 490      -#endif
 491      -}
 492      -
 493      -
 494      -/*******************************************************************************
 495      - *
 496      - * FUNCTION:    AcpiPsGetArgumentCount
 497      - *
 498      - * PARAMETERS:  OpType              - Type associated with the AML opcode
 499      - *
 500      - * RETURN:      Argument count
 501      - *
 502      - * DESCRIPTION: Obtain the number of expected arguments for an AML opcode
 503      - *
 504      - ******************************************************************************/
 505      -
 506      -UINT8
 507      -AcpiPsGetArgumentCount (
 508      -    UINT32                  OpType)
 509      -{
 510      -
 511      -    if (OpType <= AML_TYPE_EXEC_6A_0T_1R)
 512      -    {
 513      -        return (AcpiGbl_ArgumentCount[OpType]);
 514      -    }
 515      -
 516      -    return (0);
 517      -}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX