Lines Matching +full:pll +full:- +full:periph
1 /*-
2 * SPDX-License-Identifier: (BSD-2-Clause AND BSD-4-Clause)
30 /*-
185 static void chdone(struct cam_periph *periph,
189 static int chmove(struct cam_periph *periph,
191 static int chexchange(struct cam_periph *periph,
193 static int chposition(struct cam_periph *periph,
195 static int chgetelemstatus(struct cam_periph *periph,
198 static int chsetvoltag(struct cam_periph *periph,
200 static int chielem(struct cam_periph *periph,
202 static int chgetparams(struct cam_periph *periph);
203 static int chscsiversion(struct cam_periph *periph);
245 struct cam_periph *periph; in chdevgonecb() local
249 periph = (struct cam_periph *)arg; in chdevgonecb()
250 mtx = cam_periph_mtx(periph); in chdevgonecb()
253 softc = (struct ch_softc *)periph->softc; in chdevgonecb()
254 KASSERT(softc->open_count >= 0, ("Negative open count %d", in chdevgonecb()
255 softc->open_count)); in chdevgonecb()
262 for (i = 0; i < softc->open_count; i++) in chdevgonecb()
263 cam_periph_release_locked(periph); in chdevgonecb()
265 softc->open_count = 0; in chdevgonecb()
270 cam_periph_release_locked(periph); in chdevgonecb()
275 * cam_periph_release_locked() above could result in the periph in chdevgonecb()
276 * getting freed. If that is the case, dereferencing the periph in chdevgonecb()
283 choninvalidate(struct cam_periph *periph) in choninvalidate() argument
287 softc = (struct ch_softc *)periph->softc; in choninvalidate()
290 * De-register any async callbacks. in choninvalidate()
292 xpt_register_async(0, chasync, periph, periph->path); in choninvalidate()
294 softc->flags |= CH_FLAG_INVALID; in choninvalidate()
300 destroy_dev_sched_cb(softc->dev, chdevgonecb, periph); in choninvalidate()
304 chcleanup(struct cam_periph *periph) in chcleanup() argument
308 softc = (struct ch_softc *)periph->softc; in chcleanup()
310 devstat_remove_entry(softc->device_stats); in chcleanup()
318 struct cam_periph *periph; in chasync() local
320 periph = (struct cam_periph *)callback_arg; in chasync()
332 if (cgd->protocol != PROTO_SCSI) in chasync()
334 if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED) in chasync()
336 if (SID_TYPE(&cgd->inq_data)!= T_CHANGER) in chasync()
357 cam_periph_async(periph, code, path, arg); in chasync()
363 chregister(struct cam_periph *periph, void *arg) in chregister() argument
386 softc->state = CH_STATE_PROBE; in chregister()
387 periph->softc = softc; in chregister()
388 softc->quirks = CH_Q_NONE; in chregister()
392 * spec. If this device claims SCSI-2 or earlier support, then it in chregister()
395 if (cgd->inq_data.version <= SCSI_REV_2) in chregister()
396 softc->quirks |= CH_Q_NO_DVCID; in chregister()
398 xpt_path_inq(&cpi, periph->path); in chregister()
404 cam_periph_unlock(periph); in chregister()
405 softc->device_stats = devstat_new_entry("ch", in chregister()
406 periph->unit_number, 0, in chregister()
408 SID_TYPE(&cgd->inq_data) | in chregister()
413 * Acquire a reference to the periph before we create the devfs in chregister()
417 if (cam_periph_acquire(periph) != 0) { in chregister()
418 xpt_print(periph->path, "%s: lost periph during " in chregister()
420 cam_periph_lock(periph); in chregister()
427 args.mda_unit = periph->unit_number; in chregister()
431 args.mda_si_drv1 = periph; in chregister()
432 error = make_dev_s(&args, &softc->dev, "%s%d", periph->periph_name, in chregister()
433 periph->unit_number); in chregister()
434 cam_periph_lock(periph); in chregister()
436 cam_periph_release_locked(periph); in chregister()
444 xpt_register_async(AC_LOST_DEVICE, chasync, periph, periph->path); in chregister()
447 * Lock this periph until we are setup. in chregister()
450 (void)cam_periph_hold(periph, PRIBIO); in chregister()
451 xpt_schedule(periph, CAM_PRIORITY_DEV); in chregister()
459 struct cam_periph *periph; in chopen() local
463 periph = (struct cam_periph *)dev->si_drv1; in chopen()
464 if (cam_periph_acquire(periph) != 0) in chopen()
467 softc = (struct ch_softc *)periph->softc; in chopen()
469 cam_periph_lock(periph); in chopen()
471 if (softc->flags & CH_FLAG_INVALID) { in chopen()
472 cam_periph_release_locked(periph); in chopen()
473 cam_periph_unlock(periph); in chopen()
477 if ((error = cam_periph_hold(periph, PRIBIO | PCATCH)) != 0) { in chopen()
478 cam_periph_unlock(periph); in chopen()
479 cam_periph_release(periph); in chopen()
486 if ((error = chgetparams(periph)) != 0) { in chopen()
487 cam_periph_unhold(periph); in chopen()
488 cam_periph_release_locked(periph); in chopen()
489 cam_periph_unlock(periph); in chopen()
493 cam_periph_unhold(periph); in chopen()
495 softc->open_count++; in chopen()
497 cam_periph_unlock(periph); in chopen()
505 struct cam_periph *periph; in chclose() local
509 periph = (struct cam_periph *)dev->si_drv1; in chclose()
510 mtx = cam_periph_mtx(periph); in chclose()
513 softc = (struct ch_softc *)periph->softc; in chclose()
514 softc->open_count--; in chclose()
516 cam_periph_release_locked(periph); in chclose()
521 * cam_periph_release_locked() above could result in the periph in chclose()
522 * getting freed. If that is the case, dereferencing the periph in chclose()
536 chstart(struct cam_periph *periph, union ccb *start_ccb) in chstart() argument
540 softc = (struct ch_softc *)periph->softc; in chstart()
542 switch (softc->state) { in chstart()
572 scsi_mode_sense(&start_ccb->csio, in chstart()
576 /* dbd */ (softc->quirks & CH_Q_NO_DBD) ? in chstart()
585 start_ccb->ccb_h.ccb_bp = NULL; in chstart()
586 start_ccb->ccb_h.ccb_state = CH_CCB_PROBE; in chstart()
594 chdone(struct cam_periph *periph, union ccb *done_ccb) in chdone() argument
599 softc = (struct ch_softc *)periph->softc; in chdone()
600 csio = &done_ccb->csio; in chdone()
602 switch(done_ccb->ccb_h.ccb_state) { in chdone()
609 mode_header = (struct scsi_mode_header_6 *)csio->data_ptr; in chdone()
614 if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP){ in chdone()
616 softc->sc_firsts[CHET_MT] = scsi_2btoul(ea->mtea); in chdone()
617 softc->sc_counts[CHET_MT] = scsi_2btoul(ea->nmte); in chdone()
618 softc->sc_firsts[CHET_ST] = scsi_2btoul(ea->fsea); in chdone()
619 softc->sc_counts[CHET_ST] = scsi_2btoul(ea->nse); in chdone()
620 softc->sc_firsts[CHET_IE] = scsi_2btoul(ea->fieea); in chdone()
621 softc->sc_counts[CHET_IE] = scsi_2btoul(ea->niee); in chdone()
622 softc->sc_firsts[CHET_DT] = scsi_2btoul(ea->fdtea); in chdone()
623 softc->sc_counts[CHET_DT] = scsi_2btoul(ea->ndte); in chdone()
624 softc->sc_picker = softc->sc_firsts[CHET_MT]; in chdone()
630 softc->sc_counts[CHET_ST], in chdone()
631 PLURAL(softc->sc_counts[CHET_ST]), in chdone()
632 softc->sc_counts[CHET_DT], in chdone()
633 PLURAL(softc->sc_counts[CHET_DT]), in chdone()
634 softc->sc_counts[CHET_MT], in chdone()
635 PLURAL(softc->sc_counts[CHET_MT]), in chdone()
636 softc->sc_counts[CHET_IE], in chdone()
637 PLURAL(softc->sc_counts[CHET_IE])); in chdone()
640 xpt_announce_periph(periph, announce_buf); in chdone()
641 xpt_announce_quirks(periph, softc->quirks, in chdone()
664 done_ccb->csio.cdb_io.cdb_bytes; in chdone()
665 frozen = (done_ccb->ccb_h.status & in chdone()
675 * them and re-send the command. in chdone()
677 if ((sms->byte2 & SMS_DBD) != 0 && in chdone()
678 (periph->flags & CAM_PERIPH_INVALID) == 0) { in chdone()
679 sms->byte2 &= ~SMS_DBD; in chdone()
681 softc->quirks |= CH_Q_NO_DBD; in chdone()
688 cam_release_devq(done_ccb->ccb_h.path, in chdone()
697 if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) in chdone()
699 scsi_sense_print(&done_ccb->csio); in chdone()
701 xpt_print(periph->path, in chdone()
703 done_ccb->ccb_h.status); in chdone()
705 xpt_print(periph->path, "fatal error, failed " in chdone()
708 cam_periph_invalidate(periph); in chdone()
711 softc->state = CH_STATE_NORMAL; in chdone()
722 cam_periph_unhold(periph); in chdone()
741 struct cam_periph *periph; in chioctl() local
745 periph = (struct cam_periph *)dev->si_drv1; in chioctl()
746 cam_periph_lock(periph); in chioctl()
747 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering chioctl\n")); in chioctl()
749 softc = (struct ch_softc *)periph->softc; in chioctl()
753 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, in chioctl()
769 cam_periph_unlock(periph); in chioctl()
776 error = chmove(periph, (struct changer_move *)addr); in chioctl()
780 error = chexchange(periph, (struct changer_exchange *)addr); in chioctl()
784 error = chposition(periph, (struct changer_position *)addr); in chioctl()
788 *(int *)addr = softc->sc_picker - softc->sc_firsts[CHET_MT]; in chioctl()
795 if (new_picker > (softc->sc_counts[CHET_MT] - 1)) { in chioctl()
799 softc->sc_picker = softc->sc_firsts[CHET_MT] + new_picker; in chioctl()
806 cp->cp_npickers = softc->sc_counts[CHET_MT]; in chioctl()
807 cp->cp_nslots = softc->sc_counts[CHET_ST]; in chioctl()
808 cp->cp_nportals = softc->sc_counts[CHET_IE]; in chioctl()
809 cp->cp_ndrives = softc->sc_counts[CHET_DT]; in chioctl()
813 error = chielem(periph, *(unsigned int *)addr); in chioctl()
818 error = chgetelemstatus(periph, SCSI_REV_2, cmd, in chioctl()
827 scsi_version = chscsiversion(periph); in chioctl()
829 error = chgetelemstatus(periph, scsi_version, cmd, in chioctl()
833 cam_periph_unlock(periph); in chioctl()
841 error = chsetvoltag(periph, in chioctl()
849 error = cam_periph_ioctl(periph, cmd, addr, cherror); in chioctl()
853 cam_periph_unlock(periph); in chioctl()
858 chmove(struct cam_periph *periph, struct changer_move *cm) in chmove() argument
866 softc = (struct ch_softc *)periph->softc; in chmove()
871 if ((cm->cm_fromtype > CHET_DT) || (cm->cm_totype > CHET_DT)) in chmove()
873 if ((cm->cm_fromunit > (softc->sc_counts[cm->cm_fromtype] - 1)) || in chmove()
874 (cm->cm_tounit > (softc->sc_counts[cm->cm_totype] - 1))) in chmove()
880 if ((softc->sc_movemask[cm->cm_fromtype] & (1 << cm->cm_totype)) == 0) in chmove()
886 fromelem = softc->sc_firsts[cm->cm_fromtype] + cm->cm_fromunit; in chmove()
887 toelem = softc->sc_firsts[cm->cm_totype] + cm->cm_tounit; in chmove()
889 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in chmove()
891 scsi_move_medium(&ccb->csio, in chmove()
895 /* tea */ softc->sc_picker, in chmove()
898 /* invert */ (cm->cm_flags & CM_INVERT) ? TRUE : FALSE, in chmove()
904 softc->device_stats); in chmove()
912 chexchange(struct cam_periph *periph, struct changer_exchange *ce) in chexchange() argument
920 softc = (struct ch_softc *)periph->softc; in chexchange()
924 if ((ce->ce_srctype > CHET_DT) || (ce->ce_fdsttype > CHET_DT) || in chexchange()
925 (ce->ce_sdsttype > CHET_DT)) in chexchange()
927 if ((ce->ce_srcunit > (softc->sc_counts[ce->ce_srctype] - 1)) || in chexchange()
928 (ce->ce_fdstunit > (softc->sc_counts[ce->ce_fdsttype] - 1)) || in chexchange()
929 (ce->ce_sdstunit > (softc->sc_counts[ce->ce_sdsttype] - 1))) in chexchange()
935 if (((softc->sc_exchangemask[ce->ce_srctype] & in chexchange()
936 (1 << ce->ce_fdsttype)) == 0) || in chexchange()
937 ((softc->sc_exchangemask[ce->ce_fdsttype] & in chexchange()
938 (1 << ce->ce_sdsttype)) == 0)) in chexchange()
944 src = softc->sc_firsts[ce->ce_srctype] + ce->ce_srcunit; in chexchange()
945 dst1 = softc->sc_firsts[ce->ce_fdsttype] + ce->ce_fdstunit; in chexchange()
946 dst2 = softc->sc_firsts[ce->ce_sdsttype] + ce->ce_sdstunit; in chexchange()
948 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in chexchange()
950 scsi_exchange_medium(&ccb->csio, in chexchange()
954 /* tea */ softc->sc_picker, in chexchange()
958 /* invert1 */ (ce->ce_flags & CE_INVERT1) ? in chexchange()
960 /* invert2 */ (ce->ce_flags & CE_INVERT2) ? in chexchange()
967 softc->device_stats); in chexchange()
975 chposition(struct cam_periph *periph, struct changer_position *cp) in chposition() argument
983 softc = (struct ch_softc *)periph->softc; in chposition()
988 if (cp->cp_type > CHET_DT) in chposition()
990 if (cp->cp_unit > (softc->sc_counts[cp->cp_type] - 1)) in chposition()
996 dst = softc->sc_firsts[cp->cp_type] + cp->cp_unit; in chposition()
998 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in chposition()
1000 scsi_position_to_element(&ccb->csio, in chposition()
1004 /* tea */ softc->sc_picker, in chposition()
1006 /* invert */ (cp->cp_flags & CP_INVERT) ? in chposition()
1013 softc->device_stats); in chposition()
1024 * nul-terminated string. Volume labels are truncated at the first
1025 * space, as suggested by SCSI-2.
1032 char c = voltag->vif[i]; in copy_voltag()
1034 uvoltag->cv_volid[i] = c; in copy_voltag()
1038 uvoltag->cv_serial = scsi_2btoul(voltag->vsn); in copy_voltag()
1042 * Copy an element status descriptor to a user-mode
1052 uint16_t eaddr = scsi_2btoul(desc->eaddr); in copy_element_status()
1057 ces->ces_int_addr = eaddr; in copy_element_status()
1060 if ((softc->sc_firsts[et] <= eaddr) in copy_element_status()
1061 && ((softc->sc_firsts[et] + softc->sc_counts[et]) in copy_element_status()
1063 ces->ces_addr = eaddr - softc->sc_firsts[et]; in copy_element_status()
1064 ces->ces_type = et; in copy_element_status()
1069 ces->ces_flags = desc->flags1; in copy_element_status()
1071 ces->ces_sensecode = desc->sense_code; in copy_element_status()
1072 ces->ces_sensequal = desc->sense_qual; in copy_element_status()
1074 if (desc->flags2 & READ_ELEMENT_STATUS_INVERT) in copy_element_status()
1075 ces->ces_flags |= CES_INVERT; in copy_element_status()
1077 if (desc->flags2 & READ_ELEMENT_STATUS_SVALID) { in copy_element_status()
1078 eaddr = scsi_2btoul(desc->ssea); in copy_element_status()
1082 if ((softc->sc_firsts[et] <= eaddr) in copy_element_status()
1083 && ((softc->sc_firsts[et] + softc->sc_counts[et]) in copy_element_status()
1085 ces->ces_source_addr = in copy_element_status()
1086 eaddr - softc->sc_firsts[et]; in copy_element_status()
1087 ces->ces_source_type = et; in copy_element_status()
1088 ces->ces_flags |= CES_SOURCE_VALID; in copy_element_status()
1093 if (!(ces->ces_flags & CES_SOURCE_VALID)) in copy_element_status()
1100 * pvoltag and avoltag are common between SCSI-2 and later versions in copy_element_status()
1103 pvol_tag = &desc->voltag_devid.pvoltag; in copy_element_status()
1106 &desc->voltag_devid.voltag[1] :&desc->voltag_devid.pvoltag; in copy_element_status()
1108 * For SCSI-3 and later, element status can carry designator and in copy_element_status()
1114 devid = &desc->voltag_devid.pvol_and_devid.devid; in copy_element_status()
1117 devid = &desc->voltag_devid.devid; in copy_element_status()
1119 devid = &desc->voltag_devid.vol_tags_and_devid.devid; in copy_element_status()
1123 copy_voltag(&(ces->ces_pvoltag), pvol_tag); in copy_element_status()
1125 copy_voltag(&(ces->ces_pvoltag), avol_tag); in copy_element_status()
1127 if (devid->designator_length > 0) { in copy_element_status()
1128 bcopy((void *)devid->designator, in copy_element_status()
1129 (void *)ces->ces_designator, in copy_element_status()
1130 devid->designator_length); in copy_element_status()
1131 ces->ces_designator_length = devid->designator_length; in copy_element_status()
1138 ces->ces_designator[devid->designator_length]= '\0'; in copy_element_status()
1140 if (devid->piv_assoc_designator_type & in copy_element_status()
1142 ces->ces_flags |= CES_PIV; in copy_element_status()
1143 ces->ces_protocol_id = in copy_element_status()
1145 devid->prot_code_set); in copy_element_status()
1147 ces->ces_code_set = in copy_element_status()
1148 READ_ELEMENT_STATUS_CODE_SET(devid->prot_code_set); in copy_element_status()
1149 ces->ces_assoc = READ_ELEMENT_STATUS_ASSOCIATION( in copy_element_status()
1150 devid->piv_assoc_designator_type); in copy_element_status()
1151 ces->ces_designator_type = READ_ELEMENT_STATUS_DESIGNATOR_TYPE( in copy_element_status()
1152 devid->piv_assoc_designator_type); in copy_element_status()
1154 /* SCSI-SPC and No devid, no designator */ in copy_element_status()
1155 ces->ces_designator_length = 0; in copy_element_status()
1156 ces->ces_designator[0] = '\0'; in copy_element_status()
1157 ces->ces_protocol_id = CES_PROTOCOL_ID_FCP_4; in copy_element_status()
1161 if (desc->dt_or_obsolete.scsi_2.dt_scsi_flags & in copy_element_status()
1163 ces->ces_flags |= CES_SCSIID_VALID; in copy_element_status()
1164 ces->ces_scsi_id = in copy_element_status()
1165 desc->dt_or_obsolete.scsi_2.dt_scsi_addr; in copy_element_status()
1168 if (desc->dt_or_obsolete.scsi_2.dt_scsi_addr & in copy_element_status()
1170 ces->ces_flags |= CES_LUN_VALID; in copy_element_status()
1171 ces->ces_scsi_lun = in copy_element_status()
1172 desc->dt_or_obsolete.scsi_2.dt_scsi_flags & in copy_element_status()
1179 chgetelemstatus(struct cam_periph *periph, int scsi_version, u_long cmd, in chgetelemstatus() argument
1193 int chet = cesr->cesr_element_type; in chgetelemstatus()
1195 int want_voltags = (cesr->cesr_flags & CESR_VOLTAGS) ? 1 : 0; in chgetelemstatus()
1197 softc = (struct ch_softc *)periph->softc; in chgetelemstatus()
1205 if ((softc->sc_counts[chet] - cesr->cesr_element_base) <= 0 in chgetelemstatus()
1206 || (cesr->cesr_element_base + cesr->cesr_element_count) in chgetelemstatus()
1207 > softc->sc_counts[chet]) in chgetelemstatus()
1216 cam_periph_unlock(periph); in chgetelemstatus()
1219 cam_periph_lock(periph); in chgetelemstatus()
1220 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in chgetelemstatus()
1223 if (softc->quirks & CH_Q_NO_DVCID) { in chgetelemstatus()
1239 scsi_read_element_status(&ccb->csio, in chgetelemstatus()
1244 /* sea */ softc->sc_firsts[chet], in chgetelemstatus()
1255 softc->device_stats); in chgetelemstatus()
1279 * This should only happen on changers that claim SCSI-3 or higher, in chgetelemstatus()
1284 softc->quirks |= CH_Q_NO_DVCID; in chgetelemstatus()
1288 cam_periph_unlock(periph); in chgetelemstatus()
1293 desclen = scsi_2btoul(pg_hdr->edl); in chgetelemstatus()
1297 (desclen * cesr->cesr_element_count); in chgetelemstatus()
1305 cam_periph_lock(periph); in chgetelemstatus()
1306 scsi_read_element_status(&ccb->csio, in chgetelemstatus()
1311 /* sea */ softc->sc_firsts[chet] in chgetelemstatus()
1312 + cesr->cesr_element_base, in chgetelemstatus()
1315 /* count */ cesr->cesr_element_count, in chgetelemstatus()
1323 softc->device_stats); in chgetelemstatus()
1327 cam_periph_unlock(periph); in chgetelemstatus()
1335 avail = scsi_2btoul(st_hdr->count); in chgetelemstatus()
1337 if (avail != cesr->cesr_element_count) { in chgetelemstatus()
1338 xpt_print(periph->path, in chgetelemstatus()
1358 * between SCSI-2 and SCSI-3, while all the rest are new in chgetelemstatus()
1359 * from SCSI-3. In order to maintain backward compatibility in chgetelemstatus()
1370 copy_element_status(softc, pg_hdr->flags, desc, in chgetelemstatus()
1380 cesr->cesr_element_status, in chgetelemstatus()
1385 cesr->cesr_element_status, in chgetelemstatus()
1388 cam_periph_lock(periph); in chgetelemstatus()
1402 chielem(struct cam_periph *periph, in chielem() argument
1416 softc = (struct ch_softc *)periph->softc; in chielem()
1418 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in chielem()
1420 scsi_initialize_element_status(&ccb->csio, in chielem()
1429 softc->device_stats); in chielem()
1437 chsetvoltag(struct cam_periph *periph, in chsetvoltag() argument
1449 softc = (struct ch_softc *)periph->softc; in chsetvoltag()
1459 if (csvr->csvr_type > CHET_DT) in chsetvoltag()
1461 if (csvr->csvr_addr > (softc->sc_counts[csvr->csvr_type] - 1)) in chsetvoltag()
1464 ea = softc->sc_firsts[csvr->csvr_type] + csvr->csvr_addr; in chsetvoltag()
1466 if (csvr->csvr_flags & CSVR_ALTERNATE) { in chsetvoltag()
1467 switch (csvr->csvr_flags & CSVR_MODE_MASK) { in chsetvoltag()
1482 switch (csvr->csvr_flags & CSVR_MODE_MASK) { in chsetvoltag()
1498 memcpy(ssvtp.vitf, csvr->csvr_voltag.cv_volid, in chsetvoltag()
1499 min(strlen(csvr->csvr_voltag.cv_volid), sizeof(ssvtp.vitf))); in chsetvoltag()
1500 scsi_ulto2b(csvr->csvr_voltag.cv_serial, ssvtp.minvsn); in chsetvoltag()
1502 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in chsetvoltag()
1504 scsi_send_volume_tag(&ccb->csio, in chsetvoltag()
1516 softc->device_stats); in chsetvoltag()
1525 chgetparams(struct cam_periph *periph) in chgetparams() argument
1538 softc = (struct ch_softc *)periph->softc; in chgetparams()
1540 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in chgetparams()
1544 * structure that allows us to easily calculate the worst-case in chgetparams()
1559 if (softc->quirks & CH_Q_NO_DBD) in chgetparams()
1567 scsi_mode_sense(&ccb->csio, in chgetparams()
1581 softc->device_stats); in chgetparams()
1588 ccb->csio.cdb_io.cdb_bytes; in chgetparams()
1590 sms->byte2 &= ~SMS_DBD; in chgetparams()
1594 softc->device_stats); in chgetparams()
1600 scsi_sense_print(&ccb->csio); in chgetparams()
1604 xpt_print(periph->path, in chgetparams()
1616 softc->sc_firsts[CHET_MT] = scsi_2btoul(ea->mtea); in chgetparams()
1617 softc->sc_counts[CHET_MT] = scsi_2btoul(ea->nmte); in chgetparams()
1618 softc->sc_firsts[CHET_ST] = scsi_2btoul(ea->fsea); in chgetparams()
1619 softc->sc_counts[CHET_ST] = scsi_2btoul(ea->nse); in chgetparams()
1620 softc->sc_firsts[CHET_IE] = scsi_2btoul(ea->fieea); in chgetparams()
1621 softc->sc_counts[CHET_IE] = scsi_2btoul(ea->niee); in chgetparams()
1622 softc->sc_firsts[CHET_DT] = scsi_2btoul(ea->fdtea); in chgetparams()
1623 softc->sc_counts[CHET_DT] = scsi_2btoul(ea->ndte); in chgetparams()
1630 scsi_mode_sense(&ccb->csio, in chgetparams()
1644 softc->device_stats); in chgetparams()
1651 ccb->csio.cdb_io.cdb_bytes; in chgetparams()
1653 sms->byte2 &= ~SMS_DBD; in chgetparams()
1657 softc->device_stats); in chgetparams()
1663 scsi_sense_print(&ccb->csio); in chgetparams()
1667 xpt_print(periph->path, in chgetparams()
1681 bzero(softc->sc_movemask, sizeof(softc->sc_movemask)); in chgetparams()
1682 bzero(softc->sc_exchangemask, sizeof(softc->sc_exchangemask)); in chgetparams()
1683 moves = cap->move_from; in chgetparams()
1684 exchanges = cap->exchange_with; in chgetparams()
1686 softc->sc_movemask[from] = moves[from]; in chgetparams()
1687 softc->sc_exchangemask[from] = exchanges[from]; in chgetparams()
1696 chscsiversion(struct cam_periph *periph) in chscsiversion() argument
1702 cam_periph_assert(periph, MA_OWNED); in chscsiversion()
1704 return (-1); in chscsiversion()
1708 xpt_gdev_type(cgd, periph->path); in chscsiversion()
1710 if (cgd->ccb_h.status != CAM_REQ_CMP) { in chscsiversion()
1712 return -1; in chscsiversion()
1715 inq_data = &cgd->inq_data; in chscsiversion()
1716 dev_scsi_version = inq_data->version; in chscsiversion()
1731 scsi_cmd = (struct scsi_move_medium *)&csio->cdb_io.cdb_bytes; in scsi_move_medium()
1734 scsi_cmd->opcode = MOVE_MEDIUM; in scsi_move_medium()
1736 scsi_ulto2b(tea, scsi_cmd->tea); in scsi_move_medium()
1737 scsi_ulto2b(src, scsi_cmd->src); in scsi_move_medium()
1738 scsi_ulto2b(dst, scsi_cmd->dst); in scsi_move_medium()
1741 scsi_cmd->invert |= MOVE_MEDIUM_INVERT; in scsi_move_medium()
1764 scsi_cmd = (struct scsi_exchange_medium *)&csio->cdb_io.cdb_bytes; in scsi_exchange_medium()
1767 scsi_cmd->opcode = EXCHANGE_MEDIUM; in scsi_exchange_medium()
1769 scsi_ulto2b(tea, scsi_cmd->tea); in scsi_exchange_medium()
1770 scsi_ulto2b(src, scsi_cmd->src); in scsi_exchange_medium()
1771 scsi_ulto2b(dst1, scsi_cmd->fdst); in scsi_exchange_medium()
1772 scsi_ulto2b(dst2, scsi_cmd->sdst); in scsi_exchange_medium()
1775 scsi_cmd->invert |= EXCHANGE_MEDIUM_INV1; in scsi_exchange_medium()
1778 scsi_cmd->invert |= EXCHANGE_MEDIUM_INV2; in scsi_exchange_medium()
1800 scsi_cmd = (struct scsi_position_to_element *)&csio->cdb_io.cdb_bytes; in scsi_position_to_element()
1803 scsi_cmd->opcode = POSITION_TO_ELEMENT; in scsi_position_to_element()
1805 scsi_ulto2b(tea, scsi_cmd->tea); in scsi_position_to_element()
1806 scsi_ulto2b(dst, scsi_cmd->dst); in scsi_position_to_element()
1809 scsi_cmd->invert |= POSITION_TO_ELEMENT_INVERT; in scsi_position_to_element()
1834 scsi_cmd = (struct scsi_read_element_status *)&csio->cdb_io.cdb_bytes; in scsi_read_element_status()
1837 scsi_cmd->opcode = READ_ELEMENT_STATUS; in scsi_read_element_status()
1839 scsi_ulto2b(sea, scsi_cmd->sea); in scsi_read_element_status()
1840 scsi_ulto2b(count, scsi_cmd->count); in scsi_read_element_status()
1841 scsi_ulto3b(dxfer_len, scsi_cmd->len); in scsi_read_element_status()
1843 scsi_cmd->flags |= READ_ELEMENT_STATUS_DVCID; in scsi_read_element_status()
1845 scsi_cmd->flags |= READ_ELEMENT_STATUS_CURDATA; in scsi_read_element_status()
1848 scsi_cmd->byte2 |= READ_ELEMENT_STATUS_VOLTAG; in scsi_read_element_status()
1871 &csio->cdb_io.cdb_bytes; in scsi_initialize_element_status()
1874 scsi_cmd->opcode = INITIALIZE_ELEMENT_STATUS; in scsi_initialize_element_status()
1899 scsi_cmd = (struct scsi_send_volume_tag *) &csio->cdb_io.cdb_bytes; in scsi_send_volume_tag()
1902 scsi_cmd->opcode = SEND_VOLUME_TAG; in scsi_send_volume_tag()
1903 scsi_ulto2b(element_address, scsi_cmd->ea); in scsi_send_volume_tag()
1904 scsi_cmd->sac = send_action_code; in scsi_send_volume_tag()
1905 scsi_ulto2b(sizeof(*parameters), scsi_cmd->pll); in scsi_send_volume_tag()