OpenAMP Library
remoteproc_virtio.h
Go to the documentation of this file.
1 /*
2  * Remoteproc Virtio Framework
3  *
4  * Copyright(c) 2018 Xilinx Ltd.
5  * Copyright(c) 2011 Texas Instruments, Inc.
6  * Copyright(c) 2011 Google, Inc.
7  * All rights reserved.
8  *
9  * SPDX-License-Identifier: BSD-3-Clause
10  */
11 
12 #ifndef REMOTEPROC_VIRTIO_H
13 #define REMOTEPROC_VIRTIO_H
14 
15 #include <metal/io.h>
16 #include <metal/list.h>
17 #include <openamp/virtio.h>
18 
19 #if defined __cplusplus
20 extern "C" {
21 #endif
22 
23 /* maximum number of vring descriptors for a vdev limited by 16-bit data type */
24 #define RPROC_MAX_VRING_DESC USHRT_MAX
25 
26 /* define vdev notification function user should implement */
27 typedef int (*rpvdev_notify_func)(void *priv, uint32_t id);
28 
39  void *priv;
40  void *vdev_rsc;
41  struct metal_io_region *vdev_rsc_io;
43  struct virtio_device vdev;
44  struct metal_list node;
45 };
46 
61 struct virtio_device *
62 rproc_virtio_create_vdev(unsigned int role, unsigned int notifyid,
63  void *rsc, struct metal_io_region *rsc_io,
64  void *priv,
65  rpvdev_notify_func notify,
66  virtio_dev_reset_cb rst_cb);
67 
73 void rproc_virtio_remove_vdev(struct virtio_device *vdev);
74 
88 int rproc_virtio_init_vring(struct virtio_device *vdev, unsigned int index,
89  unsigned int notifyid, void *va,
90  struct metal_io_region *io,
91  unsigned int num_descs, unsigned int align);
92 
101 int rproc_virtio_notified(struct virtio_device *vdev, uint32_t notifyid);
102 
112 
113 #if defined __cplusplus
114 }
115 #endif
116 
117 #endif /* REMOTEPROC_VIRTIO_H */
int rproc_virtio_init_vring(struct virtio_device *vdev, unsigned int index, unsigned int notifyid, void *va, struct metal_io_region *io, unsigned int num_descs, unsigned int align)
Initialize rproc virtio vring.
Definition: remoteproc_virtio.c:295
struct virtio_device * rproc_virtio_create_vdev(unsigned int role, unsigned int notifyid, void *rsc, struct metal_io_region *rsc_io, void *priv, rpvdev_notify_func notify, virtio_dev_reset_cb rst_cb)
Create rproc virtio vdev.
Definition: remoteproc_virtio.c:197
void rproc_virtio_wait_remote_ready(struct virtio_device *vdev)
Blocking function, waiting for the remote core is ready to start communications.
Definition: remoteproc_virtio.c:339
int(* rpvdev_notify_func)(void *priv, uint32_t id)
Definition: remoteproc_virtio.h:27
void rproc_virtio_remove_vdev(struct virtio_device *vdev)
Remove rproc virtio vdev.
Definition: remoteproc_virtio.c:275
int rproc_virtio_notified(struct virtio_device *vdev, uint32_t notifyid)
remoteproc virtio is got notified
Definition: remoteproc_virtio.c:316
Definition: remoteproc_virtio.h:38
struct metal_list node
Definition: remoteproc_virtio.h:44
rpvdev_notify_func notify
Definition: remoteproc_virtio.h:42
void * vdev_rsc
Definition: remoteproc_virtio.h:40
struct virtio_device vdev
Definition: remoteproc_virtio.h:43
struct metal_io_region * vdev_rsc_io
Definition: remoteproc_virtio.h:41
void * priv
Definition: remoteproc_virtio.h:39
Definition: virtio.h:118
unsigned int role
Definition: virtio.h:124
void * priv
Definition: virtio.h:127
uint32_t notifyid
Definition: virtio.h:119
void(* virtio_dev_reset_cb)(struct virtio_device *vdev)
Definition: virtio.h:90