]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Set MTRR registers.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Oct 2011 06:04:01 +0000 (06:04 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 28 Oct 2011 06:04:01 +0000 (06:04 +0000)
Signed-off-by: vanjeff
Reviewed-by: rsun3
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12589 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/PlatformPei/MemDetect.c
OvmfPkg/PlatformPei/PlatformPei.inf

index 78b43d22b75f5bb2c641f6ad86eaf2a4f25802b1..5070c79c0da9be00a1e6165b7721568db8e55271 100644 (file)
@@ -1,7 +1,7 @@
 /**@file\r
   Memory Detection for Virtual Machines.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2011, 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
@@ -30,6 +30,7 @@ Module Name:
 #include <Library/PcdLib.h>\r
 #include <Library/PeimEntryPoint.h>\r
 #include <Library/ResourcePublicationLib.h>\r
+#include <Library/MtrrLib.h>\r
 \r
 #include "Platform.h"\r
 #include "Cmos.h"\r
@@ -130,8 +131,17 @@ MemDetect (
   AddMemoryRangeHob (BASE_1MB, MemoryBase);\r
   AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);\r
 \r
+  Status = MtrrSetMemoryAttribute (BASE_1MB, MemoryBase + MemorySize - BASE_1MB, CacheWriteBack);\r
+  ASSERT_EFI_ERROR(Status);\r
+\r
+  Status = MtrrSetMemoryAttribute (0, BASE_512KB + BASE_128KB, CacheWriteBack);\r
+  ASSERT_EFI_ERROR(Status);\r
+\r
   if (UpperMemorySize != 0) {\r
     AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);\r
+\r
+    Status = MtrrSetMemoryAttribute (BASE_4GB, UpperMemorySize, CacheWriteBack);\r
+    ASSERT_EFI_ERROR(Status);\r
   }\r
 \r
   return MemoryBase + MemorySize;\r
index 3ef7f0d7ed060f7446bad558d2b47c861a8d5b64..db5ed31a6dcf0171b6a9ac6c8dc14b51a241755a 100644 (file)
@@ -38,6 +38,7 @@
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
+  UefiCpuPkg/UefiCpuPkg.dec\r
   OvmfPkg/OvmfPkg.dec\r
 \r
 [Guids]\r
@@ -53,6 +54,7 @@
   PeiServicesLib\r
   PeiServicesTablePointerLib\r
   PeimEntryPoint\r
+  MtrrLib\r
 \r
 [Pcd]\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase\r