OvmfPkg: XenHypercallLib: introduce XenHypercallIsAvailable()

Similarly to QemuFwCfgLib, we prefer mellow library construction code and
an explicit "are you available" query function in the XenHypercallLib
class. In this step we introduce that query function, but move no client
code to it yet.

Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17000 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Laszlo Ersek 2015-03-03 08:13:30 +00:00 committed by lersek
parent b5d85f6221
commit 02f69a25f0
3 changed files with 54 additions and 0 deletions

View File

@ -16,6 +16,22 @@
#ifndef __XEN_HYPERCALL_LIB_H__
#define __XEN_HYPERCALL_LIB_H__
/**
Check if the Xen Hypercall library is able to make calls to the Xen
hypervisor.
Client code should call further functions in this library only if, and after,
this function returns TRUE.
@retval TRUE Hypercalls are available.
@retval FALSE Hypercalls are not available.
**/
BOOLEAN
EFIAPI
XenHypercallIsAvailable (
VOID
);
/**
This function will put the two arguments in the right place (registers) and
invoke the hypercall identified by HypercallID.

View File

@ -15,6 +15,25 @@
#include <Base.h>
/**
Check if the Xen Hypercall library is able to make calls to the Xen
hypervisor.
Client code should call further functions in this library only if, and after,
this function returns TRUE.
@retval TRUE Hypercalls are available.
@retval FALSE Hypercalls are not available.
**/
BOOLEAN
EFIAPI
XenHypercallIsAvailable (
VOID
)
{
return TRUE;
}
RETURN_STATUS
EFIAPI
XenHypercallLibInit (

View File

@ -19,6 +19,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
STATIC VOID *HyperPage;
/**
Check if the Xen Hypercall library is able to make calls to the Xen
hypervisor.
Client code should call further functions in this library only if, and after,
this function returns TRUE.
@retval TRUE Hypercalls are available.
@retval FALSE Hypercalls are not available.
**/
BOOLEAN
EFIAPI
XenHypercallIsAvailable (
VOID
)
{
return HyperPage != NULL;
}
//
// Interface exposed by the ASM implementation of the core hypercall
//