aslglobal.h revision 245582
1118611Snjl/****************************************************************************** 2118611Snjl * 3118611Snjl * Module Name: aslglobal.h - Global variable definitions 4118611Snjl * 5118611Snjl *****************************************************************************/ 6118611Snjl 7217365Sjkim/* 8245582Sjkim * Copyright (C) 2000 - 2013, Intel Corp. 9118611Snjl * All rights reserved. 10118611Snjl * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 25118611Snjl * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 29118611Snjl * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 43118611Snjl 44118611Snjl 45118611Snjl#ifndef __ASLGLOBAL_H 46118611Snjl#define __ASLGLOBAL_H 47118611Snjl 48118611Snjl 49118611Snjl/* 50241973Sjkim * Global variables. Defined in aslmain.c only, externed in all other files 51118611Snjl */ 52118611Snjl 53151937Sjkim#undef ASL_EXTERN 54151937Sjkim 55118611Snjl#ifdef _DECLARE_GLOBALS 56118611Snjl#define ASL_EXTERN 57118611Snjl#define ASL_INIT_GLOBAL(a,b) (a)=(b) 58118611Snjl#else 59118611Snjl#define ASL_EXTERN extern 60118611Snjl#define ASL_INIT_GLOBAL(a,b) (a) 61118611Snjl#endif 62118611Snjl 63118611Snjl 64240716Sjkim#ifdef _DECLARE_GLOBALS 65240716SjkimUINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; 66240716Sjkimchar AslHexLookup[] = 67240716Sjkim{ 68240716Sjkim '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' 69240716Sjkim}; 70240716Sjkim 71240716Sjkim 72240716Sjkim/* Table below must match ASL_FILE_TYPES in asltypes.h */ 73240716Sjkim 74240716SjkimASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = 75240716Sjkim{ 76240716Sjkim {NULL, NULL, "stdout: ", "Standard Output"}, 77240716Sjkim {NULL, NULL, "stderr: ", "Standard Error"}, 78240716Sjkim {NULL, NULL, "Table Input: ", "Source Input"}, 79240716Sjkim {NULL, NULL, "Binary Output:", "AML Output"}, 80240716Sjkim {NULL, NULL, "Source Output:", "Source Output"}, 81240716Sjkim {NULL, NULL, "Preprocessor: ", "Preprocessor Output"}, 82240716Sjkim {NULL, NULL, "Listing File: ", "Listing Output"}, 83240716Sjkim {NULL, NULL, "Hex Dump: ", "Hex Table Output"}, 84240716Sjkim {NULL, NULL, "Namespace: ", "Namespace Output"}, 85240716Sjkim {NULL, NULL, "Debug File: ", "Debug Output"}, 86240716Sjkim {NULL, NULL, "ASM Source: ", "Assembly Code Output"}, 87240716Sjkim {NULL, NULL, "C Source: ", "C Code Output"}, 88240716Sjkim {NULL, NULL, "ASM Include: ", "Assembly Header Output"}, 89240716Sjkim {NULL, NULL, "C Include: ", "C Header Output"} 90240716Sjkim}; 91240716Sjkim 92240716Sjkim#else 93240716Sjkimextern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; 94240716Sjkimextern char AslHexLookup[]; 95240716Sjkimextern ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; 96240716Sjkim#endif 97240716Sjkim 98240716Sjkim 99118611Snjl/* 100118611Snjl * Parser and other externals 101118611Snjl */ 102118611Snjlextern int yydebug; 103118611Snjlextern FILE *AslCompilerin; 104118611Snjlextern int AslCompilerdebug; 105220663Sjkimextern int DtParserdebug; 106233250Sjkimextern int PrParserdebug; 107118611Snjlextern const ASL_MAPPING_ENTRY AslKeywordMapping[]; 108118611Snjlextern char *AslCompilertext; 109118611Snjl 110240716Sjkim#define ASL_DEFAULT_LINE_BUFFER_SIZE (1024 * 32) /* 32K */ 111240716Sjkim#define ASL_MSG_BUFFER_SIZE 4096 112240716Sjkim#define HEX_TABLE_LINE_SIZE 8 113240716Sjkim#define HEX_LISTING_LINE_SIZE 8 114118611Snjl 115118611Snjl 116118611Snjl/* Source code buffers and pointers for error reporting */ 117118611Snjl 118240716SjkimASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_CurrentLineBuffer, NULL); 119240716SjkimASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, NULL); 120240716SjkimASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE); 121118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); 122234623SjkimASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0); 123118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); 124118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); 125118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); 126118611Snjl 127118611Snjl/* Exception reporting */ 128118611Snjl 129118611SnjlASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); 130118611SnjlASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); 131118611Snjl 132118611Snjl/* Option flags */ 133118611Snjl 134193529SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE); 135193529SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE); 136233250SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE); 137234623SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE); 138210976SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE); 139193529Sjkim 140118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); 141118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); 142233250SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE); 143118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); 144118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); 145118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); 146118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE); 147118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE); 148118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE); 149118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE); 150118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE); 151118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE); 152118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE); 153118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE); 154118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); 155193529SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); 156234623SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE); 157207344SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); 158118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); 159118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE); 160118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); 161118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); 162118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); 163118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE); 164167802SjkimASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING); 165209746SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE); 166209746SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE); 167209746SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); 168228110SjkimASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); 169118611Snjl 170167802Sjkim 171240716Sjkim#define HEX_OUTPUT_NONE 0 172240716Sjkim#define HEX_OUTPUT_C 1 173240716Sjkim#define HEX_OUTPUT_ASM 2 174240716Sjkim#define HEX_OUTPUT_ASL 3 175207344Sjkim 176118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); 177118611Snjl 178118611Snjl 179118611Snjl/* Files */ 180118611Snjl 181118611SnjlASL_EXTERN char *Gbl_DirectoryPath; 182118611SnjlASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); 183118611SnjlASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); 184197104SjkimASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); 185118611SnjlASL_EXTERN char *Gbl_CurrentInputFilename; 186118611Snjl 187118611SnjlASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); 188118611Snjl 189118611Snjl 190118611Snjl/* Statistics */ 191118611Snjl 192118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0); 193209746SjkimASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputFieldCount, 0); 194118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0); 195118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0); 196118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0); 197118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0); 198118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalParseNodes, 0); 199118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalMethods, 0); 200118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocations, 0); 201118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocated, 0); 202118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalFolds, 0); 203118611Snjl 204118611Snjl 205118611Snjl/* Misc */ 206118611Snjl 207138287SmarksASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0); 208151937SjkimASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0); 209118611SnjlASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL); 210118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0); 211118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0); 212118611SnjlASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); 213118611SnjlASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL); 214118611SnjlASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL); 215118611SnjlASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL); 216118611SnjlASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL); 217118611SnjlASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; 218209746SjkimASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0); 219209746SjkimASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL); 220209746SjkimASL_EXTERN char *Gbl_TemplateSignature; 221118611Snjl 222118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); 223118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); 224118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); 225118611SnjlASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE); 226118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0); 227118611SnjlASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); 228118611SnjlASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG"); 229118611SnjlASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); 230118611SnjlASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswinxf only */ 231118611Snjl 232118611Snjl 233118611Snjl/* Static structures */ 234118611Snjl 235118611SnjlASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; 236118611SnjlASL_EXTERN ACPI_TABLE_HEADER TableHeader; 237118611Snjl 238151937Sjkim/* Event timing */ 239118611Snjl 240233250Sjkim#define ASL_NUM_EVENTS 20 241151937SjkimASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS]; 242151937SjkimASL_EXTERN UINT8 AslGbl_NextEvent; 243151937SjkimASL_EXTERN UINT8 AslGbl_NamespaceEvent; 244151937Sjkim 245118611Snjl/* Scratch buffers */ 246118611Snjl 247118611SnjlASL_EXTERN UINT8 Gbl_AmlBuffer[HEX_LISTING_LINE_SIZE]; 248118611SnjlASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE]; 249118611SnjlASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; 250118611SnjlASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; 251118611Snjl 252202771Sjkim 253118611Snjl#endif /* __ASLGLOBAL_H */ 254