- 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
This commit is contained in:
marius 2004-08-02 23:32:23 +00:00
parent 52fb831b82
commit 7a55a6bbcf

View File

@ -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;
}