From 7a55a6bbcf1c289d9449cc32e2a41123770edf33 Mon Sep 17 00:00:00 2001 From: marius Date: Mon, 2 Aug 2004 23:32:23 +0000 Subject: [PATCH] - Set the CAM status to CAM_SCSI_STATUS_ERROR rather than CAM_REQ_CMP in case of a CHECK CONDITION. - Make this driver return SCSI status information. - While here, factor out the clearing of the CAM status from every element of the switch statement to only once before the switch. This fixes burning CDs with recent cdrecord 2.01 alpha versions and burners attached to asr(4) controllers but there could have been other applications and da(4) etc. also affected. Reviewed by: gibbs, scottl MFC after: 2 weeks --- sys/dev/asr/asr.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index 8b403473c8ea..e8badb67487a 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -2791,6 +2791,7 @@ asr_intr(Asr_softc_t *sc) for(processed = 0; asr_get_status(sc) & Mask_InterruptsDisabled; processed = 1) { union asr_ccb *ccb; + u_int dsc; U32 ReplyOffset; PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME Reply; @@ -2881,18 +2882,19 @@ asr_intr(Asr_softc_t *sc) /* Welease Wadjah! (and stop timeouts) */ ASR_ccbRemove (sc, ccb); - switch ( - I2O_SINGLE_REPLY_MESSAGE_FRAME_getDetailedStatusCode( - &(Reply->StdReplyFrame))) { + dsc = I2O_SINGLE_REPLY_MESSAGE_FRAME_getDetailedStatusCode( + &(Reply->StdReplyFrame)); + ccb->csio.scsi_status = dsc & I2O_SCSI_DEVICE_DSC_MASK; + ccb->ccb_h.status &= ~CAM_STATUS_MASK; + switch (dsc) { case I2O_SCSI_DSC_SUCCESS: - ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_REQ_CMP; break; case I2O_SCSI_DSC_CHECK_CONDITION: - ccb->ccb_h.status &= ~CAM_STATUS_MASK; - ccb->ccb_h.status |= CAM_REQ_CMP|CAM_AUTOSNS_VALID; + ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR | + CAM_AUTOSNS_VALID; break; case I2O_SCSI_DSC_BUSY: @@ -2902,12 +2904,10 @@ asr_intr(Asr_softc_t *sc) case I2O_SCSI_HBA_DSC_SCSI_BUS_RESET: /* FALLTHRU */ case I2O_SCSI_HBA_DSC_BUS_BUSY: - ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_SCSI_BUSY; break; case I2O_SCSI_HBA_DSC_SELECTION_TIMEOUT: - ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_SEL_TIMEOUT; break; @@ -2918,19 +2918,16 @@ asr_intr(Asr_softc_t *sc) case I2O_SCSI_HBA_DSC_LUN_INVALID: /* FALLTHRU */ case I2O_SCSI_HBA_DSC_SCSI_TID_INVALID: - ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_CMD_TIMEOUT; break; case I2O_SCSI_HBA_DSC_DATA_OVERRUN: /* FALLTHRU */ case I2O_SCSI_HBA_DSC_REQUEST_LENGTH_ERROR: - ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_DATA_RUN_ERR; break; default: - ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_REQUEUE_REQ; break; }