@@ -126,20 +126,37 @@ static uint32_t rproc_virtio_negotiate_features(struct virtio_device *vdev,
126
126
static void rproc_virtio_read_config (struct virtio_device * vdev ,
127
127
uint32_t offset , void * dst , int length )
128
128
{
129
- (void )vdev ;
130
- (void )offset ;
131
- (void )dst ;
132
- (void )length ;
129
+ struct remoteproc_virtio * rpvdev ;
130
+ struct fw_rsc_vdev * vdev_rsc ;
131
+ struct metal_io_region * io ;
132
+ char * config ;
133
+
134
+ rpvdev = metal_container_of (vdev , struct remoteproc_virtio , vdev );
135
+ vdev_rsc = rpvdev -> vdev_rsc ;
136
+ config = (char * )(& vdev_rsc -> vring [vdev -> vrings_num ]);
137
+ io = rpvdev -> vdev_rsc_io ;
138
+ metal_io_block_read (io ,
139
+ metal_io_virt_to_offset (io , config + offset ),
140
+ dst , length );
133
141
}
134
142
135
143
#ifndef VIRTIO_SLAVE_ONLY
136
144
static void rproc_virtio_write_config (struct virtio_device * vdev ,
137
145
uint32_t offset , void * src , int length )
138
146
{
139
- (void )vdev ;
140
- (void )offset ;
141
- (void )src ;
142
- (void )length ;
147
+ struct remoteproc_virtio * rpvdev ;
148
+ struct fw_rsc_vdev * vdev_rsc ;
149
+ struct metal_io_region * io ;
150
+ char * config ;
151
+
152
+ rpvdev = metal_container_of (vdev , struct remoteproc_virtio , vdev );
153
+ vdev_rsc = rpvdev -> vdev_rsc ;
154
+ config = (char * )(& vdev_rsc -> vring [vdev -> vrings_num ]);
155
+ io = rpvdev -> vdev_rsc_io ;
156
+ metal_io_block_write (io ,
157
+ metal_io_virt_to_offset (io , config + offset ),
158
+ src , length );
159
+ rpvdev -> notify (rpvdev -> priv , vdev -> notifyid );
143
160
}
144
161
145
162
static void rproc_virtio_reset_device (struct virtio_device * vdev )
@@ -220,6 +237,7 @@ rproc_virtio_create_vdev(unsigned int role, unsigned int notifyid,
220
237
vdev -> notifyid = notifyid ;
221
238
vdev -> role = role ;
222
239
vdev -> reset_cb = rst_cb ;
240
+ vdev -> config_len = vdev_rsc -> config_len ;
223
241
vdev -> vrings_num = num_vrings ;
224
242
vdev -> func = & remoteproc_virtio_dispatch_funcs ;
225
243
0 commit comments