Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wei Liu <wei.l...@citrix.com> --- OvmfPkg/PlatformPei/Xen.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/PlatformPei/Xen.c b/OvmfPkg/PlatformPei/Xen.c index a720b91..737cb15 100644 --- a/OvmfPkg/PlatformPei/Xen.c +++ b/OvmfPkg/PlatformPei/Xen.c @@ -26,13 +26,15 @@ #include <Library/HobLib.h> #include <Library/MemoryAllocationLib.h> #include <Library/PcdLib.h> +#include <Library/BaseMemoryLib.h> +#include <IndustryStandard/E820.h> #include <Guid/XenInfo.h> #include "Platform.h" +#include "Xen.h" EFI_XEN_INFO mXenInfo; - /** Connects to the Hypervisor. @@ -50,6 +52,9 @@ XenConnect ( UINT32 TransferReg; UINT32 TransferPages; UINT32 XenVersion; + EFI_XEN_OVMF_INFO *Info = (EFI_XEN_OVMF_INFO *) OVMF_INFO_PHYSICAL_ADDRESS; + + ZeroMem (&mXenInfo, sizeof(mXenInfo)); AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL); mXenInfo.HyperPages = AllocatePages (TransferPages); @@ -72,6 +77,22 @@ XenConnect ( /* TBD: Locate hvm_info and reserve it away. */ mXenInfo.HvmInfo = NULL; + if (!AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) { + EFI_E820_ENTRY64 *E820Map; + + E820Map = AllocateCopyPool (sizeof(EFI_E820_ENTRY64) * Info->E820EntriesCount, + (VOID *)Info->E820); + ASSERT (E820Map != NULL); + + if (!E820Map) { + FreePages (mXenInfo.HyperPages, TransferPages); + return EFI_OUT_OF_RESOURCES; + } + + mXenInfo.E820 = (EFI_PHYSICAL_ADDRESS)E820Map; + mXenInfo.E820EntriesCount = Info->E820EntriesCount; + } + BuildGuidDataHob ( &gEfiXenInfoGuid, &mXenInfo, -- 1.7.10.4 ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel