/** @file\r
CPU DXE Module.\r
\r
- Copyright (c) 2008 - 2009, Intel Corporation\r
+ Copyright (c) 2008 - 2010, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
UINTN NumberOfDescriptors;\r
EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;\r
UINT64 DefaultAttributes;\r
- VARIABLE_MTRR VariableMtrr[MTRR_NUMBER_OF_VARIABLE_MTRR];\r
+ VARIABLE_MTRR VariableMtrr[MAX_MTRR_NUMBER_OF_VARIABLE_MTRR];\r
MTRR_FIXED_SETTINGS MtrrFixedSettings;\r
+ UINT32 FirmwareVariableMtrrCount;\r
+ UINT32 UsedMtrr;\r
+\r
+ FirmwareVariableMtrrCount = GetFirmwareVariableMtrrCount ();\r
\r
// mIsFlushingGCD = TRUE;\r
mIsFlushingGCD = FALSE;\r
//\r
// Get the memory attribute of variable MTRRs\r
//\r
+ UsedMtrr = MAX_MTRR_NUMBER_OF_VARIABLE_MTRR;\r
MtrrGetMemoryAttributeInVariableMtrr (\r
mValidMtrrBitsMask,\r
mValidMtrrAddressMask,\r
+ &UsedMtrr,\r
VariableMtrr\r
);\r
\r
//\r
// Go for variable MTRRs with WB attribute\r
//\r
- for (Index = 0; Index < FIRMWARE_VARIABLE_MTRR_NUMBER; Index++) {\r
+ for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {\r
if (VariableMtrr[Index].Valid &&\r
VariableMtrr[Index].Type == MTRR_CACHE_WRITE_BACK) {\r
SetGcdMemorySpaceAttributes (\r
//\r
// Go for variable MTRRs with Non-WB attribute\r
//\r
- for (Index = 0; Index < FIRMWARE_VARIABLE_MTRR_NUMBER; Index++) {\r
+ for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {\r
if (VariableMtrr[Index].Valid &&\r
VariableMtrr[Index].Type != MTRR_CACHE_WRITE_BACK) {\r
Attributes = GetMemorySpaceAttributeFromMtrrType ((UINT8) VariableMtrr[Index].Type);\r