Skip to content

Commit

Permalink
Tables: Fix FADT dependency regression
Browse files Browse the repository at this point in the history
Some logics actually relying on the existence of FADT, currently relies on
the number of loaded tables. This false dependency can easily trigger
regressions. The reported regression can be seen on the following commit:
  Commit: c0b38b4
  Subject: 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. Reported by
Meelis Roos, Fixed by Lv Zheng.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=105351
Reported-and-tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
debox1 committed Oct 13, 2015
1 parent 40d40dc commit a326796
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 38 deletions.
2 changes: 1 addition & 1 deletion source/components/events/evxfevnt.c
Expand Up @@ -148,7 +148,7 @@ AcpiEnable (

/* ACPI tables must be present */

if (!AcpiTbTablesLoaded ())
if (AcpiGbl_FadtIndex == ACPI_INVALID_TABLE_INDEX)
{
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
Expand Down
8 changes: 4 additions & 4 deletions source/components/tables/tbfadt.c
Expand Up @@ -398,7 +398,7 @@ AcpiTbSelectAddress (
*
* FUNCTION: AcpiTbParseFadt
*
* PARAMETERS: TableIndex - Index for the FADT
* PARAMETERS: None
*
* RETURN: None
*
Expand All @@ -409,7 +409,7 @@ AcpiTbSelectAddress (

void
AcpiTbParseFadt (
UINT32 TableIndex)
void)
{
UINT32 Length;
ACPI_TABLE_HEADER *Table;
Expand All @@ -422,10 +422,10 @@ AcpiTbParseFadt (
* Get a local copy of the FADT and convert it to a common format
* Map entire FADT, assumed to be smaller than one page.
*/
Length = AcpiGbl_RootTableList.Tables[TableIndex].Length;
Length = AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex].Length;

Table = AcpiOsMapMemory (
AcpiGbl_RootTableList.Tables[TableIndex].Address, Length);
AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex].Address, Length);
if (!Table)
{
return;
Expand Down
30 changes: 2 additions & 28 deletions source/components/tables/tbutils.c
Expand Up @@ -178,33 +178,6 @@ AcpiTbInitializeFacs (
#endif /* !ACPI_REDUCED_HARDWARE */


/*******************************************************************************
*
* FUNCTION: AcpiTbTablesLoaded
*
* PARAMETERS: None
*
* RETURN: TRUE if required ACPI tables are loaded
*
* DESCRIPTION: Determine if the minimum required ACPI tables are present
* (FADT, FACS, DSDT)
*
******************************************************************************/

BOOLEAN
AcpiTbTablesLoaded (
void)
{

if (AcpiGbl_RootTableList.CurrentTableCount >= 4)
{
return (TRUE);
}

return (FALSE);
}


/*******************************************************************************
*
* FUNCTION: AcpiTbCheckDsdtHeader
Expand Down Expand Up @@ -498,7 +471,8 @@ AcpiTbParseRootTable (
&AcpiGbl_RootTableList.Tables[TableIndex].Signature,
ACPI_SIG_FADT))
{
AcpiTbParseFadt (TableIndex);
AcpiGbl_FadtIndex = TableIndex;
AcpiTbParseFadt ();
}

NextTable:
Expand Down
1 change: 1 addition & 0 deletions source/include/acglobal.h
Expand Up @@ -134,6 +134,7 @@ ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_DsdtIndex, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FacsIndex, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_XFacsIndex, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FadtIndex, ACPI_INVALID_TABLE_INDEX);

#if (!ACPI_REDUCED_HARDWARE)
ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS);
Expand Down
6 changes: 1 addition & 5 deletions source/include/actables.h
Expand Up @@ -187,7 +187,7 @@ AcpiTbSetTableLoadedFlag (
*/
void
AcpiTbParseFadt (
UINT32 TableIndex);
void);

void
AcpiTbCreateLocalFadt (
Expand Down Expand Up @@ -279,10 +279,6 @@ ACPI_STATUS
AcpiTbInitializeFacs (
void);

BOOLEAN
AcpiTbTablesLoaded (
void);

void
AcpiTbPrintTableHeader(
ACPI_PHYSICAL_ADDRESS Address,
Expand Down

0 comments on commit a326796

Please sign in to comment.