1 /** @file
2   Functions declarations to make Xen hypercalls.
3 
4   Copyright (C) 2014, Citrix Ltd.
5 
6   This program and the accompanying materials
7   are licensed and made available under the terms and conditions of the BSD License
8   which accompanies this distribution.  The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef __XEN_HYPERCALL_LIB_H__
17 #define __XEN_HYPERCALL_LIB_H__
18 
19 /**
20   Check if the Xen Hypercall library is able to make calls to the Xen
21   hypervisor.
22 
23   Client code should call further functions in this library only if, and after,
24   this function returns TRUE.
25 
26   @retval TRUE   Hypercalls are available.
27   @retval FALSE  Hypercalls are not available.
28 **/
29 BOOLEAN
30 EFIAPI
31 XenHypercallIsAvailable (
32   VOID
33   );
34 
35 /**
36   This function will put the two arguments in the right place (registers) and
37   invoke the hypercall identified by HypercallID.
38 
39   @param HypercallID    The symbolic ID of the hypercall to be invoked
40   @param Arg1           First argument.
41   @param Arg2           Second argument.
42 
43   @return   Return 0 if success otherwise it return an errno.
44 **/
45 INTN
46 EFIAPI
47 XenHypercall2 (
48   IN     UINTN  HypercallID,
49   IN OUT INTN   Arg1,
50   IN OUT INTN   Arg2
51   );
52 
53 /**
54   Return the value of the HVM parameter Index.
55 
56   @param Index  The parameter to get, e.g. HVM_PARAM_STORE_EVTCHN.
57 
58   @return   The value of the asked parameter or 0 in case of error.
59 **/
60 UINT64
61 XenHypercallHvmGetParam (
62   UINT32 Index
63   );
64 
65 /**
66   Hypercall to do different operation on the memory.
67 
68   @param Operation  The operation number, e.g. XENMEM_add_to_physmap.
69   @param Arguments  The arguments associated to the operation.
70 
71   @return  Return the return value from the hypercall, 0 in case of success
72            otherwise, an error code.
73 **/
74 INTN
75 XenHypercallMemoryOp (
76   IN     UINTN Operation,
77   IN OUT VOID *Arguments
78   );
79 
80 /**
81   Do an operation on the event channels.
82 
83   @param Operation  The operation number, e.g. EVTCHNOP_send.
84   @param Arguments  The argument associated to the operation.
85 
86   @return  Return the return value from the hypercall, 0 in case of success
87            otherwise, an error code.
88 **/
89 INTN
90 XenHypercallEventChannelOp (
91   IN     INTN Operation,
92   IN OUT VOID *Arguments
93   );
94 
95 #endif
96