-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvirtio_over_shmem.h
More file actions
78 lines (61 loc) · 1.49 KB
/
virtio_over_shmem.h
File metadata and controls
78 lines (61 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef __BACKENDS_VIRTIO_OVER_SHMEM_H__
#define __BACKENDS_VIRTIO_OVER_SHMEM_H__
#include <stddef.h>
#include <stdint.h>
#include <linux/virtio_pci.h>
#include <pci_core.h>
#include "shmem.h"
struct virtio_backend_info {
// init at runtime
struct shmem_ops *shmem_ops;
const char *shmem_devpath;
char *opts;
pthread_t tid;
void *native_window;
bool vdev_inited;
bool vdev_termed;
// driver static data
struct pci_vdev_ops *pci_vdev_ops;
void (*hook_before_init)(struct virtio_backend_info *info);
};
#define BACKEND_FLAG_PRESENT 0x0001
struct virtio_shmem_header {
uint32_t revision;
uint32_t size;
uint32_t device_id;
uint32_t vendor_id;
union {
uint32_t write_transaction;
struct {
uint16_t write_offset;
uint16_t write_size;
};
};
uint8_t config_event;
uint8_t queue_event;
uint8_t __rsvd[2];
union {
uint32_t frontend_status;
struct {
uint16_t frontend_flags;
uint16_t frontend_id;
};
};
union {
uint32_t backend_status;
struct {
uint16_t backend_flags;
uint16_t backend_id;
};
};
struct virtio_pci_common_cfg common_config;
char config[];
};
#define VI_REG_OFFSET(reg) \
__builtin_offsetof(struct shmem_virtio_header, reg)
extern struct virtio_shmem_header *virtio_header;
int vos_backend_init(struct virtio_backend_info *info);
void vos_backend_run(void);
void vos_backend_deinit(struct virtio_backend_info *info);
//void write_config(struct virtio_base *base,int offset,int size);
#endif /* __BACKENDS_VIRTIO_OVER_SHMEM_H__ */