debuggers.hg

view tools/libxc/xc_physdev.c @ 21067:b4a1832a916f

Update Xen version to 4.0.0-rc6
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 09 18:18:05 2010 +0000 (2010-03-09)
parents 12a5ca59b175
children 779c0ef9682c
line source
1 /******************************************************************************
2 * xc_physdev.c
3 *
4 * API for manipulating physical-device access permissions.
5 *
6 * Copyright (c) 2004, Rolf Neugebauer (Intel Research Cambridge)
7 * Copyright (c) 2004, K A Fraser (University of Cambridge)
8 */
10 #include "xc_private.h"
12 int xc_physdev_pci_access_modify(int xc_handle,
13 uint32_t domid,
14 int bus,
15 int dev,
16 int func,
17 int enable)
18 {
19 errno = ENOSYS;
20 return -1;
21 }
23 int xc_physdev_map_pirq(int xc_handle,
24 int domid,
25 int index,
26 int *pirq)
27 {
28 int rc;
29 struct physdev_map_pirq map;
31 if ( !pirq )
32 return -EINVAL;
34 memset(&map, 0, sizeof(struct physdev_map_pirq));
35 map.domid = domid;
36 map.type = MAP_PIRQ_TYPE_GSI;
37 map.index = index;
38 map.pirq = *pirq;
40 rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map, sizeof(map));
42 if ( !rc )
43 *pirq = map.pirq;
45 return rc;
46 }
48 int xc_physdev_map_pirq_msi(int xc_handle,
49 int domid,
50 int index,
51 int *pirq,
52 int devfn,
53 int bus,
54 int entry_nr,
55 uint64_t table_base)
56 {
57 int rc;
58 struct physdev_map_pirq map;
60 if ( !pirq )
61 return -EINVAL;
63 memset(&map, 0, sizeof(struct physdev_map_pirq));
64 map.domid = domid;
65 map.type = MAP_PIRQ_TYPE_MSI;
66 map.index = index;
67 map.pirq = *pirq;
68 map.bus = bus;
69 map.devfn = devfn;
70 map.entry_nr = entry_nr;
71 map.table_base = table_base;
73 rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map, sizeof(map));
75 if ( !rc )
76 *pirq = map.pirq;
78 return rc;
79 }
81 int xc_physdev_unmap_pirq(int xc_handle,
82 int domid,
83 int pirq)
84 {
85 int rc;
86 struct physdev_unmap_pirq unmap;
88 memset(&unmap, 0, sizeof(struct physdev_unmap_pirq));
89 unmap.domid = domid;
90 unmap.pirq = pirq;
92 rc = do_physdev_op(xc_handle, PHYSDEVOP_unmap_pirq, &unmap, sizeof(unmap));
94 return rc;
95 }