Lines Matching refs:ccb

70 					union ccb *done_ccb);
72 static int camperiphscsistatuserror(union ccb *ccb,
73 union ccb **orig_ccb,
81 static int camperiphscsisenseerror(union ccb *ccb,
82 union ccb **orig_ccb,
90 static void cam_periph_devctl_notify(union ccb *ccb);
732 union ccb ccb;
737 ccb.ccb_h.func_code = XPT_GDEV_TYPE;
738 xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
739 xpt_action(&ccb);
740 arg = &ccb;
743 xpt_path_inq(&ccb.cpi, periph->path);
744 arg = &ccb;
766 cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo,
780 switch(ccb->ccb_h.func_code) {
782 if (ccb->cdm.match_buf_len == 0) {
787 if (ccb->cdm.pattern_buf_len > 0) {
788 data_ptrs[0] = (u_int8_t **)&ccb->cdm.patterns;
789 lengths[0] = ccb->cdm.pattern_buf_len;
791 data_ptrs[1] = (u_int8_t **)&ccb->cdm.matches;
792 lengths[1] = ccb->cdm.match_buf_len;
796 data_ptrs[0] = (u_int8_t **)&ccb->cdm.matches;
797 lengths[0] = ccb->cdm.match_buf_len;
809 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE)
811 if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR)
813 data_ptrs[0] = &ccb->csio.data_ptr;
814 lengths[0] = ccb->csio.dxfer_len;
815 dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK;
819 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE)
821 if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR)
823 data_ptrs[0] = &ccb->ataio.data_ptr;
824 lengths[0] = ccb->ataio.dxfer_len;
825 dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK;
829 data_ptrs[0] = &ccb->smpio.smp_request;
830 lengths[0] = ccb->smpio.smp_request_len;
832 data_ptrs[1] = &ccb->smpio.smp_response;
833 lengths[1] = ccb->smpio.smp_response_len;
839 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE)
841 if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR)
843 data_ptrs[0] = &ccb->nvmeio.data_ptr;
844 lengths[0] = ccb->nvmeio.dxfer_len;
845 dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK;
849 if (ccb->cdai.bufsiz == 0)
852 data_ptrs[0] = (uint8_t **)&ccb->cdai.buf;
853 lengths[0] = ccb->cdai.bufsiz;
985 cam_periph_unmapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo)
997 switch (ccb->ccb_h.func_code) {
999 if (ccb->cdm.pattern_buf_len > 0) {
1000 data_ptrs[0] = (u_int8_t **)&ccb->cdm.patterns;
1001 lengths[0] = ccb->cdm.pattern_buf_len;
1003 data_ptrs[1] = (u_int8_t **)&ccb->cdm.matches;
1004 lengths[1] = ccb->cdm.match_buf_len;
1008 data_ptrs[0] = (u_int8_t **)&ccb->cdm.matches;
1009 lengths[0] = ccb->cdm.match_buf_len;
1016 data_ptrs[0] = &ccb->csio.data_ptr;
1017 lengths[0] = ccb->csio.dxfer_len;
1018 dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK;
1022 data_ptrs[0] = &ccb->ataio.data_ptr;
1023 lengths[0] = ccb->ataio.dxfer_len;
1024 dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK;
1028 data_ptrs[0] = &ccb->smpio.smp_request;
1029 lengths[0] = ccb->smpio.smp_request_len;
1031 data_ptrs[1] = &ccb->smpio.smp_response;
1032 lengths[1] = ccb->smpio.smp_response_len;
1038 data_ptrs[0] = &ccb->nvmeio.data_ptr;
1039 lengths[0] = ccb->nvmeio.dxfer_len;
1040 dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK;
1044 data_ptrs[0] = (uint8_t **)&ccb->cdai.buf;
1045 lengths[0] = ccb->cdai.bufsiz;
1081 int (*error_routine)(union ccb *ccb,
1085 union ccb *ccb;
1093 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
1094 xpt_setup_ccb(&ccb->ccb_h,
1095 ccb->ccb_h.path,
1097 ccb->ccb_h.func_code = XPT_GDEVLIST;
1107 ccb->cgdl.index = 0;
1108 ccb->cgdl.status = CAM_GDEVLIST_MORE_DEVS;
1109 while (ccb->cgdl.status == CAM_GDEVLIST_MORE_DEVS) {
1112 xpt_action(ccb);
1113 if (strncmp(ccb->cgdl.periph_name,
1119 if ((ccb->cgdl.status == CAM_GDEVLIST_LAST_DEVICE) &&
1121 ccb->cgdl.periph_name[0] = '\0';
1122 ccb->cgdl.unit_number = 0;
1128 bcopy(ccb, addr, sizeof(union ccb));
1130 /* and release the ccb */
1131 xpt_release_ccb(ccb);
1142 cam_periph_done_panic(struct cam_periph *periph, union ccb *done_ccb)
1145 panic("%s: already done with ccb %p", __func__, done_ccb);
1149 cam_periph_done(struct cam_periph *periph, union ccb *done_ccb)
1159 cam_periph_ccbwait(union ccb *ccb)
1162 if ((ccb->ccb_h.func_code & XPT_FC_QUEUED) != 0) {
1163 while (ccb->ccb_h.cbfcnp != cam_periph_done_panic)
1164 xpt_path_sleep(ccb->ccb_h.path, &ccb->ccb_h.cbfcnp,
1167 KASSERT(ccb->ccb_h.pinfo.index == CAM_UNQUEUED_INDEX &&
1168 (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG,
1169 ("%s: proceeding with incomplete ccb: ccb=%p, func_code=%#x, "
1170 "status=%#x, index=%d", __func__, ccb, ccb->ccb_h.func_code,
1171 ccb->ccb_h.status, ccb->ccb_h.pinfo.index));
1175 cam_periph_runccb(union ccb *ccb,
1176 int (*error_routine)(union ccb *ccb,
1187 xpt_path_assert(ccb->ccb_h.path, MA_OWNED);
1188 KASSERT((ccb->ccb_h.flags & CAM_UNLOCKED) == 0,
1189 ("%s: ccb=%p, func_code=%#x, flags=%#x", __func__, ccb,
1190 ccb->ccb_h.func_code, ccb->ccb_h.flags));
1194 * this particular type of ccb, record the transaction start.
1196 if ((ds != NULL) && (ccb->ccb_h.func_code == XPT_SCSI_IO ||
1197 ccb->ccb_h.func_code == XPT_ATA_IO)) {
1203 ccb->ccb_h.cbfcnp = cam_periph_done;
1204 xpt_action(ccb);
1207 cam_periph_ccbwait(ccb);
1208 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
1211 ccb->ccb_h.cbfcnp = cam_periph_done;
1212 error = (*error_routine)(ccb, camflags, sense_flags);
1218 if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
1219 cam_release_devq(ccb->ccb_h.path,
1224 ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
1228 if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
1230 ccb->csio.dxfer_len - ccb->csio.resid,
1231 ccb->csio.tag_action & 0x3,
1232 ((ccb->ccb_h.flags & CAM_DIR_MASK) ==
1234 (ccb->ccb_h.flags & CAM_DIR_OUT) ?
1237 } else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
1239 ccb->ataio.dxfer_len - ccb->ataio.resid,
1241 ((ccb->ccb_h.flags & CAM_DIR_MASK) ==
1243 (ccb->ccb_h.flags & CAM_DIR_OUT) ?
1261 xpt_action((union ccb *)&ccb_h);
1279 xpt_action((union ccb *)&crs);
1285 camperiphdone(struct cam_periph *periph, union ccb *done_ccb)
1287 union ccb *saved_ccb;
1359 saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr;
1398 xpt_action((union ccb *)&cgds);
1432 camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb,
1440 switch (ccb->csio.scsi_status) {
1449 error = camperiphscsisenseerror(ccb, orig_ccb,
1468 ccb->ccb_h.path,
1471 xpt_action((union ccb *)&cgds);
1520 periph = xpt_path_periph(ccb->ccb_h.path);
1525 ccb->ccb_h.retry_count > 0) {
1527 ccb->ccb_h.retry_count--;
1546 camperiphscsisenseerror(union ccb *ccb, union ccb **orig,
1552 union ccb *orig_ccb = ccb;
1555 periph = xpt_path_periph(ccb->ccb_h.path);
1556 recoveryccb = (ccb->ccb_h.cbfcnp == camperiphdone);
1580 xpt_setup_ccb(&cgd.ccb_h, ccb->ccb_h.path, CAM_PRIORITY_NORMAL);
1582 xpt_action((union ccb *)&cgd);
1584 err_action = scsi_error_action(&ccb->csio, &cgd.inq_data,
1604 ccb->csio.cdb_io.cdb_bytes[0] == START_STOP_UNIT) ||
1606 (ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY))) {
1618 if (ccb->ccb_h.retry_count > 0 &&
1620 ccb->ccb_h.retry_count--;
1641 ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
1642 bcopy(ccb, orig_ccb, sizeof(*orig_ccb));
1677 scsi_start_stop(&ccb->csio,
1710 scsi_test_unit_ready(&ccb->csio,
1738 ccb->ccb_h.pinfo.priority--;
1739 ccb->ccb_h.flags |= CAM_DEV_QFREEZE;
1740 ccb->ccb_h.saved_ccb_ptr = orig_ccb;
1757 cam_periph_error(union ccb *ccb, cam_flags camflags,
1758 u_int32_t sense_flags, union ccb *save_ccb)
1761 union ccb *orig_ccb, *scan_ccb;
1769 periph = xpt_path_periph(ccb->ccb_h.path);
1771 status = ccb->ccb_h.status;
1775 orig_ccb = ccb;
1778 switch (ccb->ccb_h.status & CAM_STATUS_MASK) {
1800 error = camperiphscsistatuserror(ccb, &orig_ccb,
1815 if (ccb->ccb_h.retry_count > 0 &&
1817 ccb->ccb_h.retry_count--;
1889 } else if (ccb->ccb_h.retry_count == 0) {
1896 ccb->ccb_h.retry_count--;
1903 CAM_DEBUGGED(ccb->ccb_h.path, CAM_DEBUG_INFO))
1913 xpt_print(ccb->ccb_h.path, "Error %d, %s\n",
1916 xpt_print(ccb->ccb_h.path, "%s\n", action_string);
1918 xpt_print(ccb->ccb_h.path, "Retrying command\n");
1936 lun_id = xpt_path_lun_id(ccb->ccb_h.path);
1940 xpt_path_path_id(ccb->ccb_h.path),
1941 xpt_path_target_id(ccb->ccb_h.path),
1960 xpt_path_path_id(ccb->ccb_h.path),
1961 xpt_path_target_id(ccb->ccb_h.path),
1981 ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
1983 xpt_action(ccb);
1985 cam_release_devq(ccb->ccb_h.path,
1998 cam_periph_devctl_notify(union ccb *ccb)
2012 periph = xpt_path_periph(ccb->ccb_h.path);
2018 xpt_setup_ccb(&cgd->ccb_h, ccb->ccb_h.path,
2021 xpt_action((union ccb *)cgd);
2025 xpt_free_ccb((union ccb *)cgd);
2028 sbuf_printf(&sb, "cam_status=\"0x%x\" ", ccb->ccb_h.status);
2030 switch (ccb->ccb_h.status & CAM_STATUS_MASK) {
2032 sbuf_printf(&sb, "timeout=%d ", ccb->ccb_h.timeout);
2036 sbuf_printf(&sb, "scsi_status=%d ", ccb->csio.scsi_status);
2037 if (scsi_extract_sense_ccb(ccb, &serr, &sk, &asc, &ascq))
2044 ata_res_sbuf(&ccb->ataio.res, &sb);
2053 if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
2055 scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb);
2057 } else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
2059 ata_cmd_sbuf(&ccb->ataio.cmd, &sb);