1 /******************************************************************************
   2  *
   3  * Module Name: aslglobal.h - Global variable definitions
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, 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 
  45 #ifndef __ASLGLOBAL_H
  46 #define __ASLGLOBAL_H
  47 
  48 
  49 /*
  50  * Global variables. Defined in aslmain.c only, externed in all other files
  51  */
  52 
  53 #undef ASL_EXTERN
  54 
  55 #ifdef _DECLARE_GLOBALS
  56 #define ASL_EXTERN
  57 #define ASL_INIT_GLOBAL(a,b)        (a)=(b)
  58 #else
  59 #define ASL_EXTERN                  extern
  60 #define ASL_INIT_GLOBAL(a,b)        (a)
  61 #endif
  62 
  63 
  64 #ifdef _DECLARE_GLOBALS
  65 UINT32                              Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0};
  66 char                                AslHexLookup[] =
  67 {
  68     '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
  69 };
  70 
  71 
  72 /* Table below must match ASL_FILE_TYPES in asltypes.h */
  73 
  74 ASL_FILE_INFO                       Gbl_Files [ASL_NUM_FILES] =
  75 {
  76     {NULL, NULL, "stdout:       ", "Standard Output"},
  77     {NULL, NULL, "stderr:       ", "Standard Error"},
  78     {NULL, NULL, "Table Input:  ", "Source Input"},
  79     {NULL, NULL, "Binary Output:", "AML Output"},
  80     {NULL, NULL, "Source Output:", "Source Output"},
  81     {NULL, NULL, "Preprocessor: ", "Preprocessor Output"},
  82     {NULL, NULL, "Listing File: ", "Listing Output"},
  83     {NULL, NULL, "Hex Dump:     ", "Hex Table Output"},
  84     {NULL, NULL, "Namespace:    ", "Namespace Output"},
  85     {NULL, NULL, "Debug File:   ", "Debug Output"},
  86     {NULL, NULL, "ASM Source:   ", "Assembly Code Output"},
  87     {NULL, NULL, "C Source:     ", "C Code Output"},
  88     {NULL, NULL, "ASM Include:  ", "Assembly Header Output"},
  89     {NULL, NULL, "C Include:    ", "C Header Output"},
  90     {NULL, NULL, "Offset Table: ", "C Offset Table Output"}
  91 };
  92 
  93 #else
  94 extern UINT32                       Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
  95 extern char                         AslHexLookup[];
  96 extern ASL_FILE_INFO                Gbl_Files [ASL_NUM_FILES];
  97 #endif
  98 
  99 
 100 /*
 101  * Parser and other externals
 102  */
 103 extern int                          yydebug;
 104 extern FILE                         *AslCompilerin;
 105 extern int                          AslCompilerdebug;
 106 extern int                          DtParserdebug;
 107 extern int                          PrParserdebug;
 108 extern const ASL_MAPPING_ENTRY      AslKeywordMapping[];
 109 extern char                         *AslCompilertext;
 110 
 111 #define ASL_DEFAULT_LINE_BUFFER_SIZE    (1024 * 32) /* 32K */
 112 #define ASL_MSG_BUFFER_SIZE             4096
 113 #define ASL_MAX_DISABLED_MESSAGES       32
 114 #define HEX_TABLE_LINE_SIZE             8
 115 #define HEX_LISTING_LINE_SIZE           8
 116 
 117 
 118 /* Source code buffers and pointers for error reporting */
 119 
 120 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_CurrentLineBuffer, NULL);
 121 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_LineBufPtr, NULL);
 122 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE);
 123 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0);
 124 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0);
 125 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1);
 126 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1);
 127 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0);
 128 
 129 /* Exception reporting */
 130 
 131 ASL_EXTERN ASL_ERROR_MSG            ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL);
 132 ASL_EXTERN ASL_ERROR_MSG            ASL_INIT_GLOBAL (*Gbl_NextError,NULL);
 133 
 134 /* Option flags */
 135 
 136 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE);
 137 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE);
 138 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE);
 139 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE);
 140 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE);
 141 
 142 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
 143 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
 144 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);
 145 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
 146 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE);
 147 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE);
 148 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_C_OffsetTableFlag, FALSE);
 149 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE);
 150 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE);
 151 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE);
 152 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE);
 153 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE);
 154 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
 155 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
 156 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
 157 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
 158 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
 159 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE);
 160 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE);
 161 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
 162 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
 163 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);
 164 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE);
 165 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
 166 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DisplayWarnings, TRUE);
 167 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
 168 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING);
 169 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE);
 170 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE);
 171 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE);
 172 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE);
 173 
 174 
 175 #define HEX_OUTPUT_NONE             0
 176 #define HEX_OUTPUT_C                1
 177 #define HEX_OUTPUT_ASM              2
 178 #define HEX_OUTPUT_ASL              3
 179 
 180 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE);
 181 
 182 
 183 /* Files */
 184 
 185 ASL_EXTERN char                     *Gbl_DirectoryPath;
 186 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL);
 187 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
 188 ASL_EXTERN ASL_INCLUDE_DIR          ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL);
 189 ASL_EXTERN char                     *Gbl_CurrentInputFilename;
 190 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL);
 191 
 192 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE);
 193 
 194 
 195 /* Statistics */
 196 
 197 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_InputByteCount, 0);
 198 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_InputFieldCount, 0);
 199 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0);
 200 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalKeywords, 0);
 201 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalNamedObjects, 0);
 202 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0);
 203 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalParseNodes, 0);
 204 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalMethods, 0);
 205 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalAllocations, 0);
 206 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalAllocated, 0);
 207 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalFolds, 0);
 208 
 209 
 210 /* Misc */
 211 
 212 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0);
 213 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_TempCount, 0);
 214 ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*RootNode, NULL);
 215 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_TableLength, 0);
 216 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_SourceLine, 0);
 217 ASL_EXTERN ASL_LISTING_NODE         ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL);
 218 ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL);
 219 ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL);
 220 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
 221 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
 222 ASL_EXTERN ACPI_PARSE_OBJECT        *Gbl_FirstLevelInsertionNode;
 223 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_FileType, 0);
 224 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_Signature, NULL);
 225 ASL_EXTERN char                     *Gbl_TemplateSignature;
 226 
 227 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);
 228 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0);
 229 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentLine, 0);
 230 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_DisabledMessagesIndex, 0);
 231 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE);
 232 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0);
 233 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0);
 234 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG");
 235 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID");
 236 
 237 
 238 /* Static structures */
 239 
 240 ASL_EXTERN ASL_ANALYSIS_WALK_INFO   AnalysisWalkInfo;
 241 ASL_EXTERN ACPI_TABLE_HEADER        TableHeader;
 242 
 243 /* Event timing */
 244 
 245 #define ASL_NUM_EVENTS              20
 246 ASL_EXTERN ASL_EVENT_INFO           AslGbl_Events[ASL_NUM_EVENTS];
 247 ASL_EXTERN UINT8                    AslGbl_NextEvent;
 248 ASL_EXTERN UINT8                    AslGbl_NamespaceEvent;
 249 
 250 /* Scratch buffers */
 251 
 252 ASL_EXTERN UINT8                    Gbl_AmlBuffer[HEX_LISTING_LINE_SIZE];
 253 ASL_EXTERN char                     MsgBuffer[ASL_MSG_BUFFER_SIZE];
 254 ASL_EXTERN char                     StringBuffer[ASL_MSG_BUFFER_SIZE];
 255 ASL_EXTERN char                     StringBuffer2[ASL_MSG_BUFFER_SIZE];
 256 ASL_EXTERN UINT32                   Gbl_DisabledMessages[ASL_MAX_DISABLED_MESSAGES];
 257 
 258 
 259 #endif /* __ASLGLOBAL_H */