]> Git Repo - qemu.git/commitdiff
scsi: Advertise limits by blocksize, not 512
authorEric Blake <[email protected]>
Thu, 23 Jun 2016 22:37:11 +0000 (16:37 -0600)
committerKevin Wolf <[email protected]>
Tue, 5 Jul 2016 14:46:25 +0000 (16:46 +0200)
s->blocksize may be larger than 512, in which case our
tweaks to max_xfer_len and opt_xfer_len must be scaled
appropriately.

CC: [email protected]
Reported-by: Fam Zheng <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
hw/scsi/scsi-generic.c

index 6a2d89afbad69f2288c63c099be997a55bd310b6..75e227de95e0a4aa59f052ea6f456842146edd9d 100644 (file)
@@ -225,7 +225,8 @@ static void scsi_read_complete(void * opaque, int ret)
     if (s->type == TYPE_DISK &&
         r->req.cmd.buf[0] == INQUIRY &&
         r->req.cmd.buf[2] == 0xb0) {
-        uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk);
+        uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk) /
+            (s->blocksize / BDRV_SECTOR_SIZE);
         if (max_xfer_len) {
             stl_be_p(&r->buf[8], max_xfer_len);
             /* Also take care of the opt xfer len. */
This page took 0.026741 seconds and 4 git commands to generate.