MdeModulePkg/ACPI: Install ACPI table from HOB.

If HOB contains APCI table information, entry point of AcpiTableDxe.inf
should parse the APCI table from HOB, and install these tables.
We assume the whole ACPI table
(starting with EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
is contained by a single gEfiAcpiTableGuid HOB.

If error happens when installing ACPI table, stop installing and removing
all the tables that are already added.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Tested-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
Zhiguang Liu
2021-04-30 14:17:56 +08:00
committed by mergify[bot]
parent 75293330ea
commit 761329ee27
4 changed files with 271 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
/** @file
ACPI Sdt Protocol Driver
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
Copyright (c) 2010 - 2021, Intel Corporation. All rights reserved. <BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -191,8 +191,7 @@ SdtNotifyAcpiList (
/**
Returns a requested ACPI table.
The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated
with the Index that was input. The following structures are not considered elements in the list of
The following structures are not considered elements in the list of
ACPI tables:
- Root System Description Pointer (RSD_PTR)
- Root System Description Table (RSDT)
@@ -201,42 +200,32 @@ SdtNotifyAcpiList (
member. For tables installed via the EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable() interface,
the function returns the value of EFI_ACPI_STD_PROTOCOL.AcpiVersion.
@param[in] Index The zero-based index of the table to retrieve.
@param[out] Table Pointer for returning the table buffer.
@param[out] Version On return, updated with the ACPI versions to which this table belongs. Type
EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the
EFI_ACPI_SDT_PROTOCOL.
@param[out] TableKey On return, points to the table key for the specified ACPI system definition table.
This is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL.
The TableKey can be passed to EFI_ACPI_TABLE_PROTOCOL.UninstallAcpiTable()
to uninstall the table.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_FOUND The requested index is too large and a table was not found.
@param[in] AcpiTableInstance ACPI table Instance.
@param[in] Index The zero-based index of the table to retrieve.
@param[out] Table Pointer for returning the table buffer.
@param[out] Version On return, updated with the ACPI versions to which this table belongs. Type
EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the
EFI_ACPI_SDT_PROTOCOL.
@param[out] TableKey On return, points to the table key for the specified ACPI system definition table.
This is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL.
The TableKey can be passed to EFI_ACPI_TABLE_PROTOCOL.UninstallAcpiTable()
to uninstall the table.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_FOUND The requested index is too large and a table was not found.
**/
EFI_STATUS
EFIAPI
GetAcpiTable2 (
SdtGetAcpiTable (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
UINTN TableIndex;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *CurrentTable;
ASSERT (Table != NULL);
ASSERT (Version != NULL);
ASSERT (TableKey != NULL);
//
// Get the instance of the ACPI Table
//
AcpiTableInstance = SdtGetAcpiTableInstance ();
//
// Find the table
//
@@ -270,6 +259,55 @@ GetAcpiTable2 (
return EFI_SUCCESS;
}
/**
Returns a requested ACPI table.
The GetAcpiTable() function returns a pointer to a buffer containing the ACPI table associated
with the Index that was input. The following structures are not considered elements in the list of
ACPI tables:
- Root System Description Pointer (RSD_PTR)
- Root System Description Table (RSDT)
- Extended System Description Table (XSDT)
Version is updated with a bit map containing all the versions of ACPI of which the table is a
member. For tables installed via the EFI_ACPI_TABLE_PROTOCOL.InstallAcpiTable() interface,
the function returns the value of EFI_ACPI_STD_PROTOCOL.AcpiVersion.
@param[in] Index The zero-based index of the table to retrieve.
@param[out] Table Pointer for returning the table buffer.
@param[out] Version On return, updated with the ACPI versions to which this table belongs. Type
EFI_ACPI_TABLE_VERSION is defined in "Related Definitions" in the
EFI_ACPI_SDT_PROTOCOL.
@param[out] TableKey On return, points to the table key for the specified ACPI system definition table.
This is identical to the table key used in the EFI_ACPI_TABLE_PROTOCOL.
The TableKey can be passed to EFI_ACPI_TABLE_PROTOCOL.UninstallAcpiTable()
to uninstall the table.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_FOUND The requested index is too large and a table was not found.
**/
EFI_STATUS
EFIAPI
GetAcpiTable2 (
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
ASSERT (Table != NULL);
ASSERT (Version != NULL);
ASSERT (TableKey != NULL);
//
// Get the instance of the ACPI Table
//
AcpiTableInstance = SdtGetAcpiTableInstance ();
return SdtGetAcpiTable (AcpiTableInstance, Index, Table, Version, TableKey);
}
/**
Register a callback when an ACPI table is installed.