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.
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
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 #include #include +#include #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