:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / drivers / bus / acpi / include / acglobal.h
1 /******************************************************************************
2  *
3  * Name: acglobal.h - Declarations for global variables
4  *       $Revision$
5  *
6  *****************************************************************************/
7
8 /*
9  *  Copyright (C) 2000, 2001 R. Byron Moore
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26 #ifndef __ACGLOBAL_H__
27 #define __ACGLOBAL_H__
28
29
30 /*
31  * Ensure that the globals are actually defined only once.
32  *
33  * The use of these defines allows a single list of globals (here) in order
34  * to simplify maintenance of the code.
35  */
36 #ifdef DEFINE_ACPI_GLOBALS
37 #define ACPI_EXTERN
38 #else
39 #define ACPI_EXTERN extern
40 #endif
41
42
43 extern      NATIVE_CHAR                 *msg_acpi_error_break;
44
45 /*****************************************************************************
46  *
47  * Debug support
48  *
49  ****************************************************************************/
50
51 /* Runtime configuration of debug print levels */
52
53 extern      u32                         acpi_dbg_level;
54 extern      u32                         acpi_dbg_layer;
55
56
57 /* Procedure nesting level for debug output */
58
59 extern      u32                         acpi_gbl_nesting_level;
60
61
62 /*****************************************************************************
63  *
64  * ACPI Table globals
65  *
66  ****************************************************************************/
67
68 /*
69  * Table pointers.
70  * Although these pointers are somewhat redundant with the global Acpi_table,
71  * they are convenient because they are typed pointers.
72  *
73  * These tables are single-table only; meaning that there can be at most one
74  * of each in the system.  Each global points to the actual table.
75  *
76  */
77 ACPI_EXTERN RSDP_DESCRIPTOR             *acpi_gbl_RSDP;
78 ACPI_EXTERN XSDT_DESCRIPTOR             *acpi_gbl_XSDT;
79 ACPI_EXTERN FADT_DESCRIPTOR             *acpi_gbl_FADT;
80 ACPI_EXTERN ACPI_TABLE_HEADER           *acpi_gbl_DSDT;
81 ACPI_EXTERN ACPI_COMMON_FACS            *acpi_gbl_FACS;
82
83 /*
84  * Since there may be multiple SSDTs and PSDTS, a single pointer is not
85  * sufficient; Therefore, there isn't one!
86  */
87
88
89 /*
90  * ACPI Table info arrays
91  */
92 extern      ACPI_TABLE_DESC             acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
93 extern      ACPI_TABLE_SUPPORT          acpi_gbl_acpi_table_data[NUM_ACPI_TABLES];
94
95 /*
96  * Predefined mutex objects.  This array contains the
97  * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
98  * (The table maps local handles to the real OS handles)
99  */
100 ACPI_EXTERN ACPI_MUTEX_INFO             acpi_gbl_acpi_mutex_info [NUM_MTX];
101
102
103 /*****************************************************************************
104  *
105  * Miscellaneous globals
106  *
107  ****************************************************************************/
108
109
110 ACPI_EXTERN u8                         *acpi_gbl_gpe0enable_register_save;
111 ACPI_EXTERN u8                         *acpi_gbl_gpe1_enable_register_save;
112 ACPI_EXTERN ACPI_WALK_STATE            *acpi_gbl_breakpoint_walk;
113 ACPI_EXTERN ACPI_GENERIC_STATE         *acpi_gbl_generic_state_cache;
114 ACPI_EXTERN ACPI_PARSE_OBJECT          *acpi_gbl_parse_cache;
115 ACPI_EXTERN ACPI_PARSE2_OBJECT         *acpi_gbl_ext_parse_cache;
116 ACPI_EXTERN ACPI_OPERAND_OBJECT        *acpi_gbl_object_cache;
117 ACPI_EXTERN ACPI_WALK_STATE            *acpi_gbl_walk_state_cache;
118 ACPI_EXTERN ACPI_HANDLE                 acpi_gbl_global_lock_semaphore;
119
120
121 ACPI_EXTERN u32                         acpi_gbl_global_lock_thread_count;
122 ACPI_EXTERN u32                         acpi_gbl_restore_acpi_chipset;
123 ACPI_EXTERN u32                         acpi_gbl_original_mode;
124 ACPI_EXTERN u32                         acpi_gbl_edge_level_save;
125 ACPI_EXTERN u32                         acpi_gbl_irq_enable_save;
126 ACPI_EXTERN u32                         acpi_gbl_rsdp_original_location;
127
128 ACPI_EXTERN u32                         acpi_gbl_state_cache_requests;
129 ACPI_EXTERN u32                         acpi_gbl_state_cache_hits;
130 ACPI_EXTERN u32                         acpi_gbl_parse_cache_requests;
131 ACPI_EXTERN u32                         acpi_gbl_parse_cache_hits;
132 ACPI_EXTERN u32                         acpi_gbl_ext_parse_cache_requests;
133 ACPI_EXTERN u32                         acpi_gbl_ext_parse_cache_hits;
134 ACPI_EXTERN u32                         acpi_gbl_object_cache_requests;
135 ACPI_EXTERN u32                         acpi_gbl_object_cache_hits;
136 ACPI_EXTERN u32                         acpi_gbl_walk_state_cache_requests;
137 ACPI_EXTERN u32                         acpi_gbl_walk_state_cache_hits;
138 ACPI_EXTERN u32                         acpi_gbl_ns_lookup_count;
139 ACPI_EXTERN u32                         acpi_gbl_ps_find_count;
140
141
142 ACPI_EXTERN u16                         acpi_gbl_generic_state_cache_depth;
143 ACPI_EXTERN u16                         acpi_gbl_parse_cache_depth;
144 ACPI_EXTERN u16                         acpi_gbl_ext_parse_cache_depth;
145 ACPI_EXTERN u16                         acpi_gbl_object_cache_depth;
146 ACPI_EXTERN u16                         acpi_gbl_walk_state_cache_depth;
147 ACPI_EXTERN u16                         acpi_gbl_pm1_enable_register_save;
148 ACPI_EXTERN u16                         acpi_gbl_next_table_owner_id;
149 ACPI_EXTERN u16                         acpi_gbl_next_method_owner_id;
150
151 ACPI_EXTERN u8                          acpi_gbl_debugger_configuration;
152 ACPI_EXTERN u8                          acpi_gbl_global_lock_acquired;
153 ACPI_EXTERN u8                          acpi_gbl_step_to_next_call;
154 ACPI_EXTERN u8                          acpi_gbl_acpi_hardware_present;
155 ACPI_EXTERN u8                          acpi_gbl_global_lock_present;
156
157 ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER  acpi_gbl_drv_notify;
158 ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER  acpi_gbl_sys_notify;
159
160
161 extern u8                               acpi_gbl_shutdown;
162 extern u32                              acpi_gbl_system_flags;
163 extern u32                              acpi_gbl_startup_flags;
164 extern u8                               acpi_gbl_decode_to8bit[8];
165 extern NATIVE_CHAR                      acpi_gbl_hex_to_ascii[16];
166
167
168 /*****************************************************************************
169  *
170  * Namespace globals
171  *
172  ****************************************************************************/
173
174 #define NUM_NS_TYPES                    INTERNAL_TYPE_INVALID+1
175 #define NUM_PREDEFINED_NAMES            9
176
177
178 ACPI_EXTERN ACPI_NAMESPACE_NODE         acpi_gbl_root_node_struct;
179 ACPI_EXTERN ACPI_NAMESPACE_NODE        *acpi_gbl_root_node;
180
181 extern u8                               acpi_gbl_ns_properties[NUM_NS_TYPES];
182 extern PREDEFINED_NAMES                 acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
183
184
185 /* Used to detect memory leaks (DEBUG ONLY) */
186
187 #ifdef ACPI_DEBUG
188 ACPI_EXTERN ALLOCATION_INFO            *acpi_gbl_head_alloc_ptr;
189 ACPI_EXTERN ALLOCATION_INFO            *acpi_gbl_tail_alloc_ptr;
190 #endif
191
192
193 /*****************************************************************************
194  *
195  * Interpreter globals
196  *
197  ****************************************************************************/
198
199
200 ACPI_EXTERN ACPI_WALK_LIST             *acpi_gbl_current_walk_list;
201
202 /*
203  * Handle to the last method found - used during pass1 of load
204  */
205 ACPI_EXTERN ACPI_HANDLE                 acpi_gbl_last_method;
206
207 /*
208  * Table of Address Space handlers
209  */
210
211 ACPI_EXTERN ACPI_ADDRESS_SPACE_INFO     acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES];
212
213
214 /* Control method single step flag */
215
216 ACPI_EXTERN u8                          acpi_gbl_cm_single_step;
217
218
219 /*****************************************************************************
220  *
221  * Parser globals
222  *
223  ****************************************************************************/
224
225 ACPI_EXTERN ACPI_PARSE_OBJECT           *acpi_gbl_parsed_namespace_root;
226
227 /*****************************************************************************
228  *
229  * Hardware globals
230  *
231  ****************************************************************************/
232
233 extern ACPI_C_STATE_HANDLER             acpi_hw_cx_handlers[MAX_CX_STATES];
234 extern u32                              acpi_hw_active_cx_state;
235
236
237 /*****************************************************************************
238  *
239  * Event globals
240  *
241  ****************************************************************************/
242
243 ACPI_EXTERN ACPI_FIXED_EVENT_INFO       acpi_gbl_fixed_event_handlers[NUM_FIXED_EVENTS];
244
245 ACPI_EXTERN ACPI_HANDLE                 acpi_gbl_gpe_obj_handle;
246 ACPI_EXTERN u32                         acpi_gbl_gpe_register_count;
247 ACPI_EXTERN ACPI_GPE_REGISTERS          *acpi_gbl_gpe_registers;
248 ACPI_EXTERN ACPI_GPE_LEVEL_INFO         *acpi_gbl_gpe_info;
249
250 /*
251  * Gpe validation and translation table
252  * Indexed by the GPE number, returns GPE_INVALID if the GPE is not supported.
253  * Otherwise, returns a valid index into the global GPE table.
254  *
255  * This table is needed because the GPE numbers supported by block 1 do not
256  * have to be contiguous with the GPE numbers supported by block 0.
257  */
258 ACPI_EXTERN u8                          acpi_gbl_gpe_valid [NUM_GPE];
259
260 /* Acpi_event counter for debug only */
261
262 #ifdef ACPI_DEBUG
263 ACPI_EXTERN u32                         acpi_gbl_event_count[NUM_FIXED_EVENTS];
264 #endif
265
266
267 /*****************************************************************************
268  *
269  * Debugger globals
270  *
271  ****************************************************************************/
272
273 #ifdef ENABLE_DEBUGGER
274 ACPI_EXTERN u8                          acpi_gbl_method_executing;
275 ACPI_EXTERN u8                          acpi_gbl_db_terminate_threads;
276 #endif
277
278 /* Memory allocation metrics - Debug Only! */
279
280 #ifdef ACPI_DEBUG
281
282 ACPI_EXTERN u32                         acpi_gbl_current_alloc_size;
283 ACPI_EXTERN u32                         acpi_gbl_current_alloc_count;
284 ACPI_EXTERN u32                         acpi_gbl_running_alloc_size;
285 ACPI_EXTERN u32                         acpi_gbl_running_alloc_count;
286 ACPI_EXTERN u32                         acpi_gbl_max_concurrent_alloc_size;
287 ACPI_EXTERN u32                         acpi_gbl_max_concurrent_alloc_count;
288 ACPI_EXTERN u32                         acpi_gbl_current_object_count;
289 ACPI_EXTERN u32                         acpi_gbl_current_object_size;
290 ACPI_EXTERN u32                         acpi_gbl_max_concurrent_object_count;
291 ACPI_EXTERN u32                         acpi_gbl_max_concurrent_object_size;
292 ACPI_EXTERN u32                         acpi_gbl_running_object_count;
293 ACPI_EXTERN u32                         acpi_gbl_running_object_size;
294 ACPI_EXTERN u32                         acpi_gbl_current_node_count;
295 ACPI_EXTERN u32                         acpi_gbl_current_node_size;
296 ACPI_EXTERN u32                         acpi_gbl_max_concurrent_node_count;
297
298 #endif
299
300
301 #endif /* __ACGLOBAL_H__ */