OvmfPkg/PlatformPei: Merge Xen support into MemMapInitialization

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15205 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jordan Justen 2014-02-01 21:22:43 +00:00 committed by jljusten
parent c191a58fac
commit 4b455f7bf0
3 changed files with 33 additions and 62 deletions

View File

@ -1,7 +1,7 @@
/**@file /**@file
Memory Detection for Virtual Machines. Memory Detection for Virtual Machines.
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -35,9 +35,9 @@ Module Name:
#include "Platform.h" #include "Platform.h"
#include "Cmos.h" #include "Cmos.h"
STATIC UINT32
UINTN
GetSystemMemorySizeBelow4gb ( GetSystemMemorySizeBelow4gb (
VOID
) )
{ {
UINT8 Cmos0x34; UINT8 Cmos0x34;

View File

@ -164,7 +164,7 @@ AddUntestedMemoryRangeHob (
} }
VOID VOID
XenMemMapInitialization ( MemMapInitialization (
VOID VOID
) )
{ {
@ -193,39 +193,9 @@ XenMemMapInitialization (
// //
AddIoMemoryRangeHob (0x0A0000, BASE_1MB); AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
XenPublishRamRegions (); if (!mXen) {
} UINT32 TopOfLowRam;
TopOfLowRam = GetSystemMemorySizeBelow4gb ();
VOID
MemMapInitialization (
EFI_PHYSICAL_ADDRESS TopOfMemory
)
{
//
// Create Memory Type Information HOB
//
BuildGuidDataHob (
&gEfiMemoryTypeInformationGuid,
mDefaultMemoryTypeInformation,
sizeof(mDefaultMemoryTypeInformation)
);
//
// Add PCI IO Port space available for PCI resource allocations.
//
BuildResourceDescriptorHob (
EFI_RESOURCE_IO,
EFI_RESOURCE_ATTRIBUTE_PRESENT |
EFI_RESOURCE_ATTRIBUTE_INITIALIZED,
0xC000,
0x4000
);
//
// Video memory + Legacy BIOS region
//
AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
// //
// address purpose size // address purpose size
@ -238,10 +208,14 @@ MemMapInitialization (
// 0xFED00400 gap 1023 KB // 0xFED00400 gap 1023 KB
// 0xFEE00000 LAPIC 1 MB // 0xFEE00000 LAPIC 1 MB
// //
AddIoMemoryRangeHob (TopOfMemory < BASE_2GB ? BASE_2GB : TopOfMemory, 0xFC000000); AddIoMemoryRangeHob (TopOfLowRam < BASE_2GB ?
BASE_2GB : TopOfLowRam, 0xFC000000);
AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB); AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB);
AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB); AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB);
AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress), SIZE_1MB); AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress), SIZE_1MB);
} else {
XenPublishRamRegions ();
}
} }
@ -370,10 +344,6 @@ InitializePlatform (
IN CONST EFI_PEI_SERVICES **PeiServices IN CONST EFI_PEI_SERVICES **PeiServices
) )
{ {
EFI_PHYSICAL_ADDRESS TopOfMemory;
TopOfMemory = 0;
DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n")); DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));
DebugDumpCmos (); DebugDumpCmos ();
@ -385,7 +355,7 @@ InitializePlatform (
PublishPeiMemory (); PublishPeiMemory ();
if (!mXen) { if (!mXen) {
TopOfMemory = MemDetect (); MemDetect ();
} }
if (mXen) { if (mXen) {
@ -397,11 +367,7 @@ InitializePlatform (
PeiFvInitialization (); PeiFvInitialization ();
if (mXen) { MemMapInitialization ();
XenMemMapInitialization ();
} else {
MemMapInitialization (TopOfMemory);
}
MiscInitialization (); MiscInitialization ();

View File

@ -64,6 +64,11 @@ PublishPeiMemory (
VOID VOID
); );
UINT32
GetSystemMemorySizeBelow4gb (
VOID
);
EFI_PHYSICAL_ADDRESS EFI_PHYSICAL_ADDRESS
MemDetect ( MemDetect (
VOID VOID