0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <acpi/acpi.h>
0011 #include "accommon.h"
0012 #include "acnamesp.h"
0013 #include "acevents.h"
0014 #include "actables.h"
0015
0016 #define _COMPONENT ACPI_UTILITIES
0017 ACPI_MODULE_NAME("utinit")
0018
0019
0020 static void acpi_ut_terminate(void);
0021
0022 #if (!ACPI_REDUCED_HARDWARE)
0023
0024 static void acpi_ut_free_gpe_lists(void);
0025
0026 #else
0027
0028 #define acpi_ut_free_gpe_lists()
0029 #endif
0030
0031 #if (!ACPI_REDUCED_HARDWARE)
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 static void acpi_ut_free_gpe_lists(void)
0045 {
0046 struct acpi_gpe_block_info *gpe_block;
0047 struct acpi_gpe_block_info *next_gpe_block;
0048 struct acpi_gpe_xrupt_info *gpe_xrupt_info;
0049 struct acpi_gpe_xrupt_info *next_gpe_xrupt_info;
0050
0051
0052
0053 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
0054 while (gpe_xrupt_info) {
0055 gpe_block = gpe_xrupt_info->gpe_block_list_head;
0056 while (gpe_block) {
0057 next_gpe_block = gpe_block->next;
0058 ACPI_FREE(gpe_block->event_info);
0059 ACPI_FREE(gpe_block->register_info);
0060 ACPI_FREE(gpe_block);
0061
0062 gpe_block = next_gpe_block;
0063 }
0064 next_gpe_xrupt_info = gpe_xrupt_info->next;
0065 ACPI_FREE(gpe_xrupt_info);
0066 gpe_xrupt_info = next_gpe_xrupt_info;
0067 }
0068 }
0069 #endif
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 acpi_status acpi_ut_init_globals(void)
0086 {
0087 acpi_status status;
0088 u32 i;
0089
0090 ACPI_FUNCTION_TRACE(ut_init_globals);
0091
0092
0093
0094 status = acpi_ut_create_caches();
0095 if (ACPI_FAILURE(status)) {
0096 return_ACPI_STATUS(status);
0097 }
0098
0099
0100
0101 for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
0102 acpi_gbl_address_range_list[i] = NULL;
0103 }
0104
0105
0106
0107 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
0108 acpi_gbl_mutex_info[i].mutex = NULL;
0109 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
0110 acpi_gbl_mutex_info[i].use_count = 0;
0111 }
0112
0113 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
0114 acpi_gbl_owner_id_mask[i] = 0;
0115 }
0116
0117
0118
0119 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
0120
0121
0122
0123 acpi_method_count = 0;
0124 acpi_sci_count = 0;
0125 acpi_gpe_count = 0;
0126
0127 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
0128 acpi_fixed_event_count[i] = 0;
0129 }
0130
0131 #if (!ACPI_REDUCED_HARDWARE)
0132
0133
0134
0135 acpi_gbl_all_gpes_initialized = FALSE;
0136 acpi_gbl_gpe_xrupt_list_head = NULL;
0137 acpi_gbl_gpe_fadt_blocks[0] = NULL;
0138 acpi_gbl_gpe_fadt_blocks[1] = NULL;
0139 acpi_current_gpe_count = 0;
0140
0141 acpi_gbl_global_event_handler = NULL;
0142 acpi_gbl_sci_handler_list = NULL;
0143
0144 #endif
0145
0146
0147
0148 acpi_gbl_global_notify[0].handler = NULL;
0149 acpi_gbl_global_notify[1].handler = NULL;
0150 acpi_gbl_exception_handler = NULL;
0151 acpi_gbl_init_handler = NULL;
0152 acpi_gbl_table_handler = NULL;
0153 acpi_gbl_interface_handler = NULL;
0154
0155
0156
0157 acpi_gbl_global_lock_semaphore = NULL;
0158 acpi_gbl_global_lock_mutex = NULL;
0159 acpi_gbl_global_lock_acquired = FALSE;
0160 acpi_gbl_global_lock_handle = 0;
0161 acpi_gbl_global_lock_present = FALSE;
0162
0163
0164
0165 acpi_gbl_DSDT = NULL;
0166 acpi_gbl_cm_single_step = FALSE;
0167 acpi_gbl_shutdown = FALSE;
0168 acpi_gbl_ns_lookup_count = 0;
0169 acpi_gbl_ps_find_count = 0;
0170 acpi_gbl_acpi_hardware_present = TRUE;
0171 acpi_gbl_last_owner_id_index = 0;
0172 acpi_gbl_next_owner_id_offset = 0;
0173 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
0174 acpi_gbl_osi_mutex = NULL;
0175
0176
0177
0178 acpi_gbl_events_initialized = FALSE;
0179 acpi_gbl_system_awake_and_running = TRUE;
0180
0181
0182
0183 acpi_gbl_root_node = NULL;
0184 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
0185 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
0186 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
0187 acpi_gbl_root_node_struct.parent = NULL;
0188 acpi_gbl_root_node_struct.child = NULL;
0189 acpi_gbl_root_node_struct.peer = NULL;
0190 acpi_gbl_root_node_struct.object = NULL;
0191
0192 #ifdef ACPI_DISASSEMBLER
0193 acpi_gbl_external_list = NULL;
0194 acpi_gbl_num_external_methods = 0;
0195 acpi_gbl_resolved_external_methods = 0;
0196 #endif
0197
0198 #ifdef ACPI_DEBUG_OUTPUT
0199 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
0200 #endif
0201
0202 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
0203 acpi_gbl_display_final_mem_stats = FALSE;
0204 acpi_gbl_disable_mem_tracking = FALSE;
0205 #endif
0206
0207 return_ACPI_STATUS(AE_OK);
0208 }
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222 static void acpi_ut_terminate(void)
0223 {
0224 ACPI_FUNCTION_TRACE(ut_terminate);
0225
0226 acpi_ut_free_gpe_lists();
0227 acpi_ut_delete_address_lists();
0228 return_VOID;
0229 }
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244 void acpi_ut_subsystem_shutdown(void)
0245 {
0246 ACPI_FUNCTION_TRACE(ut_subsystem_shutdown);
0247
0248
0249
0250 if (acpi_gbl_shutdown) {
0251 ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
0252 return_VOID;
0253 }
0254
0255
0256
0257 acpi_gbl_shutdown = TRUE;
0258 acpi_gbl_startup_flags = 0;
0259 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
0260
0261 #ifndef ACPI_ASL_COMPILER
0262
0263
0264
0265 acpi_ev_terminate();
0266
0267
0268
0269 acpi_ut_interface_terminate();
0270 #endif
0271
0272
0273
0274 acpi_ns_terminate();
0275
0276
0277
0278 acpi_tb_terminate();
0279
0280
0281
0282 acpi_ut_terminate();
0283
0284
0285
0286 (void)acpi_ut_delete_caches();
0287 return_VOID;
0288 }