Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: Tables: Fix FADT dependency regression

Some logics actually relying on the existence of FADT, currently relies on
the number of loaded tables. This false dependency can easily trigger
regressions. One of them has been introduced by commit 8ec3f459073e
(ACPICA: Tables: Fix global table list issues by removing fixed table).

The commit changing the fixed table indexes results in the change of FADT
table index, originally, it was 3 (thus the installed table count should be
greater than 4), while currently it is 0 (and the installed table count may
be 3).

This patch fixes this regression by cleaning up the code. Lv Zheng.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=105351
Fixes: 8ec3f459073e (ACPICA: Tables: Fix global table list issues by removing fixed table)
Reported-and-tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Lv Zheng and committed by
Rafael J. Wysocki
62fcce91 25cb62b7

+10 -33
+1
drivers/acpi/acpica/acglobal.h
··· 61 61 ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX); 62 62 ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX); 63 63 ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX); 64 + ACPI_INIT_GLOBAL(u32, acpi_gbl_fadt_index, ACPI_INVALID_TABLE_INDEX); 64 65 65 66 #if (!ACPI_REDUCED_HARDWARE) 66 67 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
+1 -3
drivers/acpi/acpica/actables.h
··· 85 85 /* 86 86 * tbfadt - FADT parse/convert/validate 87 87 */ 88 - void acpi_tb_parse_fadt(u32 table_index); 88 + void acpi_tb_parse_fadt(void); 89 89 90 90 void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length); 91 91 ··· 137 137 * tbutils - table manager utilities 138 138 */ 139 139 acpi_status acpi_tb_initialize_facs(void); 140 - 141 - u8 acpi_tb_tables_loaded(void); 142 140 143 141 void 144 142 acpi_tb_print_table_header(acpi_physical_address address,
+1 -1
drivers/acpi/acpica/evxfevnt.c
··· 71 71 72 72 /* ACPI tables must be present */ 73 73 74 - if (!acpi_tb_tables_loaded()) { 74 + if (acpi_gbl_fadt_index == ACPI_INVALID_TABLE_INDEX) { 75 75 return_ACPI_STATUS(AE_NO_ACPI_TABLES); 76 76 } 77 77
+5 -5
drivers/acpi/acpica/tbfadt.c
··· 298 298 * 299 299 * FUNCTION: acpi_tb_parse_fadt 300 300 * 301 - * PARAMETERS: table_index - Index for the FADT 301 + * PARAMETERS: None 302 302 * 303 303 * RETURN: None 304 304 * ··· 307 307 * 308 308 ******************************************************************************/ 309 309 310 - void acpi_tb_parse_fadt(u32 table_index) 310 + void acpi_tb_parse_fadt(void) 311 311 { 312 312 u32 length; 313 313 struct acpi_table_header *table; ··· 319 319 * Get a local copy of the FADT and convert it to a common format 320 320 * Map entire FADT, assumed to be smaller than one page. 321 321 */ 322 - length = acpi_gbl_root_table_list.tables[table_index].length; 322 + length = acpi_gbl_root_table_list.tables[acpi_gbl_fadt_index].length; 323 323 324 324 table = 325 - acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. 326 - address, length); 325 + acpi_os_map_memory(acpi_gbl_root_table_list. 326 + tables[acpi_gbl_fadt_index].address, length); 327 327 if (!table) { 328 328 return; 329 329 }
+2 -24
drivers/acpi/acpica/tbutils.c
··· 99 99 100 100 /******************************************************************************* 101 101 * 102 - * FUNCTION: acpi_tb_tables_loaded 103 - * 104 - * PARAMETERS: None 105 - * 106 - * RETURN: TRUE if required ACPI tables are loaded 107 - * 108 - * DESCRIPTION: Determine if the minimum required ACPI tables are present 109 - * (FADT, FACS, DSDT) 110 - * 111 - ******************************************************************************/ 112 - 113 - u8 acpi_tb_tables_loaded(void) 114 - { 115 - 116 - if (acpi_gbl_root_table_list.current_table_count >= 4) { 117 - return (TRUE); 118 - } 119 - 120 - return (FALSE); 121 - } 122 - 123 - /******************************************************************************* 124 - * 125 102 * FUNCTION: acpi_tb_check_dsdt_header 126 103 * 127 104 * PARAMETERS: None ··· 369 392 ACPI_COMPARE_NAME(&acpi_gbl_root_table_list. 370 393 tables[table_index].signature, 371 394 ACPI_SIG_FADT)) { 372 - acpi_tb_parse_fadt(table_index); 395 + acpi_gbl_fadt_index = table_index; 396 + acpi_tb_parse_fadt(); 373 397 } 374 398 375 399 next_table: