OvmfPkg/XenBusDxe: Add support to make Xen Hypercalls.
[mirror_edk2.git] / OvmfPkg / XenBusDxe / XenHypercall.h
CommitLineData
abcbbb14
AP
1/** @file\r
2 Functions declarations to make Xen hypercalls.\r
3\r
4 Copyright (C) 2014, Citrix Ltd.\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __XENBUS_DXE_HYPERCALL_H__\r
17#define __XENBUS_DXE_HYPERCALL_H__\r
18\r
19typedef struct _XENBUS_DEVICE XENBUS_DEVICE;\r
20\r
21/**\r
22 This function will put the two arguments in the right place (registers) and\r
23 call HypercallAddr, which correspond to an entry in the hypercall pages.\r
24\r
25 @param HypercallAddr A memory address where the hypercall to call is.\r
26 @param Arg1 First argument.\r
27 @param Arg2 Second argument.\r
28\r
29 @return Return 0 if success otherwise it return an errno.\r
30**/\r
31INTN\r
32EFIAPI\r
33XenHypercall2 (\r
34 IN VOID *HypercallAddr,\r
35 IN OUT INTN Arg1,\r
36 IN OUT INTN Arg2\r
37 );\r
38\r
39/**\r
40 Get the page where all hypercall are from the XenInfo hob.\r
41\r
42 @param Dev A XENBUS_DEVICE instance.\r
43\r
44 @retval EFI_NOT_FOUND hyperpage could not be found.\r
45 @retval EFI_SUCCESS Successfully retrieve the hyperpage pointer.\r
46**/\r
47EFI_STATUS\r
48XenHyperpageInit (\r
49 XENBUS_DEVICE *Dev\r
50 );\r
51\r
52/**\r
53 Return the value of the HVM parameter Index.\r
54\r
55 @param Dev A XENBUS_DEVICE instance.\r
56 @param Index The parameter to get, e.g. HVM_PARAM_STORE_EVTCHN.\r
57\r
58 @return The value of the asked parameter or 0 in case of error.\r
59**/\r
60UINT64\r
61XenHypercallHvmGetParam (\r
62 XENBUS_DEVICE *Dev,\r
63 INTN Index\r
64 );\r
65\r
66/**\r
67 Hypercall to do different operation on the memory.\r
68\r
69 @param Dev A XENBUS_DEVICE instance.\r
70 @param Operation The operation number, e.g. XENMEM_add_to_physmap.\r
71 @param Arguments The arguments associated to the operation.\r
72\r
73 @return Return the return value from the hypercall, 0 in case of success\r
74 otherwise, an error code.\r
75**/\r
76INTN\r
77XenHypercallMemoryOp (\r
78 IN XENBUS_DEVICE *Dev,\r
79 IN UINTN Operation,\r
80 IN OUT VOID *Arguments\r
81 );\r
82\r
83/**\r
84 Do an operation on the event channels.\r
85\r
86 @param Dev A XENBUS_DEVICE instance.\r
87 @param Operation The operation number, e.g. EVTCHNOP_send.\r
88 @param Arguments The argument associated to the operation.\r
89\r
90 @return Return the return value from the hypercall, 0 in case of success\r
91 otherwise, an error code.\r
92**/\r
93INTN\r
94XenHypercallEventChannelOp (\r
95 IN XENBUS_DEVICE *Dev,\r
96 IN INTN Operation,\r
97 IN OUT VOID *Arguments\r
98 );\r
99\r
100/**\r
101 Map the shared_info_t page into memory.\r
102\r
103 @param Dev A XENBUS_DEVICE instance.\r
104\r
105 @retval EFI_SUCCESS Dev->SharedInfo whill contain a pointer to\r
106 the shared info page\r
107 @retval EFI_LOAD_ERROR The shared info page could not be mapped. The\r
108 hypercall returned an error.\r
109**/\r
110EFI_STATUS\r
111XenGetSharedInfoPage (\r
112 IN OUT XENBUS_DEVICE *Dev\r
113 );\r
114\r
115#endif\r