Lines Matching refs:ccb
104 static void aac_cam_action(struct cam_sim *, union ccb *);
110 static void aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb,
114 static void aac_container_rw_command(struct cam_sim *, union ccb *, u_int8_t *);
115 static void aac_container_special_command(struct cam_sim *, union ccb *,
117 static void aac_passthrough_command(struct cam_sim *, union ccb *);
119 static u_int32_t aac_cam_reset_bus(struct cam_sim *, union ccb *);
120 static u_int32_t aac_cam_abort_ccb(struct cam_sim *, union ccb *);
121 static u_int32_t aac_cam_term_io(struct cam_sim *, union ccb *);
144 aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb, u_int8_t status, in aac_set_scsi_error() argument
148 (struct scsi_sense_data_fixed *)&ccb->csio.sense_data; in aac_set_scsi_error()
152 ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; in aac_set_scsi_error()
153 ccb->csio.scsi_status = status; in aac_set_scsi_error()
155 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in aac_set_scsi_error()
156 bzero(&ccb->csio.sense_data, ccb->csio.sense_len); in aac_set_scsi_error()
157 ccb->csio.sense_data.error_code = in aac_set_scsi_error()
160 if (ccb->csio.sense_len >= 14) { in aac_set_scsi_error()
171 union ccb *ccb; in aac_cam_rescan() local
184 ccb = xpt_alloc_ccb_nowait(); in aac_cam_rescan()
185 if (ccb == NULL) { in aac_cam_rescan()
191 if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, in aac_cam_rescan()
194 xpt_free_ccb(ccb); in aac_cam_rescan()
199 xpt_rescan(ccb); in aac_cam_rescan()
207 union ccb *ccb; in aac_cam_event() local
212 ccb = arg; in aac_cam_event()
213 camsc = ccb->ccb_h.sim_priv.entries[0].ptr; in aac_cam_event()
216 ccb->ccb_h.status = CAM_REQUEUE_REQ; in aac_cam_event()
217 xpt_done(ccb); in aac_cam_event()
353 aac_container_rw_command(struct cam_sim *sim, union ccb *ccb, u_int8_t *cmdp) in aac_container_rw_command() argument
369 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_container_rw_command()
370 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_container_rw_command()
379 event->ev_arg = ccb; in aac_container_rw_command()
386 switch (ccb->ccb_h.flags & CAM_DIR_MASK) { in aac_container_rw_command()
403 cm->cm_ccb = ccb; in aac_container_rw_command()
405 cm->cm_data = (void *)ccb->csio.data_ptr; in aac_container_rw_command()
406 cm->cm_datalen = ccb->csio.dxfer_len; in aac_container_rw_command()
428 raw->ldNum = ccb->ccb_h.target_id; in aac_container_rw_command()
443 raw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
455 br->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
465 bw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
479 br->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
491 bw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
506 aac_container_special_command(struct cam_sim *sim, union ccb *ccb, in aac_container_special_command() argument
518 …AGS_DBG_ERROR_B, "found container %d search for %d", co->co_mntobj.ObjectId, ccb->ccb_h.target_id); in aac_container_special_command()
519 if (co->co_mntobj.ObjectId == ccb->ccb_h.target_id) in aac_container_special_command()
522 if (co == NULL || ccb->ccb_h.target_lun != 0) { in aac_container_special_command()
525 *cmdp, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
526 ccb->csio.dxfer_len); in aac_container_special_command()
527 ccb->ccb_h.status = CAM_DEV_NOT_THERE; in aac_container_special_command()
528 xpt_done(ccb); in aac_container_special_command()
532 if (ccb->csio.dxfer_len) in aac_container_special_command()
533 bzero(ccb->csio.data_ptr, ccb->csio.dxfer_len); in aac_container_special_command()
542 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
543 ccb->csio.dxfer_len, inq->byte2, inq->page_code); in aac_container_special_command()
546 (struct scsi_inquiry_data *)ccb->csio.data_ptr; in aac_container_special_command()
548 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
551 xpt_done(ccb); in aac_container_special_command()
557 if (ccb->csio.dxfer_len >= 36) { in aac_container_special_command()
571 ccb->csio.data_ptr; in aac_container_special_command()
580 ccb->csio.data_ptr; in aac_container_special_command()
585 ccb->ccb_h.target_id); in aac_container_special_command()
587 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
590 xpt_done(ccb); in aac_container_special_command()
594 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
601 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
602 ccb->csio.dxfer_len); in aac_container_special_command()
603 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
612 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
613 ccb->csio.dxfer_len); in aac_container_special_command()
623 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_container_special_command()
624 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_container_special_command()
633 event->ev_arg = ccb; in aac_container_special_command()
675 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
682 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
683 ccb->csio.dxfer_len); in aac_container_special_command()
684 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
690 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
691 ccb->csio.dxfer_len); in aac_container_special_command()
692 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
698 (struct scsi_read_capacity_data *)ccb->csio.data_ptr; 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()
711 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
719 ccb->csio.data_ptr; in aac_container_special_command()
722 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
723 ccb->csio.dxfer_len); in aac_container_special_command()
726 aac_set_scsi_error(sc, ccb, SCSI_STATUS_CHECK_COND, in aac_container_special_command()
728 xpt_done(ccb); in aac_container_special_command()
735 if (ccb->csio.dxfer_len >= 14) { in aac_container_special_command()
745 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
756 } *p = (struct ms6_data *)ccb->csio.data_ptr; in aac_container_special_command()
762 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
763 ccb->csio.dxfer_len, msp->page); in aac_container_special_command()
798 if (ccb->csio.dxfer_len <= p->hd.datalen + 8) { in aac_container_special_command()
799 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
802 xpt_done(ccb); in aac_container_special_command()
815 aac_set_scsi_error(sc, ccb, SCSI_STATUS_CHECK_COND, in aac_container_special_command()
817 xpt_done(ccb); in aac_container_special_command()
820 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
827 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
828 ccb->csio.dxfer_len); in aac_container_special_command()
829 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
835 *cmdp, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
836 ccb->csio.dxfer_len); in aac_container_special_command()
837 ccb->ccb_h.status = CAM_REQ_CMP; /*CAM_REQ_INVALID*/ in aac_container_special_command()
840 xpt_done(ccb); in aac_container_special_command()
844 aac_passthrough_command(struct cam_sim *sim, union ccb *ccb) in aac_passthrough_command() argument
860 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_passthrough_command()
861 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_passthrough_command()
870 event->ev_arg = ccb; in aac_passthrough_command()
877 switch (ccb->ccb_h.flags & CAM_DIR_MASK) { in aac_passthrough_command()
906 srb->cdb_len = ccb->csio.cdb_len; in aac_passthrough_command()
907 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_passthrough_command()
908 bcopy(ccb->csio.cdb_io.cdb_ptr, (u_int8_t *)&srb->cdb[0], in aac_passthrough_command()
911 bcopy(ccb->csio.cdb_io.cdb_bytes, (u_int8_t *)&srb->cdb[0], in aac_passthrough_command()
922 if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { in aac_passthrough_command()
927 cm->cm_data = (void *)ccb->csio.data_ptr; in aac_passthrough_command()
928 cm->cm_datalen = ccb->csio.dxfer_len; in aac_passthrough_command()
929 srb->data_len = ccb->csio.dxfer_len; in aac_passthrough_command()
937 srb->target = ccb->ccb_h.target_id; in aac_passthrough_command()
938 srb->lun = ccb->ccb_h.target_lun; in aac_passthrough_command()
939 srb->timeout = ccb->ccb_h.timeout; /* XXX */ in aac_passthrough_command()
944 cm->cm_ccb = ccb; in aac_passthrough_command()
961 aac_cam_action(struct cam_sim *sim, union ccb *ccb) in aac_cam_action() argument
973 switch(ccb->ccb_h.func_code) { in aac_cam_action()
983 ccg = &ccb->ccg; in aac_cam_action()
999 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1000 xpt_done(ccb); in aac_cam_action()
1005 struct ccb_pathinq *cpi = &ccb->cpi; in aac_cam_action()
1034 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1035 xpt_done(ccb); in aac_cam_action()
1042 &ccb->cts.proto_specific.scsi; in aac_cam_action()
1044 &ccb->cts.xport_specific.spi; in aac_cam_action()
1045 ccb->cts.protocol = PROTO_SCSI; in aac_cam_action()
1046 ccb->cts.protocol_version = SCSI_REV_SPC2; in aac_cam_action()
1047 ccb->cts.transport = XPORT_SAS; in aac_cam_action()
1048 ccb->cts.transport_version = 0; in aac_cam_action()
1054 ccb->cts.flags = ~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB); in aac_cam_action()
1055 ccb->cts.valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; in aac_cam_action()
1057 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1058 xpt_done(ccb); in aac_cam_action()
1062 ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; in aac_cam_action()
1063 xpt_done(ccb); in aac_cam_action()
1068 ccb->ccb_h.status = aac_cam_reset_bus(sim, ccb); in aac_cam_action()
1070 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1072 xpt_done(ccb); in aac_cam_action()
1075 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1076 xpt_done(ccb); in aac_cam_action()
1079 ccb->ccb_h.status = aac_cam_abort_ccb(sim, ccb); in aac_cam_action()
1080 xpt_done(ccb); in aac_cam_action()
1083 ccb->ccb_h.status = aac_cam_term_io(sim, ccb); in aac_cam_action()
1084 xpt_done(ccb); in aac_cam_action()
1088 ccb->ccb_h.func_code); in aac_cam_action()
1089 ccb->ccb_h.status = CAM_PROVIDE_FAIL; in aac_cam_action()
1090 xpt_done(ccb); in aac_cam_action()
1098 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_cam_action()
1099 cmdp = ccb->csio.cdb_io.cdb_ptr; in aac_cam_action()
1101 cmdp = &ccb->csio.cdb_io.cdb_bytes[0]; in aac_cam_action()
1106 aac_container_rw_command(sim, ccb, cmdp); in aac_cam_action()
1108 aac_container_special_command(sim, ccb, cmdp); in aac_cam_action()
1110 aac_passthrough_command(sim, ccb); in aac_cam_action()
1126 union ccb *ccb; in aac_container_complete() local
1130 ccb = cm->cm_ccb; in aac_container_complete()
1134 ccb->ccb_h.status = CAM_SCSI_BUS_RESET; in aac_container_complete()
1136 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_complete()
1138 ccb->ccb_h.status = CAM_BUSY; in aac_container_complete()
1140 ccb->ccb_h.status = CAM_REQ_CMP_ERR; in aac_container_complete()
1144 xpt_done(ccb); in aac_container_complete()
1150 union ccb *ccb; in aac_cam_complete() local
1156 ccb = cm->cm_ccb; in aac_cam_complete()
1168 ccb->ccb_h.status = CAM_SCSI_BUS_RESET; in aac_cam_complete()
1171 ccb->ccb_h.status = CAM_REQ_ABORTED; in aac_cam_complete()
1177 ccb->ccb_h.status = srbr->srb_status; in aac_cam_complete()
1180 if (ccb->ccb_h.func_code == XPT_SCSI_IO) { in aac_cam_complete()
1183 ccb->csio.scsi_status = srbr->scsi_status; in aac_cam_complete()
1190 bzero(&ccb->csio.sense_data, scsi_sense_len); in aac_cam_complete()
1194 bcopy(&srbr->sense[0], &ccb->csio.sense_data, in aac_cam_complete()
1196 ccb->csio.sense_len = sense_len; in aac_cam_complete()
1197 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in aac_cam_complete()
1202 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_cam_complete()
1203 command = ccb->csio.cdb_io.cdb_ptr[0]; in aac_cam_complete()
1205 command = ccb->csio.cdb_io.cdb_bytes[0]; in aac_cam_complete()
1208 if (ccb->ccb_h.status == CAM_REQ_CMP) { in aac_cam_complete()
1209 device = ccb->csio.data_ptr[0] & 0x1f; in aac_cam_complete()
1217 ccb->csio.data_ptr[0] = in aac_cam_complete()
1221 if (ccb->csio.data_ptr[0] & 0x20) { in aac_cam_complete()
1224 ccb->csio.data_ptr[0] &= 0xdf; in aac_cam_complete()
1227 ccb->csio.data_ptr[0] |= 0x10; in aac_cam_complete()
1230 } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && in aac_cam_complete()
1231 ccb->ccb_h.target_lun != 0) { in aac_cam_complete()
1233 ccb->ccb_h.status = CAM_DEV_NOT_THERE; in aac_cam_complete()
1240 xpt_done(ccb); in aac_cam_complete()
1244 aac_cam_reset_bus(struct cam_sim *sim, union ccb *ccb) in aac_cam_reset_bus() argument
1266 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_cam_reset_bus()
1267 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_cam_reset_bus()
1276 event->ev_arg = ccb; in aac_cam_reset_bus()
1323 aac_cam_abort_ccb(struct cam_sim *sim, union ccb *ccb) in aac_cam_abort_ccb() argument
1329 aac_cam_term_io(struct cam_sim *sim, union ccb *ccb) in aac_cam_term_io() argument