summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-28 06:04:01 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-28 06:04:01 +0000
commite8e5cd4a5e0e85382d5fc4d1eb469e8c52d58f18 (patch)
tree2a09df6ae1b18e68b6e4e9bed27fadbac83ff1c2
parent4bf8ffc3fbff9dedb390821905b1631b2fb4157c (diff)
downloadedk2-platforms-e8e5cd4a5e0e85382d5fc4d1eb469e8c52d58f18.tar.xz
Set MTRR registers.
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
-rw-r--r--OvmfPkg/PlatformPei/MemDetect.c12
-rw-r--r--OvmfPkg/PlatformPei/PlatformPei.inf2
2 files changed, 13 insertions, 1 deletions
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 78b43d22b7..5070c79c0d 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -1,7 +1,7 @@
/**@file
Memory Detection for Virtual Machines.
- Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
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
@@ -30,6 +30,7 @@ Module Name:
#include <Library/PcdLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/ResourcePublicationLib.h>
+#include <Library/MtrrLib.h>
#include "Platform.h"
#include "Cmos.h"
@@ -130,8 +131,17 @@ MemDetect (
AddMemoryRangeHob (BASE_1MB, MemoryBase);
AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
+ Status = MtrrSetMemoryAttribute (BASE_1MB, MemoryBase + MemorySize - BASE_1MB, CacheWriteBack);
+ ASSERT_EFI_ERROR(Status);
+
+ Status = MtrrSetMemoryAttribute (0, BASE_512KB + BASE_128KB, CacheWriteBack);
+ ASSERT_EFI_ERROR(Status);
+
if (UpperMemorySize != 0) {
AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
+
+ Status = MtrrSetMemoryAttribute (BASE_4GB, UpperMemorySize, CacheWriteBack);
+ ASSERT_EFI_ERROR(Status);
}
return MemoryBase + MemorySize;
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
index 3ef7f0d7ed..db5ed31a6d 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -38,6 +38,7 @@
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
OvmfPkg/OvmfPkg.dec
[Guids]
@@ -53,6 +54,7 @@
PeiServicesLib
PeiServicesTablePointerLib
PeimEntryPoint
+ MtrrLib
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase