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