xref: /kvmtool/include/kvm/devices.h (revision 8f160708e68f4322cd698052d17ade8708d0982c)
1 #ifndef KVM__DEVICES_H
2 #define KVM__DEVICES_H
3 
4 #include <linux/rbtree.h>
5 #include <linux/types.h>
6 #include <linux/compiler.h>
7 
8 enum device_bus_type {
9 	DEVICE_BUS_PCI,
10 	DEVICE_BUS_MMIO,
11 	DEVICE_BUS_IOPORT,
12 	DEVICE_BUS_MAX,
13 };
14 
15 struct device_header {
16 	enum device_bus_type	bus_type;
17 	void			*data;
18 	int			dev_num;
19 	struct rb_node		node;
20 };
21 
22 int __must_check device__register(struct device_header *dev);
23 void device__unregister(struct device_header *dev);
24 struct device_header *device__find_dev(enum device_bus_type bus_type,
25 				       u8 dev_num);
26 
27 struct device_header *device__first_dev(enum device_bus_type bus_type);
28 struct device_header *device__next_dev(struct device_header *dev);
29 
30 #endif /* KVM__DEVICES_H */
31