Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


moved over the a real linked list implementation
[palacios.git] / palacios / include / palacios / vmm_dev_mgr.h
1 #ifndef _VMM_DEV_MGR
2 #define _VMM_DEV_MGR
3
4 #include <palacios/vmm_types.h>
5 #include <palacios/vmm_list.h>
6 #include <palacios/vmm_string.h>
7
8 struct vm_device;
9 struct guest_info;
10
11
12 struct vmm_dev_mgr {
13   uint_t num_devs;
14   struct list_head dev_list;
15
16   uint_t num_io_hooks;
17   struct list_head io_hooks;
18   
19   uint_t num_mem_hooks;
20   struct list_head mem_hooks;
21
22   uint_t num_irq_hooks;
23   struct list_head irq_hooks;
24 };
25
26
27
28 struct dev_io_hook {
29   ushort_t port;
30   
31   int (*read)(ushort_t port, void * dst, uint_t length, struct vm_device * dev);
32   int (*write)(ushort_t port, void * src, uint_t length, struct vm_device * dev);
33
34   struct vm_device * dev;
35
36   // Do not touch anything below this  
37   /*
38     struct dev_io_hook *dev_next, *dev_prev;
39     struct dev_io_hook *mgr_next, *mgr_prev;
40   */
41   struct list_head dev_list;
42   struct list_head mgr_list;
43 };
44
45 struct dev_mem_hook {
46   void  *addr_start;
47   void  *addr_end;
48
49   struct vm_device * dev;
50
51   // Do not touch anything below this
52   struct list_head dev_list;
53   struct list_head mgr_list;
54 };
55
56 struct dev_irq_hook {
57   uint_t irq;
58
59   int (*handler)(uint_t irq, struct vm_device * dev);
60
61   struct vm_device * dev;
62
63   struct list_head dev_list;
64   struct list_head mgr_list;
65 };
66
67 // Registration of devices
68
69 //
70 // The following device manager functions should only be called
71 // when the guest is stopped
72 //
73
74 int dev_mgr_init(struct vmm_dev_mgr *mgr);
75 int dev_mgr_deinit(struct vmm_dev_mgr * mgr);
76
77
78
79 int attach_device(struct guest_info *vm, struct vm_device * dev);
80 int unattach_device(struct vm_device *dev);
81
82
83 int dev_mgr_add_device(struct vmm_dev_mgr * mgr, struct vm_device * dev);
84 int dev_mgr_remove_device(struct vmm_dev_mgr * mgr, struct vm_device * dev);
85
86
87 /*
88   int dev_mgr_add_io_hook(struct vmm_dev_mgr * mgr, struct dev_io_hook * hook);
89   int dev_mgr_remove_io_hook(struct vmm_dev_mgr * mgr, struct dev_io_hook * hook);
90   int dev_add_io_hook(struct vmm_dev_mgr * mgr, struct dev_io_hook * hook);
91   int dev_remove_io_hook(struct vmm_dev_mgr * mgr, struct dev_io_hook * hook);
92   struct dev_io_hook * dev_find_io_hook(struct vm_device * dev, ushort_t port);
93   struct dev_io_hook * dev_mgr_find_io_hook(struct vmm_dev_mgr * mgr, ushort_t port)
94 */
95
96 void PrintDebugDevMgr(struct vmm_dev_mgr * mgr);
97 void PrintDebugDev(struct vm_device * dev);
98 void PrintDebugDevIO(struct vm_device * dev);
99 void PrintDebugDevMgrIO(struct vmm_dev_mgr * mgr);
100
101 #endif