1 2 3 /****************************************************************************** 4 * 5 * Module Name: aslglobal.h - Global variable definitions 6 * 7 *****************************************************************************/ 8 9 /* 10 * Copyright (C) 2000 - 2011, Intel Corp. 11 * All rights reserved. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions, and the following disclaimer, 18 * without modification. 19 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 20 * substantially similar to the "NO WARRANTY" disclaimer below 21 * ("Disclaimer") and any redistribution must be conditioned upon 22 * including a substantially similar Disclaimer requirement for further 23 * binary redistribution. 24 * 3. Neither the names of the above-listed copyright holders nor the names 25 * of any contributors may be used to endorse or promote products derived 26 * from this software without specific prior written permission. 27 * 28 * Alternatively, this software may be distributed under the terms of the 29 * GNU General Public License ("GPL") version 2 as published by the Free 30 * Software Foundation. 31 * 32 * NO WARRANTY 33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 34 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 35 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 36 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 37 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 42 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 43 * POSSIBILITY OF SUCH DAMAGES. 44 */ 45 46 47 #ifndef __ASLGLOBAL_H 48 #define __ASLGLOBAL_H 49 50 51 /* 52 * Global variables. Defined in aslmain.c only, externed in all other files 53 */ 54 55 #undef ASL_EXTERN 56 57 #ifdef _DECLARE_GLOBALS 58 #define ASL_EXTERN 59 #define ASL_INIT_GLOBAL(a,b) (a)=(b) 60 #else 61 #define ASL_EXTERN extern 62 #define ASL_INIT_GLOBAL(a,b) (a) 63 #endif 64 65 66 /* 67 * Parser and other externals 68 */ 69 extern int yydebug; 70 extern FILE *AslCompilerin; 71 extern int AslCompilerdebug; 72 extern int DtParserdebug; 73 extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; 74 extern char *AslCompilertext; 75 76 #define ASL_LINE_BUFFER_SIZE 1024 77 #define ASL_MSG_BUFFER_SIZE 4096 78 #define HEX_TABLE_LINE_SIZE 8 79 #define HEX_LISTING_LINE_SIZE 8 80 81 82 /* Source code buffers and pointers for error reporting */ 83 84 ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE]; 85 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); 86 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); 87 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); 88 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); 89 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer); 90 91 92 /* Exception reporting */ 93 94 ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); 95 ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); 96 97 98 /* Option flags */ 99 100 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE); 101 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE); 102 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE); 103 104 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE); 105 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); 106 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); 107 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); 108 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); 109 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); 110 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE); 111 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE); 112 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE); 113 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE); 114 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE); 115 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE); 116 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE); 117 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE); 118 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); 119 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); 120 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); 121 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); 122 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE); 123 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); 124 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); 125 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); 126 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE); 127 ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING); 128 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE); 129 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE); 130 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); 131 132 133 #define HEX_OUTPUT_NONE 0 134 #define HEX_OUTPUT_C 1 135 #define HEX_OUTPUT_ASM 2 136 #define HEX_OUTPUT_ASL 3 137 138 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); 139 140 141 /* Files */ 142 143 ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; 144 145 ASL_EXTERN char *Gbl_DirectoryPath; 146 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); 147 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); 148 ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); 149 ASL_EXTERN char *Gbl_CurrentInputFilename; 150 151 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); 152 153 154 /* Statistics */ 155 156 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0); 157 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputFieldCount, 0); 158 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0); 159 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0); 160 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0); 161 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0); 162 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalParseNodes, 0); 163 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalMethods, 0); 164 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocations, 0); 165 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocated, 0); 166 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalFolds, 0); 167 168 169 /* Misc */ 170 171 ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0); 172 ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0); 173 ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL); 174 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0); 175 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0); 176 ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); 177 ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL); 178 ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL); 179 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL); 180 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL); 181 ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; 182 ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0); 183 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL); 184 ASL_EXTERN char *Gbl_TemplateSignature; 185 186 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); 187 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); 188 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); 189 ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE); 190 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0); 191 ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); 192 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG"); 193 ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); 194 ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswinxf only */ 195 196 197 /* Static structures */ 198 199 ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; 200 ASL_EXTERN ACPI_TABLE_HEADER TableHeader; 201 extern char AslHexLookup[]; 202 203 /* Event timing */ 204 205 #define ASL_NUM_EVENTS 19 206 ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS]; 207 ASL_EXTERN UINT8 AslGbl_NextEvent; 208 ASL_EXTERN UINT8 AslGbl_NamespaceEvent; 209 210 /* Scratch buffers */ 211 212 ASL_EXTERN UINT8 Gbl_AmlBuffer[HEX_LISTING_LINE_SIZE]; 213 ASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE]; 214 ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; 215 ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; 216 217 218 #ifdef _DECLARE_GLOBALS 219 UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; 220 #else 221 extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; 222 #endif 223 224 #endif /* __ASLGLOBAL_H */ 225 226