From f0071740ec3c7a536201cb02cec013442805760a Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 17 Jun 2015 02:51:47 +0000 Subject: [PATCH] MdeModulePkg AcpiTableDxe: Cover EFI_ACPI_TABLE_VERSION_5_0. Follow PI 1.4 spec, 1. Cover EFI_ACPI_TABLE_VERSION_5_0. 2. Update TableKey parameter description in the EFI_ACPI_SDT_PROTOCOL.GetAcpiTable() section. 3. Update EFI_ACPI_SDT_PROTOCOL.GetAcpiTable() description. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17649 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/Acpi/AcpiTableDxe/AcpiSdt.c | 14 +++-- .../Universal/Acpi/AcpiTableDxe/AcpiSdt.h | 11 ++-- .../Universal/Acpi/AcpiTableDxe/AcpiTable.h | 32 ++-------- .../Acpi/AcpiTableDxe/AcpiTableProtocol.c | 58 +++++++------------ 4 files changed, 41 insertions(+), 74 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c index 93f26606d0..57fdc7844e 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c @@ -1,7 +1,7 @@ /** @file ACPI Sdt Protocol Driver - Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
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 @@ -19,7 +19,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_SDT_PROTOCOL mAcpiSdtProtocolTemplate = { - EFI_ACPI_TABLE_VERSION_NONE | EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0 | EFI_ACPI_TABLE_VERSION_4_0, + EFI_ACPI_TABLE_VERSION_NONE | EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0, GetAcpiTable2, RegisterNotify, Open, @@ -204,16 +204,18 @@ SdtNotifyAcpiList ( - 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. + 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. - + @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. **/ diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h index 2eca1e432f..f11bdee9ac 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h @@ -1,7 +1,7 @@ /** @file ACPI Sdt Protocol Driver - Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
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 @@ -155,15 +155,18 @@ struct _AML_BYTE_ENCODING { - 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. + 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. + @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. diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h index 6541a84501..6460320995 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h @@ -1,7 +1,7 @@ /** @file ACPI Table Protocol Driver - Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
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 @@ -40,32 +40,12 @@ #include "AcpiSdt.h" // -// From Protocol/AcpiSupport.h +// Great than or equal to 2.0. // - -// -// ACPI Version bitmap definition: -// -// EFI_ACPI_TABLE_VERSION_1_0B - ACPI Version 1.0b -// EFI_ACPI_TABLE_VERSION_2_0 - ACPI Version 2.0 -// EFI_ACPI_TABLE_VERSION_3_0 - ACPI Version 3.0 -// EFI_ACPI_TABLE_VERSION_NONE - No ACPI Versions. This might be used -// to create memory-based operation regions or other information -// that is not part of the ACPI "tree" but must still be found -// in ACPI memory space and/or managed by the core ACPI driver. -// -// Note that EFI provides discrete GUIDs for each version of ACPI -// that is supported. It is expected that each EFI GUIDed -// version of ACPI will also have a corresponding bitmap -// definition. This allows maintenance of separate ACPI trees -// for each distinctly different version of ACPI. -// -#define EFI_ACPI_TABLE_VERSION UINT32 - -#define EFI_ACPI_TABLE_VERSION_NONE (1 << 0) -#define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1) -#define EFI_ACPI_TABLE_VERSION_2_0 (1 << 2) -#define EFI_ACPI_TABLE_VERSION_3_0 (1 << 3) +#define ACPI_TABLE_VERSION_GTE_2_0 (EFI_ACPI_TABLE_VERSION_2_0 | \ + EFI_ACPI_TABLE_VERSION_3_0 | \ + EFI_ACPI_TABLE_VERSION_4_0 | \ + EFI_ACPI_TABLE_VERSION_5_0) // // Private Driver Data diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index 247c398c4f..d016f341ca 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 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
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 @@ -134,8 +134,7 @@ PublishTables ( CurrentRsdtEntry = (UINT32 *) ((UINT8 *) AcpiTableInstance->Rsdt1 + sizeof (EFI_ACPI_DESCRIPTION_HEADER)); *CurrentRsdtEntry = (UINT32) (UINTN) AcpiTableInstance->Fadt1; } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { CurrentRsdtEntry = (UINT32 *) ((UINT8 *) AcpiTableInstance->Rsdt3 + sizeof (EFI_ACPI_DESCRIPTION_HEADER)); *CurrentRsdtEntry = (UINT32) (UINTN) AcpiTableInstance->Fadt3; CurrentXsdtEntry = (VOID *) ((UINT8 *) AcpiTableInstance->Xsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER)); @@ -170,8 +169,7 @@ PublishTables ( AcpiTableInstance->TablesInstalled1 = TRUE; } - if (((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) && + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) && !AcpiTableInstance->TablesInstalled3) { Status = gBS->InstallConfigurationTable (&gEfiAcpiTableGuid, AcpiTableInstance->Rsdp3); if (EFI_ERROR (Status)) { @@ -240,13 +238,13 @@ InstallAcpiTable ( AcpiTableInstance, AcpiTableBufferConst, TRUE, - EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0, + EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0, TableKey ); if (!EFI_ERROR (Status)) { Status = PublishTables ( AcpiTableInstance, - EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0 + EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0 ); } FreePool (AcpiTableBufferConst); @@ -258,7 +256,7 @@ InstallAcpiTable ( if (!EFI_ERROR (Status)) { SdtNotifyAcpiList ( AcpiTableInstance, - EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0, + EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0, *TableKey ); } @@ -298,13 +296,13 @@ UninstallAcpiTable ( // Status = RemoveTableFromList ( AcpiTableInstance, - EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0, + EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0, TableKey ); if (!EFI_ERROR (Status)) { Status = PublishTables ( AcpiTableInstance, - EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0 + EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0 ); } @@ -559,8 +557,7 @@ AddTableToList ( // Check that the table has not been previously added. // if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0 && AcpiTableInstance->Fadt1 != NULL) || - ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 && AcpiTableInstance->Fadt3 != NULL) || - ((Version & EFI_ACPI_TABLE_VERSION_3_0) != 0 && AcpiTableInstance->Fadt3 != NULL) + ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0 && AcpiTableInstance->Fadt3 != NULL) ) { gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages); gBS->FreePool (CurrentTableList); @@ -607,8 +604,7 @@ AddTableToList ( AcpiTableInstance->Rsdt1->OemRevision = AcpiTableInstance->Fadt1->Header.OemRevision; } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { // // Save a pointer to the table // @@ -696,8 +692,7 @@ AddTableToList ( // Check that the table has not been previously added. // if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0 && AcpiTableInstance->Facs1 != NULL) || - ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 && AcpiTableInstance->Facs3 != NULL) || - ((Version & EFI_ACPI_TABLE_VERSION_3_0) != 0 && AcpiTableInstance->Facs3 != NULL) + ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0 && AcpiTableInstance->Facs3 != NULL) ) { gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages); gBS->FreePool (CurrentTableList); @@ -735,8 +730,7 @@ AddTableToList ( } } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { // // Save a pointer to the table // @@ -782,8 +776,7 @@ AddTableToList ( // Check that the table has not been previously added. // if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0 && AcpiTableInstance->Dsdt1 != NULL) || - ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 && AcpiTableInstance->Dsdt3 != NULL) || - ((Version & EFI_ACPI_TABLE_VERSION_3_0) != 0 && AcpiTableInstance->Dsdt3 != NULL) + ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0 && AcpiTableInstance->Dsdt3 != NULL) ) { gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages); gBS->FreePool (CurrentTableList); @@ -821,8 +814,7 @@ AddTableToList ( } } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { // // Save a pointer to the table // @@ -922,8 +914,7 @@ AddTableToList ( // // Add to ACPI 2.0/3.0 table tree // - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { if (AddToRsdt) { // // If the table number exceed the gEfiAcpiMaxNumTables, enlarge the table buffer @@ -1255,17 +1246,11 @@ DeleteTable ( } } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0 & Table->Version) || - (Version & EFI_ACPI_TABLE_VERSION_3_0 & Table->Version)) { + if (Version & ACPI_TABLE_VERSION_GTE_2_0 & Table->Version) { // // Remove this version from the table // - if (Version & EFI_ACPI_TABLE_VERSION_2_0 & Table->Version) { - Table->Version = Table->Version &~EFI_ACPI_TABLE_VERSION_2_0; - } - if (Version & EFI_ACPI_TABLE_VERSION_3_0 & Table->Version) { - Table->Version = Table->Version &~EFI_ACPI_TABLE_VERSION_3_0; - } + Table->Version = Table->Version &~(Version & ACPI_TABLE_VERSION_GTE_2_0); // // Remove from Rsdt and Xsdt. We don't care about the return value @@ -1291,8 +1276,7 @@ DeleteTable ( AcpiTableInstance->Fadt1 = NULL; } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { AcpiTableInstance->Fadt3 = NULL; } break; @@ -1319,8 +1303,7 @@ DeleteTable ( } } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { AcpiTableInstance->Facs3 = NULL; // @@ -1366,8 +1349,7 @@ DeleteTable ( } - if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 || - (Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) { + if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) { AcpiTableInstance->Dsdt3 = NULL; //