Per PI 1.2 errata B spec, for SetMemoryAttributes() service of CPU Architecture Protocol, EFI_INVALID_PARAMETER should be returned for cases:

If Attributes specifies a combination of memory attributes that cannot be set together, then EFI_INVALID_PARAMETER is returned. For example, if both EFI_MEMORY_UC and EFI_MEMORY_WT are set.

Signed-off-by: rsun3
Reviewed-by:  jyao1


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11694 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3 2011-05-24 01:56:29 +00:00
parent 33d41385e3
commit 4ec21e8b50
2 changed files with 30 additions and 13 deletions

View File

@ -3,7 +3,7 @@
This code abstracts the DXE core from processor implementation details. This code abstracts the DXE core from processor implementation details.
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -244,6 +244,8 @@ EFI_STATUS
@retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
BaseAddress and Length cannot be modified. BaseAddress and Length cannot be modified.
@retval EFI_INVALID_PARAMETER Length is zero. @retval EFI_INVALID_PARAMETER Length is zero.
Attributes specified an illegal combination of attributes that
cannot be set together.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
the memory resource range. the memory resource range.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory

View File

@ -581,19 +581,28 @@ CpuGetTimerValue (
/** /**
Set memory cacheability attributes for given range of memeory. Implementation of SetMemoryAttributes() service of CPU Architecture Protocol.
@param This Protocol instance structure This function modifies the attributes for the memory region specified by BaseAddress and
@param BaseAddress Specifies the start address of the Length from their current attributes to the attributes specified by Attributes.
memory range
@param Length Specifies the length of the memory range
@param Attributes The memory cacheability for the memory range
@retval EFI_SUCCESS If the cacheability of that memory range is @param This The EFI_CPU_ARCH_PROTOCOL instance.
set successfully @param BaseAddress The physical address that is the start address of a memory region.
@retval EFI_UNSUPPORTED If the desired operation cannot be done @param Length The size in bytes of the memory region.
@retval EFI_INVALID_PARAMETER The input parameter is not correct, @param Attributes The bit mask of attributes to set for the memory region.
such as Length = 0
@retval EFI_SUCCESS The attributes were set for the memory region.
@retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
BaseAddress and Length cannot be modified.
@retval EFI_INVALID_PARAMETER Length is zero.
Attributes specified an illegal combination of attributes that
cannot be set together.
@retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
the memory resource range.
@retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
resource range specified by BaseAddress and Length.
The bit mask of attributes is not support for the memory resource
range specified by BaseAddress and Length.
**/ **/
EFI_STATUS EFI_STATUS
@ -644,8 +653,14 @@ CpuSetMemoryAttributes (
CacheType = CacheWriteBack; CacheType = CacheWriteBack;
break; break;
default: case EFI_MEMORY_UCE:
case EFI_MEMORY_RP:
case EFI_MEMORY_XP:
case EFI_MEMORY_RUNTIME:
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
default:
return EFI_INVALID_PARAMETER;
} }
// //
// call MTRR libary function // call MTRR libary function