On Fri, 1 Mar 2019 13:59:32 -0500 "Jason J. Herne" <[email protected]> wrote:
> Now that we have a Channel I/O library let's modify virtio boot code to > make use of it for running channel programs. > > Signed-off-by: Jason J. Herne <[email protected]> > --- > pc-bios/s390-ccw/virtio.c | 49 > +++++++++++++++++++---------------------------- > 1 file changed, 20 insertions(+), 29 deletions(-) > > diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c > index aa9da72..711daf5 100644 > --- a/pc-bios/s390-ccw/virtio.c > +++ b/pc-bios/s390-ccw/virtio.c > @@ -14,6 +14,7 @@ > #include "virtio.h" > #include "virtio-scsi.h" > #include "bswap.h" > +#include "helper.h" > > #define VRING_WAIT_REPLY_TIMEOUT 30 > > @@ -89,33 +90,20 @@ int drain_irqs(SubChannelId schid) > } > } > > -static int run_ccw(VDev *vdev, int cmd, void *ptr, int len) > +static int run_ccw(VDev *vdev, int cmd, void *ptr, int len, bool sli) > { > Ccw1 ccw = {}; > - CmdOrb orb = {}; > - int r; > - > - enable_subchannel(vdev->schid); > - > - /* start subchannel command */ > - orb.fmt = 1; > - orb.cpa = (u32)(long)&ccw; > - orb.lpm = 0x80; > > ccw.cmd_code = cmd; > ccw.cda = (long)ptr; > ccw.count = len; > > - r = ssch(vdev->schid, &orb); > - /* > - * XXX Wait until device is done processing the CCW. For now we can > - * assume that a simple tsch will have finished the CCW processing, > - * but the architecture allows for asynchronous operation > - */ > - if (!r) { > - r = drain_irqs(vdev->schid); > + if (sli) { > + ccw.flags |= CCW_FLAG_SLI; > } > - return r; > + > + enable_subchannel(vdev->schid); As said, maybe just move this to the main routine, instead of having to call this here again and again. > + return do_cio(vdev->schid, ptr2u32(&ccw), CCW_FMT1); > } > > static void vring_init(VRing *vr, VqInfo *info) (...) > @@ -324,7 +314,8 @@ bool virtio_is_supported(SubChannelId schid) > vdev.schid = schid; > memset(&vdev.senseid, 0, sizeof(vdev.senseid)); > /* run sense id command */ > - if (run_ccw(&vdev, CCW_CMD_SENSE_ID, &vdev.senseid, > sizeof(vdev.senseid))) { > + if (run_ccw(&vdev, CCW_CMD_SENSE_ID, &vdev.senseid, sizeof(vdev.senseid), > + true)) { > return false; > } > if (vdev.senseid.cu_type == 0x3832) { Can't you use the new routine for obtaining the cu type here?
