summaryrefslogtreecommitdiff
path: root/UefiCpuPkg/CpuDxe
diff options
context:
space:
mode:
authorjyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-05 06:33:42 +0000
committerjyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-05 06:33:42 +0000
commit3b9be4164b8714a4d866e822cfacb1ea6da6ef7b (patch)
treef84fab3b814fa78cd4e5205a7d39bccc49d28dee /UefiCpuPkg/CpuDxe
parent1b2bf3cadcd1beac1ad0da61bc8142e00aa848ed (diff)
downloadedk2-platforms-3b9be4164b8714a4d866e822cfacb1ea6da6ef7b.tar.xz
Original MTRR lib hardcode VARIABLE_MTRR as 8. But it is 7 in Core2 if SMRR enabled, and 10 in latest Corei7.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9935 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UefiCpuPkg/CpuDxe')
-rw-r--r--UefiCpuPkg/CpuDxe/CpuDxe.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index 25131febf2..68579a7da0 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -1,7 +1,7 @@
/** @file
CPU DXE Module.
- Copyright (c) 2008 - 2009, Intel Corporation
+ Copyright (c) 2008 - 2010, Intel Corporation
All rights reserved. This program and the accompanying materials
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
@@ -852,8 +852,12 @@ RefreshGcdMemoryAttributes (
UINTN NumberOfDescriptors;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
UINT64 DefaultAttributes;
- VARIABLE_MTRR VariableMtrr[MTRR_NUMBER_OF_VARIABLE_MTRR];
+ VARIABLE_MTRR VariableMtrr[MAX_MTRR_NUMBER_OF_VARIABLE_MTRR];
MTRR_FIXED_SETTINGS MtrrFixedSettings;
+ UINT32 FirmwareVariableMtrrCount;
+ UINT32 UsedMtrr;
+
+ FirmwareVariableMtrrCount = GetFirmwareVariableMtrrCount ();
// mIsFlushingGCD = TRUE;
mIsFlushingGCD = FALSE;
@@ -867,9 +871,11 @@ RefreshGcdMemoryAttributes (
//
// Get the memory attribute of variable MTRRs
//
+ UsedMtrr = MAX_MTRR_NUMBER_OF_VARIABLE_MTRR;
MtrrGetMemoryAttributeInVariableMtrr (
mValidMtrrBitsMask,
mValidMtrrAddressMask,
+ &UsedMtrr,
VariableMtrr
);
@@ -902,7 +908,7 @@ RefreshGcdMemoryAttributes (
//
// Go for variable MTRRs with WB attribute
//
- for (Index = 0; Index < FIRMWARE_VARIABLE_MTRR_NUMBER; Index++) {
+ for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {
if (VariableMtrr[Index].Valid &&
VariableMtrr[Index].Type == MTRR_CACHE_WRITE_BACK) {
SetGcdMemorySpaceAttributes (
@@ -917,7 +923,7 @@ RefreshGcdMemoryAttributes (
//
// Go for variable MTRRs with Non-WB attribute
//
- for (Index = 0; Index < FIRMWARE_VARIABLE_MTRR_NUMBER; Index++) {
+ for (Index = 0; Index < FirmwareVariableMtrrCount; Index++) {
if (VariableMtrr[Index].Valid &&
VariableMtrr[Index].Type != MTRR_CACHE_WRITE_BACK) {
Attributes = GetMemorySpaceAttributeFromMtrrType ((UINT8) VariableMtrr[Index].Type);