// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: tbutils - ACPI Table utilities * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "actables.h" #define _COMPONENT … ACPI_MODULE_NAME("tbutils") /* Local prototypes */ static acpi_physical_address acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); /******************************************************************************* * * FUNCTION: acpi_tb_initialize_facs * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global * for accessing the Global Lock and Firmware Waking Vector * ******************************************************************************/ acpi_status acpi_tb_initialize_facs(void) { … } /******************************************************************************* * * FUNCTION: acpi_tb_check_dsdt_header * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Quick compare to check validity of the DSDT. This will detect * if the DSDT has been replaced from outside the OS and/or if * the DSDT header has been corrupted. * ******************************************************************************/ void acpi_tb_check_dsdt_header(void) { … } /******************************************************************************* * * FUNCTION: acpi_tb_copy_dsdt * * PARAMETERS: table_index - Index of installed table to copy * * RETURN: The copied DSDT * * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory. * Some very bad BIOSs are known to either corrupt the DSDT or * install a new, bad DSDT. This copy works around the problem. * ******************************************************************************/ struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index) { … } /******************************************************************************* * * FUNCTION: acpi_tb_get_root_table_entry * * PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry * table_entry_size - sizeof 32 or 64 (RSDT or XSDT) * * RETURN: Physical address extracted from the root table * * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on * both 32-bit and 64-bit platforms * * NOTE: acpi_physical_address is 32-bit on 32-bit platforms, 64-bit on * 64-bit platforms. * ******************************************************************************/ static acpi_physical_address acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size) { … } /******************************************************************************* * * FUNCTION: acpi_tb_parse_root_table * * PARAMETERS: rsdp_address - Pointer to the RSDP * * RETURN: Status * * DESCRIPTION: This function is called to parse the Root System Description * Table (RSDT or XSDT) * * NOTE: Tables are mapped (not copied) for efficiency. The FACS must * be mapped and cannot be copied because it contains the actual * memory location of the ACPI Global Lock. * ******************************************************************************/ acpi_status ACPI_INIT_FUNCTION acpi_tb_parse_root_table(acpi_physical_address rsdp_address) { … } /******************************************************************************* * * FUNCTION: acpi_tb_get_table * * PARAMETERS: table_desc - Table descriptor * out_table - Where the pointer to the table is returned * * RETURN: Status and pointer to the requested table * * DESCRIPTION: Increase a reference to a table descriptor and return the * validated table pointer. * If the table descriptor is an entry of the root table list, * this API must be invoked with ACPI_MTX_TABLES acquired. * ******************************************************************************/ acpi_status acpi_tb_get_table(struct acpi_table_desc *table_desc, struct acpi_table_header **out_table) { … } /******************************************************************************* * * FUNCTION: acpi_tb_put_table * * PARAMETERS: table_desc - Table descriptor * * RETURN: None * * DESCRIPTION: Decrease a reference to a table descriptor and release the * validated table pointer if no references. * If the table descriptor is an entry of the root table list, * this API must be invoked with ACPI_MTX_TABLES acquired. * ******************************************************************************/ void acpi_tb_put_table(struct acpi_table_desc *table_desc) { … }