From caa0284630ed95b9ccf8f1448869f98244ef839e Mon Sep 17 00:00:00 2001 From: thomas Date: Sun, 21 Sep 2003 16:49:53 +0000 Subject: (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. --- sys/dev/ata/atapi-cam.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'sys/dev/ata/atapi-cam.c') 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); } -- cgit v1.1