]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/XenHypercallLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / Include / Library / XenHypercallLib.h
1 /** @file
2 Functions declarations to make Xen hypercalls.
3
4 Copyright (C) 2014, Citrix Ltd.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __XEN_HYPERCALL_LIB_H__
11 #define __XEN_HYPERCALL_LIB_H__
12
13 /**
14 To call when the gEfiXenInfoGuid HOB became available after the library init
15 function has already been executed.
16
17 This allow to make hypercall in the PEIM stage.
18 **/
19 RETURN_STATUS
20 EFIAPI
21 XenHypercallLibInit (
22 VOID
23 );
24
25 /**
26 Check if the Xen Hypercall library is able to make calls to the Xen
27 hypervisor.
28
29 Client code should call further functions in this library only if, and after,
30 this function returns TRUE.
31
32 @retval TRUE Hypercalls are available.
33 @retval FALSE Hypercalls are not available.
34 **/
35 BOOLEAN
36 EFIAPI
37 XenHypercallIsAvailable (
38 VOID
39 );
40
41 /**
42 This function will put the two arguments in the right place (registers) and
43 invoke the hypercall identified by HypercallID.
44
45 @param HypercallID The symbolic ID of the hypercall to be invoked
46 @param Arg1 First argument.
47 @param Arg2 Second argument.
48
49 @return Return 0 if success otherwise it return an errno.
50 **/
51 INTN
52 EFIAPI
53 XenHypercall2 (
54 IN UINTN HypercallID,
55 IN OUT INTN Arg1,
56 IN OUT INTN Arg2
57 );
58
59 /**
60 Return the value of the HVM parameter Index.
61
62 @param Index The parameter to get, e.g. HVM_PARAM_STORE_EVTCHN.
63
64 @return The value of the asked parameter or 0 in case of error.
65 **/
66 UINT64
67 EFIAPI
68 XenHypercallHvmGetParam (
69 UINT32 Index
70 );
71
72 /**
73 Hypercall to do different operation on the memory.
74
75 @param Operation The operation number, e.g. XENMEM_add_to_physmap.
76 @param Arguments The arguments associated to the operation.
77
78 @return Return the return value from the hypercall, 0 in case of success
79 otherwise, an error code.
80 **/
81 INTN
82 EFIAPI
83 XenHypercallMemoryOp (
84 IN UINTN Operation,
85 IN OUT VOID *Arguments
86 );
87
88 /**
89 Do an operation on the event channels.
90
91 @param Operation The operation number, e.g. EVTCHNOP_send.
92 @param Arguments The argument associated to the operation.
93
94 @return Return the return value from the hypercall, 0 in case of success
95 otherwise, an error code.
96 **/
97 INTN
98 EFIAPI
99 XenHypercallEventChannelOp (
100 IN INTN Operation,
101 IN OUT VOID *Arguments
102 );
103
104 #endif