]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/XenBusDxe/XenHypercall.h
OvmfPkg/XenBusDxe: Add support to make Xen Hypercalls.
[mirror_edk2.git] / OvmfPkg / XenBusDxe / XenHypercall.h
diff --git a/OvmfPkg/XenBusDxe/XenHypercall.h b/OvmfPkg/XenBusDxe/XenHypercall.h
new file mode 100644 (file)
index 0000000..3627b18
--- /dev/null
@@ -0,0 +1,115 @@
+/** @file\r
+  Functions declarations to make Xen hypercalls.\r
+\r
+  Copyright (C) 2014, Citrix Ltd.\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __XENBUS_DXE_HYPERCALL_H__\r
+#define __XENBUS_DXE_HYPERCALL_H__\r
+\r
+typedef struct _XENBUS_DEVICE XENBUS_DEVICE;\r
+\r
+/**\r
+  This function will put the two arguments in the right place (registers) and\r
+  call HypercallAddr, which correspond to an entry in the hypercall pages.\r
+\r
+  @param HypercallAddr  A memory address where the hypercall to call is.\r
+  @param Arg1           First argument.\r
+  @param Arg2           Second argument.\r
+\r
+  @return   Return 0 if success otherwise it return an errno.\r
+**/\r
+INTN\r
+EFIAPI\r
+XenHypercall2 (\r
+  IN     VOID *HypercallAddr,\r
+  IN OUT INTN Arg1,\r
+  IN OUT INTN Arg2\r
+  );\r
+\r
+/**\r
+  Get the page where all hypercall are from the XenInfo hob.\r
+\r
+  @param Dev    A XENBUS_DEVICE instance.\r
+\r
+  @retval EFI_NOT_FOUND   hyperpage could not be found.\r
+  @retval EFI_SUCCESS     Successfully retrieve the hyperpage pointer.\r
+**/\r
+EFI_STATUS\r
+XenHyperpageInit (\r
+  XENBUS_DEVICE *Dev\r
+  );\r
+\r
+/**\r
+  Return the value of the HVM parameter Index.\r
+\r
+  @param Dev    A XENBUS_DEVICE instance.\r
+  @param Index  The parameter to get, e.g. HVM_PARAM_STORE_EVTCHN.\r
+\r
+  @return   The value of the asked parameter or 0 in case of error.\r
+**/\r
+UINT64\r
+XenHypercallHvmGetParam (\r
+  XENBUS_DEVICE *Dev,\r
+  INTN Index\r
+  );\r
+\r
+/**\r
+  Hypercall to do different operation on the memory.\r
+\r
+  @param Dev        A XENBUS_DEVICE instance.\r
+  @param Operation  The operation number, e.g. XENMEM_add_to_physmap.\r
+  @param Arguments  The arguments associated to the operation.\r
+\r
+  @return  Return the return value from the hypercall, 0 in case of success\r
+           otherwise, an error code.\r
+**/\r
+INTN\r
+XenHypercallMemoryOp (\r
+  IN     XENBUS_DEVICE *Dev,\r
+  IN     UINTN Operation,\r
+  IN OUT VOID *Arguments\r
+  );\r
+\r
+/**\r
+  Do an operation on the event channels.\r
+\r
+  @param Dev        A XENBUS_DEVICE instance.\r
+  @param Operation  The operation number, e.g. EVTCHNOP_send.\r
+  @param Arguments  The argument associated to the operation.\r
+\r
+  @return  Return the return value from the hypercall, 0 in case of success\r
+           otherwise, an error code.\r
+**/\r
+INTN\r
+XenHypercallEventChannelOp (\r
+  IN     XENBUS_DEVICE *Dev,\r
+  IN     INTN Operation,\r
+  IN OUT VOID *Arguments\r
+  );\r
+\r
+/**\r
+  Map the shared_info_t page into memory.\r
+\r
+  @param Dev    A XENBUS_DEVICE instance.\r
+\r
+  @retval EFI_SUCCESS     Dev->SharedInfo whill contain a pointer to\r
+                          the shared info page\r
+  @retval EFI_LOAD_ERROR  The shared info page could not be mapped. The\r
+                          hypercall returned an error.\r
+**/\r
+EFI_STATUS\r
+XenGetSharedInfoPage (\r
+  IN OUT XENBUS_DEVICE *Dev\r
+  );\r
+\r
+#endif\r