Indentation fix, cleanup.
[AROS.git] / arch / all-pc / acpica / source / include / acglobal.h
blobcb76f653b36862fcdd58a4db6c0cfb908b4276cd
1 /******************************************************************************
3 * Name: acglobal.h - Declarations for global variables
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
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.
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.
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.
44 #ifndef __ACGLOBAL_H__
45 #define __ACGLOBAL_H__
49 * Ensure that the globals are actually defined and initialized only once.
51 * The use of these macros allows a single list of globals (here) in order
52 * to simplify maintenance of the code.
54 #ifdef DEFINE_ACPI_GLOBALS
55 #define ACPI_EXTERN
56 #define ACPI_INIT_GLOBAL(a,b) a=b
57 #else
58 #define ACPI_EXTERN extern
59 #define ACPI_INIT_GLOBAL(a,b) a
60 #endif
63 #ifdef DEFINE_ACPI_GLOBALS
65 /* Public globals, available from outside ACPICA subsystem */
67 /*****************************************************************************
69 * Runtime configuration (static defaults that can be overriden at runtime)
71 ****************************************************************************/
74 * Enable "slack" in the AML interpreter? Default is FALSE, and the
75 * interpreter strictly follows the ACPI specification. Setting to TRUE
76 * allows the interpreter to ignore certain errors and/or bad AML constructs.
78 * Currently, these features are enabled by this flag:
80 * 1) Allow "implicit return" of last value in a control method
81 * 2) Allow access beyond the end of an operation region
82 * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
83 * 4) Allow ANY object type to be a source operand for the Store() operator
84 * 5) Allow unresolved references (invalid target name) in package objects
85 * 6) Enable warning messages for behavior that is not ACPI spec compliant
87 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE);
90 * Automatically serialize ALL control methods? Default is FALSE, meaning
91 * to use the Serialized/NotSerialized method flags on a per method basis.
92 * Only change this if the ASL code is poorly written and cannot handle
93 * reentrancy even though methods are marked "NotSerialized".
95 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE);
98 * Create the predefined _OSI method in the namespace? Default is TRUE
99 * because ACPI CA is fully compatible with other ACPI implementations.
100 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
102 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE);
105 * Optionally use default values for the ACPI register widths. Set this to
106 * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
108 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE);
111 * Optionally enable output from the AML Debug Object.
113 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE);
116 * Optionally copy the entire DSDT to local memory (instead of simply
117 * mapping it.) There are some BIOSs that corrupt or replace the original
118 * DSDT, creating the need for this option. Default is FALSE, do not copy
119 * the DSDT.
121 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE);
124 * Optionally truncate I/O addresses to 16 bits. Provides compatibility
125 * with other ACPI implementations. NOTE: During ACPICA initialization,
126 * this value is set to TRUE if any Windows OSI strings have been
127 * requested by the BIOS.
129 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE);
132 * Disable runtime checking and repair of values returned by control methods.
133 * Use only if the repair is causing a problem on a particular machine.
135 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableAutoRepair, FALSE);
138 * Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
139 * This can be useful for debugging ACPI problems on some machines.
141 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableSsdtTableLoad, FALSE);
144 * We keep track of the latest version of Windows that has been requested by
145 * the BIOS.
147 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_OsiData, 0);
150 /* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */
152 ACPI_TABLE_FADT AcpiGbl_FADT;
153 UINT32 AcpiCurrentGpeCount;
154 UINT32 AcpiGbl_TraceFlags;
155 ACPI_NAME AcpiGbl_TraceMethodName;
156 BOOLEAN AcpiGbl_SystemAwakeAndRunning;
159 * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning
160 * that the ACPI hardware is no longer required. A flag in the FADT indicates
161 * a reduced HW machine, and that flag is duplicated here for convenience.
163 BOOLEAN AcpiGbl_ReducedHardware;
165 #endif /* DEFINE_ACPI_GLOBALS */
167 /* Do not disassemble buffers to resource descriptors */
169 ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_NoResourceDisassembly, FALSE);
171 /*****************************************************************************
173 * ACPI Table globals
175 ****************************************************************************/
178 * AcpiGbl_RootTableList is the master list of ACPI tables that were
179 * found in the RSDT/XSDT.
181 ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList;
183 #if (!ACPI_REDUCED_HARDWARE)
184 ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS;
186 #endif /* !ACPI_REDUCED_HARDWARE */
188 /* These addresses are calculated from the FADT Event Block addresses */
190 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aStatus;
191 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
193 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus;
194 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
196 /* DSDT information. Used to check for DSDT corruption */
198 ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
199 ACPI_EXTERN ACPI_TABLE_HEADER AcpiGbl_OriginalDsdtHeader;
202 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
203 * determined by the revision of the DSDT: If the DSDT revision is less than
204 * 2, use only the lower 32 bits of the internal 64-bit Integer.
206 ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth;
207 ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth;
208 ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth;
211 /*****************************************************************************
213 * Mutual exclusion within ACPICA subsystem
215 ****************************************************************************/
218 * Predefined mutex objects. This array contains the
219 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
220 * (The table maps local handles to the real OS handles)
222 ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX];
225 * Global lock mutex is an actual AML mutex object
226 * Global lock semaphore works in conjunction with the actual global lock
227 * Global lock spinlock is used for "pending" handshake
229 ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex;
230 ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore;
231 ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GlobalLockPendingLock;
232 ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
233 ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
234 ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
235 ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPending;
238 * Spinlocks are used for interfaces that can be possibly called at
239 * interrupt level
241 ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */
242 ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */
243 ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_ReferenceCountLock;
245 /* Mutex for _OSI support */
247 ACPI_EXTERN ACPI_MUTEX AcpiGbl_OsiMutex;
249 /* Reader/Writer lock is used for namespace walk and dynamic table unload */
251 ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock;
254 /*****************************************************************************
256 * Miscellaneous globals
258 ****************************************************************************/
260 /* Object caches */
262 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache;
263 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_StateCache;
264 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeCache;
265 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeExtCache;
266 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache;
268 /* Global handlers */
270 ACPI_EXTERN ACPI_GLOBAL_NOTIFY_HANDLER AcpiGbl_GlobalNotify[2];
271 ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler;
272 ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
273 ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler;
274 ACPI_EXTERN void *AcpiGbl_TableHandlerContext;
275 ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
276 ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler;
277 ACPI_EXTERN ACPI_SCI_HANDLER_INFO *AcpiGbl_SciHandlerList;
279 /* Owner ID support */
281 ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS];
282 ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex;
283 ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset;
285 /* Initialization sequencing */
287 ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted;
289 /* Misc */
291 ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;
292 ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation;
293 ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount;
294 ACPI_EXTERN UINT32 AcpiGbl_PsFindCount;
295 ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave;
296 ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
297 ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
298 ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
299 ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
300 ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces;
301 ACPI_EXTERN ACPI_ADDRESS_RANGE *AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX];
303 #ifndef DEFINE_ACPI_GLOBALS
305 /* Other miscellaneous */
307 extern BOOLEAN AcpiGbl_Shutdown;
308 extern UINT32 AcpiGbl_StartupFlags;
309 extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT];
310 extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS];
311 extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS];
312 extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
313 extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
314 #endif
317 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
319 /* Lists for tracking memory allocations */
321 ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList;
322 ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList;
323 ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats;
324 ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking;
325 #endif
328 /*****************************************************************************
330 * Namespace globals
332 ****************************************************************************/
334 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
335 #define NUM_PREDEFINED_NAMES 10
336 #else
337 #define NUM_PREDEFINED_NAMES 9
338 #endif
340 ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct;
341 ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode;
342 ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice;
343 ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_ModuleCodeList;
346 extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES];
347 extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
349 #ifdef ACPI_DEBUG_OUTPUT
350 ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount;
351 ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize;
352 ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount;
353 ACPI_EXTERN ACPI_SIZE *AcpiGbl_EntryStackPointer;
354 ACPI_EXTERN ACPI_SIZE *AcpiGbl_LowestStackPointer;
355 ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting;
356 #endif
359 /*****************************************************************************
361 * Interpreter globals
363 ****************************************************************************/
365 ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList;
367 /* Control method single step flag */
369 ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep;
372 /*****************************************************************************
374 * Hardware globals
376 ****************************************************************************/
378 extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG];
379 ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA;
380 ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB;
383 /*****************************************************************************
385 * Event and GPE globals
387 ****************************************************************************/
389 #if (!ACPI_REDUCED_HARDWARE)
391 ACPI_EXTERN UINT8 AcpiGbl_AllGpesInitialized;
392 ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead;
393 ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS];
394 ACPI_EXTERN ACPI_GBL_EVENT_HANDLER AcpiGbl_GlobalEventHandler;
395 ACPI_EXTERN void *AcpiGbl_GlobalEventHandlerContext;
396 ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
397 extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS];
399 #endif /* !ACPI_REDUCED_HARDWARE */
401 /*****************************************************************************
403 * Debug support
405 ****************************************************************************/
407 /* Procedure nesting level for debug output */
409 extern UINT32 AcpiGbl_NestingLevel;
411 /* Event counters */
413 ACPI_EXTERN UINT32 AcpiMethodCount;
414 ACPI_EXTERN UINT32 AcpiGpeCount;
415 ACPI_EXTERN UINT32 AcpiSciCount;
416 ACPI_EXTERN UINT32 AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS];
418 /* Support for dynamic control method tracing mechanism */
420 ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel;
421 ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer;
422 ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel;
423 ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer;
426 /*****************************************************************************
428 * Debugger and Disassembler globals
430 ****************************************************************************/
432 ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags;
434 #ifdef ACPI_DISASSEMBLER
436 ACPI_EXTERN BOOLEAN ACPI_INIT_GLOBAL (AcpiGbl_IgnoreNoopOperator, FALSE);
438 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm;
439 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose;
440 ACPI_EXTERN BOOLEAN AcpiGbl_NumExternalMethods;
441 ACPI_EXTERN UINT32 AcpiGbl_ResolvedExternalMethods;
442 ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList;
443 ACPI_EXTERN ACPI_EXTERNAL_FILE *AcpiGbl_ExternalFileList;
444 #endif
447 #ifdef ACPI_DEBUGGER
449 extern BOOLEAN AcpiGbl_MethodExecuting;
450 extern BOOLEAN AcpiGbl_AbortMethod;
451 extern BOOLEAN AcpiGbl_DbTerminateThreads;
453 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables;
454 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats;
455 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods;
456 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport;
457 ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile;
458 ACPI_EXTERN char *AcpiGbl_DbBuffer;
459 ACPI_EXTERN char *AcpiGbl_DbFilename;
460 ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel;
461 ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel;
462 ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode;
464 ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
465 ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS];
467 /* These buffers should all be the same size */
469 ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE];
470 ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE];
471 ACPI_EXTERN char AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE];
472 ACPI_EXTERN char AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE];
475 * Statistic globals
477 ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1];
478 ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1];
479 ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCountMisc;
480 ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCountMisc;
481 ACPI_EXTERN UINT32 AcpiGbl_NumNodes;
482 ACPI_EXTERN UINT32 AcpiGbl_NumObjects;
485 ACPI_EXTERN UINT32 AcpiGbl_SizeOfParseTree;
486 ACPI_EXTERN UINT32 AcpiGbl_SizeOfMethodTrees;
487 ACPI_EXTERN UINT32 AcpiGbl_SizeOfNodeEntries;
488 ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects;
490 #endif /* ACPI_DEBUGGER */
493 /*****************************************************************************
495 * Info/help support
497 ****************************************************************************/
499 extern const AH_PREDEFINED_NAME AslPredefinedInfo[];
502 #endif /* __ACGLOBAL_H__ */