pc-bios/s390-ccw: Split virtio-scsi code from virtio_blk_setup_device()

The next patch is going to add more virtio-block specific code to
virtio_blk_setup_device(), and if the virtio-scsi code is also in
there, this is more cumbersome. And the calling function virtio_setup()
in main.c looks at the device type already anyway, so it's more
logical to separate the virtio-scsi stuff into a new function in
virtio-scsi.c instead.

Message-Id: <20220704111903.62400-10-thuth@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2022-07-04 13:19:00 +02:00
parent 0708248857
commit cf30b7c4a9
4 changed files with 38 additions and 27 deletions

View file

@ -329,7 +329,7 @@ static void scsi_parse_capacity_report(void *data,
}
}
int virtio_scsi_setup(VDev *vdev)
static int virtio_scsi_setup(VDev *vdev)
{
int retry_test_unit_ready = 3;
uint8_t data[256];
@ -430,3 +430,20 @@ int virtio_scsi_setup(VDev *vdev)
return 0;
}
int virtio_scsi_setup_device(SubChannelId schid)
{
VDev *vdev = virtio_get_device();
vdev->schid = schid;
virtio_setup_ccw(vdev);
IPL_assert(vdev->config.scsi.sense_size == VIRTIO_SCSI_SENSE_SIZE,
"Config: sense size mismatch");
IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE,
"Config: CDB size mismatch");
sclp_print("Using virtio-scsi.\n");
return virtio_scsi_setup(vdev);
}