summaryrefslogtreecommitdiff
path: root/OvmfPkg
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2014-02-01 21:22:19 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2014-02-01 21:22:19 +0000
commitb98b4941e266526bf4c75f9004c869bfe9ef2f14 (patch)
tree125504ecd71df98dc416253d72ca359520afc4f4 /OvmfPkg
parentb621bb0a3ce81cabc31e28e055e3206068d5aa77 (diff)
downloadedk2-platforms-b98b4941e266526bf4c75f9004c869bfe9ef2f14.tar.xz
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
Diffstat (limited to 'OvmfPkg')
-rw-r--r--OvmfPkg/PlatformPei/Platform.c5
-rw-r--r--OvmfPkg/PlatformPei/Platform.h4
-rw-r--r--OvmfPkg/PlatformPei/Xen.c34
3 files changed, 27 insertions, 16 deletions
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 0763f21fac..6166226481 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -410,7 +410,6 @@ InitializePlatform (
)
{
EFI_PHYSICAL_ADDRESS TopOfMemory;
- UINT32 XenLeaf;
TopOfMemory = 0;
@@ -418,7 +417,7 @@ InitializePlatform (
DebugDumpCmos ();
- XenLeaf = XenDetect ();
+ XenDetect ();
BootModeInitialization ();
@@ -432,7 +431,7 @@ InitializePlatform (
if (mXen) {
DEBUG ((EFI_D_INFO, "Xen was detected\n"));
- InitializeXen (XenLeaf);
+ InitializeXen ();
}
ReserveEmuVariableNvStore ();
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index cc371c57f7..4b72ee6b72 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -76,10 +76,10 @@ PeiFvInitialization (
EFI_STATUS
InitializeXen (
- UINT32 XenLeaf
+ VOID
);
-UINT32
+BOOLEAN
XenDetect (
VOID
);
diff --git a/OvmfPkg/PlatformPei/Xen.c b/OvmfPkg/PlatformPei/Xen.c
index 0f75fa7983..da3133bb9b 100644
--- a/OvmfPkg/PlatformPei/Xen.c
+++ b/OvmfPkg/PlatformPei/Xen.c
@@ -33,6 +33,8 @@
BOOLEAN mXen = FALSE;
+STATIC UINT32 mXenLeaf = 0;
+
EFI_XEN_INFO mXenInfo;
/**
@@ -114,31 +116,37 @@ XenConnect (
/**
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 (
VOID
)
{
-
- UINT32 XenLeaf;
UINT8 Signature[13];
- for (XenLeaf = 0x40000000; XenLeaf < 0x40010000; XenLeaf += 0x100) {
- AsmCpuid (XenLeaf, NULL, (UINT32 *) &Signature[0],
+ if (mXenLeaf != 0) {
+ return TRUE;
+ }
+
+ Signature[12] = '\0';
+ for (mXenLeaf = 0x40000000; mXenLeaf < 0x40010000; mXenLeaf += 0x100) {
+ AsmCpuid (mXenLeaf,
+ NULL,
+ (UINT32 *) &Signature[0],
(UINT32 *) &Signature[4],
(UINT32 *) &Signature[8]);
- Signature[12] = '\0';
if (!AsciiStrCmp ((CHAR8 *) Signature, "XenVMMXenVMM")) {
mXen = TRUE;
- return XenLeaf;
+ return TRUE;
}
}
- return 0;
+ mXenLeaf = 0;
+ return FALSE;
}
/**
@@ -150,10 +158,14 @@ XenDetect (
**/
EFI_STATUS
InitializeXen (
- UINT32 XenLeaf
+ VOID
)
{
- XenConnect (XenLeaf);
+ if (mXenLeaf == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ XenConnect (mXenLeaf);
//
// Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000).