From a89e7a10d501439f847553eb915c423c5c050cbe Mon Sep 17 00:00:00 2001 From: bryanv Date: Mon, 19 Feb 2018 19:31:18 +0000 Subject: [PATCH] Add more virtqueue getter methods MFC after: 2 weeks --- sys/dev/virtio/virtqueue.c | 27 +++++++++++++++++++++++++++ sys/dev/virtio/virtqueue.h | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c index 9434298ce231..e23d4d25c47f 100644 --- a/sys/dev/virtio/virtqueue.c +++ b/sys/dev/virtio/virtqueue.c @@ -369,6 +369,33 @@ virtqueue_paddr(struct virtqueue *vq) return (vtophys(vq->vq_ring_mem)); } +vm_paddr_t +virtqueue_desc_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.desc)); +} + +vm_paddr_t +virtqueue_avail_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.avail)); +} + +vm_paddr_t +virtqueue_used_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.used)); +} + +uint16_t +virtqueue_index(struct virtqueue *vq) +{ + return (vq->vq_queue_index); +} + int virtqueue_size(struct virtqueue *vq) { diff --git a/sys/dev/virtio/virtqueue.h b/sys/dev/virtio/virtqueue.h index 7a70dc781694..7b2db673f7ae 100644 --- a/sys/dev/virtio/virtqueue.h +++ b/sys/dev/virtio/virtqueue.h @@ -84,7 +84,11 @@ void virtqueue_disable_intr(struct virtqueue *vq); /* Get physical address of the virtqueue ring. */ vm_paddr_t virtqueue_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_desc_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_avail_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_used_paddr(struct virtqueue *vq); +uint16_t virtqueue_index(struct virtqueue *vq); int virtqueue_full(struct virtqueue *vq); int virtqueue_empty(struct virtqueue *vq); int virtqueue_size(struct virtqueue *vq);