1 /****************************************************************************** 2 * 3 * Name: acglobal.h - Declarations for global variables 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2011, 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 * Ensure that the globals are actually defined and initialized only once. 50 * 51 * The use of these macros allows a single list of globals (here) in order 52 * to simplify maintenance of the code. 53 */ 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 61 62 63 #ifdef DEFINE_ACPI_GLOBALS 64 65 /* Public globals, available from outside ACPICA subsystem */ 66 67 /***************************************************************************** 68 * 69 * Runtime configuration (static defaults that can be overriden at runtime) 70 * 71 ****************************************************************************/ 72 73 /* 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. 77 * 78 * Currently, these features are enabled by this flag: 79 * 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 86 */ 87 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE); 88 89 /* 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". 94 */ 95 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); 96 97 /* 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. 101 */ 102 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); 103 104 /* 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. 107 */ 108 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE); 109 110 /* 111 * Optionally enable output from the AML Debug Object. 112 */ 113 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE); 114 115 /* 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. 120 */ 121 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); 122 123 /* 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. 128 */ 129 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE); 130 131 /* 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. 134 */ 135 UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableAutoRepair, FALSE); 136 137 138 /* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ 139 140 ACPI_TABLE_FADT AcpiGbl_FADT; 141 UINT32 AcpiCurrentGpeCount; 142 UINT32 AcpiGbl_TraceFlags; 143 ACPI_NAME AcpiGbl_TraceMethodName; 144 BOOLEAN AcpiGbl_SystemAwakeAndRunning; 145 146 /* 147 * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning 148 * that the ACPI hardware is no longer required. A flag in the FADT indicates 149 * a reduced HW machine, and that flag is duplicated here for convenience. 150 */ 151 BOOLEAN AcpiGbl_ReducedHardware; 152 153 154 #endif 155 156 /* Do not disassemble buffers to resource descriptors */ 157 158 ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_NoResourceDisassembly, FALSE); 159 160 /***************************************************************************** 161 * 162 * ACPI Table globals 163 * 164 ****************************************************************************/ 165 166 /* 167 * AcpiGbl_RootTableList is the master list of ACPI tables that were 168 * found in the RSDT/XSDT. 169 */ 170 ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList; 171 ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS; 172 173 /* These addresses are calculated from the FADT Event Block addresses */ 174 175 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aStatus; 176 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; 177 178 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus; 179 ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; 180 181 /* DSDT information. Used to check for DSDT corruption */ 182 183 ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT; 184 ACPI_EXTERN ACPI_TABLE_HEADER AcpiGbl_OriginalDsdtHeader; 185 186 /* 187 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is 188 * determined by the revision of the DSDT: If the DSDT revision is less than 189 * 2, use only the lower 32 bits of the internal 64-bit Integer. 190 */ 191 ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth; 192 ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; 193 ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; 194 195 196 /***************************************************************************** 197 * 198 * Mutual exclusion within ACPICA subsystem 199 * 200 ****************************************************************************/ 201 202 /* 203 * Predefined mutex objects. This array contains the 204 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. 205 * (The table maps local handles to the real OS handles) 206 */ 207 ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]; 208 209 /* 210 * Global lock mutex is an actual AML mutex object 211 * Global lock semaphore works in conjunction with the actual global lock 212 * Global lock spinlock is used for "pending" handshake 213 */ 214 ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex; 215 ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore; 216 ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GlobalLockPendingLock; 217 ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; 218 ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; 219 ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; 220 ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPending; 221 222 /* 223 * Spinlocks are used for interfaces that can be possibly called at 224 * interrupt level 225 */ 226 ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */ 227 ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */ 228 229 /* Mutex for _OSI support */ 230 231 ACPI_EXTERN ACPI_MUTEX AcpiGbl_OsiMutex; 232 233 /* Reader/Writer lock is used for namespace walk and dynamic table unload */ 234 235 ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock; 236 237 238 /***************************************************************************** 239 * 240 * Miscellaneous globals 241 * 242 ****************************************************************************/ 243 244 /* Object caches */ 245 246 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache; 247 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_StateCache; 248 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeCache; 249 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeExtCache; 250 ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache; 251 252 /* Global handlers */ 253 254 ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify; 255 ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify; 256 ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler; 257 ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; 258 ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler; 259 ACPI_EXTERN void *AcpiGbl_TableHandlerContext; 260 ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; 261 ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler; 262 263 /* Owner ID support */ 264 265 ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; 266 ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; 267 ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; 268 269 /* Initialization sequencing */ 270 271 ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted; 272 273 /* Misc */ 274 275 ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; 276 ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation; 277 ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount; 278 ACPI_EXTERN UINT32 AcpiGbl_PsFindCount; 279 ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave; 280 ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration; 281 ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; 282 ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; 283 ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; 284 ACPI_EXTERN UINT8 AcpiGbl_OsiData; 285 ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces; 286 287 288 #ifndef DEFINE_ACPI_GLOBALS 289 290 /* Exception codes */ 291 292 extern char const *AcpiGbl_ExceptionNames_Env[]; 293 extern char const *AcpiGbl_ExceptionNames_Pgm[]; 294 extern char const *AcpiGbl_ExceptionNames_Tbl[]; 295 extern char const *AcpiGbl_ExceptionNames_Aml[]; 296 extern char const *AcpiGbl_ExceptionNames_Ctrl[]; 297 298 /* Other miscellaneous */ 299 300 extern BOOLEAN AcpiGbl_Shutdown; 301 extern UINT32 AcpiGbl_StartupFlags; 302 extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; 303 extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS]; 304 extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS]; 305 extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; 306 extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; 307 #endif 308 309 310 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 311 312 /* Lists for tracking memory allocations */ 313 314 ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; 315 ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; 316 ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; 317 ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking; 318 #endif 319 320 321 /***************************************************************************** 322 * 323 * Namespace globals 324 * 325 ****************************************************************************/ 326 327 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 328 #define NUM_PREDEFINED_NAMES 10 329 #else 330 #define NUM_PREDEFINED_NAMES 9 331 #endif 332 333 ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; 334 ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; 335 ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice; 336 ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_ModuleCodeList; 337 338 339 extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; 340 extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; 341 342 #ifdef ACPI_DEBUG_OUTPUT 343 ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount; 344 ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize; 345 ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount; 346 ACPI_EXTERN ACPI_SIZE *AcpiGbl_EntryStackPointer; 347 ACPI_EXTERN ACPI_SIZE *AcpiGbl_LowestStackPointer; 348 ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; 349 #endif 350 351 352 /***************************************************************************** 353 * 354 * Interpreter globals 355 * 356 ****************************************************************************/ 357 358 359 ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList; 360 361 /* Control method single step flag */ 362 363 ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; 364 365 366 /***************************************************************************** 367 * 368 * Hardware globals 369 * 370 ****************************************************************************/ 371 372 extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; 373 ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA; 374 ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; 375 376 377 /***************************************************************************** 378 * 379 * Event and GPE globals 380 * 381 ****************************************************************************/ 382 383 ACPI_EXTERN UINT8 AcpiGbl_AllGpesInitialized; 384 ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; 385 ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; 386 ACPI_EXTERN ACPI_GBL_EVENT_HANDLER AcpiGbl_GlobalEventHandler; 387 ACPI_EXTERN void *AcpiGbl_GlobalEventHandlerContext; 388 ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; 389 extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; 390 391 392 /***************************************************************************** 393 * 394 * Debug support 395 * 396 ****************************************************************************/ 397 398 /* Procedure nesting level for debug output */ 399 400 extern UINT32 AcpiGbl_NestingLevel; 401 402 /* Event counters */ 403 404 ACPI_EXTERN UINT32 AcpiMethodCount; 405 ACPI_EXTERN UINT32 AcpiGpeCount; 406 ACPI_EXTERN UINT32 AcpiSciCount; 407 ACPI_EXTERN UINT32 AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]; 408 409 /* Support for dynamic control method tracing mechanism */ 410 411 ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; 412 ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; 413 ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; 414 ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; 415 416 417 /***************************************************************************** 418 * 419 * Debugger globals 420 * 421 ****************************************************************************/ 422 423 ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags; 424 425 #ifdef ACPI_DISASSEMBLER 426 427 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm; 428 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose; 429 ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList; 430 ACPI_EXTERN ACPI_EXTERNAL_FILE *AcpiGbl_ExternalFileList; 431 #endif 432 433 434 #ifdef ACPI_DEBUGGER 435 436 extern BOOLEAN AcpiGbl_MethodExecuting; 437 extern BOOLEAN AcpiGbl_AbortMethod; 438 extern BOOLEAN AcpiGbl_DbTerminateThreads; 439 440 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables; 441 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats; 442 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; 443 ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; 444 445 ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; 446 ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]; 447 ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]; 448 ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]; 449 ACPI_EXTERN char AcpiGbl_DbScopeBuf[80]; 450 ACPI_EXTERN char AcpiGbl_DbDebugFilename[80]; 451 ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile; 452 ACPI_EXTERN char *AcpiGbl_DbBuffer; 453 ACPI_EXTERN char *AcpiGbl_DbFilename; 454 ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel; 455 ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel; 456 ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode; 457 458 /* 459 * Statistic globals 460 */ 461 ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; 462 ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; 463 ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCountMisc; 464 ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCountMisc; 465 ACPI_EXTERN UINT32 AcpiGbl_NumNodes; 466 ACPI_EXTERN UINT32 AcpiGbl_NumObjects; 467 468 469 ACPI_EXTERN UINT32 AcpiGbl_SizeOfParseTree; 470 ACPI_EXTERN UINT32 AcpiGbl_SizeOfMethodTrees; 471 ACPI_EXTERN UINT32 AcpiGbl_SizeOfNodeEntries; 472 ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects; 473 474 #endif /* ACPI_DEBUGGER */ 475 476 #endif /* __ACGLOBAL_H__ */ 477