1. Introduce the API MtrrGetDefaultMemoryType () in Mtrr Library.
2. Invoke MtrrGetDefaultMemoryType() to get the default memory type instead of the hard code value in module. 3. Add go though for UC attributes. Signed-off-by: vanjeff Reviewed-by: rsun3 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12587 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -144,17 +144,21 @@ GetFirmwareVariableMtrrCount (
|
||||
/**
|
||||
Returns the default MTRR cache type for the system.
|
||||
|
||||
@return MTRR default type
|
||||
@return The default MTRR cache type.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
GetMtrrDefaultMemoryType (
|
||||
MTRR_MEMORY_CACHE_TYPE
|
||||
EFIAPI
|
||||
MtrrGetDefaultMemoryType (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
return (AsmReadMsr64 (MTRR_LIB_IA32_MTRR_DEF_TYPE) & 0xff);
|
||||
}
|
||||
if (!IsMtrrSupported ()) {
|
||||
return CacheUncacheable;
|
||||
}
|
||||
|
||||
return (MTRR_MEMORY_CACHE_TYPE) (AsmReadMsr64 (MTRR_LIB_IA32_MTRR_DEF_TYPE) & 0x7);
|
||||
}
|
||||
|
||||
/**
|
||||
Preparation before programming MTRR.
|
||||
@@ -1036,7 +1040,7 @@ MtrrSetMemoryAttribute (
|
||||
// The memory type is the same with the type specified by
|
||||
// MTRR_LIB_IA32_MTRR_DEF_TYPE.
|
||||
//
|
||||
if ((!OverwriteExistingMtrr) && (Attribute == GetMtrrDefaultMemoryType ())) {
|
||||
if ((!OverwriteExistingMtrr) && (Attribute == MtrrGetDefaultMemoryType ())) {
|
||||
//
|
||||
// Invalidate the now-unused MTRRs
|
||||
//
|
||||
|
Reference in New Issue
Block a user