OvmfPkg/PlatformPei: Hide Xen Leaf details

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@15202 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jordan Justen 2014-02-01 21:22:19 +00:00 committed by jljusten
parent b621bb0a3c
commit b98b4941e2
3 changed files with 27 additions and 16 deletions

View File

@ -410,7 +410,6 @@ InitializePlatform (
) )
{ {
EFI_PHYSICAL_ADDRESS TopOfMemory; EFI_PHYSICAL_ADDRESS TopOfMemory;
UINT32 XenLeaf;
TopOfMemory = 0; TopOfMemory = 0;
@ -418,7 +417,7 @@ InitializePlatform (
DebugDumpCmos (); DebugDumpCmos ();
XenLeaf = XenDetect (); XenDetect ();
BootModeInitialization (); BootModeInitialization ();
@ -432,7 +431,7 @@ InitializePlatform (
if (mXen) { if (mXen) {
DEBUG ((EFI_D_INFO, "Xen was detected\n")); DEBUG ((EFI_D_INFO, "Xen was detected\n"));
InitializeXen (XenLeaf); InitializeXen ();
} }
ReserveEmuVariableNvStore (); ReserveEmuVariableNvStore ();

View File

@ -76,10 +76,10 @@ PeiFvInitialization (
EFI_STATUS EFI_STATUS
InitializeXen ( InitializeXen (
UINT32 XenLeaf VOID
); );
UINT32 BOOLEAN
XenDetect ( XenDetect (
VOID VOID
); );

View File

@ -33,6 +33,8 @@
BOOLEAN mXen = FALSE; BOOLEAN mXen = FALSE;
STATIC UINT32 mXenLeaf = 0;
EFI_XEN_INFO mXenInfo; EFI_XEN_INFO mXenInfo;
/** /**
@ -114,31 +116,37 @@ XenConnect (
/** /**
Figures out if we are running inside Xen HVM. Figures out if we are running inside Xen HVM.
@return UINT32 CPUID index used to connect to HV. @retval TRUE Xen was detected
@retval FALSE Xen was not detected
**/ **/
UINT32 BOOLEAN
XenDetect ( XenDetect (
VOID VOID
) )
{ {
UINT32 XenLeaf;
UINT8 Signature[13]; UINT8 Signature[13];
for (XenLeaf = 0x40000000; XenLeaf < 0x40010000; XenLeaf += 0x100) { if (mXenLeaf != 0) {
AsmCpuid (XenLeaf, NULL, (UINT32 *) &Signature[0], return TRUE;
}
Signature[12] = '\0';
for (mXenLeaf = 0x40000000; mXenLeaf < 0x40010000; mXenLeaf += 0x100) {
AsmCpuid (mXenLeaf,
NULL,
(UINT32 *) &Signature[0],
(UINT32 *) &Signature[4], (UINT32 *) &Signature[4],
(UINT32 *) &Signature[8]); (UINT32 *) &Signature[8]);
Signature[12] = '\0';
if (!AsciiStrCmp ((CHAR8 *) Signature, "XenVMMXenVMM")) { if (!AsciiStrCmp ((CHAR8 *) Signature, "XenVMMXenVMM")) {
mXen = TRUE; mXen = TRUE;
return XenLeaf; return TRUE;
} }
} }
return 0; mXenLeaf = 0;
return FALSE;
} }
/** /**
@ -150,10 +158,14 @@ XenDetect (
**/ **/
EFI_STATUS EFI_STATUS
InitializeXen ( InitializeXen (
UINT32 XenLeaf VOID
) )
{ {
XenConnect (XenLeaf); if (mXenLeaf == 0) {
return EFI_NOT_FOUND;
}
XenConnect (mXenLeaf);
// //
// Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000). // Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000).