@@ -128,20 +128,37 @@ static uint32_t rproc_virtio_negotiate_features(struct virtio_device *vdev,
128128static void rproc_virtio_read_config (struct virtio_device * vdev ,
129129 uint32_t offset , void * dst , int length )
130130{
131- (void )vdev ;
132- (void )offset ;
133- (void )dst ;
134- (void )length ;
131+ struct remoteproc_virtio * rpvdev ;
132+ struct fw_rsc_vdev * vdev_rsc ;
133+ struct metal_io_region * io ;
134+ char * config ;
135+
136+ rpvdev = metal_container_of (vdev , struct remoteproc_virtio , vdev );
137+ vdev_rsc = rpvdev -> vdev_rsc ;
138+ config = (char * )(& vdev_rsc -> vring [vdev -> vrings_num ]);
139+ io = rpvdev -> vdev_rsc_io ;
140+ metal_io_block_read (io ,
141+ metal_io_virt_to_offset (io , config + offset ),
142+ dst , length );
135143}
136144
137145#ifndef VIRTIO_SLAVE_ONLY
138146static void rproc_virtio_write_config (struct virtio_device * vdev ,
139147 uint32_t offset , void * src , int length )
140148{
141- (void )vdev ;
142- (void )offset ;
143- (void )src ;
144- (void )length ;
149+ struct remoteproc_virtio * rpvdev ;
150+ struct fw_rsc_vdev * vdev_rsc ;
151+ struct metal_io_region * io ;
152+ char * config ;
153+
154+ rpvdev = metal_container_of (vdev , struct remoteproc_virtio , vdev );
155+ vdev_rsc = rpvdev -> vdev_rsc ;
156+ config = (char * )(& vdev_rsc -> vring [vdev -> vrings_num ]);
157+ io = rpvdev -> vdev_rsc_io ;
158+ metal_io_block_write (io ,
159+ metal_io_virt_to_offset (io , config + offset ),
160+ src , length );
161+ rpvdev -> notify (rpvdev -> priv , vdev -> notifyid );
145162}
146163
147164static void rproc_virtio_reset_device (struct virtio_device * vdev )
0 commit comments