提交 9ce1bb2d 编写于 作者: C Christian Hoff 提交者: Paolo Bonzini

scsi: Fix transfer length for READ POSITION commands.

The transfer length depends on the specific service action
code, as defined in the SCSI stream commands spec section 7.7.
Up to now only the extended form was supported.
Signed-off-by: NChristian Hoff <christian.hoff@de.ibm.com>
Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 40723a99
......@@ -901,7 +901,21 @@ static int scsi_req_stream_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *bu
cmd->xfer = buf[13] | (buf[12] << 8);
break;
case READ_POSITION:
cmd->xfer = buf[8] | (buf[7] << 8);
switch (buf[1] & 0x1f) /* operation code */ {
case SHORT_FORM_BLOCK_ID:
case SHORT_FORM_VENDOR_SPECIFIC:
cmd->xfer = 20;
break;
case LONG_FORM:
cmd->xfer = 32;
break;
case EXTENDED_FORM:
cmd->xfer = buf[8] | (buf[7] << 8);
break;
default:
return -1;
}
break;
case FORMAT_UNIT:
cmd->xfer = buf[4] | (buf[3] << 8);
......
......@@ -146,6 +146,14 @@
*/
#define SAI_READ_CAPACITY_16 0x10
/*
* READ POSITION service action codes
*/
#define SHORT_FORM_BLOCK_ID 0x00
#define SHORT_FORM_VENDOR_SPECIFIC 0x01
#define LONG_FORM 0x06
#define EXTENDED_FORM 0x08
/*
* SAM Status codes
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册