asltypes.h revision 284583
1/****************************************************************************** 2 * 3 * Module Name: asltypes.h - compiler data types and struct definitions 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 __ASLTYPES_H 45#define __ASLTYPES_H 46 47 48/******************************************************************************* 49 * 50 * Structure definitions 51 * 52 ******************************************************************************/ 53 54 55/* Op flags for the ACPI_PARSE_OBJECT */ 56 57#define NODE_VISITED 0x00000001 58#define NODE_AML_PACKAGE 0x00000002 59#define NODE_IS_TARGET 0x00000004 60#define NODE_IS_RESOURCE_DESC 0x00000008 61#define NODE_IS_RESOURCE_FIELD 0x00000010 62#define NODE_HAS_NO_EXIT 0x00000020 63#define NODE_IF_HAS_NO_EXIT 0x00000040 64#define NODE_NAME_INTERNALIZED 0x00000080 65#define NODE_METHOD_NO_RETVAL 0x00000100 66#define NODE_METHOD_SOME_NO_RETVAL 0x00000200 67#define NODE_RESULT_NOT_USED 0x00000400 68#define NODE_METHOD_TYPED 0x00000800 69#define NODE_UNUSED_FLAG 0x00001000 70#define NODE_COMPILE_TIME_CONST 0x00002000 71#define NODE_IS_TERM_ARG 0x00004000 72#define NODE_WAS_ONES_OP 0x00008000 73#define NODE_IS_NAME_DECLARATION 0x00010000 74#define NODE_COMPILER_EMITTED 0x00020000 75#define NODE_IS_DUPLICATE 0x00040000 76#define NODE_IS_RESOURCE_DATA 0x00080000 77#define NODE_IS_NULL_RETURN 0x00100000 78 79/* Keeps information about individual control methods */ 80 81typedef struct asl_method_info 82{ 83 ACPI_PARSE_OBJECT *Op; 84 struct asl_method_info *Next; 85 UINT32 ValidArgTypes[ACPI_METHOD_NUM_ARGS]; 86 UINT32 ValidReturnTypes; 87 UINT32 NumReturnNoValue; 88 UINT32 NumReturnWithValue; 89 UINT8 NumArguments; 90 UINT8 LocalInitialized[ACPI_METHOD_NUM_LOCALS]; 91 UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS]; 92 UINT8 HasBeenTyped; 93 UINT8 ShouldBeSerialized; 94 95} ASL_METHOD_INFO; 96 97 98/* Parse tree walk info for control method analysis */ 99 100typedef struct asl_analysis_walk_info 101{ 102 ASL_METHOD_INFO *MethodStack; 103 104} ASL_ANALYSIS_WALK_INFO; 105 106 107/* An entry in the ParseOpcode to AmlOpcode mapping table */ 108 109typedef struct asl_mapping_entry 110{ 111 UINT32 Value; 112 UINT32 AcpiBtype; /* Object type or return type */ 113 UINT16 AmlOpcode; 114 UINT8 Flags; 115 116} ASL_MAPPING_ENTRY; 117 118 119/* Parse tree walk info structure */ 120 121typedef struct asl_walk_info 122{ 123 ACPI_PARSE_OBJECT **NodePtr; 124 UINT32 *LevelPtr; 125 126} ASL_WALK_INFO; 127 128 129/* File info */ 130 131typedef struct asl_file_info 132{ 133 FILE *Handle; 134 char *Filename; 135 const char *ShortDescription; 136 const char *Description; 137 138} ASL_FILE_INFO; 139 140typedef struct asl_file_status 141{ 142 UINT32 Line; 143 UINT32 Offset; 144 145} ASL_FILE_STATUS; 146 147 148/* 149 * File types. Note: Any changes to this table must also be reflected 150 * in the Gbl_Files array. 151 * 152 * Corresponding filename suffixes are in comments 153 * 154 * NOTE: Don't move the first 4 file types 155 */ 156typedef enum 157{ 158 ASL_FILE_STDOUT = 0, 159 ASL_FILE_STDERR, 160 ASL_FILE_INPUT, /* .asl */ 161 ASL_FILE_AML_OUTPUT, /* .aml */ 162 ASL_FILE_SOURCE_OUTPUT, /* .src */ 163 ASL_FILE_PREPROCESSOR, /* .pre */ 164 ASL_FILE_PREPROCESSOR_USER, /* .i */ 165 ASL_FILE_LISTING_OUTPUT, /* .lst */ 166 ASL_FILE_HEX_OUTPUT, /* .hex */ 167 ASL_FILE_NAMESPACE_OUTPUT, /* .nsp */ 168 ASL_FILE_DEBUG_OUTPUT, /* .txt */ 169 ASL_FILE_ASM_SOURCE_OUTPUT, /* .asm */ 170 ASL_FILE_C_SOURCE_OUTPUT, /* .c */ 171 ASL_FILE_ASM_INCLUDE_OUTPUT,/* .inc */ 172 ASL_FILE_C_INCLUDE_OUTPUT, /* .h */ 173 ASL_FILE_C_OFFSET_OUTPUT, /* offset.h */ 174 ASL_FILE_MAP_OUTPUT /* .map */ 175 176} ASL_FILE_TYPES; 177 178 179#define ASL_MAX_FILE_TYPE 16 180#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) 181 182/* filename suffixes for output files */ 183 184#define FILE_SUFFIX_PREPROC_USER "i " 185#define FILE_SUFFIX_PREPROCESSOR "pre" 186#define FILE_SUFFIX_AML_CODE "aml" 187#define FILE_SUFFIX_MAP "map" 188#define FILE_SUFFIX_LISTING "lst" 189#define FILE_SUFFIX_HEX_DUMP "hex" 190#define FILE_SUFFIX_DEBUG "txt" 191#define FILE_SUFFIX_SOURCE "src" 192#define FILE_SUFFIX_NAMESPACE "nsp" 193#define FILE_SUFFIX_ASM_SOURCE "asm" 194#define FILE_SUFFIX_C_SOURCE "c" 195#define FILE_SUFFIX_DISASSEMBLY "dsl" 196#define FILE_SUFFIX_ASM_INCLUDE "inc" 197#define FILE_SUFFIX_C_INCLUDE "h" 198#define FILE_SUFFIX_ASL_CODE "asl" 199#define FILE_SUFFIX_C_OFFSET "offset.h" 200 201 202/* Cache block structure for ParseOps and Strings */ 203 204typedef struct asl_cache_info 205{ 206 void *Next; 207 char Buffer[1]; 208 209} ASL_CACHE_INFO; 210 211 212typedef struct asl_include_dir 213{ 214 char *Dir; 215 struct asl_include_dir *Next; 216 217} ASL_INCLUDE_DIR; 218 219 220/* An entry in the exception list, one for each error/warning */ 221 222typedef struct asl_error_msg 223{ 224 UINT32 LineNumber; 225 UINT32 LogicalLineNumber; 226 UINT32 LogicalByteOffset; 227 UINT32 Column; 228 char *Message; 229 struct asl_error_msg *Next; 230 char *Filename; 231 char *SourceLine; 232 UINT32 FilenameLength; 233 UINT16 MessageId; 234 UINT8 Level; 235 236} ASL_ERROR_MSG; 237 238 239/* An entry in the listing file stack (for include files) */ 240 241typedef struct asl_listing_node 242{ 243 char *Filename; 244 UINT32 LineNumber; 245 struct asl_listing_node *Next; 246 247} ASL_LISTING_NODE; 248 249 250/* Callback interface for a parse tree walk */ 251 252/* 253 * TBD - another copy of this is in adisasm.h, fix 254 */ 255#ifndef ASL_WALK_CALLBACK_DEFINED 256typedef 257ACPI_STATUS (*ASL_WALK_CALLBACK) ( 258 ACPI_PARSE_OBJECT *Op, 259 UINT32 Level, 260 void *Context); 261#define ASL_WALK_CALLBACK_DEFINED 262#endif 263 264 265typedef struct asl_event_info 266{ 267 UINT64 StartTime; 268 UINT64 EndTime; 269 char *EventName; 270 BOOLEAN Valid; 271 272} ASL_EVENT_INFO; 273 274 275/* Hardware mapping file structures */ 276 277typedef struct acpi_gpio_info 278{ 279 struct acpi_gpio_info *Next; 280 ACPI_PARSE_OBJECT *Op; 281 char *DeviceName; 282 ACPI_NAMESPACE_NODE *TargetNode; 283 UINT32 References; 284 UINT32 PinCount; 285 UINT32 PinIndex; 286 UINT16 PinNumber; 287 UINT8 Type; 288 UINT8 Direction; 289 UINT8 Polarity; 290 291} ACPI_GPIO_INFO; 292 293typedef struct acpi_serial_info 294{ 295 struct acpi_serial_info *Next; 296 ACPI_PARSE_OBJECT *Op; 297 char *DeviceName; 298 ACPI_NAMESPACE_NODE *TargetNode; 299 AML_RESOURCE *Resource; 300 UINT32 Speed; 301 UINT16 Address; 302 303} ACPI_SERIAL_INFO; 304 305 306#endif /* __ASLTYPES_H */ 307