[PATCH] UefiPayloadPkg: Keep reserved MMIO at runtime


Akihiko Odaki <akihiko.odaki@...>
 

Signed-off-by: Akihiko Odaki <akihiko.odaki@...>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 9 +++++++++
MdePkg/Include/Pi/PiHob.h | 2 ++
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 3 ++-
3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gc=
d.c
index 3763467bdb..623b316c61 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -2628,6 +2628,15 @@ CoreInitializeGcdServices (
ResourceHob->ResourceLength,=0D
Capabilities=0D
);=0D
+=0D
+ if (!EFI_ERROR (Status) &&=0D
+ (ResourceHob->ResourceAttribute & EFI_RESOURCE_ATTRIBUTE_RUNTI=
ME) =3D=3D EFI_RESOURCE_ATTRIBUTE_RUNTIME) {=0D
+ Status =3D CoreSetMemorySpaceAttributes(=0D
+ ResourceHob->PhysicalStart,=0D
+ ResourceHob->ResourceLength,=0D
+ EFI_MEMORY_RUNTIME=0D
+ );=0D
+ }=0D
}=0D
=0D
if (GcdIoType !=3D EfiGcdIoTypeNonExistent) {=0D
diff --git a/MdePkg/Include/Pi/PiHob.h b/MdePkg/Include/Pi/PiHob.h
index e9f0ab4309..92bacbe62c 100644
--- a/MdePkg/Include/Pi/PiHob.h
+++ b/MdePkg/Include/Pi/PiHob.h
@@ -296,6 +296,8 @@ typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
//=0D
#define EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE 0x02000000=0D
=0D
+#define EFI_RESOURCE_ATTRIBUTE_RUNTIME 0x04000000=0D
+=0D
///=0D
/// Describes the resource properties of all fixed,=0D
/// nonrelocatable resource ranges found on the processor=0D
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo=
adPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 0fed1e3691..a50f1c0271 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -74,7 +74,8 @@ MemInfoCallbackMmio (
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |=0D
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;=0D
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_RUNTIME;=0D
=0D
BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Base, =
Size);=0D
DEBUG ((DEBUG_INFO, "buildhob: base =3D 0x%lx, size =3D 0x%lx, type =3D =
0x%x\n", Base, Size, Type));=0D
--=20
2.35.1

Join devel@edk2.groups.io to automatically receive all group messages.