summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2014-05-06 02:11:23 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2014-05-06 02:11:23 +0000
commit5966402ed51c5b611bf437c812047dc9c432a47e (patch)
treec6fa2a7aabd067fe170813ff84dd9cbfb7fe89d3
parenta06ec3e2af16c64709a77c8a354d6cec92185f1f (diff)
downloadedk2-platforms-5966402ed51c5b611bf437c812047dc9c432a47e.tar.xz
MdeModulePkg/IntelFrameworkModulePkg ACPI: Follow the new UEFI 2.4a spec to return EFI_ACCESS_DENIED for duplicated FADT, FACS or DSDT installation.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15496 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupportAcpiSupportProtocol.c42
-rw-r--r--MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c127
-rw-r--r--MdePkg/Include/Protocol/AcpiTable.h14
3 files changed, 46 insertions, 137 deletions
diff --git a/IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupportAcpiSupportProtocol.c b/IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupportAcpiSupportProtocol.c
index 3bcff22dcf..6443c3acd0 100644
--- a/IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupportAcpiSupportProtocol.c
+++ b/IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupportAcpiSupportProtocol.c
@@ -1,7 +1,7 @@
/** @file
ACPI Support Protocol implementation
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -375,6 +375,9 @@ PublishTables (
and the size field embedded in the ACPI table pointed to by AcpiTableBuffer
are not in sync.
@return EFI_OUT_OF_RESOURCES Insufficient resources exist to complete the request.
+ @retval EFI_ACCESS_DENIED The table signature matches a table already
+ present in the system and platform policy
+ does not allow duplicate tables of this type.
**/
EFI_STATUS
@@ -410,13 +413,13 @@ InstallAcpiTable (
//
AcpiTableBufferConst = AllocateCopyPool (AcpiTableBufferSize, AcpiTableBuffer);
*TableKey = 0;
- Status = AcpiSupport->SetAcpiTable (
- AcpiSupport,
- AcpiTableBufferConst,
- TRUE,
- EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,
- TableKey
- );
+ Status = AddTableToList (
+ AcpiSupportInstance,
+ AcpiTableBufferConst,
+ TRUE,
+ EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,
+ TableKey
+ );
if (!EFI_ERROR (Status)) {
Status = AcpiSupport->PublishTables (
AcpiSupport,
@@ -457,13 +460,11 @@ UninstallAcpiTable (
//
// Uninstall the ACPI table by using ACPI support protocol
//
- Status = AcpiSupport->SetAcpiTable (
- AcpiSupport,
- NULL,
- FALSE,
- EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,
- &TableKey
- );
+ Status = RemoveTableFromList (
+ AcpiSupportInstance,
+ EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,
+ TableKey
+ );
if (!EFI_ERROR (Status)) {
Status = AcpiSupport->PublishTables (
AcpiSupport,
@@ -588,8 +589,9 @@ ReallocateAcpiTableBuffer (
@return EFI_SUCCESS The function completed successfully.
@return EFI_OUT_OF_RESOURCES Could not allocate a required resource.
- @return EFI_ABORTED The table is a duplicate of a table that is required
- to be unique.
+ @retval EFI_ACCESS_DENIED The table signature matches a table already
+ present in the system and platform policy
+ does not allow duplicate tables of this type.
**/
EFI_STATUS
AddTableToList (
@@ -724,7 +726,7 @@ AddTableToList (
) {
gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
gBS->FreePool (CurrentTableList);
- return EFI_ABORTED;
+ return EFI_ACCESS_DENIED;
}
//
// Add the table to the appropriate table version
@@ -865,7 +867,7 @@ AddTableToList (
) {
gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
gBS->FreePool (CurrentTableList);
- return EFI_ABORTED;
+ return EFI_ACCESS_DENIED;
}
//
// FACS is referenced by FADT and is not part of RSDT
@@ -949,7 +951,7 @@ AddTableToList (
) {
gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
gBS->FreePool (CurrentTableList);
- return EFI_ABORTED;
+ return EFI_ACCESS_DENIED;
}
//
// DSDT is referenced by FADT and is not part of RSDT
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index f8cf99ac2f..76f2199c96 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -1,7 +1,7 @@
/** @file
ACPI Table Protocol Implementation
- Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -99,109 +99,6 @@ ChecksumCommonTables (
//
/**
- This function adds, removes, or updates ACPI tables. If the address is not
- null and the handle value is null, the table is added. If both the address and
- handle are not null, the table at handle is updated with the table at address.
- If the address is null and the handle is not, the table at handle is deleted.
-
- @param AcpiTableInstance Instance of the protocol.
- @param Table Pointer to a table.
- @param Checksum Boolean indicating if the checksum should be calculated.
- @param Version Version(s) to set.
- @param Handle Handle of the table.
-
- @return EFI_SUCCESS The function completed successfully.
- @return EFI_INVALID_PARAMETER Both the Table and *Handle were NULL.
- @return EFI_ABORTED Could not complete the desired request.
-
-**/
-EFI_STATUS
-EFIAPI
-SetAcpiTable (
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
- IN VOID *Table OPTIONAL,
- IN BOOLEAN Checksum,
- IN EFI_ACPI_TABLE_VERSION Version,
- IN OUT UINTN *Handle
- )
-{
- UINTN SavedHandle;
- EFI_STATUS Status;
-
- //
- // Check for invalid input parameters
- //
- ASSERT (Handle);
-
- //
- // Initialize locals
- //
- //
- // Determine desired action
- //
- if (*Handle == 0) {
- if (Table == NULL) {
- //
- // Invalid parameter combination
- //
- return EFI_INVALID_PARAMETER;
- } else {
- //
- // Add table
- //
- Status = AddTableToList (AcpiTableInstance, Table, Checksum, Version, Handle);
- }
- } else {
- if (Table != NULL) {
- //
- // Update table
- //
- //
- // Delete the table list entry
- //
- Status = RemoveTableFromList (AcpiTableInstance, Version, *Handle);
- if (EFI_ERROR (Status)) {
- //
- // Should not get an error here ever, but abort if we do.
- //
- return EFI_ABORTED;
- }
- //
- // Set the handle to replace the table at the same handle
- //
- SavedHandle = AcpiTableInstance->CurrentHandle;
- AcpiTableInstance->CurrentHandle = *Handle;
-
- //
- // Add the table
- //
- Status = AddTableToList (AcpiTableInstance, Table, Checksum, Version, Handle);
-
- //
- // Restore the saved current handle
- //
- AcpiTableInstance->CurrentHandle = SavedHandle;
- } else {
- //
- // Delete table
- //
- Status = RemoveTableFromList (AcpiTableInstance, Version, *Handle);
- }
- }
-
- if (EFI_ERROR (Status)) {
- //
- // Should not get an error here ever, but abort if we do.
- //
- return EFI_ABORTED;
- }
- //
- // Done
- //
- return EFI_SUCCESS;
-}
-
-/**
This function publishes the specified versions of the ACPI tables by
installing EFI configuration table entries for them. Any combination of
table versions can be published.
@@ -303,6 +200,9 @@ PublishTables (
and the size field embedded in the ACPI table pointed to by AcpiTableBuffer
are not in sync.
@return EFI_OUT_OF_RESOURCES Insufficient resources exist to complete the request.
+ @retval EFI_ACCESS_DENIED The table signature matches a table already
+ present in the system and platform policy
+ does not allow duplicate tables of this type.
**/
EFI_STATUS
@@ -336,7 +236,7 @@ InstallAcpiTable (
//
AcpiTableBufferConst = AllocateCopyPool (AcpiTableBufferSize,AcpiTableBuffer);
*TableKey = 0;
- Status = SetAcpiTable (
+ Status = AddTableToList (
AcpiTableInstance,
AcpiTableBufferConst,
TRUE,
@@ -396,12 +296,10 @@ UninstallAcpiTable (
//
// Uninstall the ACPI table
//
- Status = SetAcpiTable (
+ Status = RemoveTableFromList (
AcpiTableInstance,
- NULL,
- FALSE,
EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,
- &TableKey
+ TableKey
);
if (!EFI_ERROR (Status)) {
Status = PublishTables (
@@ -528,8 +426,9 @@ ReallocateAcpiTableBuffer (
@return EFI_SUCCESS The function completed successfully.
@return EFI_OUT_OF_RESOURCES Could not allocate a required resource.
- @return EFI_ABORTED The table is a duplicate of a table that is required
- to be unique.
+ @retval EFI_ACCESS_DENIED The table signature matches a table already
+ present in the system and platform policy
+ does not allow duplicate tables of this type.
**/
EFI_STATUS
@@ -665,7 +564,7 @@ AddTableToList (
) {
gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
gBS->FreePool (CurrentTableList);
- return EFI_ABORTED;
+ return EFI_ACCESS_DENIED;
}
//
// Add the table to the appropriate table version
@@ -800,7 +699,7 @@ AddTableToList (
) {
gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
gBS->FreePool (CurrentTableList);
- return EFI_ABORTED;
+ return EFI_ACCESS_DENIED;
}
//
// FACS is referenced by FADT and is not part of RSDT
@@ -884,7 +783,7 @@ AddTableToList (
) {
gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
gBS->FreePool (CurrentTableList);
- return EFI_ABORTED;
+ return EFI_ACCESS_DENIED;
}
//
// DSDT is referenced by FADT and is not part of RSDT
diff --git a/MdePkg/Include/Protocol/AcpiTable.h b/MdePkg/Include/Protocol/AcpiTable.h
index 13a39d89c1..6149b7e453 100644
--- a/MdePkg/Include/Protocol/AcpiTable.h
+++ b/MdePkg/Include/Protocol/AcpiTable.h
@@ -2,7 +2,7 @@
The file provides the protocol to install or remove an ACPI
table from a platform.
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -31,7 +31,12 @@ typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL;
copy into the RSDT/XSDT. InstallAcpiTable() must insert the new
table at the end of the RSDT/XSDT. To prevent namespace
collision, ACPI tables may be created using UEFI ACPI table
- format. On successful output, TableKey is
+ format. If this protocol is used to install a table with a
+ signature already present in the system, the new table will not
+ replace the existing table. It is a platform implementation
+ decision to add a new table with a signature matching an
+ existing table or disallow duplicate table signatures and
+ return EFI_ACCESS_DENIED. On successful output, TableKey is
initialized with a unique key. Its value may be used in a
subsequent call to UninstallAcpiTable to remove an ACPI table.
If an EFI application is running at the time of this call, the
@@ -61,7 +66,10 @@ typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL;
@retval EFI_OUT_OF_RESOURCES Insufficient resources exist to
complete the request.
-
+ @retval EFI_ACCESS_DENIED The table signature matches a table already
+ present in the system and platform policy
+ does not allow duplicate tables of this type.
+
**/
typedef
EFI_STATUS