Files
xen/tools/libxc/xc_physdev.c
T
Keir Fraser 5cc436c1d2 libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).

Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.

There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.

All libxc callers have been adjusted accordingly.

Also update QEMU_TAG for corresponding qemu change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:30:19 +01:00

97 lines
2.3 KiB
C

/******************************************************************************
* xc_physdev.c
*
* API for manipulating physical-device access permissions.
*
* Copyright (c) 2004, Rolf Neugebauer (Intel Research Cambridge)
* Copyright (c) 2004, K A Fraser (University of Cambridge)
*/
#include "xc_private.h"
int xc_physdev_pci_access_modify(xc_interface *xch,
uint32_t domid,
int bus,
int dev,
int func,
int enable)
{
errno = ENOSYS;
return -1;
}
int xc_physdev_map_pirq(xc_interface *xch,
int domid,
int index,
int *pirq)
{
int rc;
struct physdev_map_pirq map;
if ( !pirq )
return -EINVAL;
memset(&map, 0, sizeof(struct physdev_map_pirq));
map.domid = domid;
map.type = MAP_PIRQ_TYPE_GSI;
map.index = index;
map.pirq = *pirq;
rc = do_physdev_op(xch, PHYSDEVOP_map_pirq, &map, sizeof(map));
if ( !rc )
*pirq = map.pirq;
return rc;
}
int xc_physdev_map_pirq_msi(xc_interface *xch,
int domid,
int index,
int *pirq,
int devfn,
int bus,
int entry_nr,
uint64_t table_base)
{
int rc;
struct physdev_map_pirq map;
if ( !pirq )
return -EINVAL;
memset(&map, 0, sizeof(struct physdev_map_pirq));
map.domid = domid;
map.type = MAP_PIRQ_TYPE_MSI;
map.index = index;
map.pirq = *pirq;
map.bus = bus;
map.devfn = devfn;
map.entry_nr = entry_nr;
map.table_base = table_base;
rc = do_physdev_op(xch, PHYSDEVOP_map_pirq, &map, sizeof(map));
if ( !rc )
*pirq = map.pirq;
return rc;
}
int xc_physdev_unmap_pirq(xc_interface *xch,
int domid,
int pirq)
{
int rc;
struct physdev_unmap_pirq unmap;
memset(&unmap, 0, sizeof(struct physdev_unmap_pirq));
unmap.domid = domid;
unmap.pirq = pirq;
rc = do_physdev_op(xch, PHYSDEVOP_unmap_pirq, &unmap, sizeof(unmap));
return rc;
}