2014-10-29 07:49:10 +01:00
|
|
|
/** @file
|
|
|
|
Functions to make Xen hypercalls.
|
|
|
|
|
|
|
|
Copyright (C) 2014, Citrix Ltd.
|
|
|
|
|
2019-04-04 01:06:33 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2014-10-29 07:49:10 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include <PiDxe.h>
|
|
|
|
|
|
|
|
#include <IndustryStandard/Xen/hvm/params.h>
|
|
|
|
#include <IndustryStandard/Xen/memory.h>
|
|
|
|
|
2015-02-28 21:32:39 +01:00
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/XenHypercallLib.h>
|
2014-10-29 07:49:10 +01:00
|
|
|
|
|
|
|
UINT64
|
2016-12-06 13:03:24 +01:00
|
|
|
EFIAPI
|
2014-10-29 07:49:10 +01:00
|
|
|
XenHypercallHvmGetParam (
|
2014-11-14 18:35:29 +01:00
|
|
|
IN UINT32 Index
|
2014-10-29 07:49:10 +01:00
|
|
|
)
|
|
|
|
{
|
|
|
|
xen_hvm_param_t Parameter;
|
|
|
|
INTN Error;
|
|
|
|
|
|
|
|
Parameter.domid = DOMID_SELF;
|
|
|
|
Parameter.index = Index;
|
2015-02-28 21:32:27 +01:00
|
|
|
Error = XenHypercall2 (__HYPERVISOR_hvm_op,
|
2014-10-29 07:49:10 +01:00
|
|
|
HVMOP_get_param, (INTN) &Parameter);
|
|
|
|
if (Error != 0) {
|
|
|
|
DEBUG ((EFI_D_ERROR,
|
2015-07-28 20:33:23 +02:00
|
|
|
"XenHypercall: Error %Ld trying to get HVM parameter %d\n",
|
|
|
|
(INT64)Error, Index));
|
2014-10-29 07:49:10 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return Parameter.value;
|
|
|
|
}
|
|
|
|
|
|
|
|
INTN
|
2016-12-06 13:03:24 +01:00
|
|
|
EFIAPI
|
2014-10-29 07:49:10 +01:00
|
|
|
XenHypercallMemoryOp (
|
|
|
|
IN UINTN Operation,
|
|
|
|
IN OUT VOID *Arguments
|
|
|
|
)
|
|
|
|
{
|
2015-02-28 21:32:27 +01:00
|
|
|
return XenHypercall2 (__HYPERVISOR_memory_op,
|
2014-10-29 07:49:10 +01:00
|
|
|
Operation, (INTN) Arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
INTN
|
2016-12-06 13:03:24 +01:00
|
|
|
EFIAPI
|
2014-10-29 07:49:10 +01:00
|
|
|
XenHypercallEventChannelOp (
|
|
|
|
IN INTN Operation,
|
|
|
|
IN OUT VOID *Arguments
|
|
|
|
)
|
|
|
|
{
|
2015-02-28 21:32:27 +01:00
|
|
|
return XenHypercall2 (__HYPERVISOR_event_channel_op,
|
2014-10-29 07:49:10 +01:00
|
|
|
Operation, (INTN) Arguments);
|
|
|
|
}
|