]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/XenHypercallLib/XenHypercall.c
OvmfPkg/Virtio: take RingBaseShift in SetQueueAddress()
[mirror_edk2.git] / OvmfPkg / Library / XenHypercallLib / XenHypercall.c
CommitLineData
abcbbb14
AP
1/** @file\r
2 Functions 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#include <PiDxe.h>\r
abcbbb14
AP
17\r
18#include <IndustryStandard/Xen/hvm/params.h>\r
19#include <IndustryStandard/Xen/memory.h>\r
20\r
cd8ff8fd
AB
21#include <Library/DebugLib.h>\r
22#include <Library/XenHypercallLib.h>\r
abcbbb14
AP
23\r
24UINT64\r
6ad157c3 25EFIAPI\r
abcbbb14 26XenHypercallHvmGetParam (\r
cec6ad0a 27 IN UINT32 Index\r
abcbbb14
AP
28 )\r
29{\r
30 xen_hvm_param_t Parameter;\r
31 INTN Error;\r
32\r
abcbbb14
AP
33 Parameter.domid = DOMID_SELF;\r
34 Parameter.index = Index;\r
bbc3758a 35 Error = XenHypercall2 (__HYPERVISOR_hvm_op,\r
abcbbb14
AP
36 HVMOP_get_param, (INTN) &Parameter);\r
37 if (Error != 0) {\r
38 DEBUG ((EFI_D_ERROR,\r
6394c35a
LE
39 "XenHypercall: Error %Ld trying to get HVM parameter %d\n",\r
40 (INT64)Error, Index));\r
abcbbb14
AP
41 return 0;\r
42 }\r
43 return Parameter.value;\r
44}\r
45\r
46INTN\r
6ad157c3 47EFIAPI\r
abcbbb14 48XenHypercallMemoryOp (\r
abcbbb14
AP
49 IN UINTN Operation,\r
50 IN OUT VOID *Arguments\r
51 )\r
52{\r
bbc3758a 53 return XenHypercall2 (__HYPERVISOR_memory_op,\r
abcbbb14
AP
54 Operation, (INTN) Arguments);\r
55}\r
56\r
57INTN\r
6ad157c3 58EFIAPI\r
abcbbb14 59XenHypercallEventChannelOp (\r
abcbbb14
AP
60 IN INTN Operation,\r
61 IN OUT VOID *Arguments\r
62 )\r
63{\r
bbc3758a 64 return XenHypercall2 (__HYPERVISOR_event_channel_op,\r
abcbbb14
AP
65 Operation, (INTN) Arguments);\r
66}\r