#include <stdbool.h>
#include <stdint.h>
#include <openamp/virtio_ring.h>
#include <metal/alloc.h>
#include <metal/io.h>
#include <metal/cache.h>
Go to the source code of this file.
|
| int | virtqueue_create (struct virtio_device *device, unsigned short id, const char *name, struct vring_alloc_info *ring, void(*callback)(struct virtqueue *vq), void(*notify)(struct virtqueue *vq), struct virtqueue *vq) |
| |
| static void | virtqueue_set_shmem_io (struct virtqueue *vq, struct metal_io_region *io) |
| |
| int | virtqueue_add_buffer (struct virtqueue *vq, struct virtqueue_buf *buf_list, int readable, int writable, void *cookie) |
| |
| void * | virtqueue_get_buffer (struct virtqueue *vq, uint32_t *len, uint16_t *idx) |
| |
| void * | virtqueue_get_first_avail_buffer (struct virtqueue *vq, uint16_t *avail_idx, uint32_t *len) |
| |
| void * | virtqueue_get_next_avail_buffer (struct virtqueue *vq, uint16_t idx, uint16_t *next_idx, uint32_t *next_len) |
| |
| int | virtqueue_add_consumed_buffer (struct virtqueue *vq, uint16_t head_idx, uint32_t len) |
| |
| void | virtqueue_disable_cb (struct virtqueue *vq) |
| |
| int | virtqueue_enable_cb (struct virtqueue *vq) |
| |
| void | virtqueue_kick (struct virtqueue *vq) |
| |
| static struct virtqueue * | virtqueue_allocate (unsigned int num_desc_extra) |
| |
| void | virtqueue_free (struct virtqueue *vq) |
| |
| void | virtqueue_dump (struct virtqueue *vq) |
| |
| void | virtqueue_notification (struct virtqueue *vq) |
| |
| uint32_t | virtqueue_get_desc_size (struct virtqueue *vq) |
| |
| uint32_t | virtqueue_get_buffer_length (struct virtqueue *vq, uint16_t idx) |
| |
| void * | virtqueue_get_buffer_addr (struct virtqueue *vq, uint16_t idx) |
| |
| static int | virtqueue_empty (struct virtqueue *vq) |
| | Test if virtqueue is empty. More...
|
| |
| static int | virtqueue_full (struct virtqueue *vq) |
| | Test if virtqueue is full. More...
|
| |
◆ ERROR_EMPTY_RING
◆ ERROR_INVLD_DESC_IDX
◆ ERROR_NO_MEM
◆ ERROR_VQUEUE_INVLD_PARAM
◆ ERROR_VRING_ALIGN
◆ ERROR_VRING_FULL
◆ ERROR_VRING_MAX_DESC
◆ ERROR_VRING_NO_BUFF
◆ VIRTIO_RING_F_EVENT_IDX
| #define VIRTIO_RING_F_EVENT_IDX (1 << 29) |
◆ VIRTIO_RING_F_INDIRECT_DESC
| #define VIRTIO_RING_F_INDIRECT_DESC (1 << 28) |
◆ VQ_ERROR_BASE
| #define VQ_ERROR_BASE -3000 |
◆ VQ_PARAM_CHK
| #define VQ_PARAM_CHK |
( |
|
condition, |
|
|
|
status_var, |
|
|
|
status_err |
|
) |
| |
◆ VQ_RING_ASSERT_CHAIN_TERM
| #define VQ_RING_ASSERT_CHAIN_TERM |
( |
|
_vq | ) |
|
◆ VQ_RING_ASSERT_VALID_IDX
| #define VQ_RING_ASSERT_VALID_IDX |
( |
|
_vq, |
|
|
|
_idx |
|
) |
| |
◆ VQ_RING_DESC_CHAIN_END
| #define VQ_RING_DESC_CHAIN_END 32768 |
◆ VQASSERT
| #define VQASSERT |
( |
|
_vq, |
|
|
|
_exp, |
|
|
|
_msg |
|
) |
| |
◆ VQUEUE_BUSY
| #define VQUEUE_BUSY |
( |
|
vq | ) |
|
◆ VQUEUE_IDLE
| #define VQUEUE_IDLE |
( |
|
vq | ) |
|
◆ VQUEUE_SUCCESS
◆ VRING_FLUSH
| #define VRING_FLUSH |
( |
|
x, |
|
|
|
s |
|
) |
| do { } while (0) |
◆ VRING_INVALIDATE
| #define VRING_INVALIDATE |
( |
|
x, |
|
|
|
s |
|
) |
| do { } while (0) |
◆ vq_callback
| typedef void(* vq_callback) (struct virtqueue *) |
◆ vq_notify
| typedef void(* vq_notify) (struct virtqueue *) |
◆ virtqueue_add_buffer()
| int virtqueue_add_buffer |
( |
struct virtqueue * |
vq, |
|
|
struct virtqueue_buf * |
buf_list, |
|
|
int |
readable, |
|
|
int |
writable, |
|
|
void * |
cookie |
|
) |
| |
◆ virtqueue_add_consumed_buffer()
| int virtqueue_add_consumed_buffer |
( |
struct virtqueue * |
vq, |
|
|
uint16_t |
head_idx, |
|
|
uint32_t |
len |
|
) |
| |
◆ virtqueue_allocate()
| static struct virtqueue* virtqueue_allocate |
( |
unsigned int |
num_desc_extra | ) |
|
|
inlinestatic |
◆ virtqueue_create()
◆ virtqueue_disable_cb()
| void virtqueue_disable_cb |
( |
struct virtqueue * |
vq | ) |
|
◆ virtqueue_dump()
◆ virtqueue_empty()
| static int virtqueue_empty |
( |
struct virtqueue * |
vq | ) |
|
|
inlinestatic |
Test if virtqueue is empty.
- Parameters
-
| vq | Pointer to VirtIO queue control block |
- Returns
- 1 if virtqueue is empty, 0 otherwise
◆ virtqueue_enable_cb()
| int virtqueue_enable_cb |
( |
struct virtqueue * |
vq | ) |
|
◆ virtqueue_free()
◆ virtqueue_full()
| static int virtqueue_full |
( |
struct virtqueue * |
vq | ) |
|
|
inlinestatic |
Test if virtqueue is full.
- Parameters
-
| vq | Pointer to VirtIO queue control block |
- Returns
- 1 if virtqueue is full, 0 otherwise
◆ virtqueue_get_buffer()
| void* virtqueue_get_buffer |
( |
struct virtqueue * |
vq, |
|
|
uint32_t * |
len, |
|
|
uint16_t * |
idx |
|
) |
| |
◆ virtqueue_get_buffer_addr()
| void* virtqueue_get_buffer_addr |
( |
struct virtqueue * |
vq, |
|
|
uint16_t |
idx |
|
) |
| |
◆ virtqueue_get_buffer_length()
| uint32_t virtqueue_get_buffer_length |
( |
struct virtqueue * |
vq, |
|
|
uint16_t |
idx |
|
) |
| |
◆ virtqueue_get_desc_size()
| uint32_t virtqueue_get_desc_size |
( |
struct virtqueue * |
vq | ) |
|
◆ virtqueue_get_first_avail_buffer()
| void* virtqueue_get_first_avail_buffer |
( |
struct virtqueue * |
vq, |
|
|
uint16_t * |
avail_idx, |
|
|
uint32_t * |
len |
|
) |
| |
◆ virtqueue_get_next_avail_buffer()
| void* virtqueue_get_next_avail_buffer |
( |
struct virtqueue * |
vq, |
|
|
uint16_t |
idx, |
|
|
uint16_t * |
next_idx, |
|
|
uint32_t * |
next_len |
|
) |
| |
◆ virtqueue_kick()
◆ virtqueue_notification()
| void virtqueue_notification |
( |
struct virtqueue * |
vq | ) |
|
◆ virtqueue_set_shmem_io()
| static void virtqueue_set_shmem_io |
( |
struct virtqueue * |
vq, |
|
|
struct metal_io_region * |
io |
|
) |
| |
|
inlinestatic |