summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/atapi-cam.c
diff options
context:
space:
mode:
authorthomas <thomas@FreeBSD.org>2003-09-21 16:49:53 +0000
committerthomas <thomas@FreeBSD.org>2003-09-21 16:49:53 +0000
commitcaa0284630ed95b9ccf8f1448869f98244ef839e (patch)
tree24ae19150dc57811de43d1cb177666d11fede6ae /sys/dev/ata/atapi-cam.c
parentb90934409616c74cc7a5d2050ce89958456f09f7 (diff)
downloadFreeBSD-src-caa0284630ed95b9ccf8f1448869f98244ef839e.zip
FreeBSD-src-caa0284630ed95b9ccf8f1448869f98244ef839e.tar.gz
(atapi_cb): Reorganize error handling circuitry.
Fix to the messages output under CAM_DEBUG_CCB: the summary sense information (error bits and sense key) is in the error field, not in the result field, of struct ata_request. No other functional change.
Diffstat (limited to 'sys/dev/ata/atapi-cam.c')
-rw-r--r--sys/dev/ata/atapi-cam.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sys/dev/ata/atapi-cam.c b/sys/dev/ata/atapi-cam.c
index 0473c16..3a2e864 100644
--- a/sys/dev/ata/atapi-cam.c
+++ b/sys/dev/ata/atapi-cam.c
@@ -544,22 +544,25 @@ atapi_cb(struct ata_request *request)
{
struct atapi_hcb *hcb = (struct atapi_hcb *) request->driver;
struct ccb_scsiio *csio = &hcb->ccb->csio;
- int hcb_status = request->result;
+ u_int32_t rc;
mtx_lock(&Giant);
-
#ifdef CAMDEBUG
- if (CAM_DEBUGGED(csio->ccb_h.path, CAM_DEBUG_CDB)) {
- printf("atapi_cb: hcb@%p status = %02x: (sk = %02x%s%s%s)\n",
- hcb, hcb_status, hcb_status >> 4,
- (hcb_status & 4) ? " ABRT" : "",
- (hcb_status & 2) ? " EOM" : "",
- (hcb_status & 1) ? " ILI" : "");
- printf(" %s: cmd %02x\n",
- request->device->name, request->u.atapi.ccb[0]);
- }
+# define err (request->error)
+ 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",
+ request->device->name, request->u.atapi.ccb[0],
+ request->status, request->result);
+ }
#endif
- if (hcb_status != 0) {
+
+ if (request->result != 0) {
+ rc = CAM_SCSI_STATUS_ERROR;
csio->scsi_status = SCSI_STATUS_CHECK_COND;
#if 0
/*
@@ -578,17 +581,16 @@ atapi_cb(struct ata_request *request)
}
}
#endif
- free_hcb_and_ccb_done(hcb, CAM_SCSI_STATUS_ERROR);
- }
- else {
+ } else {
+ rc = CAM_REQ_CMP;
+ csio->scsi_status = SCSI_STATUS_OK;
if (((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) &&
hcb->dxfer_alloc != NULL)
{
bcopy(hcb->dxfer_alloc, csio->data_ptr, csio->dxfer_len);
}
- csio->scsi_status = SCSI_STATUS_OK;
- free_hcb_and_ccb_done(hcb, CAM_REQ_CMP);
}
+ free_hcb_and_ccb_done(hcb, rc);
mtx_unlock(&Giant);
}
OpenPOWER on IntegriCloud