Add accessor functions for manipulating the CAM CCB status field.
Reviewed by: gibbs Obtained from: Netflix, Inc MFC after: 2 days
This commit is contained in:
parent
b7f7712702
commit
601781ccc3
@ -597,7 +597,7 @@ mpssas_remove_device(struct mps_softc *sc, struct mps_command *tm)
|
||||
|
||||
mps_dprint(sc, MPS_XINFO, "Completing missed command %p\n", tm);
|
||||
ccb = tm->cm_complete_data;
|
||||
ccb->ccb_h.status = CAM_DEV_NOT_THERE;
|
||||
mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE);
|
||||
mpssas_scsiio_complete(sc, tm);
|
||||
}
|
||||
}
|
||||
@ -984,7 +984,7 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
|
||||
*/
|
||||
cpi->maxio = 256 * 1024;
|
||||
#endif
|
||||
cpi->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
break;
|
||||
}
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
@ -1003,7 +1003,7 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cts->ccb_h.target_id));
|
||||
targ = &sassc->targets[cts->ccb_h.target_id];
|
||||
if (targ->handle == 0x0) {
|
||||
cts->ccb_h.status = CAM_SEL_TIMEOUT;
|
||||
mpssas_set_ccbstatus(ccb, CAM_SEL_TIMEOUT);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1030,12 +1030,12 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
scsi->flags = CTS_SCSI_FLAGS_TAG_ENB;
|
||||
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
break;
|
||||
}
|
||||
case XPT_CALC_GEOMETRY:
|
||||
cam_calc_geometry(&ccb->ccg, /*extended*/1);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
break;
|
||||
case XPT_RESET_DEV:
|
||||
mps_dprint(sassc->sc, MPS_XINFO, "mpssas_action XPT_RESET_DEV\n");
|
||||
@ -1046,7 +1046,7 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
|
||||
case XPT_TERM_IO:
|
||||
mps_dprint(sassc->sc, MPS_XINFO,
|
||||
"mpssas_action faking success for abort or reset\n");
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
break;
|
||||
case XPT_SCSI_IO:
|
||||
mpssas_action_scsiio(sassc, ccb);
|
||||
@ -1057,7 +1057,7 @@ mpssas_action(struct cam_sim *sim, union ccb *ccb)
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
mpssas_set_ccbstatus(ccb, CAM_FUNC_NOTAVAIL);
|
||||
break;
|
||||
}
|
||||
xpt_done(ccb);
|
||||
@ -1586,8 +1586,7 @@ mpssas_scsiio_timeout(void *data)
|
||||
/* XXX first, check the firmware state, to see if it's still
|
||||
* operational. if not, do a diag reset.
|
||||
*/
|
||||
|
||||
cm->cm_ccb->ccb_h.status = CAM_CMD_TIMEOUT;
|
||||
mpssas_set_ccbstatus(cm->cm_ccb, CAM_CMD_TIMEOUT);
|
||||
cm->cm_state = MPS_CM_STATE_TIMEDOUT;
|
||||
TAILQ_INSERT_TAIL(&targ->timedout_commands, cm, cm_recovery);
|
||||
|
||||
@ -1648,14 +1647,14 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
if (targ->handle == 0x0) {
|
||||
mps_dprint(sc, MPS_ERROR, "%s NULL handle for target %u\n",
|
||||
__func__, csio->ccb_h.target_id);
|
||||
csio->ccb_h.status = CAM_SEL_TIMEOUT;
|
||||
mpssas_set_ccbstatus(ccb, CAM_SEL_TIMEOUT);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
if (targ->flags & MPS_TARGET_FLAGS_RAID_COMPONENT) {
|
||||
mps_dprint(sc, MPS_ERROR, "%s Raid component no SCSI IO "
|
||||
"supported %u\n", __func__, csio->ccb_h.target_id);
|
||||
csio->ccb_h.status = CAM_TID_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_TID_INVALID);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -1664,7 +1663,7 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
* Progress" and was actually aborted by the upper layer. Check for
|
||||
* this here and complete the command without error.
|
||||
*/
|
||||
if (ccb->ccb_h.status != CAM_REQ_INPROG) {
|
||||
if (mpssas_get_ccbstatus(ccb) != CAM_REQ_INPROG) {
|
||||
mps_dprint(sc, MPS_TRACE, "%s Command is not in progress for "
|
||||
"target %u\n", __func__, csio->ccb_h.target_id);
|
||||
xpt_done(ccb);
|
||||
@ -1677,16 +1676,16 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
*/
|
||||
if (targ->flags & MPSSAS_TARGET_INREMOVAL) {
|
||||
if (targ->devinfo == 0)
|
||||
csio->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
else
|
||||
csio->ccb_h.status = CAM_SEL_TIMEOUT;
|
||||
mpssas_set_ccbstatus(ccb, CAM_SEL_TIMEOUT);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((sc->mps_flags & MPS_FLAGS_SHUTDOWN) != 0) {
|
||||
mps_dprint(sc, MPS_INFO, "%s shutting down\n", __func__);
|
||||
csio->ccb_h.status = CAM_TID_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_TID_INVALID);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -1765,7 +1764,7 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
req->Control = htole32(mpi_control);
|
||||
if (MPS_SET_LUN(req->LUN, csio->ccb_h.target_lun) != 0) {
|
||||
mps_free_command(sc, cm);
|
||||
ccb->ccb_h.status = CAM_LUN_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_LUN_INVALID);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -1853,10 +1852,10 @@ mpssas_action_scsiio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
* the I/O to the IR volume itself.
|
||||
*/
|
||||
if (sc->WD_valid_config) {
|
||||
if (ccb->ccb_h.status != MPS_WD_RETRY) {
|
||||
if (mpssas_get_ccbstatus(ccb) != MPS_WD_RETRY) {
|
||||
mpssas_direct_drive_io(sassc, cm, ccb);
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_REQ_INPROG;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INPROG);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2150,7 +2149,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
* because there can be no reply when we haven't actually
|
||||
* gone out to the hardware.
|
||||
*/
|
||||
ccb->ccb_h.status = CAM_REQUEUE_REQ;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQUEUE_REQ);
|
||||
|
||||
/*
|
||||
* Currently the only error included in the mask is
|
||||
@ -2173,11 +2172,11 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
|
||||
/* Take the fast path to completion */
|
||||
if (cm->cm_reply == NULL) {
|
||||
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) {
|
||||
if (mpssas_get_ccbstatus(ccb) == CAM_REQ_INPROG) {
|
||||
if ((sc->mps_flags & MPS_FLAGS_DIAGRESET) != 0)
|
||||
ccb->ccb_h.status = CAM_SCSI_BUS_RESET;
|
||||
mpssas_set_ccbstatus(ccb, CAM_SCSI_BUS_RESET);
|
||||
else {
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
ccb->csio.scsi_status = SCSI_STATUS_OK;
|
||||
}
|
||||
if (sassc->flags & MPSSAS_QUEUE_FROZEN) {
|
||||
@ -2193,10 +2192,10 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
* CAM_REQ_CMP. The first is if MPS_CM_FLAGS_ERROR_MASK is
|
||||
* set, the second is in the MPS_FLAGS_DIAGRESET above.
|
||||
*/
|
||||
if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
|
||||
if (mpssas_get_ccbstatus(ccb) != CAM_REQ_CMP) {
|
||||
/*
|
||||
* Freeze the dev queue so that commands are
|
||||
* executed in the correct order with after error
|
||||
* executed in the correct order after error
|
||||
* recovery.
|
||||
*/
|
||||
ccb->ccb_h.status |= CAM_DEV_QFRZN;
|
||||
@ -2220,7 +2219,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
*/
|
||||
if (cm->cm_flags & MPS_CM_FLAGS_DD_IO) {
|
||||
mps_free_command(sc, cm);
|
||||
ccb->ccb_h.status = MPS_WD_RETRY;
|
||||
mpssas_set_ccbstatus(ccb, MPS_WD_RETRY);
|
||||
mpssas_action_scsiio(sassc, ccb);
|
||||
return;
|
||||
}
|
||||
@ -2239,7 +2238,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
/* Completion failed at the transport level. */
|
||||
if (rep->SCSIState & (MPI2_SCSI_STATE_NO_SCSI_STATUS |
|
||||
MPI2_SCSI_STATE_TERMINATED)) {
|
||||
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2248,7 +2247,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
* recover the command.
|
||||
*/
|
||||
if (rep->SCSIState & MPI2_SCSI_STATE_AUTOSENSE_FAILED) {
|
||||
ccb->ccb_h.status = CAM_AUTOSENSE_FAIL;
|
||||
mpssas_set_ccbstatus(ccb, CAM_AUTOSENSE_FAIL);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2272,16 +2271,16 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
*/
|
||||
if ((rep->SCSIStatus == MPI2_SCSI_STATUS_COMMAND_TERMINATED) ||
|
||||
(rep->SCSIStatus == MPI2_SCSI_STATUS_TASK_ABORTED)) {
|
||||
ccb->ccb_h.status = CAM_REQ_ABORTED;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_ABORTED);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Handle normal status and sense */
|
||||
csio->scsi_status = rep->SCSIStatus;
|
||||
if (rep->SCSIStatus == MPI2_SCSI_STATUS_GOOD)
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
else
|
||||
ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_SCSI_STATUS_ERROR);
|
||||
|
||||
if (rep->SCSIState & MPI2_SCSI_STATE_AUTOSENSE_VALID) {
|
||||
int sense_len, returned_sense_len;
|
||||
@ -2345,13 +2344,13 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
* failed.
|
||||
*/
|
||||
if (cm->cm_targ->devinfo == 0)
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
else
|
||||
ccb->ccb_h.status = CAM_DEV_NOT_THERE;
|
||||
mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE);
|
||||
break;
|
||||
case MPI2_IOCSTATUS_INVALID_SGL:
|
||||
mps_print_scsiio_cmd(sc, cm);
|
||||
ccb->ccb_h.status = CAM_UNREC_HBA_ERROR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_UNREC_HBA_ERROR);
|
||||
break;
|
||||
case MPI2_IOCSTATUS_SCSI_TASK_TERMINATED:
|
||||
/*
|
||||
@ -2364,14 +2363,14 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
* on the console.
|
||||
*/
|
||||
if (cm->cm_state == MPS_CM_STATE_TIMEDOUT)
|
||||
ccb->ccb_h.status = CAM_CMD_TIMEOUT;
|
||||
mpssas_set_ccbstatus(ccb, CAM_CMD_TIMEOUT);
|
||||
else
|
||||
ccb->ccb_h.status = CAM_REQ_ABORTED;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_ABORTED);
|
||||
break;
|
||||
case MPI2_IOCSTATUS_SCSI_DATA_OVERRUN:
|
||||
/* resid is ignored for this condition */
|
||||
csio->resid = 0;
|
||||
ccb->ccb_h.status = CAM_DATA_RUN_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_DATA_RUN_ERR);
|
||||
break;
|
||||
case MPI2_IOCSTATUS_SCSI_IOC_TERMINATED:
|
||||
case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED:
|
||||
@ -2380,7 +2379,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
* transient transport-related) errors, retry these without
|
||||
* decrementing the retry count.
|
||||
*/
|
||||
ccb->ccb_h.status = CAM_REQUEUE_REQ;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQUEUE_REQ);
|
||||
mpssas_log_command(cm, MPS_INFO,
|
||||
"terminated ioc %x scsi %x state %x xfer %u\n",
|
||||
le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
|
||||
@ -2402,7 +2401,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
|
||||
le32toh(rep->TransferCount));
|
||||
csio->resid = cm->cm_length;
|
||||
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2415,7 +2414,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
"unfreezing SIM queue\n");
|
||||
}
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
|
||||
if (mpssas_get_ccbstatus(ccb) != CAM_REQ_CMP) {
|
||||
ccb->ccb_h.status |= CAM_DEV_QFRZN;
|
||||
xpt_freeze_devq(ccb->ccb_h.path, /*count*/ 1);
|
||||
}
|
||||
@ -2713,14 +2712,14 @@ mpssas_smpio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
if ((cm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
|
||||
mps_dprint(sc, MPS_ERROR,"%s: cm_flags = %#x on SMP request!\n",
|
||||
__func__, cm->cm_flags);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
rpl = (MPI2_SMP_PASSTHROUGH_REPLY *)cm->cm_reply;
|
||||
if (rpl == NULL) {
|
||||
mps_dprint(sc, MPS_ERROR, "%s: NULL cm_reply!\n", __func__);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
@ -2733,7 +2732,7 @@ mpssas_smpio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
rpl->SASStatus != MPI2_SASSTATUS_SUCCESS) {
|
||||
mps_dprint(sc, MPS_XINFO, "%s: IOCStatus %04x SASStatus %02x\n",
|
||||
__func__, le16toh(rpl->IOCStatus), rpl->SASStatus);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
@ -2742,9 +2741,9 @@ mpssas_smpio_complete(struct mps_softc *sc, struct mps_command *cm)
|
||||
(uintmax_t)sasaddr);
|
||||
|
||||
if (ccb->smpio.smp_response[2] == SMP_FR_ACCEPTED)
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
else
|
||||
ccb->ccb_h.status = CAM_SMP_STATUS_ERROR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_SMP_STATUS_ERROR);
|
||||
|
||||
bailout:
|
||||
/*
|
||||
@ -2780,7 +2779,7 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
|
||||
case CAM_DATA_SG_PADDR:
|
||||
mps_dprint(sc, MPS_ERROR,
|
||||
"%s: physical addresses not supported\n", __func__);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
case CAM_DATA_SG:
|
||||
@ -2794,7 +2793,7 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
|
||||
"%s: multiple request or response "
|
||||
"buffer segments not supported for SMP\n",
|
||||
__func__);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -2828,7 +2827,7 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
|
||||
response = ccb->smpio.smp_response;
|
||||
break;
|
||||
default:
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -2837,7 +2836,7 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
|
||||
if (cm == NULL) {
|
||||
mps_dprint(sc, MPS_ERROR,
|
||||
"%s: cannot allocate command\n", __func__);
|
||||
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
||||
mpssas_set_ccbstatus(ccb, CAM_RESRC_UNAVAIL);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -2925,7 +2924,7 @@ mpssas_send_smpcmd(struct mpssas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
|
||||
|
||||
bailout_error:
|
||||
mps_free_command(sc, cm);
|
||||
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
||||
mpssas_set_ccbstatus(ccb, CAM_RESRC_UNAVAIL);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
|
||||
@ -2950,7 +2949,7 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
mps_dprint(sc, MPS_ERROR,
|
||||
"%s: target %d does not exist!\n", __func__,
|
||||
ccb->ccb_h.target_id);
|
||||
ccb->ccb_h.status = CAM_SEL_TIMEOUT;
|
||||
mpssas_set_ccbstatus(ccb, CAM_SEL_TIMEOUT);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -2999,7 +2998,7 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
mps_dprint(sc, MPS_ERROR,
|
||||
"%s: handle %d does not have a valid "
|
||||
"parent handle!\n", __func__, targ->handle);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
goto bailout;
|
||||
}
|
||||
#ifdef OLD_MPS_PROBE
|
||||
@ -3010,7 +3009,7 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
mps_dprint(sc, MPS_ERROR,
|
||||
"%s: handle %d does not have a valid "
|
||||
"parent target!\n", __func__, targ->handle);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
@ -3020,7 +3019,7 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
"%s: handle %d parent %d does not "
|
||||
"have an SMP target!\n", __func__,
|
||||
targ->handle, parent_target->handle);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
goto bailout;
|
||||
|
||||
}
|
||||
@ -3033,7 +3032,7 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
"%s: handle %d parent %d does not "
|
||||
"have an SMP target!\n", __func__,
|
||||
targ->handle, targ->parent_handle);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
goto bailout;
|
||||
|
||||
}
|
||||
@ -3042,7 +3041,7 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
"%s: handle %d parent handle %d does "
|
||||
"not have a valid SAS address!\n",
|
||||
__func__, targ->handle, targ->parent_handle);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
@ -3055,7 +3054,7 @@ mpssas_action_smpio(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
mps_dprint(sc, MPS_INFO,
|
||||
"%s: unable to find SAS address for handle %d\n",
|
||||
__func__, targ->handle);
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID);
|
||||
goto bailout;
|
||||
}
|
||||
mpssas_send_smpcmd(sassc, ccb, sasaddr);
|
||||
@ -3087,7 +3086,7 @@ mpssas_action_resetdev(struct mpssas_softc *sassc, union ccb *ccb)
|
||||
if (tm == NULL) {
|
||||
mps_dprint(sc, MPS_ERROR,
|
||||
"command alloc failure in mpssas_action_resetdev\n");
|
||||
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
||||
mpssas_set_ccbstatus(ccb, CAM_RESRC_UNAVAIL);
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
@ -3135,7 +3134,7 @@ mpssas_resetdev_complete(struct mps_softc *sc, struct mps_command *tm)
|
||||
"%s: cm_flags = %#x for reset of handle %#04x! "
|
||||
"This should not happen!\n", __func__, tm->cm_flags,
|
||||
req->DevHandle);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
@ -3144,12 +3143,12 @@ mpssas_resetdev_complete(struct mps_softc *sc, struct mps_command *tm)
|
||||
le16toh(resp->IOCStatus), le32toh(resp->ResponseCode));
|
||||
|
||||
if (le32toh(resp->ResponseCode) == MPI2_SCSITASKMGMT_RSP_TM_COMPLETE) {
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP);
|
||||
mpssas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid,
|
||||
CAM_LUN_WILDCARD);
|
||||
}
|
||||
else
|
||||
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
|
||||
|
||||
bailout:
|
||||
|
||||
@ -3251,7 +3250,7 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path,
|
||||
cam_release_devq(cdai.ccb_h.path,
|
||||
0, 0, 0, FALSE);
|
||||
|
||||
if (((cdai.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
|
||||
if ((mpssas_get_ccbstatus((union ccb *)&cdai) == CAM_REQ_CMP)
|
||||
&& (rcap_buf.prot & SRC16_PROT_EN)) {
|
||||
lun->eedp_formatted = TRUE;
|
||||
lun->eedp_block_size = scsi_4btoul(rcap_buf.length);
|
||||
@ -3453,7 +3452,7 @@ mpssas_read_cap_done(struct cam_periph *periph, union ccb *done_ccb)
|
||||
* the lun as not supporting EEDP and set the block size
|
||||
* to 0.
|
||||
*/
|
||||
if (((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
|
||||
if ((mpssas_get_ccbstatus(done_ccb) != CAM_REQ_CMP)
|
||||
|| (done_ccb->csio.scsi_status != SCSI_STATUS_OK)) {
|
||||
lun->eedp_formatted = FALSE;
|
||||
lun->eedp_block_size = 0;
|
||||
|
@ -145,6 +145,19 @@ mpssas_set_lun(uint8_t *lun, u_int ccblun)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
mpssas_set_ccbstatus(union ccb *ccb, int status)
|
||||
{
|
||||
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
|
||||
ccb->ccb_h.status |= status;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
mpssas_get_ccbstatus(union ccb *ccb)
|
||||
{
|
||||
return (ccb->ccb_h.status & CAM_STATUS_MASK);
|
||||
}
|
||||
|
||||
#define MPS_SET_SINGLE_LUN(req, lun) \
|
||||
do { \
|
||||
bzero((req)->LUN, 8); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user