asldefine.h revision 281687
11556Srgrimes/******************************************************************************
21556Srgrimes *
31556Srgrimes * Module Name: asldefine.h - Common defines for the iASL compiler
41556Srgrimes *
51556Srgrimes *****************************************************************************/
61556Srgrimes
71556Srgrimes/*
81556Srgrimes * Copyright (C) 2000 - 2015, Intel Corp.
91556Srgrimes * All rights reserved.
101556Srgrimes *
111556Srgrimes * Redistribution and use in source and binary forms, with or without
121556Srgrimes * modification, are permitted provided that the following conditions
131556Srgrimes * are met:
141556Srgrimes * 1. Redistributions of source code must retain the above copyright
151556Srgrimes *    notice, this list of conditions, and the following disclaimer,
161556Srgrimes *    without modification.
171556Srgrimes * 2. Redistributions in binary form must reproduce at minimum a disclaimer
181556Srgrimes *    substantially similar to the "NO WARRANTY" disclaimer below
191556Srgrimes *    ("Disclaimer") and any redistribution must be conditioned upon
201556Srgrimes *    including a substantially similar Disclaimer requirement for further
211556Srgrimes *    binary redistribution.
221556Srgrimes * 3. Neither the names of the above-listed copyright holders nor the names
231556Srgrimes *    of any contributors may be used to endorse or promote products derived
241556Srgrimes *    from this software without specific prior written permission.
251556Srgrimes *
261556Srgrimes * Alternatively, this software may be distributed under the terms of the
271556Srgrimes * GNU General Public License ("GPL") version 2 as published by the Free
281556Srgrimes * Software Foundation.
291556Srgrimes *
301556Srgrimes * NO WARRANTY
311556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
321556Srgrimes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
331556Srgrimes * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3436150Scharnier * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3536150Scharnier * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3636150Scharnier * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
371556Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3899110Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3999110Sobrien * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
401556Srgrimes * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
411556Srgrimes * POSSIBILITY OF SUCH DAMAGES.
421556Srgrimes */
431556Srgrimes
441556Srgrimes#ifndef __ASLDEFINE_H
451556Srgrimes#define __ASLDEFINE_H
461556Srgrimes
47149017Sstefanf
481556Srgrimes/*
491556Srgrimes * Compiler versions and names
501556Srgrimes */
511556Srgrimes#define ASL_COMPILER_NAME           "ASL+ Optimizing Compiler"
521556Srgrimes#define AML_DISASSEMBLER_NAME       "AML/ASL+ Disassembler"
531556Srgrimes#define ASL_INVOCATION_NAME         "iasl"
5478469Sdes#define ASL_CREATOR_ID              "INTL"
551556Srgrimes
561556Srgrimes#define ASL_COMPLIANCE              "Supports ACPI Specification Revision 5.1"
571556Srgrimes
581556Srgrimes
591556Srgrimes/* Configuration constants */
601556Srgrimes
611556Srgrimes#define ASL_MAX_ERROR_COUNT         200
621556Srgrimes#define ASL_PARSEOP_CACHE_SIZE      (1024 * 16)
631556Srgrimes#define ASL_STRING_CACHE_SIZE       (1024 * 64)
641556Srgrimes
651556Srgrimes#define ASL_FIRST_PARSE_OPCODE      PARSEOP_ACCESSAS
661556Srgrimes#define ASL_PARSE_OPCODE_BASE       PARSEOP_ACCESSAS        /* First Lex type */
671556Srgrimes
681556Srgrimes
691556Srgrimes/*
701556Srgrimes * Per-parser-generator configuration. These values are used to cheat and
711556Srgrimes * directly access the bison/yacc token name table (yyname or yytname).
7290111Simp * Note: These values are the index in yyname for the first lex token
7317987Speter * (PARSEOP_ACCCESSAS).
7425222Ssteve */
75200956Sjilles#if defined (YYBISON)
761556Srgrimes#define ASL_YYTNAME_START           3   /* Bison */
7725222Ssteve#elif defined (YYBYACC)
781556Srgrimes#define ASL_YYTNAME_START           257 /* Berkeley yacc */
791556Srgrimes#endif
801556Srgrimes
811556Srgrimes
821556Srgrimes/*
831556Srgrimes * Macros
841556Srgrimes */
851556Srgrimes#define ASL_RESDESC_OFFSET(m)       ACPI_OFFSET (AML_RESOURCE, m)
861556Srgrimes#define ASL_PTR_DIFF(a,b)           ((UINT8 *)(b) - (UINT8 *)(a))
871556Srgrimes#define ASL_PTR_ADD(a,b)            ((UINT8 *)(a) = ((UINT8 *)(a) + (b)))
881556Srgrimes#define ASL_GET_CHILD_NODE(a)       (a)->Asl.Child
891556Srgrimes#define ASL_GET_PEER_NODE(a)        (a)->Asl.Next
901556Srgrimes#define OP_TABLE_ENTRY(a,b,c,d)     {b,d,a,c}
911556Srgrimes
921556Srgrimes
931556Srgrimes/* Internal AML opcodes */
941556Srgrimes
951556Srgrimes#define AML_RAW_DATA_BYTE           (UINT16) 0xAA01 /* write one raw byte */
961556Srgrimes#define AML_RAW_DATA_WORD           (UINT16) 0xAA02 /* write 2 raw bytes */
971556Srgrimes#define AML_RAW_DATA_DWORD          (UINT16) 0xAA04 /* write 4 raw bytes */
981556Srgrimes#define AML_RAW_DATA_QWORD          (UINT16) 0xAA08 /* write 8 raw bytes */
991556Srgrimes#define AML_RAW_DATA_BUFFER         (UINT16) 0xAA0B /* raw buffer with length */
1001556Srgrimes#define AML_RAW_DATA_CHAIN          (UINT16) 0xAA0C /* chain of raw buffers */
1011556Srgrimes#define AML_PACKAGE_LENGTH          (UINT16) 0xAA10
1021556Srgrimes#define AML_UNASSIGNED_OPCODE       (UINT16) 0xEEEE
1031556Srgrimes#define AML_DEFAULT_ARG_OP          (UINT16) 0xDDDD
1041556Srgrimes
1051556Srgrimes
1061556Srgrimes/* filename suffixes for output files */
1071556Srgrimes
1081556Srgrimes#define FILE_SUFFIX_PREPROCESSOR    "i"
1091556Srgrimes#define FILE_SUFFIX_AML_CODE        "aml"
1101556Srgrimes#define FILE_SUFFIX_MAP             "map"
1111556Srgrimes#define FILE_SUFFIX_LISTING         "lst"
1121556Srgrimes#define FILE_SUFFIX_HEX_DUMP        "hex"
1131556Srgrimes#define FILE_SUFFIX_DEBUG           "txt"
1141556Srgrimes#define FILE_SUFFIX_SOURCE          "src"
1151556Srgrimes#define FILE_SUFFIX_NAMESPACE       "nsp"
1161556Srgrimes#define FILE_SUFFIX_ASM_SOURCE      "asm"
1171556Srgrimes#define FILE_SUFFIX_C_SOURCE        "c"
118#define FILE_SUFFIX_DISASSEMBLY     "dsl"
119#define FILE_SUFFIX_ASM_INCLUDE     "inc"
120#define FILE_SUFFIX_C_INCLUDE       "h"
121#define FILE_SUFFIX_ASL_CODE        "asl"
122#define FILE_SUFFIX_C_OFFSET        "offset.h"
123
124
125/* Types for input files */
126
127#define ASL_INPUT_TYPE_BINARY       0
128#define ASL_INPUT_TYPE_ACPI_TABLE   1
129#define ASL_INPUT_TYPE_ASCII_ASL    2
130#define ASL_INPUT_TYPE_ASCII_DATA   3
131
132
133/* Misc */
134
135#define ASL_EXTERNAL_METHOD         255
136#define ASL_ABORT                   TRUE
137#define ASL_NO_ABORT                FALSE
138#define ASL_EOF                     ACPI_UINT32_MAX
139
140
141/* Listings */
142
143#define ASL_LISTING_LINE_PREFIX         ":  "
144
145
146/* Support for reserved method names */
147
148#define ACPI_VALID_RESERVED_NAME_MAX    0x80000000
149#define ACPI_NOT_RESERVED_NAME          ACPI_UINT32_MAX
150#define ACPI_PREDEFINED_NAME            (ACPI_UINT32_MAX - 1)
151#define ACPI_EVENT_RESERVED_NAME        (ACPI_UINT32_MAX - 2)
152#define ACPI_COMPILER_RESERVED_NAME     (ACPI_UINT32_MAX - 3)
153
154
155/* String to Integer conversion */
156
157#define NEGATIVE                    1
158#define POSITIVE                    0
159
160
161/* Helper macros for resource tag creation */
162
163#define RsCreateMultiBitField \
164    RsCreateResourceField
165
166#define RsCreateBitField(Op, Name, ByteOffset, BitOffset) \
167    RsCreateResourceField (Op, Name, ByteOffset, BitOffset, 1)
168
169#define RsCreateByteField(Op, Name, ByteOffset) \
170    RsCreateResourceField (Op, Name, ByteOffset, 0, 8);
171
172#define RsCreateWordField(Op, Name, ByteOffset) \
173    RsCreateResourceField (Op, Name, ByteOffset, 0, 16);
174
175#define RsCreateDwordField(Op, Name, ByteOffset) \
176    RsCreateResourceField (Op, Name, ByteOffset, 0, 32);
177
178#define RsCreateQwordField(Op, Name, ByteOffset) \
179    RsCreateResourceField (Op, Name, ByteOffset, 0, 64);
180
181#endif /* ASLDEFINE.H */
182