mirror of https://github.com/xqemu/xqemu.git
scsi: ignore LUN field in the CDB
The LUN field in the CDB is a historical relic. Ignore it as reserved, which is what modern SCSI specifications actually say. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
aba1f02363
commit
1455084ea2
|
@ -518,7 +518,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
|
||||||
|
|
||||||
memset(outbuf, 0, buflen);
|
memset(outbuf, 0, buflen);
|
||||||
|
|
||||||
if (req->lun || req->cmd.buf[1] >> 5) {
|
if (req->lun) {
|
||||||
outbuf[0] = 0x7f; /* LUN not supported */
|
outbuf[0] = 0x7f; /* LUN not supported */
|
||||||
return buflen;
|
return buflen;
|
||||||
}
|
}
|
||||||
|
@ -1024,9 +1024,9 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (req->lun || buf[1] >> 5) {
|
if (req->lun) {
|
||||||
/* Only LUN 0 supported. */
|
/* Only LUN 0 supported. */
|
||||||
DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : buf[1] >> 5);
|
DPRINTF("Unimplemented LUN %d\n", req->lun);
|
||||||
if (command != REQUEST_SENSE && command != INQUIRY) {
|
if (command != REQUEST_SENSE && command != INQUIRY) {
|
||||||
scsi_command_complete(r, CHECK_CONDITION,
|
scsi_command_complete(r, CHECK_CONDITION,
|
||||||
SENSE_CODE(LUN_NOT_SUPPORTED));
|
SENSE_CODE(LUN_NOT_SUPPORTED));
|
||||||
|
|
|
@ -337,9 +337,8 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd)
|
||||||
SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req);
|
SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (cmd[0] != REQUEST_SENSE &&
|
if (cmd[0] != REQUEST_SENSE && req->lun != s->lun) {
|
||||||
(req->lun != s->lun || (cmd[1] >> 5) != s->lun)) {
|
DPRINTF("Unimplemented LUN %d\n", req->lun);
|
||||||
DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : cmd[1] >> 5);
|
|
||||||
scsi_set_sense(s, SENSE_CODE(LUN_NOT_SUPPORTED));
|
scsi_set_sense(s, SENSE_CODE(LUN_NOT_SUPPORTED));
|
||||||
r->req.status = CHECK_CONDITION;
|
r->req.status = CHECK_CONDITION;
|
||||||
scsi_req_complete(&r->req);
|
scsi_req_complete(&r->req);
|
||||||
|
|
Loading…
Reference in New Issue