xref: /freebsd/sys/contrib/dev/acpica/include/acglobal.h (revision 98e0ffaefb0f241cda3a72395d3be04192ae0d47)
1 /******************************************************************************
2  *
3  * Name: acglobal.h - Declarations for global variables
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2015, 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  *
50  * Globals related to the ACPI tables
51  *
52  ****************************************************************************/
53 
54 /* Master list of all ACPI tables that were found in the RSDT/XSDT */
55 
56 ACPI_GLOBAL (ACPI_TABLE_LIST,           AcpiGbl_RootTableList);
57 
58 /* DSDT information. Used to check for DSDT corruption */
59 
60 ACPI_GLOBAL (ACPI_TABLE_HEADER *,       AcpiGbl_DSDT);
61 ACPI_GLOBAL (ACPI_TABLE_HEADER,         AcpiGbl_OriginalDsdtHeader);
62 
63 #if (!ACPI_REDUCED_HARDWARE)
64 ACPI_GLOBAL (ACPI_TABLE_FACS *,         AcpiGbl_FACS);
65 
66 #endif /* !ACPI_REDUCED_HARDWARE */
67 
68 /* These addresses are calculated from the FADT Event Block addresses */
69 
70 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS,      AcpiGbl_XPm1aStatus);
71 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS,      AcpiGbl_XPm1aEnable);
72 
73 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS,      AcpiGbl_XPm1bStatus);
74 ACPI_GLOBAL (ACPI_GENERIC_ADDRESS,      AcpiGbl_XPm1bEnable);
75 
76 /*
77  * Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is
78  * determined by the revision of the DSDT: If the DSDT revision is less than
79  * 2, use only the lower 32 bits of the internal 64-bit Integer.
80  */
81 ACPI_GLOBAL (UINT8,                     AcpiGbl_IntegerBitWidth);
82 ACPI_GLOBAL (UINT8,                     AcpiGbl_IntegerByteWidth);
83 ACPI_GLOBAL (UINT8,                     AcpiGbl_IntegerNybbleWidth);
84 
85 
86 /*****************************************************************************
87  *
88  * Mutual exclusion within ACPICA subsystem
89  *
90  ****************************************************************************/
91 
92 /*
93  * Predefined mutex objects. This array contains the
94  * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
95  * (The table maps local handles to the real OS handles)
96  */
97 ACPI_GLOBAL (ACPI_MUTEX_INFO,           AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]);
98 
99 /*
100  * Global lock mutex is an actual AML mutex object
101  * Global lock semaphore works in conjunction with the actual global lock
102  * Global lock spinlock is used for "pending" handshake
103  */
104 ACPI_GLOBAL (ACPI_OPERAND_OBJECT *,     AcpiGbl_GlobalLockMutex);
105 ACPI_GLOBAL (ACPI_SEMAPHORE,            AcpiGbl_GlobalLockSemaphore);
106 ACPI_GLOBAL (ACPI_SPINLOCK,             AcpiGbl_GlobalLockPendingLock);
107 ACPI_GLOBAL (UINT16,                    AcpiGbl_GlobalLockHandle);
108 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_GlobalLockAcquired);
109 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_GlobalLockPresent);
110 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_GlobalLockPending);
111 
112 /*
113  * Spinlocks are used for interfaces that can be possibly called at
114  * interrupt level
115  */
116 ACPI_GLOBAL (ACPI_SPINLOCK,             AcpiGbl_GpeLock);       /* For GPE data structs and registers */
117 ACPI_GLOBAL (ACPI_SPINLOCK,             AcpiGbl_HardwareLock);  /* For ACPI H/W except GPE registers */
118 ACPI_GLOBAL (ACPI_SPINLOCK,             AcpiGbl_ReferenceCountLock);
119 
120 /* Mutex for _OSI support */
121 
122 ACPI_GLOBAL (ACPI_MUTEX,                AcpiGbl_OsiMutex);
123 
124 /* Reader/Writer lock is used for namespace walk and dynamic table unload */
125 
126 ACPI_GLOBAL (ACPI_RW_LOCK,              AcpiGbl_NamespaceRwLock);
127 
128 
129 /*****************************************************************************
130  *
131  * Miscellaneous globals
132  *
133  ****************************************************************************/
134 
135 /* Object caches */
136 
137 ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_NamespaceCache);
138 ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_StateCache);
139 ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_PsNodeCache);
140 ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_PsNodeExtCache);
141 ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_OperandCache);
142 
143 /* System */
144 
145 ACPI_INIT_GLOBAL (UINT32,               AcpiGbl_StartupFlags, 0);
146 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_Shutdown, TRUE);
147 
148 /* Global handlers */
149 
150 ACPI_GLOBAL (ACPI_GLOBAL_NOTIFY_HANDLER,AcpiGbl_GlobalNotify[2]);
151 ACPI_GLOBAL (ACPI_EXCEPTION_HANDLER,    AcpiGbl_ExceptionHandler);
152 ACPI_GLOBAL (ACPI_INIT_HANDLER,         AcpiGbl_InitHandler);
153 ACPI_GLOBAL (ACPI_TABLE_HANDLER,        AcpiGbl_TableHandler);
154 ACPI_GLOBAL (void *,                    AcpiGbl_TableHandlerContext);
155 ACPI_GLOBAL (ACPI_INTERFACE_HANDLER,    AcpiGbl_InterfaceHandler);
156 ACPI_GLOBAL (ACPI_SCI_HANDLER_INFO *,   AcpiGbl_SciHandlerList);
157 
158 /* Owner ID support */
159 
160 ACPI_GLOBAL (UINT32,                    AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]);
161 ACPI_GLOBAL (UINT8,                     AcpiGbl_LastOwnerIdIndex);
162 ACPI_GLOBAL (UINT8,                     AcpiGbl_NextOwnerIdOffset);
163 
164 /* Initialization sequencing */
165 
166 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_RegMethodsExecuted);
167 
168 /* Misc */
169 
170 ACPI_GLOBAL (UINT32,                    AcpiGbl_OriginalMode);
171 ACPI_GLOBAL (UINT32,                    AcpiGbl_NsLookupCount);
172 ACPI_GLOBAL (UINT32,                    AcpiGbl_PsFindCount);
173 ACPI_GLOBAL (UINT16,                    AcpiGbl_Pm1EnableRegisterSave);
174 ACPI_GLOBAL (UINT8,                     AcpiGbl_DebuggerConfiguration);
175 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_StepToNextCall);
176 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_AcpiHardwarePresent);
177 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_EventsInitialized);
178 ACPI_GLOBAL (ACPI_INTERFACE_INFO *,     AcpiGbl_SupportedInterfaces);
179 ACPI_GLOBAL (ACPI_ADDRESS_RANGE *,      AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX]);
180 
181 /* Other miscellaneous, declared and initialized in utglobal */
182 
183 extern const char                      *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT];
184 extern const char                      *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS];
185 extern const char                      *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS];
186 extern const char                      *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
187 extern const ACPI_OPCODE_INFO           AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
188 
189 
190 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
191 
192 /* Lists for tracking memory allocations (debug only) */
193 
194 ACPI_GLOBAL (ACPI_MEMORY_LIST *,        AcpiGbl_GlobalList);
195 ACPI_GLOBAL (ACPI_MEMORY_LIST *,        AcpiGbl_NsNodeList);
196 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DisplayFinalMemStats);
197 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DisableMemTracking);
198 #endif
199 
200 
201 /*****************************************************************************
202  *
203  * Namespace globals
204  *
205  ****************************************************************************/
206 
207 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
208 #define NUM_PREDEFINED_NAMES            10
209 #else
210 #define NUM_PREDEFINED_NAMES            9
211 #endif
212 
213 ACPI_GLOBAL (ACPI_NAMESPACE_NODE,       AcpiGbl_RootNodeStruct);
214 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_RootNode);
215 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_FadtGpeDevice);
216 ACPI_GLOBAL (ACPI_OPERAND_OBJECT *,     AcpiGbl_ModuleCodeList);
217 
218 
219 extern const UINT8                      AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES];
220 extern const ACPI_PREDEFINED_NAMES      AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
221 
222 #ifdef ACPI_DEBUG_OUTPUT
223 ACPI_GLOBAL (UINT32,                    AcpiGbl_CurrentNodeCount);
224 ACPI_GLOBAL (UINT32,                    AcpiGbl_CurrentNodeSize);
225 ACPI_GLOBAL (UINT32,                    AcpiGbl_MaxConcurrentNodeCount);
226 ACPI_GLOBAL (ACPI_SIZE *,               AcpiGbl_EntryStackPointer);
227 ACPI_GLOBAL (ACPI_SIZE *,               AcpiGbl_LowestStackPointer);
228 ACPI_GLOBAL (UINT32,                    AcpiGbl_DeepestNesting);
229 ACPI_INIT_GLOBAL (UINT32,               AcpiGbl_NestingLevel, 0);
230 #endif
231 
232 
233 /*****************************************************************************
234  *
235  * Interpreter globals
236  *
237  ****************************************************************************/
238 
239 ACPI_GLOBAL (ACPI_THREAD_STATE *,       AcpiGbl_CurrentWalkList);
240 
241 /* Control method single step flag */
242 
243 ACPI_GLOBAL (UINT8,                     AcpiGbl_CmSingleStep);
244 
245 
246 /*****************************************************************************
247  *
248  * Hardware globals
249  *
250  ****************************************************************************/
251 
252 extern ACPI_BIT_REGISTER_INFO           AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG];
253 
254 ACPI_GLOBAL (UINT8,                     AcpiGbl_SleepTypeA);
255 ACPI_GLOBAL (UINT8,                     AcpiGbl_SleepTypeB);
256 
257 
258 /*****************************************************************************
259  *
260  * Event and GPE globals
261  *
262  ****************************************************************************/
263 
264 #if (!ACPI_REDUCED_HARDWARE)
265 
266 ACPI_GLOBAL (UINT8,                     AcpiGbl_AllGpesInitialized);
267 ACPI_GLOBAL (ACPI_GPE_XRUPT_INFO *,     AcpiGbl_GpeXruptListHead);
268 ACPI_GLOBAL (ACPI_GPE_BLOCK_INFO *,     AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]);
269 ACPI_GLOBAL (ACPI_GBL_EVENT_HANDLER,    AcpiGbl_GlobalEventHandler);
270 ACPI_GLOBAL (void *,                    AcpiGbl_GlobalEventHandlerContext);
271 ACPI_GLOBAL (ACPI_FIXED_EVENT_HANDLER,  AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]);
272 
273 extern ACPI_FIXED_EVENT_INFO            AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS];
274 
275 #endif /* !ACPI_REDUCED_HARDWARE */
276 
277 /*****************************************************************************
278  *
279  * Debug support
280  *
281  ****************************************************************************/
282 
283 /* Event counters */
284 
285 ACPI_GLOBAL (UINT32,                    AcpiMethodCount);
286 ACPI_GLOBAL (UINT32,                    AcpiGpeCount);
287 ACPI_GLOBAL (UINT32,                    AcpiSciCount);
288 ACPI_GLOBAL (UINT32,                    AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]);
289 
290 /* Support for dynamic control method tracing mechanism */
291 
292 ACPI_GLOBAL (UINT32,                    AcpiGbl_OriginalDbgLevel);
293 ACPI_GLOBAL (UINT32,                    AcpiGbl_OriginalDbgLayer);
294 ACPI_GLOBAL (UINT32,                    AcpiGbl_TraceDbgLevel);
295 ACPI_GLOBAL (UINT32,                    AcpiGbl_TraceDbgLayer);
296 
297 
298 /*****************************************************************************
299  *
300  * Debugger and Disassembler globals
301  *
302  ****************************************************************************/
303 
304 ACPI_INIT_GLOBAL (UINT8,                AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT);
305 
306 #ifdef ACPI_DISASSEMBLER
307 
308 /* Do not disassemble buffers to resource descriptors */
309 
310 ACPI_INIT_GLOBAL (UINT8,                AcpiGbl_NoResourceDisassembly, FALSE);
311 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_IgnoreNoopOperator, FALSE);
312 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_CstyleDisassembly, TRUE);
313 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_ForceAmlDisassembly, FALSE);
314 
315 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_Disasm);
316 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_Verbose);
317 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_NumExternalMethods);
318 ACPI_GLOBAL (UINT32,                    AcpiGbl_ResolvedExternalMethods);
319 ACPI_GLOBAL (ACPI_EXTERNAL_LIST *,      AcpiGbl_ExternalList);
320 ACPI_GLOBAL (ACPI_EXTERNAL_FILE *,      AcpiGbl_ExternalFileList);
321 #endif
322 
323 #ifdef ACPI_DEBUGGER
324 
325 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_DbTerminateThreads, FALSE);
326 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_AbortMethod, FALSE);
327 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_MethodExecuting, FALSE);
328 
329 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_NoIniMethods);
330 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_NoRegionSupport);
331 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOutputToFile);
332 ACPI_GLOBAL (char *,                    AcpiGbl_DbBuffer);
333 ACPI_GLOBAL (char *,                    AcpiGbl_DbFilename);
334 ACPI_GLOBAL (UINT32,                    AcpiGbl_DbDebugLevel);
335 ACPI_GLOBAL (UINT32,                    AcpiGbl_DbConsoleDebugLevel);
336 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_DbScopeNode);
337 
338 ACPI_GLOBAL (char *,                    AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]);
339 ACPI_GLOBAL (ACPI_OBJECT_TYPE,          AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]);
340 
341 /* These buffers should all be the same size */
342 
343 ACPI_GLOBAL (char,                      AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]);
344 ACPI_GLOBAL (char,                      AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]);
345 ACPI_GLOBAL (char,                      AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]);
346 ACPI_GLOBAL (char,                      AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]);
347 
348 /*
349  * Statistic globals
350  */
351 ACPI_GLOBAL (UINT16,                    AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]);
352 ACPI_GLOBAL (UINT16,                    AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]);
353 ACPI_GLOBAL (UINT16,                    AcpiGbl_ObjTypeCountMisc);
354 ACPI_GLOBAL (UINT16,                    AcpiGbl_NodeTypeCountMisc);
355 ACPI_GLOBAL (UINT32,                    AcpiGbl_NumNodes);
356 ACPI_GLOBAL (UINT32,                    AcpiGbl_NumObjects);
357 
358 #endif /* ACPI_DEBUGGER */
359 
360 
361 /*****************************************************************************
362  *
363  * Application globals
364  *
365  ****************************************************************************/
366 
367 #ifdef ACPI_APPLICATION
368 
369 ACPI_INIT_GLOBAL (ACPI_FILE,            AcpiGbl_DebugFile, NULL);
370 ACPI_INIT_GLOBAL (ACPI_FILE,            AcpiGbl_OutputFile, NULL);
371 
372 /* Print buffer */
373 
374 ACPI_GLOBAL (ACPI_SPINLOCK,             AcpiGbl_PrintLock);     /* For print buffer */
375 ACPI_GLOBAL (char,                      AcpiGbl_PrintBuffer[1024]);
376 
377 #endif /* ACPI_APPLICATION */
378 
379 
380 /*****************************************************************************
381  *
382  * Info/help support
383  *
384  ****************************************************************************/
385 
386 extern const AH_PREDEFINED_NAME         AslPredefinedInfo[];
387 extern const AH_DEVICE_ID               AslDeviceIds[];
388 
389 
390 #endif /* __ACGLOBAL_H__ */
391