summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-23 08:15:14 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-23 08:15:14 +0000
commitfc8ff20ff28469d10e5f69de2d44c47f0d522858 (patch)
treed28159cfc5630b025ccc0c982227b4987352ea9a
parentd912bad783d0bb7538c578ce71e307f6b6b09c18 (diff)
downloadedk2-platforms-fc8ff20ff28469d10e5f69de2d44c47f0d522858.tar.xz
MdeModulePkg DXE Core: Update implementation of SetMemorySpaceAttributes() DXE Service to return EFI_NOT_AVAILABLE_YET if CPU Arch Protocol is not available per PI 1.2 Errata C spec.
Signed-off-by: rsun3 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12766 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/Dxe/DxeMain.h14
-rw-r--r--MdeModulePkg/Core/Dxe/Gcd/Gcd.c29
2 files changed, 34 insertions, 9 deletions
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 4949b9f552..8cdfe06054 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -1683,8 +1683,18 @@ CoreGetMemorySpaceDescriptor (
@param Length Specified length
@param Attributes Specified attributes
- @retval EFI_SUCCESS Successfully set attribute of a segment of
- memory space.
+ @retval EFI_SUCCESS The attributes were set for the memory region.
+ @retval EFI_INVALID_PARAMETER Length is zero.
+ @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
+ resource range specified by BaseAddress and Length.
+ @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
+ range specified by BaseAddress and Length.
+ @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by
+ BaseAddress and Length cannot be modified.
+ @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
+ the memory resource range.
+ @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
+ not available yet.
**/
EFI_STATUS
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 5292d368c5..49697ae89c 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -689,7 +689,8 @@ ConverToCpuArchAttributes (
@retval EFI_NOT_FOUND Free a non-using space or remove a non-exist
space, and so on.
@retval EFI_OUT_OF_RESOURCES No buffer could be allocated.
-
+ @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol
+ is not available yet.
**/
EFI_STATUS
CoreConvertSpace (
@@ -831,16 +832,20 @@ CoreConvertSpace (
//
CpuArchAttributes = ConverToCpuArchAttributes (Attributes);
if (CpuArchAttributes != INVALID_CPU_ARCH_ATTRIBUTES) {
- if (gCpu != NULL) {
+ if (gCpu == NULL) {
+ Status = EFI_NOT_AVAILABLE_YET;
+ } else {
Status = gCpu->SetMemoryAttributes (
gCpu,
BaseAddress,
Length,
CpuArchAttributes
);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
+ }
+ if (EFI_ERROR (Status)) {
+ CoreFreePool (TopEntry);
+ CoreFreePool (BottomEntry);
+ goto Done;
}
}
}
@@ -1524,8 +1529,18 @@ CoreGetMemorySpaceDescriptor (
@param Length Specified length
@param Attributes Specified attributes
- @retval EFI_SUCCESS Successfully set attribute of a segment of
- memory space.
+ @retval EFI_SUCCESS The attributes were set for the memory region.
+ @retval EFI_INVALID_PARAMETER Length is zero.
+ @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
+ resource range specified by BaseAddress and Length.
+ @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
+ range specified by BaseAddress and Length.
+ @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by
+ BaseAddress and Length cannot be modified.
+ @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
+ the memory resource range.
+ @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
+ not available yet.
**/
EFI_STATUS