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.


Added devices, device manager, and nvram device
[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_device_types.h>
6
7 struct vm_device;
8 struct guest_info;
9
10
11 struct vmm_dev_mgr {
12   struct guest_info   *vm;
13   struct vm_device  *dev_list;
14   uint_t             num_devices;
15 };
16
17
18 enum access_control {DEVICE_EMULATED, DEVICE_PASSTHROUGH} ;
19 enum access_type {DEVICE_READ, DEVICE_WRITE, DEVICE_READWRITE} ;
20
21 struct vm_device_io_hook {
22   enum access_control control;
23   enum access_type    atype;
24
25   ushort_t            guest_port;
26
27   // Do not touch anything below this
28   
29   struct vm_device_io_hook *next, *prev;
30 };
31
32 struct vm_device_mem_hook {
33   enum access_control control;
34   enum access_type    atype;
35
36   void             *guest_physical_start;
37   void             *guest_physical_end;
38
39   // Do not touch anything below this
40   
41   struct vm_device_mem_hook *next, *prev;
42
43 };
44
45
46
47 // Registration of devices
48
49 //
50 // The following device manager functions should only be called
51 // when the guest is stopped
52 //
53
54 int dev_mgr_init(struct vmm_dev_mgr *mgr, struct guest_info *vm);
55 int dev_mgr_deinit(struct vmm_dev_mgr *mgr);
56
57 int dev_mgr_attach_device(struct guest_info *vm, 
58                           struct vm_device *device);
59 int dev_mgr_detach_device(struct guest_info *vm, 
60                           struct vm_device *device);
61
62
63 int dev_mgr_hook_io(struct guest_info    *vm,
64                     struct vm_device   *device,
65                     ushort_t            portno,
66                     enum access_control control,
67                     enum access_type    atype);
68
69 int dev_mgr_unhook_io(struct guest_info    *vm,
70                       struct vm_device   *device,
71                       ushort_t            portno);
72
73 int dev_mgr_hook_mem(struct guest_info    *vm,
74                      struct vm_device   *device,
75                      void               *guest_physical_address_start,
76                      void               *guest_physical_address_end,
77                      enum access_control control,
78                      enum access_type    atype);
79
80 int dev_mgr_unhook_mem(struct guest_info    *vm,
81                        struct vm_device   *device,
82                        void               *guest_physical_address_start,
83                        void               *guest_physical_address_end);
84
85 //
86 // Strictly a helper - the device is resposible for unhooking on disconnect
87 //
88
89 int dev_mgr_unhook_device(struct guest_info  *vm,
90                           struct vm_device *device);
91
92
93 #endif