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
This commit is contained in:
vanjeff 2011-10-28 06:04:01 +00:00
parent 4bf8ffc3fb
commit e8e5cd4a5e
2 changed files with 13 additions and 1 deletions

View File

@ -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;

View File

@ -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