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