aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-07-07 22:06:39 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-08 08:22:25 -0400
commite8c038a3c6227892e6c0982804b6f9d03fa4b3c5 (patch)
tree336859a993480881c05cd14d1820dec1814f479a
parentafbdc6aece93edb6c8f14722782696ef7c439231 (diff)
ACPICA: Utilities: Cleanup DEFINE_ACPI_GLOBALS by moving acpi_ut_init_global() from utglobal.c to utinit.c
The utglobal.c is used to define and initialize global variables. It makes sense if just adding utglobal.o to applications that are using such variables. But acpi_ut_init_globals() is preventing us from doing so as this initialization function references other components' initializations code, which leads to the requirement that many files should also get linked if one wants to link utglobal.o. It is possible to just move acpi_ut_init_global() to utinit.c for applications that require this function to link. By linking utglobal.o, we can stop defining DEFINE_ACPI_GLOBALS for applications (currently only acpidump is affected). Lv Zheng. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/utglobal.c146
-rw-r--r--drivers/acpi/acpica/utinit.c146
-rw-r--r--tools/power/acpi/Makefile1
-rw-r--r--tools/power/acpi/tools/acpidump/acpidump.h1
4 files changed, 147 insertions, 147 deletions
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index d69be3cb3fae..77ceac715f28 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -214,152 +214,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
214}; 214};
215#endif /* !ACPI_REDUCED_HARDWARE */ 215#endif /* !ACPI_REDUCED_HARDWARE */
216 216
217/*******************************************************************************
218 *
219 * FUNCTION: acpi_ut_init_globals
220 *
221 * PARAMETERS: None
222 *
223 * RETURN: Status
224 *
225 * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
226 * initialization should be initialized here. This allows for
227 * a warm restart.
228 *
229 ******************************************************************************/
230
231acpi_status acpi_ut_init_globals(void)
232{
233 acpi_status status;
234 u32 i;
235
236 ACPI_FUNCTION_TRACE(ut_init_globals);
237
238 /* Create all memory caches */
239
240 status = acpi_ut_create_caches();
241 if (ACPI_FAILURE(status)) {
242 return_ACPI_STATUS(status);
243 }
244
245 /* Address Range lists */
246
247 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
248 acpi_gbl_address_range_list[i] = NULL;
249 }
250
251 /* Mutex locked flags */
252
253 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
254 acpi_gbl_mutex_info[i].mutex = NULL;
255 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
256 acpi_gbl_mutex_info[i].use_count = 0;
257 }
258
259 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
260 acpi_gbl_owner_id_mask[i] = 0;
261 }
262
263 /* Last owner_ID is never valid */
264
265 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
266
267 /* Event counters */
268
269 acpi_method_count = 0;
270 acpi_sci_count = 0;
271 acpi_gpe_count = 0;
272
273 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
274 acpi_fixed_event_count[i] = 0;
275 }
276
277#if (!ACPI_REDUCED_HARDWARE)
278
279 /* GPE/SCI support */
280
281 acpi_gbl_all_gpes_initialized = FALSE;
282 acpi_gbl_gpe_xrupt_list_head = NULL;
283 acpi_gbl_gpe_fadt_blocks[0] = NULL;
284 acpi_gbl_gpe_fadt_blocks[1] = NULL;
285 acpi_current_gpe_count = 0;
286
287 acpi_gbl_global_event_handler = NULL;
288 acpi_gbl_sci_handler_list = NULL;
289
290#endif /* !ACPI_REDUCED_HARDWARE */
291
292 /* Global handlers */
293
294 acpi_gbl_global_notify[0].handler = NULL;
295 acpi_gbl_global_notify[1].handler = NULL;
296 acpi_gbl_exception_handler = NULL;
297 acpi_gbl_init_handler = NULL;
298 acpi_gbl_table_handler = NULL;
299 acpi_gbl_interface_handler = NULL;
300
301 /* Global Lock support */
302
303 acpi_gbl_global_lock_semaphore = NULL;
304 acpi_gbl_global_lock_mutex = NULL;
305 acpi_gbl_global_lock_acquired = FALSE;
306 acpi_gbl_global_lock_handle = 0;
307 acpi_gbl_global_lock_present = FALSE;
308
309 /* Miscellaneous variables */
310
311 acpi_gbl_DSDT = NULL;
312 acpi_gbl_cm_single_step = FALSE;
313 acpi_gbl_shutdown = FALSE;
314 acpi_gbl_ns_lookup_count = 0;
315 acpi_gbl_ps_find_count = 0;
316 acpi_gbl_acpi_hardware_present = TRUE;
317 acpi_gbl_last_owner_id_index = 0;
318 acpi_gbl_next_owner_id_offset = 0;
319 acpi_gbl_trace_dbg_level = 0;
320 acpi_gbl_trace_dbg_layer = 0;
321 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
322 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
323 acpi_gbl_osi_mutex = NULL;
324 acpi_gbl_reg_methods_executed = FALSE;
325
326 /* Hardware oriented */
327
328 acpi_gbl_events_initialized = FALSE;
329 acpi_gbl_system_awake_and_running = TRUE;
330
331 /* Namespace */
332
333 acpi_gbl_module_code_list = NULL;
334 acpi_gbl_root_node = NULL;
335 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
336 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
337 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
338 acpi_gbl_root_node_struct.parent = NULL;
339 acpi_gbl_root_node_struct.child = NULL;
340 acpi_gbl_root_node_struct.peer = NULL;
341 acpi_gbl_root_node_struct.object = NULL;
342
343#ifdef ACPI_DISASSEMBLER
344 acpi_gbl_external_list = NULL;
345 acpi_gbl_num_external_methods = 0;
346 acpi_gbl_resolved_external_methods = 0;
347#endif
348
349#ifdef ACPI_DEBUG_OUTPUT
350 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
351#endif
352
353#ifdef ACPI_DBG_TRACK_ALLOCATIONS
354 acpi_gbl_display_final_mem_stats = FALSE;
355 acpi_gbl_disable_mem_tracking = FALSE;
356#endif
357
358 ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = FALSE);
359
360 return_ACPI_STATUS(AE_OK);
361}
362
363/* Public globals */ 217/* Public globals */
364 218
365ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) 219ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index 5f56fc49021e..a7936623998f 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -102,6 +102,152 @@ static void acpi_ut_free_gpe_lists(void)
102} 102}
103#endif /* !ACPI_REDUCED_HARDWARE */ 103#endif /* !ACPI_REDUCED_HARDWARE */
104 104
105/*******************************************************************************
106 *
107 * FUNCTION: acpi_ut_init_globals
108 *
109 * PARAMETERS: None
110 *
111 * RETURN: Status
112 *
113 * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
114 * initialization should be initialized here. This allows for
115 * a warm restart.
116 *
117 ******************************************************************************/
118
119acpi_status acpi_ut_init_globals(void)
120{
121 acpi_status status;
122 u32 i;
123
124 ACPI_FUNCTION_TRACE(ut_init_globals);
125
126 /* Create all memory caches */
127
128 status = acpi_ut_create_caches();
129 if (ACPI_FAILURE(status)) {
130 return_ACPI_STATUS(status);
131 }
132
133 /* Address Range lists */
134
135 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
136 acpi_gbl_address_range_list[i] = NULL;
137 }
138
139 /* Mutex locked flags */
140
141 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
142 acpi_gbl_mutex_info[i].mutex = NULL;
143 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
144 acpi_gbl_mutex_info[i].use_count = 0;
145 }
146
147 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
148 acpi_gbl_owner_id_mask[i] = 0;
149 }
150
151 /* Last owner_ID is never valid */
152
153 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
154
155 /* Event counters */
156
157 acpi_method_count = 0;
158 acpi_sci_count = 0;
159 acpi_gpe_count = 0;
160
161 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
162 acpi_fixed_event_count[i] = 0;
163 }
164
165#if (!ACPI_REDUCED_HARDWARE)
166
167 /* GPE/SCI support */
168
169 acpi_gbl_all_gpes_initialized = FALSE;
170 acpi_gbl_gpe_xrupt_list_head = NULL;
171 acpi_gbl_gpe_fadt_blocks[0] = NULL;
172 acpi_gbl_gpe_fadt_blocks[1] = NULL;
173 acpi_current_gpe_count = 0;
174
175 acpi_gbl_global_event_handler = NULL;
176 acpi_gbl_sci_handler_list = NULL;
177
178#endif /* !ACPI_REDUCED_HARDWARE */
179
180 /* Global handlers */
181
182 acpi_gbl_global_notify[0].handler = NULL;
183 acpi_gbl_global_notify[1].handler = NULL;
184 acpi_gbl_exception_handler = NULL;
185 acpi_gbl_init_handler = NULL;
186 acpi_gbl_table_handler = NULL;
187 acpi_gbl_interface_handler = NULL;
188
189 /* Global Lock support */
190
191 acpi_gbl_global_lock_semaphore = NULL;
192 acpi_gbl_global_lock_mutex = NULL;
193 acpi_gbl_global_lock_acquired = FALSE;
194 acpi_gbl_global_lock_handle = 0;
195 acpi_gbl_global_lock_present = FALSE;
196
197 /* Miscellaneous variables */
198
199 acpi_gbl_DSDT = NULL;
200 acpi_gbl_cm_single_step = FALSE;
201 acpi_gbl_shutdown = FALSE;
202 acpi_gbl_ns_lookup_count = 0;
203 acpi_gbl_ps_find_count = 0;
204 acpi_gbl_acpi_hardware_present = TRUE;
205 acpi_gbl_last_owner_id_index = 0;
206 acpi_gbl_next_owner_id_offset = 0;
207 acpi_gbl_trace_dbg_level = 0;
208 acpi_gbl_trace_dbg_layer = 0;
209 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
210 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
211 acpi_gbl_osi_mutex = NULL;
212 acpi_gbl_reg_methods_executed = FALSE;
213
214 /* Hardware oriented */
215
216 acpi_gbl_events_initialized = FALSE;
217 acpi_gbl_system_awake_and_running = TRUE;
218
219 /* Namespace */
220
221 acpi_gbl_module_code_list = NULL;
222 acpi_gbl_root_node = NULL;
223 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
224 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
225 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
226 acpi_gbl_root_node_struct.parent = NULL;
227 acpi_gbl_root_node_struct.child = NULL;
228 acpi_gbl_root_node_struct.peer = NULL;
229 acpi_gbl_root_node_struct.object = NULL;
230
231#ifdef ACPI_DISASSEMBLER
232 acpi_gbl_external_list = NULL;
233 acpi_gbl_num_external_methods = 0;
234 acpi_gbl_resolved_external_methods = 0;
235#endif
236
237#ifdef ACPI_DEBUG_OUTPUT
238 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
239#endif
240
241#ifdef ACPI_DBG_TRACK_ALLOCATIONS
242 acpi_gbl_display_final_mem_stats = FALSE;
243 acpi_gbl_disable_mem_tracking = FALSE;
244#endif
245
246 ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = FALSE);
247
248 return_ACPI_STATUS(AE_OK);
249}
250
105/****************************************************************************** 251/******************************************************************************
106 * 252 *
107 * FUNCTION: acpi_ut_terminate 253 * FUNCTION: acpi_ut_terminate
diff --git a/tools/power/acpi/Makefile b/tools/power/acpi/Makefile
index e5a3c4be2a10..61446dbf70a6 100644
--- a/tools/power/acpi/Makefile
+++ b/tools/power/acpi/Makefile
@@ -112,6 +112,7 @@ DUMP_OBJS = \
112 tbxfroot.o\ 112 tbxfroot.o\
113 utbuffer.o\ 113 utbuffer.o\
114 utexcep.o\ 114 utexcep.o\
115 utglobal.o\
115 utmath.o\ 116 utmath.o\
116 utstring.o\ 117 utstring.o\
117 utxferror.o\ 118 utxferror.o\
diff --git a/tools/power/acpi/tools/acpidump/acpidump.h b/tools/power/acpi/tools/acpidump/acpidump.h
index 46f519597fe5..8efc84824308 100644
--- a/tools/power/acpi/tools/acpidump/acpidump.h
+++ b/tools/power/acpi/tools/acpidump/acpidump.h
@@ -47,7 +47,6 @@
47#ifdef _DECLARE_GLOBALS 47#ifdef _DECLARE_GLOBALS
48#define EXTERN 48#define EXTERN
49#define INIT_GLOBAL(a,b) a=b 49#define INIT_GLOBAL(a,b) a=b
50#define DEFINE_ACPI_GLOBALS 1
51#else 50#else
52#define EXTERN extern 51#define EXTERN extern
53#define INIT_GLOBAL(a,b) a 52#define INIT_GLOBAL(a,b) a