Lines Matching refs:ccb
112 static void aac_cam_action(struct cam_sim *, union ccb *);
120 static void aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb,
124 static void aac_container_rw_command(struct cam_sim *, union ccb *, u_int8_t *);
125 static void aac_container_special_command(struct cam_sim *, union ccb *,
127 static void aac_passthrough_command(struct cam_sim *, union ccb *);
129 static u_int32_t aac_cam_reset_bus(struct cam_sim *, union ccb *);
130 static u_int32_t aac_cam_abort_ccb(struct cam_sim *, union ccb *);
131 static u_int32_t aac_cam_term_io(struct cam_sim *, union ccb *);
154 aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb, u_int8_t status, in aac_set_scsi_error() argument
159 (struct scsi_sense_data_fixed *)&ccb->csio.sense_data; in aac_set_scsi_error()
161 struct scsi_sense_data *sense = &ccb->csio.sense_data; in aac_set_scsi_error()
166 ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; in aac_set_scsi_error()
167 ccb->csio.scsi_status = status; in aac_set_scsi_error()
169 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in aac_set_scsi_error()
170 bzero(&ccb->csio.sense_data, ccb->csio.sense_len); in aac_set_scsi_error()
171 ccb->csio.sense_data.error_code = in aac_set_scsi_error()
174 if (ccb->csio.sense_len >= 14) { in aac_set_scsi_error()
186 union ccb *ccb; in aac_cam_rescan() local
199 ccb = xpt_alloc_ccb_nowait(); in aac_cam_rescan()
200 if (ccb == NULL) { in aac_cam_rescan()
206 if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, in aac_cam_rescan()
209 xpt_free_ccb(ccb); in aac_cam_rescan()
214 xpt_rescan(ccb); in aac_cam_rescan()
223 union ccb *ccb; in aac_cam_event() local
228 ccb = arg; in aac_cam_event()
229 camsc = ccb->ccb_h.sim_priv.entries[0].ptr; in aac_cam_event()
232 ccb->ccb_h.status = CAM_REQUEUE_REQ; in aac_cam_event()
233 xpt_done(ccb); in aac_cam_event()
371 aac_container_rw_command(struct cam_sim *sim, union ccb *ccb, u_int8_t *cmdp) in aac_container_rw_command() argument
387 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_container_rw_command()
388 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_container_rw_command()
397 event->ev_arg = ccb; in aac_container_rw_command()
404 switch (ccb->ccb_h.flags & CAM_DIR_MASK) { in aac_container_rw_command()
421 cm->cm_ccb = ccb; in aac_container_rw_command()
423 cm->cm_data = (void *)ccb->csio.data_ptr; in aac_container_rw_command()
424 cm->cm_datalen = ccb->csio.dxfer_len; in aac_container_rw_command()
445 raw->ldNum = ccb->ccb_h.target_id; in aac_container_rw_command()
459 raw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
471 br->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
480 bw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
493 br->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
504 bw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
518 aac_container_special_command(struct cam_sim *sim, union ccb *ccb, in aac_container_special_command() argument
530 …AGS_DBG_ERROR_B, "found container %d search for %d", co->co_mntobj.ObjectId, ccb->ccb_h.target_id); in aac_container_special_command()
531 if (co->co_mntobj.ObjectId == ccb->ccb_h.target_id) in aac_container_special_command()
534 if (co == NULL || ccb->ccb_h.target_lun != 0) { in aac_container_special_command()
537 *cmdp, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
538 ccb->csio.dxfer_len); in aac_container_special_command()
539 ccb->ccb_h.status = CAM_DEV_NOT_THERE; in aac_container_special_command()
540 xpt_done(ccb); in aac_container_special_command()
544 if (ccb->csio.dxfer_len) in aac_container_special_command()
545 bzero(ccb->csio.data_ptr, ccb->csio.dxfer_len); in aac_container_special_command()
554 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
555 ccb->csio.dxfer_len, inq->byte2, inq->page_code); in aac_container_special_command()
558 (struct scsi_inquiry_data *)ccb->csio.data_ptr; in aac_container_special_command()
560 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
563 xpt_done(ccb); in aac_container_special_command()
569 if (ccb->csio.dxfer_len >= 36) { in aac_container_special_command()
583 ccb->csio.data_ptr; in aac_container_special_command()
592 ccb->csio.data_ptr; in aac_container_special_command()
597 ccb->ccb_h.target_id); in aac_container_special_command()
599 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
602 xpt_done(ccb); in aac_container_special_command()
606 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
613 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
614 ccb->csio.dxfer_len); in aac_container_special_command()
615 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
624 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
625 ccb->csio.dxfer_len); in aac_container_special_command()
635 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_container_special_command()
636 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_container_special_command()
645 event->ev_arg = ccb; in aac_container_special_command()
686 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
693 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
694 ccb->csio.dxfer_len); in aac_container_special_command()
695 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
701 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
702 ccb->csio.dxfer_len); in aac_container_special_command()
703 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
709 (struct scsi_read_capacity_data *)ccb->csio.data_ptr; in aac_container_special_command()
712 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
713 ccb->csio.dxfer_len); in aac_container_special_command()
722 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
730 ccb->csio.data_ptr; in aac_container_special_command()
733 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
734 ccb->csio.dxfer_len); in aac_container_special_command()
737 aac_set_scsi_error(sc, ccb, SCSI_STATUS_CHECK_COND, in aac_container_special_command()
739 xpt_done(ccb); in aac_container_special_command()
746 if (ccb->csio.dxfer_len >= 14) { in aac_container_special_command()
756 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
767 } *p = (struct ms6_data *)ccb->csio.data_ptr; in aac_container_special_command()
773 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
774 ccb->csio.dxfer_len, msp->page); in aac_container_special_command()
809 if (ccb->csio.dxfer_len <= p->hd.datalen + 8) { in aac_container_special_command()
810 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
813 xpt_done(ccb); in aac_container_special_command()
826 aac_set_scsi_error(sc, ccb, SCSI_STATUS_CHECK_COND, in aac_container_special_command()
828 xpt_done(ccb); in aac_container_special_command()
831 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
838 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
839 ccb->csio.dxfer_len); in aac_container_special_command()
840 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
846 *cmdp, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
847 ccb->csio.dxfer_len); in aac_container_special_command()
848 ccb->ccb_h.status = CAM_REQ_CMP; /*CAM_REQ_INVALID*/ in aac_container_special_command()
851 xpt_done(ccb); in aac_container_special_command()
855 aac_passthrough_command(struct cam_sim *sim, union ccb *ccb) in aac_passthrough_command() argument
871 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_passthrough_command()
872 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_passthrough_command()
881 event->ev_arg = ccb; in aac_passthrough_command()
888 switch (ccb->ccb_h.flags & CAM_DIR_MASK) { in aac_passthrough_command()
917 srb->cdb_len = ccb->csio.cdb_len; in aac_passthrough_command()
918 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_passthrough_command()
919 bcopy(ccb->csio.cdb_io.cdb_ptr, (u_int8_t *)&srb->cdb[0], in aac_passthrough_command()
922 bcopy(ccb->csio.cdb_io.cdb_bytes, (u_int8_t *)&srb->cdb[0], in aac_passthrough_command()
933 if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { in aac_passthrough_command()
938 cm->cm_data = (void *)ccb->csio.data_ptr; in aac_passthrough_command()
939 cm->cm_datalen = ccb->csio.dxfer_len; in aac_passthrough_command()
940 srb->data_len = ccb->csio.dxfer_len; in aac_passthrough_command()
948 srb->target = ccb->ccb_h.target_id; in aac_passthrough_command()
949 srb->lun = ccb->ccb_h.target_lun; in aac_passthrough_command()
950 srb->timeout = ccb->ccb_h.timeout; /* XXX */ in aac_passthrough_command()
954 cm->cm_ccb = ccb; in aac_passthrough_command()
971 aac_cam_action(struct cam_sim *sim, union ccb *ccb) in aac_cam_action() argument
983 switch(ccb->ccb_h.func_code) { in aac_cam_action()
993 ccg = &ccb->ccg; in aac_cam_action()
1009 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1010 xpt_done(ccb); in aac_cam_action()
1015 struct ccb_pathinq *cpi = &ccb->cpi; in aac_cam_action()
1046 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1047 xpt_done(ccb); in aac_cam_action()
1054 &ccb->cts.proto_specific.scsi; in aac_cam_action()
1056 &ccb->cts.xport_specific.spi; in aac_cam_action()
1057 ccb->cts.protocol = PROTO_SCSI; in aac_cam_action()
1058 ccb->cts.protocol_version = SCSI_REV_SPC2; in aac_cam_action()
1059 ccb->cts.transport = XPORT_SAS; in aac_cam_action()
1060 ccb->cts.transport_version = 0; in aac_cam_action()
1066 ccb->cts.flags = ~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB); in aac_cam_action()
1067 ccb->cts.valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; in aac_cam_action()
1069 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1070 xpt_done(ccb); in aac_cam_action()
1074 ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; in aac_cam_action()
1075 xpt_done(ccb); in aac_cam_action()
1080 ccb->ccb_h.status = aac_cam_reset_bus(sim, ccb); in aac_cam_action()
1082 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1084 xpt_done(ccb); in aac_cam_action()
1087 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1088 xpt_done(ccb); in aac_cam_action()
1091 ccb->ccb_h.status = aac_cam_abort_ccb(sim, ccb); in aac_cam_action()
1092 xpt_done(ccb); in aac_cam_action()
1095 ccb->ccb_h.status = aac_cam_term_io(sim, ccb); in aac_cam_action()
1096 xpt_done(ccb); in aac_cam_action()
1100 ccb->ccb_h.func_code); in aac_cam_action()
1101 ccb->ccb_h.status = CAM_PROVIDE_FAIL; in aac_cam_action()
1102 xpt_done(ccb); in aac_cam_action()
1110 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_cam_action()
1111 cmdp = ccb->csio.cdb_io.cdb_ptr; in aac_cam_action()
1113 cmdp = &ccb->csio.cdb_io.cdb_bytes[0]; in aac_cam_action()
1118 aac_container_rw_command(sim, ccb, cmdp); in aac_cam_action()
1120 aac_container_special_command(sim, ccb, cmdp); in aac_cam_action()
1122 aac_passthrough_command(sim, ccb); in aac_cam_action()
1138 union ccb *ccb; in aac_container_complete() local
1142 ccb = cm->cm_ccb; in aac_container_complete()
1146 ccb->ccb_h.status = CAM_SCSI_BUS_RESET; in aac_container_complete()
1148 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_complete()
1150 ccb->ccb_h.status = CAM_BUSY; in aac_container_complete()
1152 ccb->ccb_h.status = CAM_REQ_CMP_ERR; in aac_container_complete()
1156 xpt_done(ccb); in aac_container_complete()
1162 union ccb *ccb; in aac_cam_complete() local
1168 ccb = cm->cm_ccb; in aac_cam_complete()
1179 ccb->ccb_h.status = CAM_SCSI_BUS_RESET; in aac_cam_complete()
1182 ccb->ccb_h.status = CAM_REQ_ABORTED; in aac_cam_complete()
1188 ccb->ccb_h.status = srbr->srb_status; in aac_cam_complete()
1191 if (ccb->ccb_h.func_code == XPT_SCSI_IO) { in aac_cam_complete()
1194 ccb->csio.scsi_status = srbr->scsi_status; in aac_cam_complete()
1201 bzero(&ccb->csio.sense_data, scsi_sense_len); in aac_cam_complete()
1205 bcopy(&srbr->sense[0], &ccb->csio.sense_data, in aac_cam_complete()
1207 ccb->csio.sense_len = sense_len; in aac_cam_complete()
1208 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in aac_cam_complete()
1213 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_cam_complete()
1214 command = ccb->csio.cdb_io.cdb_ptr[0]; in aac_cam_complete()
1216 command = ccb->csio.cdb_io.cdb_bytes[0]; in aac_cam_complete()
1219 if (ccb->ccb_h.status == CAM_REQ_CMP) { in aac_cam_complete()
1220 device = ccb->csio.data_ptr[0] & 0x1f; in aac_cam_complete()
1228 ccb->csio.data_ptr[0] = in aac_cam_complete()
1232 if (ccb->csio.data_ptr[0] & 0x20) { in aac_cam_complete()
1235 ccb->csio.data_ptr[0] &= 0xdf; in aac_cam_complete()
1238 ccb->csio.data_ptr[0] |= 0x10; in aac_cam_complete()
1241 } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && in aac_cam_complete()
1242 ccb->ccb_h.target_lun != 0) { in aac_cam_complete()
1244 ccb->ccb_h.status = CAM_DEV_NOT_THERE; in aac_cam_complete()
1251 xpt_done(ccb); in aac_cam_complete()
1255 aac_cam_reset_bus(struct cam_sim *sim, union ccb *ccb) in aac_cam_reset_bus() argument
1277 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_cam_reset_bus()
1278 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_cam_reset_bus()
1287 event->ev_arg = ccb; in aac_cam_reset_bus()
1333 aac_cam_abort_ccb(struct cam_sim *sim, union ccb *ccb) in aac_cam_abort_ccb() argument
1339 aac_cam_term_io(struct cam_sim *sim, union ccb *ccb) in aac_cam_term_io() argument