2fe04d4a758a6c21ac0f69f1c6c6aa77b7586b5d
[reactos.git] / reactos / drivers / bus / acpi / acpica / include / acglobal.h
1 /******************************************************************************
2 *
3 * Name: acglobal.h - Declarations for global variables
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2016, 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 __ACGLOBAL_H__
45 #define __ACGLOBAL_H__
46
47
48 /*****************************************************************************
49 *
50 * Globals related to the ACPI tables
51 *
52 ****************************************************************************/
53
54 /* Master list of all ACPI tables that were found in the RSDT/XSDT */
55
56 ACPI_GLOBAL (ACPI_TABLE_LIST, AcpiGbl_RootTableList);
57
58 /* DSDT information. Used to check for DSDT corruption */
59
60 ACPI_GLOBAL (ACPI_TABLE_HEADER *, AcpiGbl_DSDT);
61 ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader);
62 ACPI_INIT_GLOBAL (UINT32, AcpiGbl_DsdtIndex, ACPI_INVALID_TABLE_INDEX);
63 ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FacsIndex, ACPI_INVALID_TABLE_INDEX);
64 ACPI_INIT_GLOBAL (UINT32, AcpiGbl_XFacsIndex, ACPI_INVALID_TABLE_INDEX);
65 ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FadtIndex, ACPI_INVALID_TABLE_INDEX);
66
67 #if (!ACPI_REDUCED_HARDWARE)
68 ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS);
69
70 #endif /* !ACPI_REDUCED_HARDWARE */
71
72 /* These addresses are calculated from the FADT Event Block addresses */
73
74 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aStatus);
75 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aEnable);
76
77 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bStatus);
78 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bEnable);
79
80 /*
81 * Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is
82 * determined by the revision of the DSDT: If the DSDT revision is less than
83 * 2, use only the lower 32 bits of the internal 64-bit Integer.
84 */
85 ACPI_GLOBAL (UINT8, AcpiGbl_IntegerBitWidth);
86 ACPI_GLOBAL (UINT8, AcpiGbl_IntegerByteWidth);
87 ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth);
88
89 ACPI_INIT_GLOBAL (UINT8, AcpiGbl_GroupModuleLevelCode, FALSE);
90
91
92 /*****************************************************************************
93 *
94 * Mutual exclusion within ACPICA subsystem
95 *
96 ****************************************************************************/
97
98 /*
99 * Predefined mutex objects. This array contains the
100 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
101 * (The table maps local handles to the real OS handles)
102 */
103 ACPI_GLOBAL (ACPI_MUTEX_INFO, AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]);
104
105 /*
106 * Global lock mutex is an actual AML mutex object
107 * Global lock semaphore works in conjunction with the actual global lock
108 * Global lock spinlock is used for "pending" handshake
109 */
110 ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_GlobalLockMutex);
111 ACPI_GLOBAL (ACPI_SEMAPHORE, AcpiGbl_GlobalLockSemaphore);
112 ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GlobalLockPendingLock);
113 ACPI_GLOBAL (UINT16, AcpiGbl_GlobalLockHandle);
114 ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockAcquired);
115 ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPresent);
116 ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPending);
117
118 /*
119 * Spinlocks are used for interfaces that can be possibly called at
120 * interrupt level
121 */
122 ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GpeLock); /* For GPE data structs and registers */
123 ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_HardwareLock); /* For ACPI H/W except GPE registers */
124 ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_ReferenceCountLock);
125
126 /* Mutex for _OSI support */
127
128 ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_OsiMutex);
129
130 /* Reader/Writer lock is used for namespace walk and dynamic table unload */
131
132 ACPI_GLOBAL (ACPI_RW_LOCK, AcpiGbl_NamespaceRwLock);
133
134
135 /*****************************************************************************
136 *
137 * Miscellaneous globals
138 *
139 ****************************************************************************/
140
141 /* Object caches */
142
143 ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_NamespaceCache);
144 ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_StateCache);
145 ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeCache);
146 ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeExtCache);
147 ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_OperandCache);
148
149 /* System */
150
151 ACPI_INIT_GLOBAL (UINT32, AcpiGbl_StartupFlags, 0);
152 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_Shutdown, TRUE);
153 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_EarlyInitialization, TRUE);
154
155 /* Global handlers */
156
157 ACPI_GLOBAL (ACPI_GLOBAL_NOTIFY_HANDLER,AcpiGbl_GlobalNotify[2]);
158 ACPI_GLOBAL (ACPI_EXCEPTION_HANDLER, AcpiGbl_ExceptionHandler);
159 ACPI_GLOBAL (ACPI_INIT_HANDLER, AcpiGbl_InitHandler);
160 ACPI_GLOBAL (ACPI_TABLE_HANDLER, AcpiGbl_TableHandler);
161 ACPI_GLOBAL (void *, AcpiGbl_TableHandlerContext);
162 ACPI_GLOBAL (ACPI_INTERFACE_HANDLER, AcpiGbl_InterfaceHandler);
163 ACPI_GLOBAL (ACPI_SCI_HANDLER_INFO *, AcpiGbl_SciHandlerList);
164
165 /* Owner ID support */
166
167 ACPI_GLOBAL (UINT32, AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]);
168 ACPI_GLOBAL (UINT8, AcpiGbl_LastOwnerIdIndex);
169 ACPI_GLOBAL (UINT8, AcpiGbl_NextOwnerIdOffset);
170
171 /* Initialization sequencing */
172
173 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_RegMethodsEnabled, FALSE);
174
175 /* Misc */
176
177 ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode);
178 ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount);
179 ACPI_GLOBAL (UINT32, AcpiGbl_PsFindCount);
180 ACPI_GLOBAL (UINT16, AcpiGbl_Pm1EnableRegisterSave);
181 ACPI_GLOBAL (UINT8, AcpiGbl_DebuggerConfiguration);
182 ACPI_GLOBAL (BOOLEAN, AcpiGbl_StepToNextCall);
183 ACPI_GLOBAL (BOOLEAN, AcpiGbl_AcpiHardwarePresent);
184 ACPI_GLOBAL (BOOLEAN, AcpiGbl_EventsInitialized);
185 ACPI_GLOBAL (ACPI_INTERFACE_INFO *, AcpiGbl_SupportedInterfaces);
186 ACPI_GLOBAL (ACPI_ADDRESS_RANGE *, AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX]);
187
188 /* Other miscellaneous, declared and initialized in utglobal */
189
190 extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT];
191 extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS];
192 extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS];
193 extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
194 extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
195
196
197 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
198
199 /* Lists for tracking memory allocations (debug only) */
200
201 ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_GlobalList);
202 ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_NsNodeList);
203 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisplayFinalMemStats);
204 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisableMemTracking);
205 #endif
206
207
208 /*****************************************************************************
209 *
210 * Namespace globals
211 *
212 ****************************************************************************/
213
214 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
215 #define NUM_PREDEFINED_NAMES 10
216 #else
217 #define NUM_PREDEFINED_NAMES 9
218 #endif
219
220 ACPI_GLOBAL (ACPI_NAMESPACE_NODE, AcpiGbl_RootNodeStruct);
221 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_RootNode);
222 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_FadtGpeDevice);
223 ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_ModuleCodeList);
224
225
226 extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES];
227 extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
228
229 #ifdef ACPI_DEBUG_OUTPUT
230 ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeCount);
231 ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeSize);
232 ACPI_GLOBAL (UINT32, AcpiGbl_MaxConcurrentNodeCount);
233 ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_EntryStackPointer);
234 ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_LowestStackPointer);
235 ACPI_GLOBAL (UINT32, AcpiGbl_DeepestNesting);
236 ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0);
237 #endif
238
239
240 /*****************************************************************************
241 *
242 * Interpreter globals
243 *
244 ****************************************************************************/
245
246 ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList);
247
248 /* Maximum number of While() loop iterations before forced abort */
249
250 ACPI_GLOBAL (UINT16, AcpiGbl_MaxLoopIterations);
251
252 /* Control method single step flag */
253
254 ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep);
255
256
257 /*****************************************************************************
258 *
259 * Hardware globals
260 *
261 ****************************************************************************/
262
263 extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG];
264
265 ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeA);
266 ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB);
267
268
269 /*****************************************************************************
270 *
271 * Event and GPE globals
272 *
273 ****************************************************************************/
274
275 #if (!ACPI_REDUCED_HARDWARE)
276
277 ACPI_GLOBAL (UINT8, AcpiGbl_AllGpesInitialized);
278 ACPI_GLOBAL (ACPI_GPE_XRUPT_INFO *, AcpiGbl_GpeXruptListHead);
279 ACPI_GLOBAL (ACPI_GPE_BLOCK_INFO *, AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]);
280 ACPI_GLOBAL (ACPI_GBL_EVENT_HANDLER, AcpiGbl_GlobalEventHandler);
281 ACPI_GLOBAL (void *, AcpiGbl_GlobalEventHandlerContext);
282 ACPI_GLOBAL (ACPI_FIXED_EVENT_HANDLER, AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]);
283
284 extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS];
285
286 #endif /* !ACPI_REDUCED_HARDWARE */
287
288 /*****************************************************************************
289 *
290 * Debug support
291 *
292 ****************************************************************************/
293
294 /* Event counters */
295
296 ACPI_GLOBAL (UINT32, AcpiMethodCount);
297 ACPI_GLOBAL (UINT32, AcpiGpeCount);
298 ACPI_GLOBAL (UINT32, AcpiSciCount);
299 ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]);
300
301 /* Support for dynamic control method tracing mechanism */
302
303 ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel);
304 ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer);
305
306
307 /*****************************************************************************
308 *
309 * Debugger and Disassembler globals
310 *
311 ****************************************************************************/
312
313 ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT);
314
315 #ifdef ACPI_DISASSEMBLER
316
317 /* Do not disassemble buffers to resource descriptors */
318
319 ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE);
320 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE);
321 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE);
322 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE);
323 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Verbose, TRUE);
324
325 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm);
326 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing);
327 ACPI_GLOBAL (BOOLEAN, AcpiGbl_NumExternalMethods);
328 ACPI_GLOBAL (UINT32, AcpiGbl_ResolvedExternalMethods);
329 ACPI_GLOBAL (ACPI_EXTERNAL_LIST *, AcpiGbl_ExternalList);
330 ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList);
331 #endif
332
333 #ifdef ACPI_DEBUGGER
334
335 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE);
336 ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE);
337 ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID);
338
339 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoIniMethods);
340 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport);
341 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOutputToFile);
342 ACPI_GLOBAL (char *, AcpiGbl_DbBuffer);
343 ACPI_GLOBAL (char *, AcpiGbl_DbFilename);
344 ACPI_GLOBAL (UINT32, AcpiGbl_DbDebugLevel);
345 ACPI_GLOBAL (UINT32, AcpiGbl_DbConsoleDebugLevel);
346 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_DbScopeNode);
347 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateLoop);
348 ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbThreadsTerminated);
349
350 ACPI_GLOBAL (char *, AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]);
351 ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]);
352
353 /* These buffers should all be the same size */
354
355 ACPI_GLOBAL (char, AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]);
356 ACPI_GLOBAL (char, AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]);
357 ACPI_GLOBAL (char, AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]);
358 ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]);
359
360 /*
361 * Statistic globals
362 */
363 ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TOTAL_TYPES]);
364 ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TOTAL_TYPES]);
365 ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCountMisc);
366 ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc);
367 ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes);
368 ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects);
369
370 ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_DbCommandReady);
371 ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_DbCommandComplete);
372
373 #endif /* ACPI_DEBUGGER */
374
375
376 /*****************************************************************************
377 *
378 * Application globals
379 *
380 ****************************************************************************/
381
382 #ifdef ACPI_APPLICATION
383
384 ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL);
385 ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL);
386
387 /* Print buffer */
388
389 ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer */
390 ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]);
391
392 #endif /* ACPI_APPLICATION */
393
394
395 /*****************************************************************************
396 *
397 * Info/help support
398 *
399 ****************************************************************************/
400
401 extern const AH_PREDEFINED_NAME AslPredefinedInfo[];
402 extern const AH_DEVICE_ID AslDeviceIds[];
403
404
405 #endif /* __ACGLOBAL_H__ */