/** @file\r
CPU DXE Module.\r
\r
- Copyright (c) 2008 - 2009, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
+ Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ 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
http://opensource.org/licenses/bsd-license.php\r
RETURN_STATUS Status;\r
MTRR_MEMORY_CACHE_TYPE CacheType;\r
\r
+ if (!IsMtrrSupported ()) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
DEBUG((EFI_D_ERROR, "CpuAp: SetMemorySpaceAttributes(BA=%08x, Len=%08x, Attr=%08x)\n", BaseAddress, Length, Attributes));\r
\r
//\r
UINT64 DefaultAttributes;\r
VARIABLE_MTRR VariableMtrr[MTRR_NUMBER_OF_VARIABLE_MTRR];\r
MTRR_FIXED_SETTINGS MtrrFixedSettings;\r
+ UINT32 FirmwareVariableMtrrCount;\r
+\r
+ if (!IsMtrrSupported ()) {\r
+ return;\r
+ }\r
+\r
+ FirmwareVariableMtrrCount = GetFirmwareVariableMtrrCount ();\r
+ ASSERT (FirmwareVariableMtrrCount <= MTRR_NUMBER_OF_VARIABLE_MTRR);\r
\r
// mIsFlushingGCD = TRUE;\r
mIsFlushingGCD = FALSE;\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
IdtPtr = ALIGN_POINTER (IdtPtrAlignmentBuffer, 16);\r
IdtPtr->Base = (UINT32)(((UINTN)(VOID*) gIdtTable) & (BASE_4GB-1));\r
IdtPtr->Limit = sizeof (gIdtTable) - 1;\r
+\r
AsmWriteIdtr (IdtPtr);\r
+\r
FreePool (IdtPtrAlignmentBuffer);\r
\r
//\r