Lines Matching refs:ccb

115 static void mpt_action(struct cam_sim *, union ccb *);
144 static void mpt_target_start_io(struct mpt_softc *, union ccb *);
145 static cam_status mpt_abort_target_ccb(struct mpt_softc *, union ccb *);
147 static void mpt_scsi_tgt_status(struct mpt_softc *, union ccb *, request_t *,
1230 union ccb *ccb; in mpt_timeout() local
1234 ccb = (union ccb *)arg; in mpt_timeout()
1235 mpt = ccb->ccb_h.ccb_mpt_ptr; in mpt_timeout()
1238 req = ccb->ccb_h.ccb_req_ptr; in mpt_timeout()
1240 req->serno, ccb, req->ccb); in mpt_timeout()
1263 union ccb *ccb; in mpt_execute_req_a64() local
1275 ccb = req->ccb; in mpt_execute_req_a64()
1277 mpt = ccb->ccb_h.ccb_mpt_ptr; in mpt_execute_req_a64()
1278 req = ccb->ccb_h.ccb_req_ptr; in mpt_execute_req_a64()
1317 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) { in mpt_execute_req_a64()
1319 mpt_freeze_ccb(ccb); in mpt_execute_req_a64()
1333 mpt_set_ccb_status(ccb, status); in mpt_execute_req_a64()
1337 MPT_TAG_2_REQ(mpt, ccb->csio.tag_id); in mpt_execute_req_a64()
1339 MPT_TGT_STATE(mpt, cmd_req)->ccb = NULL; in mpt_execute_req_a64()
1342 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_execute_req_a64()
1343 KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); in mpt_execute_req_a64()
1344 xpt_done(ccb); in mpt_execute_req_a64()
1371 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { in mpt_execute_req_a64()
1375 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_execute_req_a64()
1380 if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { in mpt_execute_req_a64()
1383 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_execute_req_a64()
1389 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_execute_req_a64()
1610 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) { in mpt_execute_req_a64()
1613 MPT_TAG_2_REQ(mpt, ccb->csio.tag_id); in mpt_execute_req_a64()
1615 MPT_TGT_STATE(mpt, cmd_req)->ccb = NULL; in mpt_execute_req_a64()
1620 ccb->ccb_h.status & CAM_STATUS_MASK); in mpt_execute_req_a64()
1624 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_execute_req_a64()
1625 KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); in mpt_execute_req_a64()
1626 xpt_done(ccb); in mpt_execute_req_a64()
1631 ccb->ccb_h.status |= CAM_SIM_QUEUED; in mpt_execute_req_a64()
1632 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) { in mpt_execute_req_a64()
1633 mpt_req_timeout(req, SBT_1MS * ccb->ccb_h.timeout, in mpt_execute_req_a64()
1634 mpt_timeout, ccb); in mpt_execute_req_a64()
1646 request_t *cmd_req = MPT_TAG_2_REQ(mpt, ccb->csio.tag_id); in mpt_execute_req_a64()
1649 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) && in mpt_execute_req_a64()
1667 union ccb *ccb; in mpt_execute_req() local
1678 ccb = req->ccb; in mpt_execute_req()
1680 mpt = ccb->ccb_h.ccb_mpt_ptr; in mpt_execute_req()
1681 req = ccb->ccb_h.ccb_req_ptr; in mpt_execute_req()
1719 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) { in mpt_execute_req()
1721 mpt_freeze_ccb(ccb); in mpt_execute_req()
1735 mpt_set_ccb_status(ccb, status); in mpt_execute_req()
1739 MPT_TAG_2_REQ(mpt, ccb->csio.tag_id); in mpt_execute_req()
1741 MPT_TGT_STATE(mpt, cmd_req)->ccb = NULL; in mpt_execute_req()
1744 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_execute_req()
1745 KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); in mpt_execute_req()
1746 xpt_done(ccb); in mpt_execute_req()
1773 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { in mpt_execute_req()
1777 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_execute_req()
1782 if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { in mpt_execute_req()
1785 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_execute_req()
1791 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_execute_req()
1996 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) { in mpt_execute_req()
1999 MPT_TAG_2_REQ(mpt, ccb->csio.tag_id); in mpt_execute_req()
2001 MPT_TGT_STATE(mpt, cmd_req)->ccb = NULL; in mpt_execute_req()
2006 ccb->ccb_h.status & CAM_STATUS_MASK); in mpt_execute_req()
2010 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_execute_req()
2011 KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); in mpt_execute_req()
2012 xpt_done(ccb); in mpt_execute_req()
2017 ccb->ccb_h.status |= CAM_SIM_QUEUED; in mpt_execute_req()
2018 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) { in mpt_execute_req()
2019 mpt_req_timeout(req, SBT_1MS * ccb->ccb_h.timeout, in mpt_execute_req()
2020 mpt_timeout, ccb); in mpt_execute_req()
2032 request_t *cmd_req = MPT_TAG_2_REQ(mpt, ccb->csio.tag_id); in mpt_execute_req()
2035 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) && in mpt_execute_req()
2049 mpt_start(struct cam_sim *sim, union ccb *ccb) in mpt_start() argument
2054 struct ccb_scsiio *csio = &ccb->csio; in mpt_start()
2055 struct ccb_hdr *ccbh = &ccb->ccb_h; in mpt_start()
2062 mpt = ccb->ccb_h.ccb_mpt_ptr; in mpt_start()
2071 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_start()
2072 mpt_set_ccb_status(ccb, CAM_REQUEUE_REQ); in mpt_start()
2073 xpt_done(ccb); in mpt_start()
2090 req->ccb = ccb; in mpt_start()
2091 ccb->ccb_h.ccb_req_ptr = req; in mpt_start()
2100 if (mpt_map_physdisk(mpt, ccb, &tgt) != 0) { in mpt_start()
2101 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_start()
2102 mpt_set_ccb_status(ccb, CAM_DEV_NOT_THERE); in mpt_start()
2103 xpt_done(ccb); in mpt_start()
2108 tgt = ccb->ccb_h.target_id; in mpt_start()
2126 if (ccb->ccb_h.target_lun >= MPT_MAX_LUNS) { in mpt_start()
2127 mpt_req->LUN[0] = 0x40 | ((ccb->ccb_h.target_lun >> 8) & 0x3f); in mpt_start()
2128 mpt_req->LUN[1] = ccb->ccb_h.target_lun & 0xff; in mpt_start()
2130 mpt_req->LUN[1] = ccb->ccb_h.target_lun; in mpt_start()
2134 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_start()
2136 } else if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { in mpt_start()
2142 if ((ccb->ccb_h.flags & CAM_TAG_ACTION_VALID) != 0) { in mpt_start()
2143 switch(ccb->csio.tag_action) { in mpt_start()
2168 if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) { in mpt_start()
2175 if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) { in mpt_start()
2201 (uintmax_t)ccb->ccb_h.target_lun, req, req->serno); in mpt_start()
2204 error = bus_dmamap_load_ccb(mpt->buffer_dmat, req->dmap, ccb, cb, in mpt_start()
2336 union ccb *ccb; in mpt_cam_event() local
2354 ccb = xpt_alloc_ccb_nowait(); in mpt_cam_event()
2355 if (ccb == NULL) { in mpt_cam_event()
2360 if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid, in mpt_cam_event()
2363 xpt_free_ccb(ccb); in mpt_cam_event()
2366 xpt_rescan(ccb); in mpt_cam_event()
2475 xpt_action((union ccb *)&crs); in mpt_cam_event()
2489 union ccb *ccb; in mpt_cam_event() local
2502 ccb = xpt_alloc_ccb_nowait(); in mpt_cam_event()
2503 if (ccb == NULL) { in mpt_cam_event()
2508 if (xpt_create_path(&ccb->ccb_h.path, NULL, in mpt_cam_event()
2513 xpt_free_ccb(ccb); in mpt_cam_event()
2516 xpt_rescan(ccb); in mpt_cam_event()
2584 union ccb *ccb; in mpt_scsi_reply_handler() local
2592 ccb = req->ccb; in mpt_scsi_reply_handler()
2593 if (ccb == NULL) { in mpt_scsi_reply_handler()
2599 mpt_req_untimeout(req, mpt_timeout, ccb); in mpt_scsi_reply_handler()
2600 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_scsi_reply_handler()
2602 if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { in mpt_scsi_reply_handler()
2605 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) in mpt_scsi_reply_handler()
2617 ccb->csio.resid = 0; in mpt_scsi_reply_handler()
2618 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_scsi_reply_handler()
2619 ccb->csio.scsi_status = SCSI_STATUS_OK; in mpt_scsi_reply_handler()
2625 ccb->ccb_h.status |= CAM_RELEASE_SIMQ; in mpt_scsi_reply_handler()
2631 (struct scsi_inquiry_data *)ccb->csio.data_ptr; in mpt_scsi_reply_handler()
2646 KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); in mpt_scsi_reply_handler()
2647 xpt_done(ccb); in mpt_scsi_reply_handler()
2950 union ccb *ccb; in mpt_fc_els_reply_handler() local
2971 ccb = tgt->ccb; in mpt_fc_els_reply_handler()
2972 if (ccb) { in mpt_fc_els_reply_handler()
2975 ccb, (uintmax_t)ccb->ccb_h.target_lun, in mpt_fc_els_reply_handler()
2976 ccb->ccb_h.flags, ccb->ccb_h.status); in mpt_fc_els_reply_handler()
3051 union ccb *ccb; in mpt_scsi_reply_frame_handler() local
3068 ccb = req->ccb; in mpt_scsi_reply_frame_handler()
3069 ccb->csio.resid = in mpt_scsi_reply_frame_handler()
3070 ccb->csio.dxfer_len - le32toh(scsi_io_reply->TransferCount); in mpt_scsi_reply_frame_handler()
3073 && (ccb->ccb_h.flags & (CAM_SENSE_PHYS | CAM_SENSE_PTR)) == 0) { in mpt_scsi_reply_frame_handler()
3076 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in mpt_scsi_reply_frame_handler()
3079 if (sense_returned < ccb->csio.sense_len) in mpt_scsi_reply_frame_handler()
3080 ccb->csio.sense_resid = ccb->csio.sense_len - in mpt_scsi_reply_frame_handler()
3083 ccb->csio.sense_resid = 0; in mpt_scsi_reply_frame_handler()
3085 bzero(&ccb->csio.sense_data, sizeof(ccb->csio.sense_data)); in mpt_scsi_reply_frame_handler()
3086 bcopy(req->sense_vbuf, &ccb->csio.sense_data, in mpt_scsi_reply_frame_handler()
3087 min(ccb->csio.sense_len, sense_returned)); in mpt_scsi_reply_frame_handler()
3111 mpt_set_ccb_status(ccb, CAM_UNCOR_PARITY); in mpt_scsi_reply_frame_handler()
3122 mpt_set_ccb_status(ccb, CAM_UNEXP_BUSFREE); in mpt_scsi_reply_frame_handler()
3124 ccb->csio.scsi_status = scsi_io_reply->SCSIStatus; in mpt_scsi_reply_frame_handler()
3125 mpt_set_ccb_status(ccb, CAM_SCSI_STATUS_ERROR); in mpt_scsi_reply_frame_handler()
3127 mpt_set_ccb_status(ccb, CAM_AUTOSENSE_FAIL); in mpt_scsi_reply_frame_handler()
3131 mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); in mpt_scsi_reply_frame_handler()
3133 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_scsi_reply_frame_handler()
3136 mpt_set_ccb_status(ccb, CAM_DATA_RUN_ERR); in mpt_scsi_reply_frame_handler()
3139 mpt_set_ccb_status(ccb, CAM_UNCOR_PARITY); in mpt_scsi_reply_frame_handler()
3150 mpt_set_ccb_status(ccb, CAM_SEL_TIMEOUT); in mpt_scsi_reply_frame_handler()
3153 mpt_set_ccb_status(ccb, CAM_SEQUENCE_FAIL); in mpt_scsi_reply_frame_handler()
3156 mpt_set_ccb_status(ccb, CAM_PATH_INVALID); in mpt_scsi_reply_frame_handler()
3159 mpt_set_ccb_status(ccb, CAM_TID_INVALID); in mpt_scsi_reply_frame_handler()
3162 ccb->ccb_h.status = CAM_UA_TERMIO; in mpt_scsi_reply_frame_handler()
3170 ccb->ccb_h.status = CAM_SCSI_BUS_RESET; in mpt_scsi_reply_frame_handler()
3181 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) in mpt_scsi_reply_frame_handler()
3183 mpt_set_ccb_status(ccb, CAM_REQ_TERMIO); in mpt_scsi_reply_frame_handler()
3187 mpt_set_ccb_status(ccb, CAM_RESRC_UNAVAIL); in mpt_scsi_reply_frame_handler()
3190 mpt_set_ccb_status(ccb, CAM_BUSY); in mpt_scsi_reply_frame_handler()
3201 ccb->ccb_h.status = CAM_UNREC_HBA_ERROR; in mpt_scsi_reply_frame_handler()
3205 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { in mpt_scsi_reply_frame_handler()
3206 mpt_freeze_ccb(ccb); in mpt_scsi_reply_frame_handler()
3213 mpt_action(struct cam_sim *sim, union ccb *ccb) in mpt_action() argument
3221 CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("mpt_action\n")); in mpt_action()
3227 tgt = ccb->ccb_h.target_id; in mpt_action()
3228 lun = ccb->ccb_h.target_lun; in mpt_action()
3230 ccb->ccb_h.func_code != XPT_PATH_INQ && in mpt_action()
3231 ccb->ccb_h.func_code != XPT_RESET_BUS && in mpt_action()
3232 ccb->ccb_h.func_code != XPT_RESET_DEV) { in mpt_action()
3233 if (mpt_map_physdisk(mpt, ccb, &tgt) != 0) { in mpt_action()
3234 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_action()
3235 mpt_set_ccb_status(ccb, CAM_DEV_NOT_THERE); in mpt_action()
3236 xpt_done(ccb); in mpt_action()
3240 ccb->ccb_h.ccb_mpt_ptr = mpt; in mpt_action()
3242 switch (ccb->ccb_h.func_code) { in mpt_action()
3247 if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) { in mpt_action()
3248 if ((ccb->ccb_h.flags & CAM_CDB_PHYS) != 0) { in mpt_action()
3249 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_action()
3250 mpt_set_ccb_status(ccb, CAM_REQ_INVALID); in mpt_action()
3256 if (ccb->csio.cdb_len > in mpt_action()
3258 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_action()
3259 mpt_set_ccb_status(ccb, CAM_REQ_INVALID); in mpt_action()
3263 if (mpt->failure_id == ccb->ccb_h.target_id) { in mpt_action()
3264 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_action()
3265 mpt_set_ccb_status(ccb, CAM_SEL_TIMEOUT); in mpt_action()
3269 ccb->csio.scsi_status = SCSI_STATUS_OK; in mpt_action()
3270 mpt_start(sim, ccb); in mpt_action()
3275 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_action()
3276 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3280 if (ccb->ccb_h.func_code == XPT_RESET_BUS) { in mpt_action()
3282 xpt_print(ccb->ccb_h.path, "reset bus\n"); in mpt_action()
3285 xpt_print(ccb->ccb_h.path, "reset device\n"); in mpt_action()
3294 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_action()
3295 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3300 union ccb *accb = ccb->cab.abort_ccb; in mpt_action()
3304 ccb->ccb_h.status = mpt_abort_target_ccb(mpt, ccb); in mpt_action()
3308 ccb->ccb_h.status = CAM_UA_ABORT; in mpt_action()
3311 ccb->ccb_h.status = CAM_UA_ABORT; in mpt_action()
3314 ccb->ccb_h.status = CAM_REQ_INVALID; in mpt_action()
3345 cts = &ccb->cts; in mpt_action()
3348 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3359 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3371 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3383 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3444 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3451 mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); in mpt_action()
3453 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3460 cts = &ccb->cts; in mpt_action()
3483 mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); in mpt_action()
3490 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3497 ccg = &ccb->ccg; in mpt_action()
3499 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_action()
3500 mpt_set_ccb_status(ccb, CAM_REQ_INVALID); in mpt_action()
3504 KASSERT(ccb->ccb_h.status, ("zero ccb sts at %d", __LINE__)); in mpt_action()
3509 struct ccb_pathinq *cpi = &ccb->cpi; in mpt_action()
3597 if (ccb->cel.enable) in mpt_action()
3599 ccb->ccb_h.target_id, ccb->ccb_h.target_lun); in mpt_action()
3602 ccb->ccb_h.target_id, ccb->ccb_h.target_lun); in mpt_action()
3604 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_action()
3606 mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); in mpt_action()
3615 lun_id_t lun = ccb->ccb_h.target_lun; in mpt_action()
3616 ccb->ccb_h.sim_priv.entries[0].field = 0; in mpt_action()
3617 ccb->ccb_h.sim_priv.entries[1].ptr = mpt; in mpt_action()
3620 if (ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) { in mpt_action()
3621 mpt_set_ccb_status(ccb, CAM_REQ_INVALID); in mpt_action()
3626 mpt_set_ccb_status(ccb, CAM_REQ_INVALID); in mpt_action()
3631 if (ccb->ccb_h.func_code == XPT_ACCEPT_TARGET_IO) { in mpt_action()
3633 "Put FREE ATIO %p lun %jx\n", ccb, (uintmax_t)lun); in mpt_action()
3634 STAILQ_INSERT_TAIL(&trtp->atios, &ccb->ccb_h, in mpt_action()
3636 } else if (ccb->ccb_h.func_code == XPT_IMMEDIATE_NOTIFY) { in mpt_action()
3639 STAILQ_INSERT_TAIL(&trtp->inots, &ccb->ccb_h, in mpt_action()
3644 mpt_set_ccb_status(ccb, CAM_REQ_INPROG); in mpt_action()
3648 mpt_target_start_io(mpt, ccb); in mpt_action()
3652 ccb->ccb_h.status = CAM_REQ_INVALID; in mpt_action()
3655 xpt_done(ccb); in mpt_action()
3670 if (mpt_map_physdisk(mpt, (union ccb *)cts, &tgt)) { in mpt_get_spi_settings()
3935 union ccb *ccb; in mpt_recover_commands() local
3980 ccb = req->ccb; in mpt_recover_commands()
3981 if (ccb == NULL) { in mpt_recover_commands()
3987 mpt_set_ccb_status(ccb, CAM_CMD_TIMEOUT); in mpt_recover_commands()
4010 0, 0, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in mpt_recover_commands()
4290 mpt_target_start_io(struct mpt_softc *mpt, union ccb *ccb) in mpt_target_start_io() argument
4292 struct ccb_scsiio *csio = &ccb->csio; in mpt_target_start_io()
4300 mpt_set_ccb_status(ccb, CAM_REQUEUE_REQ); in mpt_target_start_io()
4302 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_target_start_io()
4303 tgt->ccb->ccb_h.status |= CAM_RELEASE_SIMQ; in mpt_target_start_io()
4304 xpt_done(ccb); in mpt_target_start_io()
4308 "starting I/O\n", ccb, csio->ccb_h.flags, csio->tag_id); in mpt_target_start_io()
4310 mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); in mpt_target_start_io()
4311 xpt_done(ccb); in mpt_target_start_io()
4321 KASSERT((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE, in mpt_target_start_io()
4330 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_target_start_io()
4331 mpt_set_ccb_status(ccb, CAM_REQUEUE_REQ); in mpt_target_start_io()
4332 xpt_done(ccb); in mpt_target_start_io()
4335 ccb->ccb_h.status = CAM_SIM_QUEUED | CAM_REQ_INPROG; in mpt_target_start_io()
4342 req->ccb = ccb; in mpt_target_start_io()
4343 ccb->ccb_h.ccb_req_ptr = req; in mpt_target_start_io()
4349 tgt->ccb = ccb; in mpt_target_start_io()
4376 ta->DataLength = ccb->csio.dxfer_len; in mpt_target_start_io()
4387 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { in mpt_target_start_io()
4393 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) && in mpt_target_start_io()
4404 tgt->resid, ccb->ccb_h.flags, req, req->serno, tgt->state); in mpt_target_start_io()
4406 error = bus_dmamap_load_ccb(mpt->buffer_dmat, req->dmap, ccb, in mpt_target_start_io()
4410 ccb->ccb_h.status |= CAM_RELEASE_SIMQ; in mpt_target_start_io()
4421 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) == 0) { in mpt_target_start_io()
4424 "resid %d bytes_xfered %u\n", ccb, ccb->ccb_h.flags, in mpt_target_start_io()
4425 ccb->ccb_h.status, tgt->resid, tgt->bytes_xfered); in mpt_target_start_io()
4426 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_target_start_io()
4427 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_target_start_io()
4428 xpt_done(ccb); in mpt_target_start_io()
4431 if (ccb->ccb_h.flags & CAM_SEND_SENSE) { in mpt_target_start_io()
4436 mpt_scsi_tgt_status(mpt, ccb, cmd_req, csio->scsi_status, sp); in mpt_target_start_io()
4511 tgt->ccb = NULL; in mpt_scsi_tgt_local()
4527 mpt_abort_target_ccb(struct mpt_softc *mpt, union ccb *ccb) in mpt_abort_target_ccb() argument
4532 union ccb *accb = ccb->cab.abort_ccb; in mpt_abort_target_ccb()
4537 if (ccb->ccb_h.target_lun == CAM_LUN_WILDCARD) { in mpt_abort_target_ccb()
4540 trtp = &mpt->trt[ccb->ccb_h.target_lun]; in mpt_abort_target_ccb()
4563 mpt_prt(mpt, "mpt_abort_tgt_ccb: CCB %p not found\n", ccb); in mpt_abort_target_ccb()
4610 mpt_scsi_tgt_status(struct mpt_softc *mpt, union ccb *ccb, request_t *cmd_req, in mpt_scsi_tgt_status() argument
4631 if (ccb) { in mpt_scsi_tgt_status()
4632 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_scsi_tgt_status()
4633 mpt_set_ccb_status(ccb, CAM_REQUEUE_REQ); in mpt_scsi_tgt_status()
4634 xpt_done(ccb); in mpt_scsi_tgt_status()
4641 req->ccb = ccb; in mpt_scsi_tgt_status()
4642 if (ccb) { in mpt_scsi_tgt_status()
4643 ccb->ccb_h.ccb_mpt_ptr = mpt; in mpt_scsi_tgt_status()
4644 ccb->ccb_h.ccb_req_ptr = req; in mpt_scsi_tgt_status()
4651 tgt->ccb = ccb; in mpt_scsi_tgt_status()
4751 ccb, sense_data?"h" : "hout", ccb? ccb->csio.tag_id : -1, req, in mpt_scsi_tgt_status()
4753 if (ccb) { in mpt_scsi_tgt_status()
4754 ccb->ccb_h.status = CAM_SIM_QUEUED | CAM_REQ_INPROG; in mpt_scsi_tgt_status()
4755 mpt_req_timeout(req, SBT_1S * 60, mpt_timeout, ccb); in mpt_scsi_tgt_status()
4808 tgt->ccb = (union ccb *) inot; in mpt_scsi_tgt_tsk_mgmt()
4810 xpt_done((union ccb *)inot); in mpt_scsi_tgt_tsk_mgmt()
5081 xpt_done((union ccb *)atiop); in mpt_scsi_tgt_atio()
5091 tgt->resid, tgt->bytes_xfered, tgt->ccb, tgt->req, tgt->nxfers, in mpt_tgt_dump_tgt_state()
5109 union ccb *ccb; in mpt_scsi_tgt_reply_handler() local
5136 ccb = tgt->ccb; in mpt_scsi_tgt_reply_handler()
5142 if (ccb == NULL) { in mpt_scsi_tgt_reply_handler()
5158 tgt->ccb = NULL; in mpt_scsi_tgt_reply_handler()
5160 mpt_req_untimeout(req, mpt_timeout, ccb); in mpt_scsi_tgt_reply_handler()
5163 ccb, tgt->req, tgt->req->serno, ccb->csio.tag_id); in mpt_scsi_tgt_reply_handler()
5167 KASSERT(tgt->req->ccb == ccb, in mpt_scsi_tgt_reply_handler()
5169 tgt->req->serno, tgt->req->ccb)); in mpt_scsi_tgt_reply_handler()
5179 if ((ccb->ccb_h.flags & CAM_SEND_STATUS) == 0) { in mpt_scsi_tgt_reply_handler()
5180 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_scsi_tgt_reply_handler()
5181 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_scsi_tgt_reply_handler()
5182 KASSERT(ccb->ccb_h.status, in mpt_scsi_tgt_reply_handler()
5186 ccb->ccb_h.status |= CAM_RELEASE_SIMQ; in mpt_scsi_tgt_reply_handler()
5190 xpt_done(ccb); in mpt_scsi_tgt_reply_handler()
5196 if (ccb->ccb_h.flags & CAM_SEND_SENSE) { in mpt_scsi_tgt_reply_handler()
5198 memcpy(sp, &ccb->csio.sense_data, in mpt_scsi_tgt_reply_handler()
5199 min(ccb->csio.sense_len, MPT_SENSE_SIZE)); in mpt_scsi_tgt_reply_handler()
5201 mpt_scsi_tgt_status(mpt, ccb, req, in mpt_scsi_tgt_reply_handler()
5202 ccb->csio.scsi_status, sp); in mpt_scsi_tgt_reply_handler()
5209 ccb = tgt->ccb; in mpt_scsi_tgt_reply_handler()
5217 if (ccb) { in mpt_scsi_tgt_reply_handler()
5218 tgt->ccb = NULL; in mpt_scsi_tgt_reply_handler()
5223 mpt_req_untimeout(req, mpt_timeout, ccb); in mpt_scsi_tgt_reply_handler()
5224 if (ccb->ccb_h.flags & CAM_SEND_SENSE) { in mpt_scsi_tgt_reply_handler()
5225 ccb->ccb_h.status |= CAM_SENT_SENSE; in mpt_scsi_tgt_reply_handler()
5229 "%p\n", ccb->csio.tag_id, ccb->ccb_h.status, in mpt_scsi_tgt_reply_handler()
5230 ccb->ccb_h.flags, tgt->req); in mpt_scsi_tgt_reply_handler()
5234 KASSERT(tgt->req->ccb == ccb, in mpt_scsi_tgt_reply_handler()
5236 tgt->req, tgt->req->serno, tgt->req->ccb)); in mpt_scsi_tgt_reply_handler()
5240 mpt_set_ccb_status(ccb, CAM_REQ_CMP); in mpt_scsi_tgt_reply_handler()
5241 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in mpt_scsi_tgt_reply_handler()
5242 KASSERT(ccb->ccb_h.status, in mpt_scsi_tgt_reply_handler()
5244 tgt->ccb = NULL; in mpt_scsi_tgt_reply_handler()
5267 if (ccb) { in mpt_scsi_tgt_reply_handler()
5269 ccb->ccb_h.status |= CAM_RELEASE_SIMQ; in mpt_scsi_tgt_reply_handler()
5273 xpt_done(ccb); in mpt_scsi_tgt_reply_handler()