mirror of https://github.com/acidanthera/audk.git
OvmfPkg/PlatformPei: Add XenPublishRamRegions
This will be called from a unified MemDetect function. 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@15203 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b98b4941e2
commit
18f31ada8d
|
@ -34,10 +34,6 @@
|
||||||
#include <Guid/MemoryTypeInformation.h>
|
#include <Guid/MemoryTypeInformation.h>
|
||||||
#include <Ppi/MasterBootMode.h>
|
#include <Ppi/MasterBootMode.h>
|
||||||
#include <IndustryStandard/Pci22.h>
|
#include <IndustryStandard/Pci22.h>
|
||||||
#include <Guid/XenInfo.h>
|
|
||||||
#include <IndustryStandard/E820.h>
|
|
||||||
#include <Library/ResourcePublicationLib.h>
|
|
||||||
#include <Library/MtrrLib.h>
|
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Cmos.h"
|
#include "Cmos.h"
|
||||||
|
@ -172,12 +168,6 @@ XenMemMapInitialization (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_E820_ENTRY64 *E820Map;
|
|
||||||
UINT32 E820EntriesCount;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
DEBUG ((EFI_D_INFO, "Using memory map provided by Xen\n"));
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create Memory Type Information HOB
|
// Create Memory Type Information HOB
|
||||||
//
|
//
|
||||||
|
@ -203,36 +193,7 @@ XenMemMapInitialization (
|
||||||
//
|
//
|
||||||
AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
|
AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
|
||||||
|
|
||||||
//
|
XenPublishRamRegions ();
|
||||||
// Parse RAM in E820 map
|
|
||||||
//
|
|
||||||
Status = XenGetE820Map(&E820Map, &E820EntriesCount);
|
|
||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
if (E820EntriesCount > 0) {
|
|
||||||
EFI_E820_ENTRY64 *Entry;
|
|
||||||
UINT32 Loop;
|
|
||||||
|
|
||||||
for (Loop = 0; Loop < E820EntriesCount; Loop++) {
|
|
||||||
Entry = E820Map + Loop;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Only care about RAM
|
|
||||||
//
|
|
||||||
if (Entry->Type != EfiAcpiAddressRangeMemory) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Entry->BaseAddr >= BASE_4GB) {
|
|
||||||
AddUntestedMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
|
|
||||||
} else {
|
|
||||||
AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,9 @@ XenDetect (
|
||||||
|
|
||||||
extern BOOLEAN mXen;
|
extern BOOLEAN mXen;
|
||||||
|
|
||||||
EFI_STATUS
|
VOID
|
||||||
XenGetE820Map (
|
XenPublishRamRegions (
|
||||||
EFI_E820_ENTRY64 **Entries,
|
VOID
|
||||||
UINT32 *Count
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // _PLATFORM_PEI_H_INCLUDED_
|
#endif // _PLATFORM_PEI_H_INCLUDED_
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
#include <Guid/XenInfo.h>
|
#include <Guid/XenInfo.h>
|
||||||
|
#include <IndustryStandard/E820.h>
|
||||||
|
#include <Library/ResourcePublicationLib.h>
|
||||||
|
#include <Library/MtrrLib.h>
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Xen.h"
|
#include "Xen.h"
|
||||||
|
@ -149,6 +152,55 @@ XenDetect (
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
XenPublishRamRegions (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_E820_ENTRY64 *E820Map;
|
||||||
|
UINT32 E820EntriesCount;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
if (!mXen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG ((EFI_D_INFO, "Using memory map provided by Xen\n"));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parse RAM in E820 map
|
||||||
|
//
|
||||||
|
Status = XenGetE820Map (&E820Map, &E820EntriesCount);
|
||||||
|
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
if (E820EntriesCount > 0) {
|
||||||
|
EFI_E820_ENTRY64 *Entry;
|
||||||
|
UINT32 Loop;
|
||||||
|
|
||||||
|
for (Loop = 0; Loop < E820EntriesCount; Loop++) {
|
||||||
|
Entry = E820Map + Loop;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Only care about RAM
|
||||||
|
//
|
||||||
|
if (Entry->Type != EfiAcpiAddressRangeMemory) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Entry->BaseAddr >= BASE_4GB) {
|
||||||
|
AddUntestedMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
|
||||||
|
} else {
|
||||||
|
AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform Xen PEI initialization.
|
Perform Xen PEI initialization.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue