]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MtrrDebugPrintAllMtrrs() should loop until the max physical address is reached.
authorJeff Fan <jeff.fan@intel.com>
Tue, 7 Jan 2014 06:24:16 +0000 (06:24 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 7 Jan 2014 06:24:16 +0000 (06:24 +0000)
GetMemoryCacheTypeFromMtrrType () should return the default memory type instead of UC type for MTRR_CACHE_INVALID_TYPE.

Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15053 6f19259b-4bc3-4df7-8a09-765794883524

UefiCpuPkg/Library/MtrrLib/MtrrLib.c
UefiCpuPkg/Library/MtrrLib/MtrrLib.inf

index 586c620bd1b6375b0aefa850a98c12d5201b79e7..d9449bcca5d99f334451ee099f41e4f3f5ff02dc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   MTRR setting library\r
 \r
-  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2008 - 2014, 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
@@ -808,7 +808,7 @@ GetMemoryCacheTypeFromMtrrType (
     // MtrrType is MTRR_CACHE_INVALID_TYPE, that means\r
     // no mtrr covers the range\r
     //\r
-    return CacheUncacheable;\r
+    return MtrrGetDefaultMemoryType ();\r
   }\r
 }\r
 \r
@@ -1609,6 +1609,12 @@ MtrrDebugPrintAllMtrrs (
 \r
     VariableMtrrCount = GetVariableMtrrCount ();\r
 \r
+    Limit        = BIT36 - 1;\r
+    AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);\r
+    if (RegEax >= 0x80000008) {\r
+      AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);\r
+      Limit = LShiftU64 (1, RegEax & 0xff) - 1;\r
+    }\r
     Base = BASE_1MB;\r
     PreviousMemoryType = MTRR_CACHE_INVALID_TYPE;\r
     do {\r
@@ -1627,12 +1633,6 @@ MtrrDebugPrintAllMtrrs (
       \r
       RangeBase    = BASE_1MB;        \r
       NoRangeBase  = BASE_1MB;\r
-      Limit        = BIT36 - 1;\r
-      AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);\r
-      if (RegEax >= 0x80000008) {\r
-        AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);\r
-        Limit = LShiftU64 (1, RegEax & 0xff) - 1;\r
-      }\r
       RangeLimit   = Limit;\r
       NoRangeLimit = Limit;\r
       \r
@@ -1676,7 +1676,7 @@ MtrrDebugPrintAllMtrrs (
       } else {\r
         Base = NoRangeLimit + 1;\r
       }\r
-    } while (Found);\r
+    } while (Base < Limit);\r
     DEBUG((DEBUG_CACHE, "%016lx\n\n", Base - 1));\r
   );\r
 }\r
index f46d6cb793d2ee8b1125f88ffef75b2f58e4b6a0..e635752e8935d09668e73f5284c849704d1b2c5a 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  MTRR library provides API for MTRR operation\r
 #\r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2014, 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
@@ -38,4 +38,5 @@
   BaseMemoryLib\r
   BaseLib\r
   CpuLib\r
+  DebugLib\r
 \r