Home | History | Annotate | Line # | Download | only in compiler
asldefine.h revision 1.1.1.6
      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.6  christos  * Copyright (C) 2000 - 2015, 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.6  christos #define ASL_COMPILER_NAME           "ASL+ Optimizing Compiler"
     52  1.1.1.6  christos #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    jruoho 
     56  1.1.1.5  christos #define ASL_COMPLIANCE              "Supports ACPI Specification Revision 5.1"
     57      1.1    jruoho 
     58      1.1    jruoho 
     59      1.1    jruoho /* Configuration constants */
     60      1.1    jruoho 
     61      1.1    jruoho #define ASL_MAX_ERROR_COUNT         200
     62  1.1.1.5  christos #define ASL_PARSEOP_CACHE_SIZE      (1024 * 16)
     63  1.1.1.5  christos #define ASL_STRING_CACHE_SIZE       (1024 * 64)
     64      1.1    jruoho 
     65      1.1    jruoho #define ASL_FIRST_PARSE_OPCODE      PARSEOP_ACCESSAS
     66      1.1    jruoho #define ASL_PARSE_OPCODE_BASE       PARSEOP_ACCESSAS        /* First Lex type */
     67      1.1    jruoho 
     68      1.1    jruoho 
     69      1.1    jruoho /*
     70  1.1.1.3    jruoho  * Per-parser-generator configuration. These values are used to cheat and
     71  1.1.1.3    jruoho  * directly access the bison/yacc token name table (yyname or yytname).
     72  1.1.1.3    jruoho  * Note: These values are the index in yyname for the first lex token
     73  1.1.1.3    jruoho  * (PARSEOP_ACCCESSAS).
     74  1.1.1.3    jruoho  */
     75  1.1.1.3    jruoho #if defined (YYBISON)
     76  1.1.1.3    jruoho #define ASL_YYTNAME_START           3   /* Bison */
     77  1.1.1.3    jruoho #elif defined (YYBYACC)
     78  1.1.1.3    jruoho #define ASL_YYTNAME_START           257 /* Berkeley yacc */
     79  1.1.1.3    jruoho #endif
     80  1.1.1.3    jruoho 
     81  1.1.1.3    jruoho 
     82  1.1.1.3    jruoho /*
     83      1.1    jruoho  * Macros
     84      1.1    jruoho  */
     85      1.1    jruoho #define ASL_RESDESC_OFFSET(m)       ACPI_OFFSET (AML_RESOURCE, m)
     86      1.1    jruoho #define ASL_PTR_DIFF(a,b)           ((UINT8 *)(b) - (UINT8 *)(a))
     87      1.1    jruoho #define ASL_PTR_ADD(a,b)            ((UINT8 *)(a) = ((UINT8 *)(a) + (b)))
     88      1.1    jruoho #define ASL_GET_CHILD_NODE(a)       (a)->Asl.Child
     89      1.1    jruoho #define ASL_GET_PEER_NODE(a)        (a)->Asl.Next
     90      1.1    jruoho #define OP_TABLE_ENTRY(a,b,c,d)     {b,d,a,c}
     91      1.1    jruoho 
     92      1.1    jruoho 
     93      1.1    jruoho /* Internal AML opcodes */
     94      1.1    jruoho 
     95      1.1    jruoho #define AML_RAW_DATA_BYTE           (UINT16) 0xAA01 /* write one raw byte */
     96      1.1    jruoho #define AML_RAW_DATA_WORD           (UINT16) 0xAA02 /* write 2 raw bytes */
     97      1.1    jruoho #define AML_RAW_DATA_DWORD          (UINT16) 0xAA04 /* write 4 raw bytes */
     98      1.1    jruoho #define AML_RAW_DATA_QWORD          (UINT16) 0xAA08 /* write 8 raw bytes */
     99      1.1    jruoho #define AML_RAW_DATA_BUFFER         (UINT16) 0xAA0B /* raw buffer with length */
    100      1.1    jruoho #define AML_RAW_DATA_CHAIN          (UINT16) 0xAA0C /* chain of raw buffers */
    101      1.1    jruoho #define AML_PACKAGE_LENGTH          (UINT16) 0xAA10
    102      1.1    jruoho #define AML_UNASSIGNED_OPCODE       (UINT16) 0xEEEE
    103      1.1    jruoho #define AML_DEFAULT_ARG_OP          (UINT16) 0xDDDD
    104      1.1    jruoho 
    105      1.1    jruoho 
    106      1.1    jruoho /* filename suffixes for output files */
    107      1.1    jruoho 
    108  1.1.1.3    jruoho #define FILE_SUFFIX_PREPROCESSOR    "i"
    109      1.1    jruoho #define FILE_SUFFIX_AML_CODE        "aml"
    110  1.1.1.5  christos #define FILE_SUFFIX_MAP             "map"
    111      1.1    jruoho #define FILE_SUFFIX_LISTING         "lst"
    112      1.1    jruoho #define FILE_SUFFIX_HEX_DUMP        "hex"
    113      1.1    jruoho #define FILE_SUFFIX_DEBUG           "txt"
    114      1.1    jruoho #define FILE_SUFFIX_SOURCE          "src"
    115      1.1    jruoho #define FILE_SUFFIX_NAMESPACE       "nsp"
    116      1.1    jruoho #define FILE_SUFFIX_ASM_SOURCE      "asm"
    117      1.1    jruoho #define FILE_SUFFIX_C_SOURCE        "c"
    118      1.1    jruoho #define FILE_SUFFIX_DISASSEMBLY     "dsl"
    119      1.1    jruoho #define FILE_SUFFIX_ASM_INCLUDE     "inc"
    120      1.1    jruoho #define FILE_SUFFIX_C_INCLUDE       "h"
    121  1.1.1.2    jruoho #define FILE_SUFFIX_ASL_CODE        "asl"
    122  1.1.1.4  christos #define FILE_SUFFIX_C_OFFSET        "offset.h"
    123      1.1    jruoho 
    124      1.1    jruoho 
    125      1.1    jruoho /* Types for input files */
    126      1.1    jruoho 
    127      1.1    jruoho #define ASL_INPUT_TYPE_BINARY       0
    128  1.1.1.4  christos #define ASL_INPUT_TYPE_ACPI_TABLE   1
    129  1.1.1.4  christos #define ASL_INPUT_TYPE_ASCII_ASL    2
    130  1.1.1.4  christos #define ASL_INPUT_TYPE_ASCII_DATA   3
    131      1.1    jruoho 
    132      1.1    jruoho 
    133      1.1    jruoho /* Misc */
    134      1.1    jruoho 
    135      1.1    jruoho #define ASL_EXTERNAL_METHOD         255
    136      1.1    jruoho #define ASL_ABORT                   TRUE
    137      1.1    jruoho #define ASL_NO_ABORT                FALSE
    138  1.1.1.3    jruoho #define ASL_EOF                     ACPI_UINT32_MAX
    139      1.1    jruoho 
    140      1.1    jruoho 
    141  1.1.1.4  christos /* Listings */
    142  1.1.1.4  christos 
    143  1.1.1.4  christos #define ASL_LISTING_LINE_PREFIX         ":  "
    144  1.1.1.4  christos 
    145  1.1.1.4  christos 
    146      1.1    jruoho /* Support for reserved method names */
    147      1.1    jruoho 
    148      1.1    jruoho #define ACPI_VALID_RESERVED_NAME_MAX    0x80000000
    149      1.1    jruoho #define ACPI_NOT_RESERVED_NAME          ACPI_UINT32_MAX
    150      1.1    jruoho #define ACPI_PREDEFINED_NAME            (ACPI_UINT32_MAX - 1)
    151      1.1    jruoho #define ACPI_EVENT_RESERVED_NAME        (ACPI_UINT32_MAX - 2)
    152      1.1    jruoho #define ACPI_COMPILER_RESERVED_NAME     (ACPI_UINT32_MAX - 3)
    153      1.1    jruoho 
    154      1.1    jruoho 
    155      1.1    jruoho /* String to Integer conversion */
    156      1.1    jruoho 
    157      1.1    jruoho #define NEGATIVE                    1
    158      1.1    jruoho #define POSITIVE                    0
    159      1.1    jruoho 
    160      1.1    jruoho 
    161  1.1.1.4  christos /* Helper macros for resource tag creation */
    162  1.1.1.4  christos 
    163  1.1.1.4  christos #define RsCreateMultiBitField \
    164  1.1.1.4  christos     RsCreateResourceField
    165      1.1    jruoho 
    166  1.1.1.4  christos #define RsCreateBitField(Op, Name, ByteOffset, BitOffset) \
    167  1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, BitOffset, 1)
    168  1.1.1.4  christos 
    169  1.1.1.4  christos #define RsCreateByteField(Op, Name, ByteOffset) \
    170  1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 8);
    171  1.1.1.4  christos 
    172  1.1.1.4  christos #define RsCreateWordField(Op, Name, ByteOffset) \
    173  1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 16);
    174  1.1.1.4  christos 
    175  1.1.1.4  christos #define RsCreateDwordField(Op, Name, ByteOffset) \
    176  1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 32);
    177  1.1.1.4  christos 
    178  1.1.1.4  christos #define RsCreateQwordField(Op, Name, ByteOffset) \
    179  1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 64);
    180  1.1.1.4  christos 
    181  1.1.1.4  christos #endif /* ASLDEFINE.H */
    182