]>
Commit | Line | Data |
---|---|---|
4e53f78e MT |
1 | #ifndef LINUX_VIRTIO_H |
2 | #define LINUX_VIRTIO_H | |
61d0b5a4 RR |
3 | #include <linux/scatterlist.h> |
4 | #include <linux/kernel.h> | |
4e53f78e | 5 | |
6be3ffaa MT |
6 | struct device { |
7 | void *parent; | |
8 | }; | |
9 | ||
4e53f78e | 10 | struct virtio_device { |
6be3ffaa | 11 | struct device dev; |
d0254773 | 12 | u64 features; |
4e53f78e MT |
13 | }; |
14 | ||
15 | struct virtqueue { | |
16 | /* TODO: commented as list macros are empty stubs for now. | |
17 | * Broken but enough for virtio_ring.c | |
18 | * struct list_head list; */ | |
19 | void (*callback)(struct virtqueue *vq); | |
20 | const char *name; | |
21 | struct virtio_device *vdev; | |
73640c99 MT |
22 | unsigned int index; |
23 | unsigned int num_free; | |
4e53f78e MT |
24 | void *priv; |
25 | }; | |
26 | ||
4e53f78e | 27 | /* Interfaces exported by virtio_ring. */ |
13816c76 RR |
28 | int virtqueue_add_sgs(struct virtqueue *vq, |
29 | struct scatterlist *sgs[], | |
30 | unsigned int out_sgs, | |
31 | unsigned int in_sgs, | |
32 | void *data, | |
33 | gfp_t gfp); | |
34 | ||
e538ebaf RR |
35 | int virtqueue_add_outbuf(struct virtqueue *vq, |
36 | struct scatterlist sg[], unsigned int num, | |
37 | void *data, | |
38 | gfp_t gfp); | |
39 | ||
40 | int virtqueue_add_inbuf(struct virtqueue *vq, | |
41 | struct scatterlist sg[], unsigned int num, | |
42 | void *data, | |
43 | gfp_t gfp); | |
44 | ||
d1b8c4c2 | 45 | bool virtqueue_kick(struct virtqueue *vq); |
4e53f78e MT |
46 | |
47 | void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); | |
48 | ||
49 | void virtqueue_disable_cb(struct virtqueue *vq); | |
50 | ||
51 | bool virtqueue_enable_cb(struct virtqueue *vq); | |
64d09888 | 52 | bool virtqueue_enable_cb_delayed(struct virtqueue *vq); |
4e53f78e MT |
53 | |
54 | void *virtqueue_detach_unused_buf(struct virtqueue *vq); | |
73640c99 MT |
55 | struct virtqueue *vring_new_virtqueue(unsigned int index, |
56 | unsigned int num, | |
4e53f78e MT |
57 | unsigned int vring_align, |
58 | struct virtio_device *vdev, | |
7b21e34f | 59 | bool weak_barriers, |
4e53f78e | 60 | void *pages, |
d1b8c4c2 | 61 | bool (*notify)(struct virtqueue *vq), |
4e53f78e MT |
62 | void (*callback)(struct virtqueue *vq), |
63 | const char *name); | |
64 | void vring_del_virtqueue(struct virtqueue *vq); | |
65 | ||
66 | #endif |