]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuDxe.c
Update the copyright notice format
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuDxe.c
index 2895da8571140015f9a607856f0fdd6a5afb98bf..66955c3f199a7d7591c1c0868cc8888229e06fa3 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   CPU DXE Module.\r
 \r
-  Copyright (c) 2008 - 2010, 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
@@ -590,6 +590,10 @@ CpuSetMemoryAttributes (
   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
@@ -852,12 +856,16 @@ RefreshGcdMemoryAttributes (
   UINTN                               NumberOfDescriptors;\r
   EFI_GCD_MEMORY_SPACE_DESCRIPTOR     *MemorySpaceMap;\r
   UINT64                              DefaultAttributes;\r
-  VARIABLE_MTRR                       VariableMtrr[MAX_MTRR_NUMBER_OF_VARIABLE_MTRR];\r
+  VARIABLE_MTRR                       VariableMtrr[MTRR_NUMBER_OF_VARIABLE_MTRR];\r
   MTRR_FIXED_SETTINGS                 MtrrFixedSettings;\r
   UINT32                              FirmwareVariableMtrrCount;\r
-  UINT32                              UsedMtrr;\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
@@ -871,11 +879,9 @@ RefreshGcdMemoryAttributes (
   //\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
@@ -1014,7 +1020,6 @@ InitInterruptDescriptorTable (
   IA32_DESCRIPTOR *IdtPtr;\r
   UINTN           Index;\r
   UINTN           CurrentHandler;\r
-  BOOLEAN         InterruptState;\r
 \r
   SetMem (ExternalVectorTable, sizeof(ExternalVectorTable), 0);\r
 \r
@@ -1042,18 +1047,8 @@ InitInterruptDescriptorTable (
   IdtPtr->Base = (UINT32)(((UINTN)(VOID*) gIdtTable) & (BASE_4GB-1));\r
   IdtPtr->Limit = sizeof (gIdtTable) - 1;\r
 \r
-  //\r
-  // Disable interrupts and save the current interrupt state\r
-  //\r
-  InterruptState = SaveAndDisableInterrupts ();\r
-\r
   AsmWriteIdtr (IdtPtr);\r
 \r
-  //\r
-  // Restore the interrupt state\r
-  //\r
-  SetInterruptState (InterruptState);\r
-\r
   FreePool (IdtPtrAlignmentBuffer);\r
 \r
   //\r