mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
scsi: cleanup scsi_clear_unit_attention()
The previous commit moved the unit attention clearing when we create the request. So now we can clean scsi_clear_unit_attention() to handle only the case of the REPORT LUNS command: this is the only case in which a UNIT ATTENTION is cleared without having been reported. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-ID: <20230712134352.118655-3-sgarzare@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9472083e64
commit
ba947dab98
1 changed files with 6 additions and 22 deletions
|
@ -828,26 +828,12 @@ static void scsi_clear_unit_attention(SCSIRequest *req)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req->dev->unit_attention.key != UNIT_ATTENTION &&
|
|
||||||
req->bus->unit_attention.key != UNIT_ATTENTION) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If an INQUIRY command enters the enabled command state,
|
|
||||||
* the device server shall [not] clear any unit attention condition;
|
|
||||||
* See also MMC-6, paragraphs 6.5 and 6.6.2.
|
|
||||||
*/
|
|
||||||
if (req->cmd.buf[0] == INQUIRY ||
|
|
||||||
req->cmd.buf[0] == GET_CONFIGURATION ||
|
|
||||||
req->cmd.buf[0] == GET_EVENT_STATUS_NOTIFICATION) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req->dev->unit_attention.key == UNIT_ATTENTION) {
|
if (req->dev->unit_attention.key == UNIT_ATTENTION) {
|
||||||
ua = &req->dev->unit_attention;
|
ua = &req->dev->unit_attention;
|
||||||
} else {
|
} else if (req->bus->unit_attention.key == UNIT_ATTENTION) {
|
||||||
ua = &req->bus->unit_attention;
|
ua = &req->bus->unit_attention;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -856,12 +842,10 @@ static void scsi_clear_unit_attention(SCSIRequest *req)
|
||||||
* with an additional sense code of REPORTED LUNS DATA HAS CHANGED.
|
* with an additional sense code of REPORTED LUNS DATA HAS CHANGED.
|
||||||
*/
|
*/
|
||||||
if (req->cmd.buf[0] == REPORT_LUNS &&
|
if (req->cmd.buf[0] == REPORT_LUNS &&
|
||||||
!(ua->asc == SENSE_CODE(REPORTED_LUNS_CHANGED).asc &&
|
ua->asc == SENSE_CODE(REPORTED_LUNS_CHANGED).asc &&
|
||||||
ua->ascq == SENSE_CODE(REPORTED_LUNS_CHANGED).ascq)) {
|
ua->ascq == SENSE_CODE(REPORTED_LUNS_CHANGED).ascq) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ua = SENSE_CODE(NO_SENSE);
|
*ua = SENSE_CODE(NO_SENSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int scsi_req_get_sense(SCSIRequest *req, uint8_t *buf, int len)
|
int scsi_req_get_sense(SCSIRequest *req, uint8_t *buf, int len)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue