Home | History | Annotate | Line # | Download | only in compiler
asldefine.h revision 1.1.1.23
      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.22  christos  * Copyright (C) 2000 - 2023, 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.20  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 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.10  christos #define ASL_COMPILER_NAME           "ASL+ Optimizing Compiler/Disassembler"
     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.1.7  christos #define ASL_DEFINE                  "__IASL__"
     56  1.1.1.12  christos #define ASL_PREFIX                  "iASL: "
     57  1.1.1.23  christos #define ASL_COMPLIANCE              "Supports ACPI Specification Revision 6.5"
     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.8  christos #define ASL_INPUT_TYPE_BINARY               0
    110   1.1.1.8  christos #define ASL_INPUT_TYPE_BINARY_ACPI_TABLE    1
    111   1.1.1.8  christos #define ASL_INPUT_TYPE_ASCII_ASL            2
    112   1.1.1.8  christos #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.1.18  christos #define ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS  255
    118  1.1.1.18  christos #define ASL_ABORT                           TRUE
    119  1.1.1.18  christos #define ASL_NO_ABORT                        FALSE
    120  1.1.1.18  christos #define ASL_EOF                             ACPI_UINT32_MAX
    121  1.1.1.18  christos #define ASL_IGNORE_LINE                     (ACPI_UINT32_MAX -1)
    122  1.1.1.19  christos #define ASL_ERROR_CODE_LENGTH               4
    123       1.1    jruoho 
    124       1.1    jruoho 
    125   1.1.1.4  christos /* Listings */
    126   1.1.1.4  christos 
    127   1.1.1.4  christos #define ASL_LISTING_LINE_PREFIX         ":  "
    128   1.1.1.4  christos 
    129   1.1.1.4  christos 
    130       1.1    jruoho /* Support for reserved method names */
    131       1.1    jruoho 
    132       1.1    jruoho #define ACPI_VALID_RESERVED_NAME_MAX    0x80000000
    133       1.1    jruoho #define ACPI_NOT_RESERVED_NAME          ACPI_UINT32_MAX
    134       1.1    jruoho #define ACPI_PREDEFINED_NAME            (ACPI_UINT32_MAX - 1)
    135       1.1    jruoho #define ACPI_EVENT_RESERVED_NAME        (ACPI_UINT32_MAX - 2)
    136       1.1    jruoho #define ACPI_COMPILER_RESERVED_NAME     (ACPI_UINT32_MAX - 3)
    137       1.1    jruoho 
    138       1.1    jruoho 
    139   1.1.1.4  christos /* Helper macros for resource tag creation */
    140   1.1.1.4  christos 
    141   1.1.1.4  christos #define RsCreateMultiBitField \
    142   1.1.1.4  christos     RsCreateResourceField
    143       1.1    jruoho 
    144   1.1.1.4  christos #define RsCreateBitField(Op, Name, ByteOffset, BitOffset) \
    145   1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, BitOffset, 1)
    146   1.1.1.4  christos 
    147   1.1.1.4  christos #define RsCreateByteField(Op, Name, ByteOffset) \
    148   1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 8);
    149   1.1.1.4  christos 
    150   1.1.1.4  christos #define RsCreateWordField(Op, Name, ByteOffset) \
    151   1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 16);
    152   1.1.1.4  christos 
    153   1.1.1.4  christos #define RsCreateDwordField(Op, Name, ByteOffset) \
    154   1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 32);
    155   1.1.1.4  christos 
    156   1.1.1.4  christos #define RsCreateQwordField(Op, Name, ByteOffset) \
    157   1.1.1.4  christos     RsCreateResourceField (Op, Name, ByteOffset, 0, 64);
    158   1.1.1.4  christos 
    159   1.1.1.9  christos 
    160   1.1.1.9  christos /*
    161   1.1.1.9  christos  * Macros for debug output
    162   1.1.1.9  christos  */
    163   1.1.1.9  christos #define DEBUG_MAX_LINE_LENGTH       61
    164   1.1.1.9  christos #define DEBUG_SPACES_PER_INDENT     3
    165   1.1.1.9  christos #define DEBUG_FULL_LINE_LENGTH      71
    166   1.1.1.9  christos 
    167   1.1.1.9  christos #define ASL_PARSE_TREE_FULL_LINE    "\n%71.71s"
    168   1.1.1.9  christos 
    169   1.1.1.9  christos /* Header/Trailer for original parse tree directly from the parser */
    170   1.1.1.9  christos 
    171   1.1.1.9  christos #define ASL_PARSE_TREE_HEADER1 \
    172   1.1.1.9  christos     "%*s Value P_Op Flags     Line#  End# LogL# EndL#\n", 65, " "
    173   1.1.1.9  christos 
    174   1.1.1.9  christos #define ASL_PARSE_TREE_DEBUG1 \
    175   1.1.1.9  christos     " %4.4X %8.8X %5d %5d %5d %5d"
    176   1.1.1.9  christos 
    177   1.1.1.9  christos /* Header/Trailer for processed parse tree used for AML generation */
    178   1.1.1.9  christos 
    179   1.1.1.9  christos #define ASL_PARSE_TREE_HEADER2 \
    180   1.1.1.9  christos     "%*s NameString Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr"\
    181   1.1.1.9  christos     "    Parent   Child    Next     Flags    AcTyp    Final Col"\
    182   1.1.1.9  christos     " Line#  End# LogL# EndL#\n", 60, " "
    183   1.1.1.9  christos 
    184   1.1.1.9  christos #define ASL_PARSE_TREE_DEBUG2 \
    185   1.1.1.9  christos     " %08X %04X %04X %01X     %04X  %04X %05X  %05X   "\
    186  1.1.1.17  christos     "%8p %8p %8p %8p %08X %08X %04X  %02d  %5d %5d %5d %5d"
    187   1.1.1.9  christos 
    188  1.1.1.11  christos /*
    189  1.1.1.11  christos  * Macros for ASL/ASL+ converter
    190  1.1.1.11  christos  */
    191  1.1.1.15  christos #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
    192  1.1.1.15  christos #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
    193  1.1.1.11  christos 
    194  1.1.1.17  christos /*
    195  1.1.1.17  christos  * Special name segments - these must only be declared at the root scope
    196  1.1.1.17  christos  */
    197  1.1.1.17  christos #define NAMESEG__PTS    "_PTS"
    198  1.1.1.17  christos #define NAMESEG__WAK    "_WAK"
    199  1.1.1.17  christos #define NAMESEG__S0     "_S0_"
    200  1.1.1.17  christos #define NAMESEG__S1     "_S1_"
    201  1.1.1.17  christos #define NAMESEG__S2     "_S2_"
    202  1.1.1.17  christos #define NAMESEG__S3     "_S3_"
    203  1.1.1.17  christos #define NAMESEG__S4     "_S4_"
    204  1.1.1.17  christos #define NAMESEG__S5     "_S5_"
    205  1.1.1.17  christos #define NAMESEG__TTS    "_TTS"
    206  1.1.1.17  christos 
    207  1.1.1.17  christos #define MAX_SPECIAL_NAMES      9
    208  1.1.1.17  christos 
    209  1.1.1.17  christos 
    210   1.1.1.4  christos #endif /* ASLDEFINE.H */
    211