MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it
Set the EFI_MEMORY_RUNTIME attribute in FtwNotificationEvent() only if the attribute is not already present. This will ensure that the attributes set by the platform drivers (e.g Ovmf pflash) is not lost. Cc: Dong Eric <eric.dong@intel.com> Cc: Justen Jordan L <jordan.l.justen@intel.com> Cc: Zeng Star <star.zeng@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Star Zeng <star.zeng@intel.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
This commit is contained in:
@@ -412,6 +412,7 @@ FtwNotificationEvent (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((DEBUG_WARN, "Variable driver failed to get flash memory attribute.\n"));
|
DEBUG ((DEBUG_WARN, "Variable driver failed to get flash memory attribute.\n"));
|
||||||
} else {
|
} else {
|
||||||
|
if ((GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME) == 0) {
|
||||||
Status = gDS->SetMemorySpaceAttributes (
|
Status = gDS->SetMemorySpaceAttributes (
|
||||||
BaseAddress,
|
BaseAddress,
|
||||||
Length,
|
Length,
|
||||||
@@ -421,6 +422,7 @@ FtwNotificationEvent (
|
|||||||
DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));
|
DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Status = VariableWriteServiceInitialize ();
|
Status = VariableWriteServiceInitialize ();
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
Reference in New Issue
Block a user