Lines Matching refs:ccb

102 static void aac_cam_action(struct cam_sim *, union ccb *);
108 static void aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb,
112 static void aac_container_rw_command(struct cam_sim *, union ccb *, u_int8_t *);
113 static void aac_container_special_command(struct cam_sim *, union ccb *,
115 static void aac_passthrough_command(struct cam_sim *, union ccb *);
117 static u_int32_t aac_cam_reset_bus(struct cam_sim *, union ccb *);
118 static u_int32_t aac_cam_abort_ccb(struct cam_sim *, union ccb *);
119 static u_int32_t aac_cam_term_io(struct cam_sim *, union ccb *);
140 aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb, u_int8_t status, in aac_set_scsi_error() argument
144 (struct scsi_sense_data_fixed *)&ccb->csio.sense_data; in aac_set_scsi_error()
148 ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; in aac_set_scsi_error()
149 ccb->csio.scsi_status = status; in aac_set_scsi_error()
151 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in aac_set_scsi_error()
152 bzero(&ccb->csio.sense_data, ccb->csio.sense_len); in aac_set_scsi_error()
153 ccb->csio.sense_data.error_code = in aac_set_scsi_error()
156 if (ccb->csio.sense_len >= 14) { in aac_set_scsi_error()
167 union ccb *ccb; in aac_cam_rescan() local
180 ccb = xpt_alloc_ccb_nowait(); in aac_cam_rescan()
181 if (ccb == NULL) { in aac_cam_rescan()
187 if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, in aac_cam_rescan()
190 xpt_free_ccb(ccb); in aac_cam_rescan()
195 xpt_rescan(ccb); in aac_cam_rescan()
203 union ccb *ccb; in aac_cam_event() local
208 ccb = arg; in aac_cam_event()
209 camsc = ccb->ccb_h.sim_priv.entries[0].ptr; in aac_cam_event()
212 ccb->ccb_h.status = CAM_REQUEUE_REQ; in aac_cam_event()
213 xpt_done(ccb); in aac_cam_event()
349 aac_container_rw_command(struct cam_sim *sim, union ccb *ccb, u_int8_t *cmdp) in aac_container_rw_command() argument
365 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_container_rw_command()
366 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_container_rw_command()
375 event->ev_arg = ccb; in aac_container_rw_command()
382 switch (ccb->ccb_h.flags & CAM_DIR_MASK) { in aac_container_rw_command()
399 cm->cm_ccb = ccb; in aac_container_rw_command()
401 cm->cm_data = (void *)ccb->csio.data_ptr; in aac_container_rw_command()
402 cm->cm_datalen = ccb->csio.dxfer_len; in aac_container_rw_command()
424 raw->ldNum = ccb->ccb_h.target_id; in aac_container_rw_command()
439 raw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
451 br->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
461 bw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
475 br->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
487 bw->ContainerId = ccb->ccb_h.target_id; in aac_container_rw_command()
502 aac_container_special_command(struct cam_sim *sim, union ccb *ccb, in aac_container_special_command() argument
514 …AGS_DBG_ERROR_B, "found container %d search for %d", co->co_mntobj.ObjectId, ccb->ccb_h.target_id); in aac_container_special_command()
515 if (co->co_mntobj.ObjectId == ccb->ccb_h.target_id) in aac_container_special_command()
518 if (co == NULL || ccb->ccb_h.target_lun != 0) { in aac_container_special_command()
521 *cmdp, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
522 ccb->csio.dxfer_len); in aac_container_special_command()
523 ccb->ccb_h.status = CAM_DEV_NOT_THERE; in aac_container_special_command()
524 xpt_done(ccb); in aac_container_special_command()
528 if (ccb->csio.dxfer_len) in aac_container_special_command()
529 bzero(ccb->csio.data_ptr, ccb->csio.dxfer_len); in aac_container_special_command()
538 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
539 ccb->csio.dxfer_len, inq->byte2, inq->page_code); in aac_container_special_command()
542 (struct scsi_inquiry_data *)ccb->csio.data_ptr; in aac_container_special_command()
544 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
547 xpt_done(ccb); in aac_container_special_command()
553 if (ccb->csio.dxfer_len >= 36) { in aac_container_special_command()
567 ccb->csio.data_ptr; in aac_container_special_command()
576 ccb->csio.data_ptr; in aac_container_special_command()
581 ccb->ccb_h.target_id); in aac_container_special_command()
583 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
586 xpt_done(ccb); in aac_container_special_command()
590 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
597 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
598 ccb->csio.dxfer_len); in aac_container_special_command()
599 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
608 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
609 ccb->csio.dxfer_len); in aac_container_special_command()
619 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_container_special_command()
620 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_container_special_command()
629 event->ev_arg = ccb; in aac_container_special_command()
671 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
678 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
679 ccb->csio.dxfer_len); in aac_container_special_command()
680 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
686 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
687 ccb->csio.dxfer_len); in aac_container_special_command()
688 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
694 (struct scsi_read_capacity_data *)ccb->csio.data_ptr; in aac_container_special_command()
697 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
698 ccb->csio.dxfer_len); in aac_container_special_command()
707 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
715 ccb->csio.data_ptr; in aac_container_special_command()
718 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
719 ccb->csio.dxfer_len); in aac_container_special_command()
722 aac_set_scsi_error(sc, ccb, SCSI_STATUS_CHECK_COND, in aac_container_special_command()
724 xpt_done(ccb); in aac_container_special_command()
731 if (ccb->csio.dxfer_len >= 14) { in aac_container_special_command()
741 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
752 } *p = (struct ms6_data *)ccb->csio.data_ptr; in aac_container_special_command()
758 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
759 ccb->csio.dxfer_len, msp->page); in aac_container_special_command()
794 if (ccb->csio.dxfer_len <= p->hd.datalen + 8) { in aac_container_special_command()
795 aac_set_scsi_error(sc, ccb, in aac_container_special_command()
798 xpt_done(ccb); in aac_container_special_command()
811 aac_set_scsi_error(sc, ccb, SCSI_STATUS_CHECK_COND, in aac_container_special_command()
813 xpt_done(ccb); in aac_container_special_command()
816 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
823 ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
824 ccb->csio.dxfer_len); in aac_container_special_command()
825 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_special_command()
831 *cmdp, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, in aac_container_special_command()
832 ccb->csio.dxfer_len); in aac_container_special_command()
833 ccb->ccb_h.status = CAM_REQ_CMP; /*CAM_REQ_INVALID*/ in aac_container_special_command()
836 xpt_done(ccb); in aac_container_special_command()
840 aac_passthrough_command(struct cam_sim *sim, union ccb *ccb) in aac_passthrough_command() argument
856 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_passthrough_command()
857 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_passthrough_command()
866 event->ev_arg = ccb; in aac_passthrough_command()
873 switch (ccb->ccb_h.flags & CAM_DIR_MASK) { in aac_passthrough_command()
902 srb->cdb_len = ccb->csio.cdb_len; in aac_passthrough_command()
903 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_passthrough_command()
904 bcopy(ccb->csio.cdb_io.cdb_ptr, (u_int8_t *)&srb->cdb[0], in aac_passthrough_command()
907 bcopy(ccb->csio.cdb_io.cdb_bytes, (u_int8_t *)&srb->cdb[0], in aac_passthrough_command()
918 if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { in aac_passthrough_command()
923 cm->cm_data = (void *)ccb->csio.data_ptr; in aac_passthrough_command()
924 cm->cm_datalen = ccb->csio.dxfer_len; in aac_passthrough_command()
925 srb->data_len = ccb->csio.dxfer_len; in aac_passthrough_command()
933 srb->target = ccb->ccb_h.target_id; in aac_passthrough_command()
934 srb->lun = ccb->ccb_h.target_lun; in aac_passthrough_command()
935 srb->timeout = ccb->ccb_h.timeout; /* XXX */ in aac_passthrough_command()
940 cm->cm_ccb = ccb; in aac_passthrough_command()
957 aac_cam_action(struct cam_sim *sim, union ccb *ccb) in aac_cam_action() argument
969 switch(ccb->ccb_h.func_code) { in aac_cam_action()
979 ccg = &ccb->ccg; in aac_cam_action()
995 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
996 xpt_done(ccb); in aac_cam_action()
1001 struct ccb_pathinq *cpi = &ccb->cpi; in aac_cam_action()
1030 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1031 xpt_done(ccb); in aac_cam_action()
1038 &ccb->cts.proto_specific.scsi; in aac_cam_action()
1040 &ccb->cts.xport_specific.spi; in aac_cam_action()
1041 ccb->cts.protocol = PROTO_SCSI; in aac_cam_action()
1042 ccb->cts.protocol_version = SCSI_REV_SPC2; in aac_cam_action()
1043 ccb->cts.transport = XPORT_SAS; in aac_cam_action()
1044 ccb->cts.transport_version = 0; in aac_cam_action()
1050 ccb->cts.flags = ~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB); in aac_cam_action()
1051 ccb->cts.valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; in aac_cam_action()
1053 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1054 xpt_done(ccb); in aac_cam_action()
1058 ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; in aac_cam_action()
1059 xpt_done(ccb); in aac_cam_action()
1064 ccb->ccb_h.status = aac_cam_reset_bus(sim, ccb); in aac_cam_action()
1066 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1068 xpt_done(ccb); in aac_cam_action()
1071 ccb->ccb_h.status = CAM_REQ_CMP; in aac_cam_action()
1072 xpt_done(ccb); in aac_cam_action()
1075 ccb->ccb_h.status = aac_cam_abort_ccb(sim, ccb); in aac_cam_action()
1076 xpt_done(ccb); in aac_cam_action()
1079 ccb->ccb_h.status = aac_cam_term_io(sim, ccb); in aac_cam_action()
1080 xpt_done(ccb); in aac_cam_action()
1084 ccb->ccb_h.func_code); in aac_cam_action()
1085 ccb->ccb_h.status = CAM_PROVIDE_FAIL; in aac_cam_action()
1086 xpt_done(ccb); in aac_cam_action()
1094 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_cam_action()
1095 cmdp = ccb->csio.cdb_io.cdb_ptr; in aac_cam_action()
1097 cmdp = &ccb->csio.cdb_io.cdb_bytes[0]; in aac_cam_action()
1102 aac_container_rw_command(sim, ccb, cmdp); in aac_cam_action()
1104 aac_container_special_command(sim, ccb, cmdp); in aac_cam_action()
1106 aac_passthrough_command(sim, ccb); in aac_cam_action()
1122 union ccb *ccb; in aac_container_complete() local
1126 ccb = cm->cm_ccb; in aac_container_complete()
1130 ccb->ccb_h.status = CAM_SCSI_BUS_RESET; in aac_container_complete()
1132 ccb->ccb_h.status = CAM_REQ_CMP; in aac_container_complete()
1134 ccb->ccb_h.status = CAM_BUSY; in aac_container_complete()
1136 ccb->ccb_h.status = CAM_REQ_CMP_ERR; in aac_container_complete()
1140 xpt_done(ccb); in aac_container_complete()
1146 union ccb *ccb; in aac_cam_complete() local
1152 ccb = cm->cm_ccb; in aac_cam_complete()
1164 ccb->ccb_h.status = CAM_SCSI_BUS_RESET; in aac_cam_complete()
1167 ccb->ccb_h.status = CAM_REQ_ABORTED; in aac_cam_complete()
1173 ccb->ccb_h.status = srbr->srb_status; in aac_cam_complete()
1176 if (ccb->ccb_h.func_code == XPT_SCSI_IO) { in aac_cam_complete()
1179 ccb->csio.scsi_status = srbr->scsi_status; in aac_cam_complete()
1186 bzero(&ccb->csio.sense_data, scsi_sense_len); in aac_cam_complete()
1190 bcopy(&srbr->sense[0], &ccb->csio.sense_data, in aac_cam_complete()
1192 ccb->csio.sense_len = sense_len; in aac_cam_complete()
1193 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in aac_cam_complete()
1198 if (ccb->ccb_h.flags & CAM_CDB_POINTER) in aac_cam_complete()
1199 command = ccb->csio.cdb_io.cdb_ptr[0]; in aac_cam_complete()
1201 command = ccb->csio.cdb_io.cdb_bytes[0]; in aac_cam_complete()
1205 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == in aac_cam_complete()
1207 ccb->ccb_h.status = (ccb->ccb_h.status & in aac_cam_complete()
1210 if (ccb->ccb_h.status == CAM_REQ_CMP) { in aac_cam_complete()
1211 device = ccb->csio.data_ptr[0] & 0x1f; in aac_cam_complete()
1219 ccb->csio.data_ptr[0] = in aac_cam_complete()
1223 if (ccb->csio.data_ptr[0] & 0x20) { in aac_cam_complete()
1226 ccb->csio.data_ptr[0] &= 0xdf; in aac_cam_complete()
1229 ccb->csio.data_ptr[0] |= 0x10; in aac_cam_complete()
1232 } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && in aac_cam_complete()
1233 ccb->ccb_h.target_lun != 0) { in aac_cam_complete()
1235 ccb->ccb_h.status = CAM_DEV_NOT_THERE; in aac_cam_complete()
1242 xpt_done(ccb); in aac_cam_complete()
1246 aac_cam_reset_bus(struct cam_sim *sim, union ccb *ccb) in aac_cam_reset_bus() argument
1268 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; in aac_cam_reset_bus()
1269 ccb->ccb_h.sim_priv.entries[0].ptr = camsc; in aac_cam_reset_bus()
1278 event->ev_arg = ccb; in aac_cam_reset_bus()
1325 aac_cam_abort_ccb(struct cam_sim *sim, union ccb *ccb) in aac_cam_abort_ccb() argument
1331 aac_cam_term_io(struct cam_sim *sim, union ccb *ccb) in aac_cam_term_io() argument