2 Functions to make Xen hypercalls.
4 Copyright (C) 2014, Citrix Ltd.
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
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.
17 #include <Library/HobLib.h>
18 #include <Guid/XenInfo.h>
20 #include "XenBusDxe.h"
21 #include "XenHypercall.h"
23 #include <IndustryStandard/Xen/hvm/params.h>
24 #include <IndustryStandard/Xen/memory.h>
26 STATIC VOID
*HyperPage
;
29 // Interface exposed by the ASM implementation of the core hypercall
34 IN VOID
*HypercallAddr
,
43 EFI_HOB_GUID_TYPE
*GuidHob
;
44 EFI_XEN_INFO
*XenInfo
;
46 GuidHob
= GetFirstGuidHob (&gEfiXenInfoGuid
);
47 if (GuidHob
== NULL
) {
50 XenInfo
= (EFI_XEN_INFO
*) GET_GUID_HOB_DATA (GuidHob
);
51 HyperPage
= XenInfo
->HyperPages
;
56 XenHypercallHvmGetParam (
60 xen_hvm_param_t Parameter
;
63 Parameter
.domid
= DOMID_SELF
;
64 Parameter
.index
= Index
;
65 Error
= XenHypercall2 (__HYPERVISOR_hvm_op
,
66 HVMOP_get_param
, (INTN
) &Parameter
);
69 "XenHypercall: Error %d trying to get HVM parameter %d\n",
73 return Parameter
.value
;
77 XenHypercallMemoryOp (
79 IN OUT VOID
*Arguments
82 return XenHypercall2 (__HYPERVISOR_memory_op
,
83 Operation
, (INTN
) Arguments
);
87 XenHypercallEventChannelOp (
89 IN OUT VOID
*Arguments
92 return XenHypercall2 (__HYPERVISOR_event_channel_op
,
93 Operation
, (INTN
) Arguments
);
104 ASSERT (HyperPage
!= NULL
);
106 return __XenHypercall2 ((UINT8
*)HyperPage
+ HypercallID
* 32, Arg1
, Arg2
);