1 /******************************************************************************
3 * Module Name: utglobal - Global variables for the ACPI subsystem
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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 #define __UTGLOBAL_C__
45 #define EXPORT_ACPI_INTERFACES
46 #define DEFINE_ACPI_GLOBALS
51 #define _COMPONENT ACPI_UTILITIES
52 ACPI_MODULE_NAME ("utglobal")
55 /*******************************************************************************
57 * Static global variable initialization.
59 ******************************************************************************/
62 * We want the debug switches statically initialized so they
63 * are already set when the debugger is entered.
66 /* Debug switch - level and trace mask */
68 #ifdef ACPI_DEBUG_OUTPUT
69 UINT32 AcpiDbgLevel
= ACPI_DEBUG_DEFAULT
;
71 UINT32 AcpiDbgLevel
= ACPI_NORMAL_DEFAULT
;
74 /* Debug switch - layer (component) mask */
76 UINT32 AcpiDbgLayer
= ACPI_COMPONENT_DEFAULT
;
77 UINT32 AcpiGbl_NestingLevel
= 0;
79 /* Debugger globals */
81 BOOLEAN AcpiGbl_DbTerminateThreads
= FALSE
;
82 BOOLEAN AcpiGbl_AbortMethod
= FALSE
;
83 BOOLEAN AcpiGbl_MethodExecuting
= FALSE
;
87 UINT32 AcpiGbl_StartupFlags
= 0;
89 /* System starts uninitialized */
91 BOOLEAN AcpiGbl_Shutdown
= TRUE
;
93 const char *AcpiGbl_SleepStateNames
[ACPI_S_STATE_COUNT
] =
103 const char *AcpiGbl_LowestDstateNames
[ACPI_NUM_SxW_METHODS
] =
112 const char *AcpiGbl_HighestDstateNames
[ACPI_NUM_SxD_METHODS
] =
121 /*******************************************************************************
125 ******************************************************************************/
128 * Predefined ACPI Names (Built-in to the Interpreter)
131 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
132 * during the initialization sequence.
133 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
134 * perform a Notify() operation on it. 09/2010: Changed to type Device.
135 * This still allows notifies, but does not confuse host code that
136 * searches for valid ThermalZone objects.
138 const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames
[] =
140 {"_GPE", ACPI_TYPE_LOCAL_SCOPE
, NULL
},
141 {"_PR_", ACPI_TYPE_LOCAL_SCOPE
, NULL
},
142 {"_SB_", ACPI_TYPE_DEVICE
, NULL
},
143 {"_SI_", ACPI_TYPE_LOCAL_SCOPE
, NULL
},
144 {"_TZ_", ACPI_TYPE_DEVICE
, NULL
},
145 {"_REV", ACPI_TYPE_INTEGER
, (char *) ACPI_CA_SUPPORT_LEVEL
},
146 {"_OS_", ACPI_TYPE_STRING
, ACPI_OS_NAME
},
147 {"_GL_", ACPI_TYPE_MUTEX
, (char *) 1},
149 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
150 {"_OSI", ACPI_TYPE_METHOD
, (char *) 1},
153 /* Table terminator */
155 {NULL
, ACPI_TYPE_ANY
, NULL
}
159 #if (!ACPI_REDUCED_HARDWARE)
160 /******************************************************************************
162 * Event and Hardware globals
164 ******************************************************************************/
166 ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo
[ACPI_NUM_BITREG
] =
168 /* Name Parent Register Register Bit Position Register Bit Mask */
170 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_TIMER_STATUS
, ACPI_BITMASK_TIMER_STATUS
},
171 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_BUS_MASTER_STATUS
, ACPI_BITMASK_BUS_MASTER_STATUS
},
172 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_GLOBAL_LOCK_STATUS
, ACPI_BITMASK_GLOBAL_LOCK_STATUS
},
173 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_POWER_BUTTON_STATUS
, ACPI_BITMASK_POWER_BUTTON_STATUS
},
174 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS
, ACPI_BITMASK_SLEEP_BUTTON_STATUS
},
175 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_RT_CLOCK_STATUS
, ACPI_BITMASK_RT_CLOCK_STATUS
},
176 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_WAKE_STATUS
, ACPI_BITMASK_WAKE_STATUS
},
177 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS
, ACPI_BITPOSITION_PCIEXP_WAKE_STATUS
, ACPI_BITMASK_PCIEXP_WAKE_STATUS
},
179 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
, ACPI_BITPOSITION_TIMER_ENABLE
, ACPI_BITMASK_TIMER_ENABLE
},
180 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE
, ACPI_BITMASK_GLOBAL_LOCK_ENABLE
},
181 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
, ACPI_BITPOSITION_POWER_BUTTON_ENABLE
, ACPI_BITMASK_POWER_BUTTON_ENABLE
},
182 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE
, ACPI_BITMASK_SLEEP_BUTTON_ENABLE
},
183 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE
, ACPI_BITPOSITION_RT_CLOCK_ENABLE
, ACPI_BITMASK_RT_CLOCK_ENABLE
},
184 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE
, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE
, ACPI_BITMASK_PCIEXP_WAKE_DISABLE
},
186 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL
, ACPI_BITPOSITION_SCI_ENABLE
, ACPI_BITMASK_SCI_ENABLE
},
187 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL
, ACPI_BITPOSITION_BUS_MASTER_RLD
, ACPI_BITMASK_BUS_MASTER_RLD
},
188 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL
, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE
, ACPI_BITMASK_GLOBAL_LOCK_RELEASE
},
189 /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL
, ACPI_BITPOSITION_SLEEP_TYPE
, ACPI_BITMASK_SLEEP_TYPE
},
190 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL
, ACPI_BITPOSITION_SLEEP_ENABLE
, ACPI_BITMASK_SLEEP_ENABLE
},
192 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL
, ACPI_BITPOSITION_ARB_DISABLE
, ACPI_BITMASK_ARB_DISABLE
}
196 ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo
[ACPI_NUM_FIXED_EVENTS
] =
198 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS
, ACPI_BITREG_TIMER_ENABLE
, ACPI_BITMASK_TIMER_STATUS
, ACPI_BITMASK_TIMER_ENABLE
},
199 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS
, ACPI_BITREG_GLOBAL_LOCK_ENABLE
, ACPI_BITMASK_GLOBAL_LOCK_STATUS
, ACPI_BITMASK_GLOBAL_LOCK_ENABLE
},
200 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS
, ACPI_BITREG_POWER_BUTTON_ENABLE
, ACPI_BITMASK_POWER_BUTTON_STATUS
, ACPI_BITMASK_POWER_BUTTON_ENABLE
},
201 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS
, ACPI_BITREG_SLEEP_BUTTON_ENABLE
, ACPI_BITMASK_SLEEP_BUTTON_STATUS
, ACPI_BITMASK_SLEEP_BUTTON_ENABLE
},
202 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS
, ACPI_BITREG_RT_CLOCK_ENABLE
, ACPI_BITMASK_RT_CLOCK_STATUS
, ACPI_BITMASK_RT_CLOCK_ENABLE
},
204 #endif /* !ACPI_REDUCED_HARDWARE */
207 /*******************************************************************************
209 * FUNCTION: AcpiUtInitGlobals
215 * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
216 * initialization should be initialized here. This allows for
219 ******************************************************************************/
229 ACPI_FUNCTION_TRACE (UtInitGlobals
);
232 /* Create all memory caches */
234 Status
= AcpiUtCreateCaches ();
235 if (ACPI_FAILURE (Status
))
237 return_ACPI_STATUS (Status
);
240 /* Address Range lists */
242 for (i
= 0; i
< ACPI_ADDRESS_RANGE_MAX
; i
++)
244 AcpiGbl_AddressRangeList
[i
] = NULL
;
247 /* Mutex locked flags */
249 for (i
= 0; i
< ACPI_NUM_MUTEX
; i
++)
251 AcpiGbl_MutexInfo
[i
].Mutex
= NULL
;
252 AcpiGbl_MutexInfo
[i
].ThreadId
= ACPI_MUTEX_NOT_ACQUIRED
;
253 AcpiGbl_MutexInfo
[i
].UseCount
= 0;
256 for (i
= 0; i
< ACPI_NUM_OWNERID_MASKS
; i
++)
258 AcpiGbl_OwnerIdMask
[i
] = 0;
261 /* Last OwnerID is never valid */
263 AcpiGbl_OwnerIdMask
[ACPI_NUM_OWNERID_MASKS
- 1] = 0x80000000;
271 for (i
= 0; i
< ACPI_NUM_FIXED_EVENTS
; i
++)
273 AcpiFixedEventCount
[i
] = 0;
276 #if (!ACPI_REDUCED_HARDWARE)
278 /* GPE/SCI support */
280 AcpiGbl_AllGpesInitialized
= FALSE
;
281 AcpiGbl_GpeXruptListHead
= NULL
;
282 AcpiGbl_GpeFadtBlocks
[0] = NULL
;
283 AcpiGbl_GpeFadtBlocks
[1] = NULL
;
284 AcpiCurrentGpeCount
= 0;
286 AcpiGbl_GlobalEventHandler
= NULL
;
287 AcpiGbl_SciHandlerList
= NULL
;
289 #endif /* !ACPI_REDUCED_HARDWARE */
291 /* Global handlers */
293 AcpiGbl_GlobalNotify
[0].Handler
= NULL
;
294 AcpiGbl_GlobalNotify
[1].Handler
= NULL
;
295 AcpiGbl_ExceptionHandler
= NULL
;
296 AcpiGbl_InitHandler
= NULL
;
297 AcpiGbl_TableHandler
= NULL
;
298 AcpiGbl_InterfaceHandler
= NULL
;
300 /* Global Lock support */
302 AcpiGbl_GlobalLockSemaphore
= NULL
;
303 AcpiGbl_GlobalLockMutex
= NULL
;
304 AcpiGbl_GlobalLockAcquired
= FALSE
;
305 AcpiGbl_GlobalLockHandle
= 0;
306 AcpiGbl_GlobalLockPresent
= FALSE
;
308 /* Miscellaneous variables */
311 AcpiGbl_CmSingleStep
= FALSE
;
312 AcpiGbl_DbTerminateThreads
= FALSE
;
313 AcpiGbl_Shutdown
= FALSE
;
314 AcpiGbl_NsLookupCount
= 0;
315 AcpiGbl_PsFindCount
= 0;
316 AcpiGbl_AcpiHardwarePresent
= TRUE
;
317 AcpiGbl_LastOwnerIdIndex
= 0;
318 AcpiGbl_NextOwnerIdOffset
= 0;
319 AcpiGbl_TraceMethodName
= 0;
320 AcpiGbl_TraceDbgLevel
= 0;
321 AcpiGbl_TraceDbgLayer
= 0;
322 AcpiGbl_DebuggerConfiguration
= DEBUGGER_THREADING
;
323 AcpiGbl_DbOutputFlags
= ACPI_DB_CONSOLE_OUTPUT
;
324 AcpiGbl_OsiMutex
= NULL
;
325 AcpiGbl_RegMethodsExecuted
= FALSE
;
327 /* Hardware oriented */
329 AcpiGbl_EventsInitialized
= FALSE
;
330 AcpiGbl_SystemAwakeAndRunning
= TRUE
;
334 AcpiGbl_ModuleCodeList
= NULL
;
335 AcpiGbl_RootNode
= NULL
;
336 AcpiGbl_RootNodeStruct
.Name
.Integer
= ACPI_ROOT_NAME
;
337 AcpiGbl_RootNodeStruct
.DescriptorType
= ACPI_DESC_TYPE_NAMED
;
338 AcpiGbl_RootNodeStruct
.Type
= ACPI_TYPE_DEVICE
;
339 AcpiGbl_RootNodeStruct
.Parent
= NULL
;
340 AcpiGbl_RootNodeStruct
.Child
= NULL
;
341 AcpiGbl_RootNodeStruct
.Peer
= NULL
;
342 AcpiGbl_RootNodeStruct
.Object
= NULL
;
345 #ifdef ACPI_DISASSEMBLER
346 AcpiGbl_ExternalList
= NULL
;
347 AcpiGbl_NumExternalMethods
= 0;
348 AcpiGbl_ResolvedExternalMethods
= 0;
351 #ifdef ACPI_DEBUG_OUTPUT
352 AcpiGbl_LowestStackPointer
= ACPI_CAST_PTR (ACPI_SIZE
, ACPI_SIZE_MAX
);
355 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
356 AcpiGbl_DisplayFinalMemStats
= FALSE
;
357 AcpiGbl_DisableMemTracking
= FALSE
;
360 return_ACPI_STATUS (AE_OK
);
365 ACPI_EXPORT_SYMBOL (AcpiGbl_FADT
)
366 ACPI_EXPORT_SYMBOL (AcpiDbgLevel
)
367 ACPI_EXPORT_SYMBOL (AcpiDbgLayer
)
368 ACPI_EXPORT_SYMBOL (AcpiGpeCount
)
369 ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount
)