^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: tbinstal - ACPI table installation and removal
^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 "actables.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define _COMPONENT ACPI_TABLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) ACPI_MODULE_NAME("tbinstal")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * FUNCTION: acpi_tb_install_table_with_override
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * PARAMETERS: new_table_desc - New table descriptor to install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * override - Whether override should be performed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * table_index - Where the table index is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * DESCRIPTION: Install an ACPI table into the global data structure. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * table override mechanism is called to allow the host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * OS to replace any table before it is installed in the root
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * table array.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) acpi_tb_install_table_with_override(struct acpi_table_desc *new_table_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u8 override, u32 *table_index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) status = acpi_tb_get_next_table_descriptor(&i, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * ACPI Table Override:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * Before we install the table, let the host OS override it with a new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * one if desired. Any table within the RSDT/XSDT can be replaced,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * including the DSDT which is pointed to by the FADT.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) if (override) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) acpi_tb_override_table(new_table_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) acpi_tb_init_table_descriptor(&acpi_gbl_root_table_list.tables[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) new_table_desc->address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) new_table_desc->flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) new_table_desc->pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) acpi_tb_print_table_header(new_table_desc->address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) new_table_desc->pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) /* This synchronizes acpi_gbl_dsdt_index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) *table_index = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) /* Set the global integer width (based upon revision of the DSDT) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) if (i == acpi_gbl_dsdt_index) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) acpi_ut_set_integer_width(new_table_desc->pointer->revision);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * FUNCTION: acpi_tb_install_standard_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * PARAMETERS: address - Address of the table (might be a virtual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * address depending on the table_flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * flags - Flags for the table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * reload - Whether reload should be performed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * override - Whether override should be performed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * table_index - Where the table index is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * DESCRIPTION: This function is called to verify and install an ACPI table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * When this function is called by "Load" or "LoadTable" opcodes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * or by acpi_load_table() API, the "Reload" parameter is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * After successfully returning from this function, table is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * "INSTALLED" but not "VALIDATED".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) acpi_tb_install_standard_table(acpi_physical_address address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) u8 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) u8 reload, u8 override, u32 *table_index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) acpi_status status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct acpi_table_desc new_table_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) ACPI_FUNCTION_TRACE(tb_install_standard_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /* Acquire a temporary table descriptor for validation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) status = acpi_tb_acquire_temp_table(&new_table_desc, address, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) "Could not acquire table length at %8.8X%8.8X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) ACPI_FORMAT_UINT64(address)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) return_ACPI_STATUS(status);
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * Optionally do not load any SSDTs from the RSDT/XSDT. This can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * be useful for debugging ACPI problems on some machines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) if (!reload &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) acpi_gbl_disable_ssdt_table_install &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) ACPI_COMPARE_NAMESEG(&new_table_desc.signature, ACPI_SIG_SSDT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) ACPI_INFO(("Ignoring installation of %4.4s at %8.8X%8.8X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) new_table_desc.signature.ascii,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) ACPI_FORMAT_UINT64(address)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) goto release_and_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /* Acquire the table lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /* Validate and verify a table before installation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) status = acpi_tb_verify_temp_table(&new_table_desc, NULL, &i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) if (status == AE_CTRL_TERMINATE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * Table was unloaded, allow it to be reloaded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * As we are going to return AE_OK to the caller, we should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * take the responsibility of freeing the input descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * Refill the input descriptor to ensure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * acpi_tb_install_table_with_override() can be called again to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * indicate the re-installation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) acpi_tb_uninstall_table(&new_table_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) *table_index = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) goto unlock_and_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /* Add the table to the global root table list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) acpi_tb_install_table_with_override(&new_table_desc, override,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) table_index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* Invoke table handler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) acpi_tb_notify_table(ACPI_TABLE_EVENT_INSTALL, new_table_desc.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) unlock_and_exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /* Release the table lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) release_and_exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /* Release the temporary table descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) acpi_tb_release_temp_table(&new_table_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * FUNCTION: acpi_tb_override_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * PARAMETERS: old_table_desc - Validated table descriptor to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * overridden
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * DESCRIPTION: Attempt table override by calling the OSL override functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * Note: If the table is overridden, then the entire new table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * is acquired and returned by this function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * Before/after invocation, the table descriptor is in a state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * that is "VALIDATED".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) void acpi_tb_override_table(struct acpi_table_desc *old_table_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) struct acpi_table_desc new_table_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) struct acpi_table_header *table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) acpi_physical_address address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) u32 length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) ACPI_ERROR_ONLY(char *override_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) /* (1) Attempt logical override (returns a logical address) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) status = acpi_os_table_override(old_table_desc->pointer, &table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) if (ACPI_SUCCESS(status) && table) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) acpi_tb_acquire_temp_table(&new_table_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) ACPI_PTR_TO_PHYSADDR(table),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) ACPI_ERROR_ONLY(override_type = "Logical");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) goto finish_override;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /* (2) Attempt physical override (returns a physical address) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) status = acpi_os_physical_table_override(old_table_desc->pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) &address, &length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) if (ACPI_SUCCESS(status) && address && length) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) acpi_tb_acquire_temp_table(&new_table_desc, address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) ACPI_ERROR_ONLY(override_type = "Physical");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) goto finish_override;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) return; /* There was no override */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) finish_override:
^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) * Validate and verify a table before overriding, no nested table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) * duplication check as it's too complicated and unnecessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) status = acpi_tb_verify_temp_table(&new_table_desc, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) ACPI_INFO(("%4.4s 0x%8.8X%8.8X"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) " %s table override, new table: 0x%8.8X%8.8X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) old_table_desc->signature.ascii,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) ACPI_FORMAT_UINT64(old_table_desc->address),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) override_type, ACPI_FORMAT_UINT64(new_table_desc.address)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /* We can now uninstall the original table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) acpi_tb_uninstall_table(old_table_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) * Replace the original table descriptor and keep its state as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) * "VALIDATED".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) acpi_tb_init_table_descriptor(old_table_desc, new_table_desc.address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) new_table_desc.flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) new_table_desc.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) acpi_tb_validate_temp_table(old_table_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) /* Release the temporary table descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) acpi_tb_release_temp_table(&new_table_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * FUNCTION: acpi_tb_uninstall_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * PARAMETERS: table_desc - Table descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) * DESCRIPTION: Delete one internal ACPI table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) ACPI_FUNCTION_TRACE(tb_uninstall_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) /* Table must be installed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) if (!table_desc->address) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) acpi_tb_invalidate_table(table_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) ACPI_FREE(ACPI_PHYSADDR_TO_PTR(table_desc->address));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }