mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-09-22 07:34:11 +08:00
virtqueue: Add helper to get the buffer address from descriptor index
As it possible to get the buffer length we need also to retrieve the address associated to the descriptor index. This is need by rpmsg virtio to implement the buffer recycler. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
753a20368b
commit
2e0015af74
@@ -222,6 +222,7 @@ 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);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
|
||||
@@ -226,6 +226,12 @@ uint32_t virtqueue_get_buffer_length(struct virtqueue *vq, uint16_t idx)
|
||||
return vq->vq_ring.desc[idx].len;
|
||||
}
|
||||
|
||||
void *virtqueue_get_buffer_addr(struct virtqueue *vq, uint16_t idx)
|
||||
{
|
||||
VRING_INVALIDATE(vq->vq_ring.desc[idx].addr);
|
||||
return virtqueue_phys_to_virt(vq, vq->vq_ring.desc[idx].addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* virtqueue_free - Frees VirtIO queue resources
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user