9cac17da2b12898fa8e78293a851ec080decb42c
[mirror_edk2.git] / OvmfPkg / XenBusDxe / XenHypercall.h
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 __XENBUS_DXE_HYPERCALL_H__
17 #define __XENBUS_DXE_HYPERCALL_H__
18
19 typedef struct _XENBUS_DEVICE XENBUS_DEVICE;
20
21 /**
22 This function will put the two arguments in the right place (registers) and
23 call HypercallAddr, which correspond to an entry in the hypercall pages.
24
25 @param HypercallAddr A memory address where the hypercall to call is.
26 @param Arg1 First argument.
27 @param Arg2 Second argument.
28
29 @return Return 0 if success otherwise it return an errno.
30 **/
31 INTN
32 EFIAPI
33 XenHypercall2 (
34 IN VOID *HypercallAddr,
35 IN OUT INTN Arg1,
36 IN OUT INTN Arg2
37 );
38
39 /**
40 Get the page where all hypercall are from the XenInfo hob.
41
42 @param Dev A XENBUS_DEVICE instance.
43
44 @retval EFI_NOT_FOUND hyperpage could not be found.
45 @retval EFI_SUCCESS Successfully retrieve the hyperpage pointer.
46 **/
47 EFI_STATUS
48 XenHyperpageInit (
49 XENBUS_DEVICE *Dev
50 );
51
52 /**
53 Return the value of the HVM parameter Index.
54
55 @param Dev A XENBUS_DEVICE instance.
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 XENBUS_DEVICE *Dev,
63 UINT32 Index
64 );
65
66 /**
67 Hypercall to do different operation on the memory.
68
69 @param Dev A XENBUS_DEVICE instance.
70 @param Operation The operation number, e.g. XENMEM_add_to_physmap.
71 @param Arguments The arguments associated to the operation.
72
73 @return Return the return value from the hypercall, 0 in case of success
74 otherwise, an error code.
75 **/
76 INTN
77 XenHypercallMemoryOp (
78 IN XENBUS_DEVICE *Dev,
79 IN UINTN Operation,
80 IN OUT VOID *Arguments
81 );
82
83 /**
84 Do an operation on the event channels.
85
86 @param Dev A XENBUS_DEVICE instance.
87 @param Operation The operation number, e.g. EVTCHNOP_send.
88 @param Arguments The argument associated to the operation.
89
90 @return Return the return value from the hypercall, 0 in case of success
91 otherwise, an error code.
92 **/
93 INTN
94 XenHypercallEventChannelOp (
95 IN XENBUS_DEVICE *Dev,
96 IN INTN Operation,
97 IN OUT VOID *Arguments
98 );
99
100 /**
101 Map the shared_info_t page into memory.
102
103 @param Dev A XENBUS_DEVICE instance.
104
105 @retval EFI_SUCCESS Dev->SharedInfo whill contain a pointer to
106 the shared info page
107 @retval EFI_LOAD_ERROR The shared info page could not be mapped. The
108 hypercall returned an error.
109 **/
110 EFI_STATUS
111 XenGetSharedInfoPage (
112 IN OUT XENBUS_DEVICE *Dev
113 );
114
115 #endif