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
This commit is contained in:
rsun3 2011-11-23 08:15:14 +00:00
parent d912bad783
commit fc8ff20ff2
2 changed files with 34 additions and 9 deletions

View File

@ -1683,8 +1683,18 @@ CoreGetMemorySpaceDescriptor (
@param Length Specified length @param Length Specified length
@param Attributes Specified attributes @param Attributes Specified attributes
@retval EFI_SUCCESS Successfully set attribute of a segment of @retval EFI_SUCCESS The attributes were set for the memory region.
memory space. @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 EFI_STATUS

View File

@ -689,7 +689,8 @@ ConverToCpuArchAttributes (
@retval EFI_NOT_FOUND Free a non-using space or remove a non-exist @retval EFI_NOT_FOUND Free a non-using space or remove a non-exist
space, and so on. space, and so on.
@retval EFI_OUT_OF_RESOURCES No buffer could be allocated. @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 EFI_STATUS
CoreConvertSpace ( CoreConvertSpace (
@ -831,16 +832,20 @@ CoreConvertSpace (
// //
CpuArchAttributes = ConverToCpuArchAttributes (Attributes); CpuArchAttributes = ConverToCpuArchAttributes (Attributes);
if (CpuArchAttributes != INVALID_CPU_ARCH_ATTRIBUTES) { if (CpuArchAttributes != INVALID_CPU_ARCH_ATTRIBUTES) {
if (gCpu != NULL) { if (gCpu == NULL) {
Status = EFI_NOT_AVAILABLE_YET;
} else {
Status = gCpu->SetMemoryAttributes ( Status = gCpu->SetMemoryAttributes (
gCpu, gCpu,
BaseAddress, BaseAddress,
Length, Length,
CpuArchAttributes 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 Length Specified length
@param Attributes Specified attributes @param Attributes Specified attributes
@retval EFI_SUCCESS Successfully set attribute of a segment of @retval EFI_SUCCESS The attributes were set for the memory region.
memory space. @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 EFI_STATUS