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