diff --git a/lib/rpmsg/rpmsg_virtio.c b/lib/rpmsg/rpmsg_virtio.c index e96b0978..aecf290f 100644 --- a/lib/rpmsg/rpmsg_virtio.c +++ b/lib/rpmsg/rpmsg_virtio.c @@ -277,10 +277,10 @@ static int rpmsg_virtio_wait_remote_ready(struct rpmsg_virtio_device *rvdev) uint8_t status; while (1) { - status = rpmsg_virtio_get_status(rvdev); + virtio_get_status(rvdev->vdev, &status); /* Busy wait until the remote is ready */ if (status & VIRTIO_CONFIG_STATUS_NEEDS_RESET) { - rpmsg_virtio_set_status(rvdev, 0); + virtio_set_status(rvdev->vdev, 0); /* TODO notify remote processor */ } else if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) { return true; @@ -371,6 +371,7 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev, { struct rpmsg_virtio_device *rvdev; struct rpmsg_hdr *rp_hdr; + uint8_t virtio_status; uint16_t idx; int tick_count; int status; @@ -379,8 +380,8 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev, rvdev = metal_container_of(rdev, struct rpmsg_virtio_device, rdev); /* Validate device state */ - status = rpmsg_virtio_get_status(rvdev); - if (!(status & VIRTIO_CONFIG_STATUS_DRIVER_OK)) + virtio_get_status(rvdev->vdev, &virtio_status); + if (!(virtio_status & VIRTIO_CONFIG_STATUS_DRIVER_OK)) return NULL; if (wait) @@ -808,6 +809,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev, struct rpmsg_device *rdev; const char *vq_names[RPMSG_NUM_VRINGS]; vq_callback callback[RPMSG_NUM_VRINGS]; + uint32_t features; int status; unsigned int i, role; @@ -851,8 +853,8 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev, rpmsg_virtio_wait_remote_ready(rvdev); } #endif /*!VIRTIO_DRIVER_ONLY*/ - vdev->features = rpmsg_virtio_get_features(rvdev); - rdev->support_ns = !!(vdev->features & (1 << VIRTIO_RPMSG_F_NS)); + virtio_get_features(rvdev->vdev, &features); + rdev->support_ns = !!(features & (1 << VIRTIO_RPMSG_F_NS)); #ifndef VIRTIO_DEVICE_ONLY if (role == RPMSG_HOST) { @@ -969,7 +971,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev, #ifndef VIRTIO_DEVICE_ONLY if (role == RPMSG_HOST) - rpmsg_virtio_set_status(rvdev, VIRTIO_CONFIG_STATUS_DRIVER_OK); + virtio_set_status(rvdev->vdev, VIRTIO_CONFIG_STATUS_DRIVER_OK); #endif /*!VIRTIO_DEVICE_ONLY*/ return RPMSG_SUCCESS;