debuggers.hg

view tools/libxc/xc_physdev.c @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 5c0bf00e371d
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 type,
26 int index,
27 int *pirq)
28 {
29 int rc;
30 struct physdev_map_pirq map;
32 if ( !pirq )
33 return -EINVAL;
35 map.domid = domid;
36 map.type = type;
37 map.index = index;
38 map.pirq = *pirq;
40 rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &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 type,
51 int index,
52 int *pirq,
53 int devfn,
54 int bus,
55 int entry_nr,
56 int msi_type)
57 {
58 int rc;
59 struct physdev_map_pirq map;
61 if ( !pirq )
62 return -EINVAL;
64 map.domid = domid;
65 map.type = type;
66 map.index = index;
67 map.pirq = *pirq;
68 map.msi_info.devfn = devfn;
69 map.msi_info.bus = bus;
70 map.msi_info.entry_nr = entry_nr;
71 map.msi_info.msi = msi_type;
73 rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &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 unmap.domid = domid;
89 unmap.pirq = pirq;
91 rc = do_physdev_op(xc_handle, PHYSDEVOP_unmap_pirq, &unmap);
93 return rc;
94 }