(atapi_action): Improve error reporting by removing ATA_R_QUIET flag
from ATAPI requests. If CAM debugging is enabled, also mark ATAPI requests with ATA_R_DEBUG flag. (atapi_cb): Report ATAPI timeouts to the CAM layer. Fix incorrect debugging traces in the presence of ATAPI errors. PR: kern/103602 MFC after: 2 weeks
This commit is contained in:
parent
c78849acb1
commit
0c37bdc190
@ -471,7 +471,7 @@ atapi_action(struct cam_sim *sim, union ccb *ccb)
|
||||
case XPT_SCSI_IO: {
|
||||
struct ccb_scsiio *csio = &ccb->csio;
|
||||
int tid = ccb_h->target_id, lid = ccb_h->target_lun;
|
||||
int request_flags = ATA_R_QUIET | ATA_R_ATAPI;
|
||||
int request_flags = ATA_R_ATAPI;
|
||||
|
||||
CAM_DEBUG(ccb_h->path, CAM_DEBUG_SUBTRACE, ("XPT_SCSI_IO\n"));
|
||||
|
||||
@ -550,6 +550,9 @@ atapi_action(struct cam_sim *sim, union ccb *ccb)
|
||||
printf("atapi_action: hcb@%p: %s\n", hcb,
|
||||
scsi_cdb_string(request->u.atapi.ccb, cdb_str, sizeof(cdb_str)));
|
||||
}
|
||||
if (CAM_DEBUGGED(ccb_h->path, CAM_DEBUG_SUBTRACE)) {
|
||||
request_flags |= ATA_R_DEBUG;
|
||||
}
|
||||
#endif
|
||||
|
||||
len = csio->dxfer_len;
|
||||
@ -608,10 +611,15 @@ atapi_action(struct cam_sim *sim, union ccb *ccb)
|
||||
request->bytecount = len;
|
||||
request->transfersize = min(request->bytecount, 65534);
|
||||
request->timeout = ccb_h->timeout / 1000; /* XXX lost granularity */
|
||||
request->retries = 2;
|
||||
request->callback = &atapi_cb;
|
||||
request->flags = request_flags;
|
||||
|
||||
/*
|
||||
* no retries are to be performed at the ATA level; any retries
|
||||
* will be done by CAM .
|
||||
*/
|
||||
request->retries = 0;
|
||||
|
||||
TAILQ_INSERT_TAIL(&softc->pending_hcbs, hcb, chain);
|
||||
hcb->flags |= QUEUED;
|
||||
ccb_h->status |= CAM_SIM_QUEUED;
|
||||
@ -674,14 +682,15 @@ atapi_cb(struct ata_request *request)
|
||||
#ifdef CAMDEBUG
|
||||
# define err (request->u.atapi.sense.key)
|
||||
if (CAM_DEBUGGED(csio->ccb_h.path, CAM_DEBUG_CDB)) {
|
||||
printf("atapi_cb: hcb@%p error = %02x: (sk = %02x%s%s%s)\n",
|
||||
hcb, err, err >> 4,
|
||||
(err & 4) ? " ABRT" : "",
|
||||
(err & 2) ? " EOM" : "",
|
||||
(err & 1) ? " ILI" : "");
|
||||
printf("dev %s: cmd %02x status %02x result %02x\n",
|
||||
device_get_nameunit(request->dev), request->u.atapi.ccb[0],
|
||||
request->status, request->result);
|
||||
printf("atapi_cb: hcb@%p sense = %02x: sk = %01x%s%s%s\n",
|
||||
hcb, err, err & 0x0f,
|
||||
(err & 0x80) ? ", Filemark" : "",
|
||||
(err & 0x40) ? ", EOM" : "",
|
||||
(err & 0x20) ? ", ILI" : "");
|
||||
device_printf(request->dev,
|
||||
"cmd %s status %02x result %02x error %02x\n",
|
||||
ata_cmd2str(request),
|
||||
request->status, request->result, request->error);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -691,32 +700,39 @@ atapi_cb(struct ata_request *request)
|
||||
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 ((request->flags & ATA_R_TIMEOUT) != 0) {
|
||||
rc = CAM_CMD_TIMEOUT;
|
||||
} else {
|
||||
rc = CAM_SCSI_STATUS_ERROR;
|
||||
csio->scsi_status = SCSI_STATUS_CHECK_COND;
|
||||
|
||||
if ((csio->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) {
|
||||
if ((csio->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) {
|
||||
#if 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 };
|
||||
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 };
|
||||
|
||||
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 / 1000;
|
||||
request->retries = 2;
|
||||
request->flags = ATA_R_QUIET|ATA_R_ATAPI|ATA_R_IMMEDIATE;
|
||||
hcb->flags |= AUTOSENSE;
|
||||
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 / 1000;
|
||||
request->retries = 2;
|
||||
request->flags = ATA_R_QUIET|ATA_R_ATAPI|ATA_R_IMMEDIATE;
|
||||
hcb->flags |= AUTOSENSE;
|
||||
|
||||
ata_queue_request(request);
|
||||
return;
|
||||
ata_queue_request(request);
|
||||
return;
|
||||
#else
|
||||
/* The ATA driver has already requested sense for us. */
|
||||
if (request->error == 0) {
|
||||
/* The ATA autosense suceeded. */
|
||||
bcopy (&request->u.atapi.sense, &csio->sense_data, sizeof(struct atapi_sense));
|
||||
csio->ccb_h.status |= CAM_AUTOSNS_VALID;
|
||||
/*
|
||||
* Use auto-sense data from the ATA layer, if it has
|
||||
* issued a REQUEST SENSE automatically and that operation
|
||||
* returned without error.
|
||||
*/
|
||||
if (request->saved_cmd != 0 && request->error == 0) {
|
||||
bcopy (&request->u.atapi.sense, &csio->sense_data, sizeof(struct atapi_sense));
|
||||
csio->ccb_h.status |= CAM_AUTOSNS_VALID;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user