* [PATCH] MdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities.
@ 2017-01-09 6:34 Jiewen Yao
2017-01-09 6:38 ` Zeng, Star
0 siblings, 1 reply; 2+ messages in thread
From: Jiewen Yao @ 2017-01-09 6:34 UTC (permalink / raw)
To: edk2-devel; +Cc: Star Zeng, Feng Tian
When gDS->SetMemorySpaceCapabilities() is called,
current DXE core will sync all GCD attributes to memory map
attributes, including RUNTIME attributes.
It is wrong, because RUNTIME attributes should be set for
runtime memory only.
This fix clears the RUNTIME attributes before convert to UEFI
memory map. So that the UEFI memory map is good after
gDS->SetMemorySpaceCapabilities() is called.
Cc: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index bd7c6c6..056fc6a 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -1624,7 +1624,7 @@ CoreSetMemorySpaceCapabilities (
Status = CoreConvertSpace (GCD_SET_CAPABILITIES_MEMORY_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, Capabilities, 0);
if (!EFI_ERROR(Status)) {
- CoreUpdateMemoryAttributes(BaseAddress, RShiftU64(Length, EFI_PAGE_SHIFT), Capabilities);
+ CoreUpdateMemoryAttributes(BaseAddress, RShiftU64(Length, EFI_PAGE_SHIFT), Capabilities & (~EFI_MEMORY_RUNTIME));
}
return Status;
--
2.7.4.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities.
2017-01-09 6:34 [PATCH] MdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities Jiewen Yao
@ 2017-01-09 6:38 ` Zeng, Star
0 siblings, 0 replies; 2+ messages in thread
From: Zeng, Star @ 2017-01-09 6:38 UTC (permalink / raw)
To: Yao, Jiewen, edk2-devel@lists.01.org; +Cc: Tian, Feng, Zeng, Star
Reviewed-by: Star Zeng <star.zeng@intel.com>
-----Original Message-----
From: Yao, Jiewen
Sent: Monday, January 9, 2017 2:35 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Tian, Feng <feng.tian@intel.com>
Subject: [PATCH] MdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities.
When gDS->SetMemorySpaceCapabilities() is called, current DXE core will sync all GCD attributes to memory map attributes, including RUNTIME attributes.
It is wrong, because RUNTIME attributes should be set for runtime memory only.
This fix clears the RUNTIME attributes before convert to UEFI memory map. So that the UEFI memory map is good after
gDS->SetMemorySpaceCapabilities() is called.
Cc: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index bd7c6c6..056fc6a 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -1624,7 +1624,7 @@ CoreSetMemorySpaceCapabilities (
Status = CoreConvertSpace (GCD_SET_CAPABILITIES_MEMORY_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, Capabilities, 0);
if (!EFI_ERROR(Status)) {
- CoreUpdateMemoryAttributes(BaseAddress, RShiftU64(Length, EFI_PAGE_SHIFT), Capabilities);
+ CoreUpdateMemoryAttributes(BaseAddress, RShiftU64(Length,
+ EFI_PAGE_SHIFT), Capabilities & (~EFI_MEMORY_RUNTIME));
}
return Status;
--
2.7.4.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-09 6:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-09 6:34 [PATCH] MdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities Jiewen Yao
2017-01-09 6:38 ` Zeng, Star
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox