]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPICA: Utilities: Cleanup DEFINE_ACPI_GLOBALS by moving acpi_ut_init_global() from...
authorLv Zheng <lv.zheng@intel.com>
Tue, 8 Jul 2014 02:06:39 +0000 (10:06 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 8 Jul 2014 12:22:25 +0000 (14:22 +0200)
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>
drivers/acpi/acpica/utglobal.c
drivers/acpi/acpica/utinit.c
tools/power/acpi/Makefile
tools/power/acpi/tools/acpidump/acpidump.h

index d69be3cb3faebca6e981617b506a4dfdfcd18d7b..77ceac715f28bd40f1f3ad8f4ff8152f53fbf3f0 100644 (file)
@@ -214,152 +214,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
 };
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_init_globals
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
- *              initialization should be initialized here. This allows for
- *              a warm restart.
- *
- ******************************************************************************/
-
-acpi_status acpi_ut_init_globals(void)
-{
-       acpi_status status;
-       u32 i;
-
-       ACPI_FUNCTION_TRACE(ut_init_globals);
-
-       /* Create all memory caches */
-
-       status = acpi_ut_create_caches();
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       /* Address Range lists */
-
-       for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
-               acpi_gbl_address_range_list[i] = NULL;
-       }
-
-       /* Mutex locked flags */
-
-       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
-               acpi_gbl_mutex_info[i].mutex = NULL;
-               acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
-               acpi_gbl_mutex_info[i].use_count = 0;
-       }
-
-       for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
-               acpi_gbl_owner_id_mask[i] = 0;
-       }
-
-       /* Last owner_ID is never valid */
-
-       acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
-
-       /* Event counters */
-
-       acpi_method_count = 0;
-       acpi_sci_count = 0;
-       acpi_gpe_count = 0;
-
-       for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
-               acpi_fixed_event_count[i] = 0;
-       }
-
-#if (!ACPI_REDUCED_HARDWARE)
-
-       /* GPE/SCI support */
-
-       acpi_gbl_all_gpes_initialized = FALSE;
-       acpi_gbl_gpe_xrupt_list_head = NULL;
-       acpi_gbl_gpe_fadt_blocks[0] = NULL;
-       acpi_gbl_gpe_fadt_blocks[1] = NULL;
-       acpi_current_gpe_count = 0;
-
-       acpi_gbl_global_event_handler = NULL;
-       acpi_gbl_sci_handler_list = NULL;
-
-#endif                         /* !ACPI_REDUCED_HARDWARE */
-
-       /* Global handlers */
-
-       acpi_gbl_global_notify[0].handler = NULL;
-       acpi_gbl_global_notify[1].handler = NULL;
-       acpi_gbl_exception_handler = NULL;
-       acpi_gbl_init_handler = NULL;
-       acpi_gbl_table_handler = NULL;
-       acpi_gbl_interface_handler = NULL;
-
-       /* Global Lock support */
-
-       acpi_gbl_global_lock_semaphore = NULL;
-       acpi_gbl_global_lock_mutex = NULL;
-       acpi_gbl_global_lock_acquired = FALSE;
-       acpi_gbl_global_lock_handle = 0;
-       acpi_gbl_global_lock_present = FALSE;
-
-       /* Miscellaneous variables */
-
-       acpi_gbl_DSDT = NULL;
-       acpi_gbl_cm_single_step = FALSE;
-       acpi_gbl_shutdown = FALSE;
-       acpi_gbl_ns_lookup_count = 0;
-       acpi_gbl_ps_find_count = 0;
-       acpi_gbl_acpi_hardware_present = TRUE;
-       acpi_gbl_last_owner_id_index = 0;
-       acpi_gbl_next_owner_id_offset = 0;
-       acpi_gbl_trace_dbg_level = 0;
-       acpi_gbl_trace_dbg_layer = 0;
-       acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
-       acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
-       acpi_gbl_osi_mutex = NULL;
-       acpi_gbl_reg_methods_executed = FALSE;
-
-       /* Hardware oriented */
-
-       acpi_gbl_events_initialized = FALSE;
-       acpi_gbl_system_awake_and_running = TRUE;
-
-       /* Namespace */
-
-       acpi_gbl_module_code_list = NULL;
-       acpi_gbl_root_node = NULL;
-       acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
-       acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
-       acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
-       acpi_gbl_root_node_struct.parent = NULL;
-       acpi_gbl_root_node_struct.child = NULL;
-       acpi_gbl_root_node_struct.peer = NULL;
-       acpi_gbl_root_node_struct.object = NULL;
-
-#ifdef ACPI_DISASSEMBLER
-       acpi_gbl_external_list = NULL;
-       acpi_gbl_num_external_methods = 0;
-       acpi_gbl_resolved_external_methods = 0;
-#endif
-
-#ifdef ACPI_DEBUG_OUTPUT
-       acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
-#endif
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-       acpi_gbl_display_final_mem_stats = FALSE;
-       acpi_gbl_disable_mem_tracking = FALSE;
-#endif
-
-       ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = FALSE);
-
-       return_ACPI_STATUS(AE_OK);
-}
-
 /* Public globals */
 
 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
index 5f56fc49021ecf9f198baec7370e940441ecfc06..a7936623998f4a91b1557ad902e01497bcdc0e46 100644 (file)
@@ -102,6 +102,152 @@ static void acpi_ut_free_gpe_lists(void)
 }
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_init_globals
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
+ *              initialization should be initialized here. This allows for
+ *              a warm restart.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_ut_init_globals(void)
+{
+       acpi_status status;
+       u32 i;
+
+       ACPI_FUNCTION_TRACE(ut_init_globals);
+
+       /* Create all memory caches */
+
+       status = acpi_ut_create_caches();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       /* Address Range lists */
+
+       for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
+               acpi_gbl_address_range_list[i] = NULL;
+       }
+
+       /* Mutex locked flags */
+
+       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
+               acpi_gbl_mutex_info[i].mutex = NULL;
+               acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
+               acpi_gbl_mutex_info[i].use_count = 0;
+       }
+
+       for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
+               acpi_gbl_owner_id_mask[i] = 0;
+       }
+
+       /* Last owner_ID is never valid */
+
+       acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
+
+       /* Event counters */
+
+       acpi_method_count = 0;
+       acpi_sci_count = 0;
+       acpi_gpe_count = 0;
+
+       for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
+               acpi_fixed_event_count[i] = 0;
+       }
+
+#if (!ACPI_REDUCED_HARDWARE)
+
+       /* GPE/SCI support */
+
+       acpi_gbl_all_gpes_initialized = FALSE;
+       acpi_gbl_gpe_xrupt_list_head = NULL;
+       acpi_gbl_gpe_fadt_blocks[0] = NULL;
+       acpi_gbl_gpe_fadt_blocks[1] = NULL;
+       acpi_current_gpe_count = 0;
+
+       acpi_gbl_global_event_handler = NULL;
+       acpi_gbl_sci_handler_list = NULL;
+
+#endif                         /* !ACPI_REDUCED_HARDWARE */
+
+       /* Global handlers */
+
+       acpi_gbl_global_notify[0].handler = NULL;
+       acpi_gbl_global_notify[1].handler = NULL;
+       acpi_gbl_exception_handler = NULL;
+       acpi_gbl_init_handler = NULL;
+       acpi_gbl_table_handler = NULL;
+       acpi_gbl_interface_handler = NULL;
+
+       /* Global Lock support */
+
+       acpi_gbl_global_lock_semaphore = NULL;
+       acpi_gbl_global_lock_mutex = NULL;
+       acpi_gbl_global_lock_acquired = FALSE;
+       acpi_gbl_global_lock_handle = 0;
+       acpi_gbl_global_lock_present = FALSE;
+
+       /* Miscellaneous variables */
+
+       acpi_gbl_DSDT = NULL;
+       acpi_gbl_cm_single_step = FALSE;
+       acpi_gbl_shutdown = FALSE;
+       acpi_gbl_ns_lookup_count = 0;
+       acpi_gbl_ps_find_count = 0;
+       acpi_gbl_acpi_hardware_present = TRUE;
+       acpi_gbl_last_owner_id_index = 0;
+       acpi_gbl_next_owner_id_offset = 0;
+       acpi_gbl_trace_dbg_level = 0;
+       acpi_gbl_trace_dbg_layer = 0;
+       acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
+       acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
+       acpi_gbl_osi_mutex = NULL;
+       acpi_gbl_reg_methods_executed = FALSE;
+
+       /* Hardware oriented */
+
+       acpi_gbl_events_initialized = FALSE;
+       acpi_gbl_system_awake_and_running = TRUE;
+
+       /* Namespace */
+
+       acpi_gbl_module_code_list = NULL;
+       acpi_gbl_root_node = NULL;
+       acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
+       acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
+       acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
+       acpi_gbl_root_node_struct.parent = NULL;
+       acpi_gbl_root_node_struct.child = NULL;
+       acpi_gbl_root_node_struct.peer = NULL;
+       acpi_gbl_root_node_struct.object = NULL;
+
+#ifdef ACPI_DISASSEMBLER
+       acpi_gbl_external_list = NULL;
+       acpi_gbl_num_external_methods = 0;
+       acpi_gbl_resolved_external_methods = 0;
+#endif
+
+#ifdef ACPI_DEBUG_OUTPUT
+       acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
+#endif
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+       acpi_gbl_display_final_mem_stats = FALSE;
+       acpi_gbl_disable_mem_tracking = FALSE;
+#endif
+
+       ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = FALSE);
+
+       return_ACPI_STATUS(AE_OK);
+}
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_ut_terminate
index e5a3c4be2a10d696c31aebc733234964197affad..61446dbf70a6052d5f91da744898f7295b43d386 100644 (file)
@@ -112,6 +112,7 @@ DUMP_OBJS = \
        tbxfroot.o\
        utbuffer.o\
        utexcep.o\
+       utglobal.o\
        utmath.o\
        utstring.o\
        utxferror.o\
index 46f519597fe5eb4a8e2f8674f2bcaef29f31eb0c..8efc848243083b95dc312f6d606c1d6cc564570e 100644 (file)
@@ -47,7 +47,6 @@
 #ifdef _DECLARE_GLOBALS
 #define EXTERN
 #define INIT_GLOBAL(a,b)        a=b
-#define DEFINE_ACPI_GLOBALS     1
 #else
 #define EXTERN                  extern
 #define INIT_GLOBAL(a,b)        a