(atapi_cb): Reenable automatic retrieve of sense data on error, making

it asynchronous to avoid incorrect use of ata_atapicmd within an
 ATAPI callback.

Tested by:	harti
This commit is contained in:
Thomas Quinot 2004-02-11 10:14:08 +00:00
parent eb4f5d9df6
commit a0e1020523

View File

@ -62,7 +62,7 @@ struct atapi_hcb {
union ccb *ccb;
int flags;
#define QUEUED 0x0001
#define AUTOSENSE 0x0002
char *dxfer_alloc;
TAILQ_ENTRY(atapi_hcb) chain;
};
@ -569,26 +569,33 @@ atapi_cb(struct ata_request *request)
}
#endif
if (request->result != 0) {
if ((hcb->flags & AUTOSENSE) != 0) {
rc = CAM_SCSI_STATUS_ERROR;
if (request->result == 0) {
csio->ccb_h.status |= CAM_AUTOSNS_VALID;
}
} else if (request->result != 0) {
rc = CAM_SCSI_STATUS_ERROR;
csio->scsi_status = SCSI_STATUS_CHECK_COND;
#if 0
/*
* XXX Temporarily disable autosense, as this seems to cause
* a missed ATA interrupt.
*/
if ((csio->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) {
int8_t ccb[16] = { ATAPI_REQUEST_SENSE, 0, 0, 0,
static const int8_t ccb[16] = { ATAPI_REQUEST_SENSE, 0, 0, 0,
sizeof(struct atapi_sense), 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0 };
if (ata_atapicmd(request->device, ccb, (caddr_t)&csio->sense_data,
sizeof(struct atapi_sense), ATA_R_READ, 30) == 0)
{
csio->ccb_h.status |= CAM_AUTOSNS_VALID;
}
bcopy (ccb, request->u.atapi.ccb, sizeof ccb);
request->data = (caddr_t)&csio->sense_data;
request->bytecount = sizeof(struct atapi_sense);
request->transfersize = min(request->bytecount, 65534);
request->timeout = csio->ccb_h.timeout;
request->retries = 2;
request->flags = ATA_R_QUIET|ATA_R_ATAPI|ATA_R_IMMEDIATE;
hcb->flags |= AUTOSENSE;
mtx_unlock (&Giant);
ata_queue_request(request);
return;
}
#endif
} else {
rc = CAM_REQ_CMP;
csio->scsi_status = SCSI_STATUS_OK;