Skip to content

Commit

Permalink
Tables: Add AcpiInstallTable() API to be invoked by OSPM early table …
Browse files Browse the repository at this point in the history
…installation.

This patch adds a new API - AcpiInstallTable().  OSPMs can use this API
to install tables during early boot stage.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
Lv Zheng committed Mar 19, 2014
1 parent c5dfd64 commit 32ae0ea
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 8 deletions.
2 changes: 1 addition & 1 deletion source/components/executer/exconfig.c
Expand Up @@ -603,7 +603,7 @@ AcpiExLoadOp (
ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
Status = AcpiTbInstallNonFixedTable (ACPI_PTR_TO_PHYSADDR (Table),
ACPI_TABLE_ORIGIN_INTERN_VIRTUAL, TRUE, &TableIndex);
ACPI_TABLE_ORIGIN_INTERN_VIRTUAL, TRUE, TRUE, &TableIndex);
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
if (ACPI_FAILURE (Status))
{
Expand Down
15 changes: 11 additions & 4 deletions source/components/tables/tbinstal.c
Expand Up @@ -514,6 +514,7 @@ AcpiTbReleaseTemporalTable (
*
* PARAMETERS: TableIndex - Index into root table array
* NewTableDesc - New table descriptor to install
* Override - Whether override should be performed
*
* RETURN: None
*
Expand All @@ -527,7 +528,8 @@ AcpiTbReleaseTemporalTable (
void
AcpiTbInstallAndOverrideTable (
UINT32 TableIndex,
ACPI_TABLE_DESC *NewTableDesc)
ACPI_TABLE_DESC *NewTableDesc,
BOOLEAN Override)
{
if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
{
Expand All @@ -541,7 +543,10 @@ AcpiTbInstallAndOverrideTable (
* one if desired. Any table within the RSDT/XSDT can be replaced,
* including the DSDT which is pointed to by the FADT.
*/
AcpiTbOverrideTable (NewTableDesc);
if (Override)
{
AcpiTbOverrideTable (NewTableDesc);
}

AcpiTbInstallTable (&AcpiGbl_RootTableList.Tables[TableIndex],
NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer);
Expand Down Expand Up @@ -612,7 +617,7 @@ AcpiTbInstallFixedTable (
goto ReleaseAndExit;
}

AcpiTbInstallAndOverrideTable (TableIndex, &NewTableDesc);
AcpiTbInstallAndOverrideTable (TableIndex, &NewTableDesc, TRUE);

ReleaseAndExit:

Expand Down Expand Up @@ -680,6 +685,7 @@ AcpiTbIsEquivalentTable (
* address depending on the TableFlags)
* Flags - Flags for the table
* Reload - Whether reload should be performed
* Override - Whether override should be performed
* TableIndex - Where the table index is returned
*
* RETURN: Status
Expand All @@ -698,6 +704,7 @@ AcpiTbInstallNonFixedTable (
ACPI_PHYSICAL_ADDRESS Address,
UINT8 Flags,
BOOLEAN Reload,
BOOLEAN Override,
UINT32 *TableIndex)
{
UINT32 i;
Expand Down Expand Up @@ -826,7 +833,7 @@ AcpiTbInstallNonFixedTable (
goto ReleaseAndExit;
}
*TableIndex = i;
AcpiTbInstallAndOverrideTable (i, &NewTableDesc);
AcpiTbInstallAndOverrideTable (i, &NewTableDesc, Override);

ReleaseAndExit:

Expand Down
2 changes: 1 addition & 1 deletion source/components/tables/tbutils.c
Expand Up @@ -584,7 +584,7 @@ AcpiTbParseRootTable (

Status = AcpiTbInstallNonFixedTable (
AcpiTbGetRootTableEntry (TableEntry, TableEntrySize),
ACPI_TABLE_ORIGIN_INTERN_PHYSICAL, FALSE, &TableIndex);
ACPI_TABLE_ORIGIN_INTERN_PHYSICAL, FALSE, TRUE, &TableIndex);

if (ACPI_SUCCESS (Status) &&
ACPI_COMPARE_NAME (&AcpiGbl_RootTableList.Tables[TableIndex].Signature,
Expand Down
49 changes: 48 additions & 1 deletion source/components/tables/tbxfload.c
Expand Up @@ -280,6 +280,53 @@ AcpiTbLoadNamespace (
}


/*******************************************************************************
*
* FUNCTION: AcpiInstallTable
*
* PARAMETERS: Address - Address of the ACPI table to be installed.
* Physical - Whether the address is a physical table
* address or not
*
* RETURN: Status
*
* DESCRIPTION: Dynamically install an ACPI table.
* Note: This function should only be invoked after
* AcpiInitializeTables() and before AcpiLoadTables().
*
******************************************************************************/

ACPI_STATUS
AcpiInstallTable (
ACPI_PHYSICAL_ADDRESS Address,
BOOLEAN Physical)
{
ACPI_STATUS Status;
UINT8 Flags;
UINT32 TableIndex;


ACPI_FUNCTION_TRACE (AcpiInstallTable);


if (Physical)
{
Flags = ACPI_TABLE_ORIGIN_EXTERN_VIRTUAL;
}
else
{
Flags = ACPI_TABLE_ORIGIN_INTERN_PHYSICAL;
}

Status = AcpiTbInstallNonFixedTable (Address, Flags,
FALSE, FALSE, &TableIndex);

return_ACPI_STATUS (Status);
}

ACPI_EXPORT_SYMBOL_INIT (AcpiInstallTable)


/*******************************************************************************
*
* FUNCTION: AcpiLoadTable
Expand Down Expand Up @@ -328,7 +375,7 @@ AcpiLoadTable (
ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:"));
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
Status = AcpiTbInstallNonFixedTable (ACPI_PTR_TO_PHYSADDR (Table),
ACPI_TABLE_ORIGIN_EXTERN_VIRTUAL, TRUE, &TableIndex);
ACPI_TABLE_ORIGIN_EXTERN_VIRTUAL, TRUE, FALSE, &TableIndex);
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
if (ACPI_FAILURE (Status))
{
Expand Down
5 changes: 5 additions & 0 deletions source/include/acpixf.h
Expand Up @@ -274,6 +274,11 @@ AcpiDecodePldBuffer (
* ACPI table load/unload interfaces
*/
ACPI_STATUS
AcpiInstallTable (
ACPI_PHYSICAL_ADDRESS Address,
BOOLEAN Physical);

ACPI_STATUS
AcpiLoadTable (
ACPI_TABLE_HEADER *Table);

Expand Down
4 changes: 3 additions & 1 deletion source/include/actables.h
Expand Up @@ -200,6 +200,7 @@ AcpiTbInstallNonFixedTable (
ACPI_PHYSICAL_ADDRESS Address,
UINT8 Flags,
BOOLEAN Reload,
BOOLEAN Override,
UINT32 *TableIndex);

ACPI_STATUS
Expand Down Expand Up @@ -289,7 +290,8 @@ AcpiTbInstallTable (
void
AcpiTbInstallAndOverrideTable (
UINT32 TableIndex,
ACPI_TABLE_DESC *NewTableDesc);
ACPI_TABLE_DESC *NewTableDesc,
BOOLEAN Override);

ACPI_STATUS
AcpiTbInstallFixedTable (
Expand Down

0 comments on commit 32ae0ea

Please sign in to comment.