Roll back the change on GetMemorySpaceAttributeFromMtrrType()'s parameter type, from MTRR_MEMORY_CACHE_TYPE to UINT8 since MtrrAttributes may be the value not belongs to MTRR_MEMORY_CACHE_TYPE.

Signed-off-by: vanjeff



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12609 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2011-10-31 06:45:56 +00:00
parent da27b950d5
commit 2c4b1bdce7
1 changed files with 6 additions and 6 deletions

View File

@ -714,7 +714,7 @@ InitializeMtrrMask (
**/ **/
UINT64 UINT64
GetMemorySpaceAttributeFromMtrrType ( GetMemorySpaceAttributeFromMtrrType (
IN MTRR_MEMORY_CACHE_TYPE MtrrAttributes IN UINT8 MtrrAttributes
) )
{ {
switch (MtrrAttributes) { switch (MtrrAttributes) {
@ -879,14 +879,14 @@ RefreshGcdMemoryAttributes (
UINT64 Length; UINT64 Length;
UINT64 Attributes; UINT64 Attributes;
UINT64 CurrentAttributes; UINT64 CurrentAttributes;
MTRR_MEMORY_CACHE_TYPE MtrrType; UINT8 MtrrType;
UINTN NumberOfDescriptors; UINTN NumberOfDescriptors;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap; EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
UINT64 DefaultAttributes; UINT64 DefaultAttributes;
VARIABLE_MTRR VariableMtrr[MTRR_NUMBER_OF_VARIABLE_MTRR]; VARIABLE_MTRR VariableMtrr[MTRR_NUMBER_OF_VARIABLE_MTRR];
MTRR_FIXED_SETTINGS MtrrFixedSettings; MTRR_FIXED_SETTINGS MtrrFixedSettings;
UINT32 FirmwareVariableMtrrCount; UINT32 FirmwareVariableMtrrCount;
MTRR_MEMORY_CACHE_TYPE DefaultMemoryType; UINT8 DefaultMemoryType;
if (!IsMtrrSupported ()) { if (!IsMtrrSupported ()) {
return; return;
@ -921,7 +921,7 @@ RefreshGcdMemoryAttributes (
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
DefaultMemoryType = MtrrGetDefaultMemoryType (); DefaultMemoryType = (UINT8) MtrrGetDefaultMemoryType ();
DefaultAttributes = GetMemorySpaceAttributeFromMtrrType (DefaultMemoryType); DefaultAttributes = GetMemorySpaceAttributeFromMtrrType (DefaultMemoryType);
// //
@ -962,7 +962,7 @@ RefreshGcdMemoryAttributes (
if (VariableMtrr[Index].Valid && if (VariableMtrr[Index].Valid &&
VariableMtrr[Index].Type != MTRR_CACHE_WRITE_BACK && VariableMtrr[Index].Type != MTRR_CACHE_WRITE_BACK &&
VariableMtrr[Index].Type != MTRR_CACHE_UNCACHEABLE) { VariableMtrr[Index].Type != MTRR_CACHE_UNCACHEABLE) {
Attributes = GetMemorySpaceAttributeFromMtrrType ((MTRR_MEMORY_CACHE_TYPE) VariableMtrr[Index].Type); Attributes = GetMemorySpaceAttributeFromMtrrType ((UINT8) VariableMtrr[Index].Type);
SetGcdMemorySpaceAttributes ( SetGcdMemorySpaceAttributes (
MemorySpaceMap, MemorySpaceMap,
NumberOfDescriptors, NumberOfDescriptors,
@ -1002,7 +1002,7 @@ RefreshGcdMemoryAttributes (
// Check for continuous fixed MTRR sections // Check for continuous fixed MTRR sections
// //
for (SubIndex = 0; SubIndex < 8; SubIndex++) { for (SubIndex = 0; SubIndex < 8; SubIndex++) {
MtrrType = (MTRR_MEMORY_CACHE_TYPE) RShiftU64 (RegValue, SubIndex * 8); MtrrType = (UINT8) RShiftU64 (RegValue, SubIndex * 8);
CurrentAttributes = GetMemorySpaceAttributeFromMtrrType (MtrrType); CurrentAttributes = GetMemorySpaceAttributeFromMtrrType (MtrrType);
if (Length == 0) { if (Length == 0) {
// //