1Remoteproc data struct
2===========================
3* Representation of the remote processor instance:
4
5```
6struct remoteproc {
7	metal_mutex_t lock;                /**< mutex lock */
8	void *rsc_table;                   /**< address of the resource table */
9	size_t rsc_len;                    /**< length of the resource table */
10	struct metal_io_region *rsc_io;    /**< metal I/O region of resource table*/
11	struct metal_list mems;            /**< remoteproc memories */
12	struct metal_list vdevs;           /**< remoteproc virtio devices */
13	unsigned long bitmap;              /**< bitmap for notify IDs for remoteproc subdevices */
14	const struct remoteproc_ops *ops;  /**< pointer to remoteproc operation */
15	metal_phys_addr_t bootaddr;        /**< boot address */
16	const struct loader_ops *loader;   /**< image loader operation */
17	unsigned int state;                /**< remote processor state */
18	void *priv;                        /**< remoteproc private data */
19};
20```
21* Representation of the remote processor virtio device:
22```
23
24struct remoteproc_virtio {
25	void *priv;                           /**< private data */
26	void *vdev_rsc;                       /**< address of vdev resource */
27	struct metal_io_region *vdev_rsc_io;  /**< metal I/O region of vdev_info, can be NULL */
28	rpvdev_notify_func notify;            /**< notification function */
29	struct virtio_device vdev;            /**< associated virtio device */
30	struct metal_list node;               /**< node for the remoteproc vdevs list */
31};
32
33```
34
35Virtio Data struct
36===========================
37* Representation of a virtio device:
38```
39struct virtio_dev {
40	uint32_t notifyid;                       /**< unique position on the virtio bus */
41	struct virtio_device_id id;              /**< the device type identification (used to match it with a driver */
42	uint64_t features;                       /**< the features supported by both ends. */
43	unsigned int role;                       /**< if it is virtio backend or front end. */
44	virtio_dev_reset_cb reset_cb;            /**< user registered device callback */
45	const struct virtio_dispatch *func;      /**< Virtio dispatch table */
46	void *priv;                              /**< pointer to virtio_device private data */
47	unsigned int vrings_num;                 /**< number of vrings */
48	struct virtio_vring_info *vrings_info;   /**< vrings associated to the virtio device*/
49};
50```
51
52* Representation of a virtqueue local context:
53```
54struct virtqueue {
55	struct virtio_device *vq_dev;            /**< pointer to virtio device */
56	const char *vq_name;                     /**< virtqueue name */
57	uint16_t vq_queue_index;                 /**< virtqueue name */
58	uint16_t vq_nentries;
59	void (*callback)(struct virtqueue *vq);  /**< virtqueue callback */
60	void (*notify)(struct virtqueue *vq);    /**< virtqueue notify remote function */
61	struct vring vq_ring;
62	uint16_t vq_free_cnt;
63	uint16_t vq_queued_cnt;
64	void *shm_io;                            /**< pointer to the shared buffer I/O region */
65
66	/*
67	 * Head of the free chain in the descriptor table. If
68	 * there are no free descriptors, this will be set to
69	 * VQ_RING_DESC_CHAIN_END.
70	 */
71	uint16_t vq_desc_head_idx;
72
73	/*
74	 * Last consumed descriptor in the used table,
75	 * trails vq_ring.used->idx.
76	 */
77	uint16_t vq_used_cons_idx;
78
79	/*
80	 * Last consumed descriptor in the available table -
81	 * used by the consumer side.
82	 */
83	uint16_t vq_available_idx;
84
85	/*
86	 * Used by the host side during callback. Cookie
87	 * holds the address of buffer received from other side.
88	 * Other fields in this structure are not used currently.
89	 * Do we needed??/
90	struct vq_desc_extra {
91		void *cookie;
92		struct vring_desc *indirect;
93		uint32_t indirect_paddr;
94		uint16_t ndescs;
95	} vq_descx[0];
96};
97```
98
99* Representation of a shared virtqueue structure defined in Virtual I/O Device (VIRTIO) Version 1.1:
100```
101struct vring {
102	unsigned int num;           /**< number of buffers of the vring */
103	struct vring_desc *desc;    /**< pointer to the buffers descriptor */
104	struct vring_avail *avail;  /**< pointer to the ring of available descriptor heads*/
105	struct vring_used *used;    /**< pointer to the ring of used descriptor heads */
106};
107```
108RPMsg virtio Data struct
109===========================
110* Representation of a RPMsg virtio device:
111```
112struct rpmsg_virtio_device {
113	struct rpmsg_device rdev;               /**< the associated rpmsg device */
114	struct rpmsg_virtio_config config;      /**< structure containing the virtio configuration */
115	struct virtio_device *vdev;             /**< pointer to the virtio device */
116	struct virtqueue *rvq;                  /**< pointer to the receive virtqueue */
117	struct virtqueue *svq;                  /**< a to the send virtqueue */
118	struct metal_io_region *shbuf_io;       /**< pointer to the shared buffer I/O region */
119	struct rpmsg_virtio_shm_pool *shpool;   /**< pointer to the shared buffers pool */
120};
121
122```
123
124RPMsg Data struct
125===========================
126* representation of a RPMsg devices:
127```
128struct rpmsg_device {
129	struct metal_list endpoints;                                   /**< list of endpoints */
130	struct rpmsg_endpoint ns_ept;                                  /**< name service endpoint */
131	unsigned long bitmap[metal_bitmap_longs(RPMSG_ADDR_BMP_SIZE)]; /**< bitmap: table endpoint address allocation */
132	metal_mutex_t lock;                                            /**<  mutex lock for rpmsg management */
133	rpmsg_ns_bind_cb ns_bind_cb;                                   /**< callback handler for name service announcement without local endpoints waiting to bind. */
134	struct rpmsg_device_ops ops;                                   /**<  RPMsg device operations */
135	bool support_ns;                                               /**< create/destroy namespace message */
136};
137
138* Representation of a local RPMsg endpoint associated to an unique address:
139struct rpmsg_endpoint {
140	char name[SERVICE_NAME_SIZE];                                                     /**< associated name service */
141	struct rpmsg_virtio_dev *rvdev;                                                   /**< pointer to the RPMsg virtio device */
142	uint32_t addr;                                                                    /**< endpoint local address */
143	uint32_t dest_addr;                                                               /**< endpoint default target address */
144	int (*cb)(struct rpmsg_endpoint *ept, void *data, size_t len, uint32_t addr);     /**< endpoint callback */
145	void (*ns_unbind_cb)(struct rpmsg_endpoint *ept);                                 /**< remote endpoint destroy callback */
146	struct metal_list node;                                                           /**< node for the rpmsg_device endpoints list */
147	void *priv;                                                                       /**< user private data */
148};
149```
150