]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: XenHypercallLib: introduce XenHypercallIsAvailable()
authorLaszlo Ersek <lersek@redhat.com>
Tue, 3 Mar 2015 08:13:30 +0000 (08:13 +0000)
committerlersek <lersek@Edk2>
Tue, 3 Mar 2015 08:13:30 +0000 (08:13 +0000)
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

OvmfPkg/Include/Library/XenHypercallLib.h
OvmfPkg/Library/XenHypercallLib/ArmXenHypercall.c
OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c

index 1a468ea7dcc5e6bd05391d84b8e3cb8b28d4dc17..509855d30251f4197f0ca8dcf1e239d2f76b5b95 100644 (file)
 #ifndef __XEN_HYPERCALL_LIB_H__\r
 #define __XEN_HYPERCALL_LIB_H__\r
 \r
+/**\r
+  Check if the Xen Hypercall library is able to make calls to the Xen\r
+  hypervisor.\r
+\r
+  Client code should call further functions in this library only if, and after,\r
+  this function returns TRUE.\r
+\r
+  @retval TRUE   Hypercalls are available.\r
+  @retval FALSE  Hypercalls are not available.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+XenHypercallIsAvailable (\r
+  VOID\r
+  );\r
+\r
 /**\r
   This function will put the two arguments in the right place (registers) and\r
   invoke the hypercall identified by HypercallID.\r
index 1f213d6e6f1880c7eff96af400c9134995a14fdf..58cd3ec76bf812eadb497d7f5c38d963121e91f0 100644 (file)
 \r
 #include <Base.h>\r
 \r
+/**\r
+  Check if the Xen Hypercall library is able to make calls to the Xen\r
+  hypervisor.\r
+\r
+  Client code should call further functions in this library only if, and after,\r
+  this function returns TRUE.\r
+\r
+  @retval TRUE   Hypercalls are available.\r
+  @retval FALSE  Hypercalls are not available.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+XenHypercallIsAvailable (\r
+  VOID\r
+  )\r
+{\r
+  return TRUE;\r
+}\r
+\r
 RETURN_STATUS\r
 EFIAPI\r
 XenHypercallLibInit (\r
index 7ee1f2f38d831f67f00f7de83bd141aa2eaa8ad5..67892bcf37e48b8b95756e0a94b8dff29d17bb62 100644 (file)
@@ -19,6 +19,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 STATIC VOID    *HyperPage;\r
 \r
+/**\r
+  Check if the Xen Hypercall library is able to make calls to the Xen\r
+  hypervisor.\r
+\r
+  Client code should call further functions in this library only if, and after,\r
+  this function returns TRUE.\r
+\r
+  @retval TRUE   Hypercalls are available.\r
+  @retval FALSE  Hypercalls are not available.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+XenHypercallIsAvailable (\r
+  VOID\r
+  )\r
+{\r
+  return HyperPage != NULL;\r
+}\r
+\r
 //\r
 // Interface exposed by the ASM implementation of the core hypercall\r
 //\r