Revision: 17000
http://sourceforge.net/p/edk2/code/17000
Author: lersek
Date: 2015-03-03 08:13:30 +0000 (Tue, 03 Mar 2015)
Log Message:
-----------
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 <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Ard Biesheuvel <[email protected]>
Tested-by: Ard Biesheuvel <[email protected]>
Modified Paths:
--------------
trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h
trunk/edk2/OvmfPkg/Library/XenHypercallLib/ArmXenHypercall.c
trunk/edk2/OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c
Modified: trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h
===================================================================
--- trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h 2015-03-03
08:13:19 UTC (rev 16999)
+++ trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h 2015-03-03
08:13:30 UTC (rev 17000)
@@ -17,6 +17,22 @@
#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.
Modified: trunk/edk2/OvmfPkg/Library/XenHypercallLib/ArmXenHypercall.c
===================================================================
--- trunk/edk2/OvmfPkg/Library/XenHypercallLib/ArmXenHypercall.c
2015-03-03 08:13:19 UTC (rev 16999)
+++ trunk/edk2/OvmfPkg/Library/XenHypercallLib/ArmXenHypercall.c
2015-03-03 08:13:30 UTC (rev 17000)
@@ -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 (
Modified: trunk/edk2/OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c
===================================================================
--- trunk/edk2/OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c
2015-03-03 08:13:19 UTC (rev 16999)
+++ trunk/edk2/OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c
2015-03-03 08:13:30 UTC (rev 17000)
@@ -19,6 +19,25 @@
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
//
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits