Home | History | Annotate | Line # | Download | only in compiler
asldefine.h revision 1.1.1.5.2.4
      1          1.1    jruoho /******************************************************************************
      2          1.1    jruoho  *
      3          1.1    jruoho  * Module Name: asldefine.h - Common defines for the iASL compiler
      4          1.1    jruoho  *
      5          1.1    jruoho  *****************************************************************************/
      6          1.1    jruoho 
      7      1.1.1.2    jruoho /*
      8  1.1.1.5.2.3     skrll  * Copyright (C) 2000 - 2016, Intel Corp.
      9          1.1    jruoho  * All rights reserved.
     10          1.1    jruoho  *
     11      1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12      1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13      1.1.1.2    jruoho  * are met:
     14      1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15      1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16      1.1.1.2    jruoho  *    without modification.
     17      1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18      1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19      1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20      1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21      1.1.1.2    jruoho  *    binary redistribution.
     22      1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23      1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24      1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25      1.1.1.2    jruoho  *
     26      1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27      1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28      1.1.1.2    jruoho  * Software Foundation.
     29      1.1.1.2    jruoho  *
     30      1.1.1.2    jruoho  * NO WARRANTY
     31      1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32      1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33      1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34      1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35      1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36      1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37      1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38      1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39      1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40      1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41      1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42      1.1.1.2    jruoho  */
     43          1.1    jruoho 
     44          1.1    jruoho #ifndef __ASLDEFINE_H
     45          1.1    jruoho #define __ASLDEFINE_H
     46          1.1    jruoho 
     47          1.1    jruoho 
     48          1.1    jruoho /*
     49          1.1    jruoho  * Compiler versions and names
     50          1.1    jruoho  */
     51  1.1.1.5.2.1     skrll #define ASL_COMPILER_NAME           "ASL+ Optimizing Compiler"
     52  1.1.1.5.2.1     skrll #define AML_DISASSEMBLER_NAME       "AML/ASL+ Disassembler"
     53      1.1.1.2    jruoho #define ASL_INVOCATION_NAME         "iasl"
     54      1.1.1.2    jruoho #define ASL_CREATOR_ID              "INTL"
     55  1.1.1.5.2.2     skrll #define ASL_DEFINE                  "__IASL__"
     56          1.1    jruoho 
     57  1.1.1.5.2.4     skrll #define ASL_COMPLIANCE              "Supports ACPI Specification Revision 6.1"
     58          1.1    jruoho 
     59          1.1    jruoho 
     60          1.1    jruoho /* Configuration constants */
     61          1.1    jruoho 
     62          1.1    jruoho #define ASL_MAX_ERROR_COUNT         200
     63      1.1.1.5  christos #define ASL_PARSEOP_CACHE_SIZE      (1024 * 16)
     64      1.1.1.5  christos #define ASL_STRING_CACHE_SIZE       (1024 * 64)
     65          1.1    jruoho 
     66          1.1    jruoho #define ASL_FIRST_PARSE_OPCODE      PARSEOP_ACCESSAS
     67          1.1    jruoho #define ASL_PARSE_OPCODE_BASE       PARSEOP_ACCESSAS        /* First Lex type */
     68          1.1    jruoho 
     69          1.1    jruoho 
     70          1.1    jruoho /*
     71      1.1.1.3    jruoho  * Per-parser-generator configuration. These values are used to cheat and
     72      1.1.1.3    jruoho  * directly access the bison/yacc token name table (yyname or yytname).
     73      1.1.1.3    jruoho  * Note: These values are the index in yyname for the first lex token
     74      1.1.1.3    jruoho  * (PARSEOP_ACCCESSAS).
     75      1.1.1.3    jruoho  */
     76      1.1.1.3    jruoho #if defined (YYBISON)
     77      1.1.1.3    jruoho #define ASL_YYTNAME_START           3   /* Bison */
     78      1.1.1.3    jruoho #elif defined (YYBYACC)
     79      1.1.1.3    jruoho #define ASL_YYTNAME_START           257 /* Berkeley yacc */
     80      1.1.1.3    jruoho #endif
     81      1.1.1.3    jruoho 
     82      1.1.1.3    jruoho 
     83      1.1.1.3    jruoho /*
     84          1.1    jruoho  * Macros
     85          1.1    jruoho  */
     86          1.1    jruoho #define ASL_RESDESC_OFFSET(m)       ACPI_OFFSET (AML_RESOURCE, m)
     87          1.1    jruoho #define ASL_PTR_DIFF(a,b)           ((UINT8 *)(b) - (UINT8 *)(a))
     88          1.1    jruoho #define ASL_PTR_ADD(a,b)            ((UINT8 *)(a) = ((UINT8 *)(a) + (b)))
     89          1.1    jruoho #define ASL_GET_CHILD_NODE(a)       (a)->Asl.Child
     90          1.1    jruoho #define ASL_GET_PEER_NODE(a)        (a)->Asl.Next
     91          1.1    jruoho #define OP_TABLE_ENTRY(a,b,c,d)     {b,d,a,c}
     92          1.1    jruoho 
     93          1.1    jruoho 
     94          1.1    jruoho /* Internal AML opcodes */
     95          1.1    jruoho 
     96          1.1    jruoho #define AML_RAW_DATA_BYTE           (UINT16) 0xAA01 /* write one raw byte */
     97          1.1    jruoho #define AML_RAW_DATA_WORD           (UINT16) 0xAA02 /* write 2 raw bytes */
     98          1.1    jruoho #define AML_RAW_DATA_DWORD          (UINT16) 0xAA04 /* write 4 raw bytes */
     99          1.1    jruoho #define AML_RAW_DATA_QWORD          (UINT16) 0xAA08 /* write 8 raw bytes */
    100          1.1    jruoho #define AML_RAW_DATA_BUFFER         (UINT16) 0xAA0B /* raw buffer with length */
    101          1.1    jruoho #define AML_RAW_DATA_CHAIN          (UINT16) 0xAA0C /* chain of raw buffers */
    102          1.1    jruoho #define AML_PACKAGE_LENGTH          (UINT16) 0xAA10
    103          1.1    jruoho #define AML_UNASSIGNED_OPCODE       (UINT16) 0xEEEE
    104          1.1    jruoho #define AML_DEFAULT_ARG_OP          (UINT16) 0xDDDD
    105          1.1    jruoho 
    106          1.1    jruoho 
    107          1.1    jruoho /* Types for input files */
    108          1.1    jruoho 
    109  1.1.1.5.2.3     skrll #define ASL_INPUT_TYPE_BINARY               0
    110  1.1.1.5.2.3     skrll #define ASL_INPUT_TYPE_BINARY_ACPI_TABLE    1
    111  1.1.1.5.2.3     skrll #define ASL_INPUT_TYPE_ASCII_ASL            2
    112  1.1.1.5.2.3     skrll #define ASL_INPUT_TYPE_ASCII_DATA           3
    113          1.1    jruoho 
    114          1.1    jruoho 
    115          1.1    jruoho /* Misc */
    116          1.1    jruoho 
    117          1.1    jruoho #define ASL_EXTERNAL_METHOD         255
    118          1.1    jruoho #define ASL_ABORT                   TRUE
    119          1.1    jruoho #define ASL_NO_ABORT                FALSE
    120      1.1.1.3    jruoho #define ASL_EOF                     ACPI_UINT32_MAX
    121  1.1.1.5.2.4     skrll #define ASL_IGNORE_LINE            (ACPI_UINT32_MAX -1)
    122          1.1    jruoho 
    123          1.1    jruoho 
    124      1.1.1.4  christos /* Listings */
    125      1.1.1.4  christos 
    126      1.1.1.4  christos #define ASL_LISTING_LINE_PREFIX         ":  "
    127      1.1.1.4  christos 
    128      1.1.1.4  christos 
    129          1.1    jruoho /* Support for reserved method names */
    130          1.1    jruoho 
    131          1.1    jruoho #define ACPI_VALID_RESERVED_NAME_MAX    0x80000000
    132          1.1    jruoho #define ACPI_NOT_RESERVED_NAME          ACPI_UINT32_MAX
    133          1.1    jruoho #define ACPI_PREDEFINED_NAME            (ACPI_UINT32_MAX - 1)
    134          1.1    jruoho #define ACPI_EVENT_RESERVED_NAME        (ACPI_UINT32_MAX - 2)
    135          1.1    jruoho #define ACPI_COMPILER_RESERVED_NAME     (ACPI_UINT32_MAX - 3)
    136          1.1    jruoho 
    137          1.1    jruoho 
    138      1.1.1.4  christos /* Helper macros for resource tag creation */
    139      1.1.1.4  christos 
    140      1.1.1.4  christos #define RsCreateMultiBitField \
    141      1.1.1.4  christos     RsCreateResourceField
    142          1.1    jruoho 
    143      1.1.1.4  christos #define RsCreateBitField(Op, Name, ByteOffset, BitOffset) \
    144      1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, BitOffset, 1)
    145      1.1.1.4  christos 
    146      1.1.1.4  christos #define RsCreateByteField(Op, Name, ByteOffset) \
    147      1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 8);
    148      1.1.1.4  christos 
    149      1.1.1.4  christos #define RsCreateWordField(Op, Name, ByteOffset) \
    150      1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 16);
    151      1.1.1.4  christos 
    152      1.1.1.4  christos #define RsCreateDwordField(Op, Name, ByteOffset) \
    153      1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 32);
    154      1.1.1.4  christos 
    155      1.1.1.4  christos #define RsCreateQwordField(Op, Name, ByteOffset) \
    156      1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 64);
    157      1.1.1.4  christos 
    158  1.1.1.5.2.4     skrll 
    159  1.1.1.5.2.4     skrll /*
    160  1.1.1.5.2.4     skrll  * Macros for debug output
    161  1.1.1.5.2.4     skrll  */
    162  1.1.1.5.2.4     skrll 
    163  1.1.1.5.2.4     skrll #define DEBUG_MAX_LINE_LENGTH       61
    164  1.1.1.5.2.4     skrll #define DEBUG_SPACES_PER_INDENT     3
    165  1.1.1.5.2.4     skrll #define DEBUG_FULL_LINE_LENGTH      71
    166  1.1.1.5.2.4     skrll 
    167  1.1.1.5.2.4     skrll #define ASL_PARSE_TREE_FULL_LINE    "\n%71.71s"
    168  1.1.1.5.2.4     skrll 
    169  1.1.1.5.2.4     skrll /* Header/Trailer for original parse tree directly from the parser */
    170  1.1.1.5.2.4     skrll 
    171  1.1.1.5.2.4     skrll #define ASL_PARSE_TREE_HEADER1 \
    172  1.1.1.5.2.4     skrll     "%*s Value P_Op Flags     Line#  End# LogL# EndL#\n", 65, " "
    173  1.1.1.5.2.4     skrll 
    174  1.1.1.5.2.4     skrll #define ASL_PARSE_TREE_DEBUG1 \
    175  1.1.1.5.2.4     skrll     " %4.4X %8.8X %5d %5d %5d %5d"
    176  1.1.1.5.2.4     skrll 
    177  1.1.1.5.2.4     skrll /* Header/Trailer for processed parse tree used for AML generation */
    178  1.1.1.5.2.4     skrll 
    179  1.1.1.5.2.4     skrll #define ASL_PARSE_TREE_HEADER2 \
    180  1.1.1.5.2.4     skrll     "%*s NameString Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr"\
    181  1.1.1.5.2.4     skrll     "    Parent   Child    Next     Flags    AcTyp    Final Col"\
    182  1.1.1.5.2.4     skrll     " Line#  End# LogL# EndL#\n", 60, " "
    183  1.1.1.5.2.4     skrll 
    184  1.1.1.5.2.4     skrll #define ASL_PARSE_TREE_DEBUG2 \
    185  1.1.1.5.2.4     skrll     " %08X %04X %04X %01X     %04X  %04X %05X  %05X   "\
    186  1.1.1.5.2.4     skrll     "%08X %08X %08X %08X %08X %08X %04X  %02d  %5d %5d %5d %5d\n"
    187  1.1.1.5.2.4     skrll 
    188      1.1.1.4  christos #endif /* ASLDEFINE.H */
    189