1 /****************************************************************************** 2 * 3 * Module Name: utglobal - Global variables for the ACPI subsystem 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2014, 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 #define __UTGLOBAL_C__ 45 #define EXPORT_ACPI_INTERFACES 46 #define DEFINE_ACPI_GLOBALS 47 48 #include "acpi.h" 49 #include "accommon.h" 50 51 #define _COMPONENT ACPI_UTILITIES 52 ACPI_MODULE_NAME ("utglobal") 53 54 55 /******************************************************************************* 56 * 57 * Static global variable initialization. 58 * 59 ******************************************************************************/ 60 61 /* Various state name strings */ 62 63 const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] = 64 { 65 "\\_S0_", 66 "\\_S1_", 67 "\\_S2_", 68 "\\_S3_", 69 "\\_S4_", 70 "\\_S5_" 71 }; 72 73 const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS] = 74 { 75 "_S0W", 76 "_S1W", 77 "_S2W", 78 "_S3W", 79 "_S4W" 80 }; 81 82 const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] = 83 { 84 "_S1D", 85 "_S2D", 86 "_S3D", 87 "_S4D" 88 }; 89 90 91 /******************************************************************************* 92 * 93 * Namespace globals 94 * 95 ******************************************************************************/ 96 97 /* 98 * Predefined ACPI Names (Built-in to the Interpreter) 99 * 100 * NOTES: 101 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run 102 * during the initialization sequence. 103 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to 104 * perform a Notify() operation on it. 09/2010: Changed to type Device. 105 * This still allows notifies, but does not confuse host code that 106 * searches for valid ThermalZone objects. 107 */ 108 const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = 109 { 110 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, 111 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 112 {"_SB_", ACPI_TYPE_DEVICE, NULL}, 113 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 114 {"_TZ_", ACPI_TYPE_DEVICE, NULL}, 115 {"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL}, 116 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 117 {"_GL_", ACPI_TYPE_MUTEX, (char *) 1}, 118 119 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 120 {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, 121 #endif 122 123 /* Table terminator */ 124 125 {NULL, ACPI_TYPE_ANY, NULL} 126 }; 127 128 129 #if (!ACPI_REDUCED_HARDWARE) 130 /****************************************************************************** 131 * 132 * Event and Hardware globals 133 * 134 ******************************************************************************/ 135 136 ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] = 137 { 138 /* Name Parent Register Register Bit Position Register Bit Mask */ 139 140 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_TIMER_STATUS, ACPI_BITMASK_TIMER_STATUS}, 141 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_BUS_MASTER_STATUS, ACPI_BITMASK_BUS_MASTER_STATUS}, 142 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_STATUS}, 143 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_STATUS}, 144 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS}, 145 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS}, 146 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS}, 147 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, ACPI_BITMASK_PCIEXP_WAKE_STATUS}, 148 149 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE}, 150 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, 151 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE}, 152 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, 153 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE}, 154 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, 155 156 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE}, 157 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD}, 158 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, 159 /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE, ACPI_BITMASK_SLEEP_TYPE}, 160 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE}, 161 162 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE} 163 }; 164 165 166 ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = 167 { 168 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, ACPI_BITREG_TIMER_ENABLE, ACPI_BITMASK_TIMER_STATUS, ACPI_BITMASK_TIMER_ENABLE}, 169 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, ACPI_BITREG_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_STATUS, ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, 170 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE}, 171 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, 172 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, 173 }; 174 #endif /* !ACPI_REDUCED_HARDWARE */ 175 176 177 /******************************************************************************* 178 * 179 * FUNCTION: AcpiUtInitGlobals 180 * 181 * PARAMETERS: None 182 * 183 * RETURN: Status 184 * 185 * DESCRIPTION: Initialize ACPICA globals. All globals that require specific 186 * initialization should be initialized here. This allows for 187 * a warm restart. 188 * 189 ******************************************************************************/ 190 191 ACPI_STATUS 192 AcpiUtInitGlobals ( 193 void) 194 { 195 ACPI_STATUS Status; 196 UINT32 i; 197 198 199 ACPI_FUNCTION_TRACE (UtInitGlobals); 200 201 202 /* Create all memory caches */ 203 204 Status = AcpiUtCreateCaches (); 205 if (ACPI_FAILURE (Status)) 206 { 207 return_ACPI_STATUS (Status); 208 } 209 210 /* Address Range lists */ 211 212 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) 213 { 214 AcpiGbl_AddressRangeList[i] = NULL; 215 } 216 217 /* Mutex locked flags */ 218 219 for (i = 0; i < ACPI_NUM_MUTEX; i++) 220 { 221 AcpiGbl_MutexInfo[i].Mutex = NULL; 222 AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; 223 AcpiGbl_MutexInfo[i].UseCount = 0; 224 } 225 226 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) 227 { 228 AcpiGbl_OwnerIdMask[i] = 0; 229 } 230 231 /* Last OwnerID is never valid */ 232 233 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; 234 235 /* Event counters */ 236 237 AcpiMethodCount = 0; 238 AcpiSciCount = 0; 239 AcpiGpeCount = 0; 240 241 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) 242 { 243 AcpiFixedEventCount[i] = 0; 244 } 245 246 #if (!ACPI_REDUCED_HARDWARE) 247 248 /* GPE/SCI support */ 249 250 AcpiGbl_AllGpesInitialized = FALSE; 251 AcpiGbl_GpeXruptListHead = NULL; 252 AcpiGbl_GpeFadtBlocks[0] = NULL; 253 AcpiGbl_GpeFadtBlocks[1] = NULL; 254 AcpiCurrentGpeCount = 0; 255 256 AcpiGbl_GlobalEventHandler = NULL; 257 AcpiGbl_SciHandlerList = NULL; 258 259 #endif /* !ACPI_REDUCED_HARDWARE */ 260 261 /* Global handlers */ 262 263 AcpiGbl_GlobalNotify[0].Handler = NULL; 264 AcpiGbl_GlobalNotify[1].Handler = NULL; 265 AcpiGbl_ExceptionHandler = NULL; 266 AcpiGbl_InitHandler = NULL; 267 AcpiGbl_TableHandler = NULL; 268 AcpiGbl_InterfaceHandler = NULL; 269 270 /* Global Lock support */ 271 272 AcpiGbl_GlobalLockSemaphore = NULL; 273 AcpiGbl_GlobalLockMutex = NULL; 274 AcpiGbl_GlobalLockAcquired = FALSE; 275 AcpiGbl_GlobalLockHandle = 0; 276 AcpiGbl_GlobalLockPresent = FALSE; 277 278 /* Miscellaneous variables */ 279 280 AcpiGbl_DSDT = NULL; 281 AcpiGbl_CmSingleStep = FALSE; 282 AcpiGbl_Shutdown = FALSE; 283 AcpiGbl_NsLookupCount = 0; 284 AcpiGbl_PsFindCount = 0; 285 AcpiGbl_AcpiHardwarePresent = TRUE; 286 AcpiGbl_LastOwnerIdIndex = 0; 287 AcpiGbl_NextOwnerIdOffset = 0; 288 AcpiGbl_TraceDbgLevel = 0; 289 AcpiGbl_TraceDbgLayer = 0; 290 AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; 291 AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; 292 AcpiGbl_OsiMutex = NULL; 293 AcpiGbl_RegMethodsExecuted = FALSE; 294 295 /* Hardware oriented */ 296 297 AcpiGbl_EventsInitialized = FALSE; 298 AcpiGbl_SystemAwakeAndRunning = TRUE; 299 300 /* Namespace */ 301 302 AcpiGbl_ModuleCodeList = NULL; 303 AcpiGbl_RootNode = NULL; 304 AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; 305 AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; 306 AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; 307 AcpiGbl_RootNodeStruct.Parent = NULL; 308 AcpiGbl_RootNodeStruct.Child = NULL; 309 AcpiGbl_RootNodeStruct.Peer = NULL; 310 AcpiGbl_RootNodeStruct.Object = NULL; 311 312 313 #ifdef ACPI_DISASSEMBLER 314 AcpiGbl_ExternalList = NULL; 315 AcpiGbl_NumExternalMethods = 0; 316 AcpiGbl_ResolvedExternalMethods = 0; 317 #endif 318 319 #ifdef ACPI_DEBUG_OUTPUT 320 AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); 321 #endif 322 323 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 324 AcpiGbl_DisplayFinalMemStats = FALSE; 325 AcpiGbl_DisableMemTracking = FALSE; 326 #endif 327 328 ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE); 329 330 return_ACPI_STATUS (AE_OK); 331 } 332 333 /* Public globals */ 334 335 ACPI_EXPORT_SYMBOL (AcpiGbl_FADT) 336 ACPI_EXPORT_SYMBOL (AcpiDbgLevel) 337 ACPI_EXPORT_SYMBOL (AcpiDbgLayer) 338 ACPI_EXPORT_SYMBOL (AcpiGpeCount) 339 ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount) 340