^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Module Name: utinit - Common ACPI subsystem initialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2000 - 2020, Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "acevents.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "actables.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define _COMPONENT ACPI_UTILITIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ACPI_MODULE_NAME("utinit")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static void acpi_ut_terminate(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #if (!ACPI_REDUCED_HARDWARE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) static void acpi_ut_free_gpe_lists(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define acpi_ut_free_gpe_lists()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #endif /* !ACPI_REDUCED_HARDWARE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #if (!ACPI_REDUCED_HARDWARE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * FUNCTION: acpi_ut_free_gpe_lists
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * PARAMETERS: none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * RETURN: none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * DESCRIPTION: Free global GPE lists
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static void acpi_ut_free_gpe_lists(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct acpi_gpe_block_info *gpe_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct acpi_gpe_block_info *next_gpe_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct acpi_gpe_xrupt_info *gpe_xrupt_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct acpi_gpe_xrupt_info *next_gpe_xrupt_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* Free global GPE blocks and related info structures */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) while (gpe_xrupt_info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) gpe_block = gpe_xrupt_info->gpe_block_list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) while (gpe_block) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) next_gpe_block = gpe_block->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) ACPI_FREE(gpe_block->event_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) ACPI_FREE(gpe_block->register_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ACPI_FREE(gpe_block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) gpe_block = next_gpe_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) next_gpe_xrupt_info = gpe_xrupt_info->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ACPI_FREE(gpe_xrupt_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) gpe_xrupt_info = next_gpe_xrupt_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #endif /* !ACPI_REDUCED_HARDWARE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * FUNCTION: acpi_ut_init_globals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * initialization should be initialized here. This allows for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * a warm restart.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) acpi_status acpi_ut_init_globals(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) ACPI_FUNCTION_TRACE(ut_init_globals);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* Create all memory caches */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) status = acpi_ut_create_caches();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) /* Address Range lists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) acpi_gbl_address_range_list[i] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* Mutex locked flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) for (i = 0; i < ACPI_NUM_MUTEX; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) acpi_gbl_mutex_info[i].mutex = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) acpi_gbl_mutex_info[i].use_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) acpi_gbl_owner_id_mask[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /* Last owner_ID is never valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /* Event counters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) acpi_method_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) acpi_sci_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) acpi_gpe_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) acpi_fixed_event_count[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #if (!ACPI_REDUCED_HARDWARE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /* GPE/SCI support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) acpi_gbl_all_gpes_initialized = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) acpi_gbl_gpe_xrupt_list_head = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) acpi_gbl_gpe_fadt_blocks[0] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) acpi_gbl_gpe_fadt_blocks[1] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) acpi_current_gpe_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) acpi_gbl_global_event_handler = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) acpi_gbl_sci_handler_list = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #endif /* !ACPI_REDUCED_HARDWARE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /* Global handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) acpi_gbl_global_notify[0].handler = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) acpi_gbl_global_notify[1].handler = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) acpi_gbl_exception_handler = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) acpi_gbl_init_handler = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) acpi_gbl_table_handler = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) acpi_gbl_interface_handler = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /* Global Lock support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) acpi_gbl_global_lock_semaphore = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) acpi_gbl_global_lock_mutex = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) acpi_gbl_global_lock_acquired = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) acpi_gbl_global_lock_handle = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) acpi_gbl_global_lock_present = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) /* Miscellaneous variables */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) acpi_gbl_DSDT = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) acpi_gbl_cm_single_step = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) acpi_gbl_shutdown = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) acpi_gbl_ns_lookup_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) acpi_gbl_ps_find_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) acpi_gbl_acpi_hardware_present = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) acpi_gbl_last_owner_id_index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) acpi_gbl_next_owner_id_offset = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) acpi_gbl_osi_mutex = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) /* Hardware oriented */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) acpi_gbl_events_initialized = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) acpi_gbl_system_awake_and_running = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /* Namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) acpi_gbl_root_node = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) acpi_gbl_root_node_struct.parent = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) acpi_gbl_root_node_struct.child = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) acpi_gbl_root_node_struct.peer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) acpi_gbl_root_node_struct.object = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #ifdef ACPI_DISASSEMBLER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) acpi_gbl_external_list = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) acpi_gbl_num_external_methods = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) acpi_gbl_resolved_external_methods = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #ifdef ACPI_DEBUG_OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #ifdef ACPI_DBG_TRACK_ALLOCATIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) acpi_gbl_display_final_mem_stats = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) acpi_gbl_disable_mem_tracking = FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) * FUNCTION: acpi_ut_terminate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * PARAMETERS: none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * RETURN: none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * DESCRIPTION: Free global memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static void acpi_ut_terminate(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) ACPI_FUNCTION_TRACE(ut_terminate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) acpi_ut_free_gpe_lists();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) acpi_ut_delete_address_lists();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) * FUNCTION: acpi_ut_subsystem_shutdown
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * PARAMETERS: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) * DESCRIPTION: Shutdown the various components. Do not delete the mutex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * objects here, because the AML debugger may be still running.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) void acpi_ut_subsystem_shutdown(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) ACPI_FUNCTION_TRACE(ut_subsystem_shutdown);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) /* Just exit if subsystem is already shutdown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) if (acpi_gbl_shutdown) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) /* Subsystem appears active, go ahead and shut it down */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) acpi_gbl_shutdown = TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) acpi_gbl_startup_flags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #ifndef ACPI_ASL_COMPILER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) /* Close the acpi_event Handling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) acpi_ev_terminate();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) /* Delete any dynamic _OSI interfaces */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) acpi_ut_interface_terminate();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) /* Close the Namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) acpi_ns_terminate();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) /* Delete the ACPI tables */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) acpi_tb_terminate();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /* Close the globals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) acpi_ut_terminate();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /* Purge the local caches */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) (void)acpi_ut_delete_caches();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) }