Discussion:
[edk2] [PATCH] MdeModulePkg AcpiTableDxe: Install config table at ACPI data change
Star Zeng
2015-07-07 13:00:57 UTC
Permalink
UEFI spec has clear description below:

Configuration Table Groups
The GUID for a configuration table also defines a corresponding event group GUID with the same value.
If the data represented by a configuration table is changed,
InstallConfigurationTable() should be called.
When InstallConfigurationTable() is called, the corresponding event is signaled.
When this event is signaled,
any components that cache information from the configuration table can optionally update their cached state.
For example, EFI_ACPI_TABLE_GUID defines a configuration table for ACPI data.
When ACPI data is changed, InstallConfigurationTable() is called.
During the execution of InstallConfigurationTable(),
a corresponding event group with EFI_ACPI_TABLE_GUID is signaled,
allowing an application to invalidate any cached ACPI data.

But current implementation only InstallConfigurationTable() at first time ACPI data change.
if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) &&
!AcpiTableInstance->TablesInstalled1) {
Status = gBS->InstallConfigurationTable (&gEfiAcpi10TableGuid, AcpiTableInstance->Rsdp1);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}

AcpiTableInstance->TablesInstalled1 = TRUE;
}

if (((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) &&
!AcpiTableInstance->TablesInstalled3) {
Status = gBS->InstallConfigurationTable (&gEfiAcpiTableGuid, AcpiTableInstance->Rsdp3);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}

AcpiTableInstance->TablesInstalled3= TRUE;
}

The AcpiTableInstance->TablesInstalled1 and AcpiTableInstance->TablesInstalled3 conditional judgment need to be removed.

Cc: Jiewen Yao <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <***@intel.com>
---
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h | 2 --
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 10 ++--------
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
index 6460320..ebedefb 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
@@ -114,8 +114,6 @@ typedef struct {
UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables
UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables
UINTN CurrentHandle;
- BOOLEAN TablesInstalled1; // ACPI 1.0 tables published
- BOOLEAN TablesInstalled3; // ACPI 3.0 tables published
EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;
LIST_ENTRY NotifyList;
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index 1569de0..c6abf1b 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -159,24 +159,18 @@ PublishTables (
// Add the RSD_PTR to the system table and store that we have installed the
// tables.
//
- if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) &&
- !AcpiTableInstance->TablesInstalled1) {
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
Status = gBS->InstallConfigurationTable (&gEfiAcpi10TableGuid, AcpiTableInstance->Rsdp1);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
-
- AcpiTableInstance->TablesInstalled1 = TRUE;
}

- if (((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) &&
- !AcpiTableInstance->TablesInstalled3) {
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
Status = gBS->InstallConfigurationTable (&gEfiAcpiTableGuid, AcpiTableInstance->Rsdp3);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
-
- AcpiTableInstance->TablesInstalled3= TRUE;
}

return EFI_SUCCESS;
--
1.9.5.msysgit.0
Yao, Jiewen
2015-07-08 07:26:52 UTC
Permalink
Looks good.

-----Original Message-----
From: Zeng, Star
Sent: Tuesday, July 07, 2015 9:01 PM
To: edk2-***@lists.sourceforge.net
Cc: Yao, Jiewen
Subject: [PATCH] MdeModulePkg AcpiTableDxe: Install config table at ACPI data change

UEFI spec has clear description below:

Configuration Table Groups
The GUID for a configuration table also defines a corresponding event group GUID with the same value.
If the data represented by a configuration table is changed,
InstallConfigurationTable() should be called.
When InstallConfigurationTable() is called, the corresponding event is signaled.
When this event is signaled,
any components that cache information from the configuration table can optionally update their cached state.
For example, EFI_ACPI_TABLE_GUID defines a configuration table for ACPI data.
When ACPI data is changed, InstallConfigurationTable() is called.
During the execution of InstallConfigurationTable(), a corresponding event group with EFI_ACPI_TABLE_GUID is signaled, allowing an application to invalidate any cached ACPI data.

But current implementation only InstallConfigurationTable() at first time ACPI data change.
if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) &&
!AcpiTableInstance->TablesInstalled1) {
Status = gBS->InstallConfigurationTable (&gEfiAcpi10TableGuid, AcpiTableInstance->Rsdp1);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}

AcpiTableInstance->TablesInstalled1 = TRUE;
}

if (((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) &&
!AcpiTableInstance->TablesInstalled3) {
Status = gBS->InstallConfigurationTable (&gEfiAcpiTableGuid, AcpiTableInstance->Rsdp3);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}

AcpiTableInstance->TablesInstalled3= TRUE;
}

The AcpiTableInstance->TablesInstalled1 and AcpiTableInstance->TablesInstalled3 conditional judgment need to be removed.

Cc: Jiewen Yao <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <***@intel.com>
---
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h | 2 --
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 10 ++--------
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
index 6460320..ebedefb 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
@@ -114,8 +114,6 @@ typedef struct {
UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables
UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables
UINTN CurrentHandle;
- BOOLEAN TablesInstalled1; // ACPI 1.0 tables published
- BOOLEAN TablesInstalled3; // ACPI 3.0 tables published
EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;
LIST_ENTRY NotifyList;
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index 1569de0..c6abf1b 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -159,24 +159,18 @@ PublishTables (
// Add the RSD_PTR to the system table and store that we have installed the
// tables.
//
- if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) &&
- !AcpiTableInstance->TablesInstalled1) {
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
Status = gBS->InstallConfigurationTable (&gEfiAcpi10TableGuid, AcpiTableInstance->Rsdp1);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
-
- AcpiTableInstance->TablesInstalled1 = TRUE;
}

- if (((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) &&
- !AcpiTableInstance->TablesInstalled3) {
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
Status = gBS->InstallConfigurationTable (&gEfiAcpiTableGuid, AcpiTableInstance->Rsdp3);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
-
- AcpiTableInstance->TablesInstalled3= TRUE;
}

return EFI_SUCCESS;
--
1.9.5.msysgit.0

Loading...