44 * SPDX-License-Identifier: Apache-2.0
55 */
66
7- #define DT_DRV_COMPAT openamp_vdev
7+ #define DT_DRV_COMPAT openamp_rpmsg_virtio_device
88
99#include <stdio.h>
1010
1414
1515#include <zephyr/drivers/mbox.h>
1616#include <zephyr/drivers/remoteproc.h>
17- #include <zephyr/drivers/remoteproc/vdev .h>
17+ #include <zephyr/drivers/remoteproc/rpmsg_virtio_device .h>
1818
1919#include <openamp/virtio.h>
2020#include <openamp/remoteproc.h>
2525#include <zephyr/logging/log.h>
2626LOG_MODULE_DECLARE (openamp_remoteproc , CONFIG_REMOTEPROC_LOG_LEVEL );
2727
28- #define DT_DRV_COMPAT openamp_vdev
2928
30- struct vdev_config {
29+ struct rvdev_config {
3130 struct mbox_dt_spec mbox_tx ;
3231 struct mbox_dt_spec mbox_rx ;
3332 const char * vring0_name ;
@@ -36,7 +35,7 @@ struct vdev_config {
3635 unsigned int idx ;
3736};
3837
39- struct vdev_data {
38+ struct rvdev_data {
4039 struct virtio_device * vdev ;
4140 struct rpmsg_virtio_device rvdev ;
4241 struct k_thread thread ;
@@ -46,16 +45,16 @@ struct vdev_data {
4645
4746};
4847
49- static int rpvdev_notify (void * priv , uint32_t id )
48+ static int rvdev_notify (void * priv , uint32_t id )
5049{
5150 const struct device * dev = priv ;
52- const struct vdev_config * config = dev -> config ;
51+ const struct rvdev_config * config = dev -> config ;
5352
5453 return mbox_send_dt (& config -> mbox_tx , NULL );
5554}
5655
5756
58- static void vdev_reset_callback (struct virtio_device * vdev )
57+ static void rvdev_reset_callback (struct virtio_device * vdev )
5958{
6059 LOG_INF ("vdev_reset_callback" );
6160}
@@ -78,10 +77,10 @@ static void mbox_callback(const struct device *dev, uint32_t channel,
7877 k_sem_give (sem );
7978}
8079
81- static void vdev_rx_thread (void * dev_ptr , void * p2 , void * p3 )
80+ static void rvdev_rx_thread (void * dev_ptr , void * p2 , void * p3 )
8281{
8382 const struct device * dev = dev_ptr ;
84- struct vdev_data * data = dev -> data ;
83+ struct rvdev_data * data = dev -> data ;
8584
8685 ARG_UNUSED (p2 );
8786 ARG_UNUSED (p3 );
@@ -99,10 +98,10 @@ static void dump_io_region(const char *name, const struct metal_io_region *regio
9998 * region -> physmap , region -> size , region -> page_shift );
10099}
101100
102- static int vdev_init (const struct device * dev )
101+ static int rvdev_init (const struct device * dev )
103102{
104- const struct vdev_config * config = dev -> config ;
105- struct vdev_data * data = dev -> data ;
103+ const struct rvdev_config * config = dev -> config ;
104+ struct rvdev_data * data = dev -> data ;
106105 struct fw_rsc_vdev * fw_vdev0 = remoteproc_get_vdev (config -> idx );
107106 struct fw_rsc_vdev_vring * fw_vring0 = remoteproc_get_vring (config -> idx , 0 );
108107 struct fw_rsc_vdev_vring * fw_vring1 = remoteproc_get_vring (config -> idx , 1 );
@@ -185,8 +184,8 @@ static int vdev_init(const struct device *dev)
185184 data -> vdev = rproc_virtio_create_vdev (VIRTIO_DEV_DEVICE ,
186185 VDEV_ID , fw_vdev0 ,
187186 rsc_table_io , (void * )dev ,
188- rpvdev_notify ,
189- vdev_reset_callback );
187+ rvdev_notify ,
188+ rvdev_reset_callback );
190189
191190 if (!data -> vdev ) {
192191 LOG_ERR ("rproc_virtio_create_vdev failed" );
@@ -220,39 +219,39 @@ static int vdev_init(const struct device *dev)
220219
221220 tid = k_thread_create (& data -> thread , data -> stack ,
222221 K_THREAD_STACK_SIZEOF (data -> stack ),
223- vdev_rx_thread , (void * )dev , NULL ,
222+ rvdev_rx_thread , (void * )dev , NULL ,
224223 NULL , CONFIG_REMOTEPROC_THREAD_PRIORITY ,
225224 0 , K_NO_WAIT );
226225
227- k_thread_name_set (tid , "vdev " );
226+ k_thread_name_set (tid , "rvdev " );
228227
229228 return 0 ;
230229}
231230
232- struct rpmsg_device * vdev_get_rpmsg_device (const struct device * dev )
231+ struct rpmsg_device * openamp_get_rpmsg_device (const struct device * dev )
233232{
234- struct vdev_data * data = dev -> data ;
233+ struct rvdev_data * data = dev -> data ;
235234
236235 return rpmsg_virtio_get_rpmsg_device (& data -> rvdev );
237236}
238237
239- #define DEFINE_VIRTIO_DEVICE (i ) \
240- static const struct vdev_config vdev_config_ ##i = { \
238+ #define DEFINE_RPMSG_VIRTIO_DEVICE (i ) \
239+ static const struct rvdev_config rvdev_config_ ##i = { \
241240 .mbox_tx = MBOX_DT_SPEC_INST_GET(i, tx), \
242241 .mbox_rx = MBOX_DT_SPEC_INST_GET(i, rx), \
243242 .vring0_name = DT_INST_PROP_BY_PHANDLE(i, vring0_io, zephyr_memory_region), \
244243 .vring1_name = DT_INST_PROP_BY_PHANDLE(i, vring1_io, zephyr_memory_region), \
245244 .buffer_name = DT_INST_PROP_BY_PHANDLE(i, buffer_io, zephyr_memory_region), \
246245 .idx = i, \
247246 }; \
248- static struct vdev_data vdev_data_ ##i = { }; \
247+ static struct rvdev_data rvdev_data_ ##i = { }; \
249248 DEVICE_DT_INST_DEFINE(i, \
250- &vdev_init , \
249+ &rvdev_init , \
251250 NULL, \
252- &vdev_data_ ##i, \
253- &vdev_config_ ##i, \
251+ &rvdev_data_ ##i, \
252+ &rvdev_config_ ##i, \
254253 POST_KERNEL, \
255254 CONFIG_REMOTEPROC_INIT_PRIORITY, \
256255 NULL);
257256
258- DT_INST_FOREACH_STATUS_OKAY (DEFINE_VIRTIO_DEVICE )
257+ DT_INST_FOREACH_STATUS_OKAY (DEFINE_RPMSG_VIRTIO_DEVICE )
0 commit comments