Lines Matching refs:periph
157 static void ndadone(struct cam_periph *periph,
290 struct cam_periph *periph; in ndaopen() local
294 periph = (struct cam_periph *)dp->d_drv1; in ndaopen()
295 if (cam_periph_acquire(periph) != 0) { in ndaopen()
299 cam_periph_lock(periph); in ndaopen()
300 if ((error = cam_periph_hold(periph, PRIBIO|PCATCH)) != 0) { in ndaopen()
301 cam_periph_unlock(periph); in ndaopen()
302 cam_periph_release(periph); in ndaopen()
306 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, in ndaopen()
309 softc = (struct nda_softc *)periph->softc; in ndaopen()
312 cam_periph_unhold(periph); in ndaopen()
313 cam_periph_unlock(periph); in ndaopen()
320 struct cam_periph *periph; in ndaclose() local
325 periph = (struct cam_periph *)dp->d_drv1; in ndaclose()
326 softc = (struct nda_softc *)periph->softc; in ndaclose()
327 cam_periph_lock(periph); in ndaclose()
329 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, in ndaclose()
333 (periph->flags & CAM_PERIPH_INVALID) == 0 && in ndaclose()
334 cam_periph_hold(periph, PRIBIO) == 0) { in ndaclose()
335 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in ndaclose()
341 xpt_print(periph->path, "Synchronize cache failed\n"); in ndaclose()
345 cam_periph_unhold(periph); in ndaclose()
351 cam_periph_sleep(periph, &softc->refcount, PRIBIO, "ndaclose", 1); in ndaclose()
354 cam_periph_unlock(periph); in ndaclose()
355 cam_periph_release(periph); in ndaclose()
360 ndaschedule(struct cam_periph *periph) in ndaschedule() argument
362 struct nda_softc *softc = (struct nda_softc *)periph->softc; in ndaschedule()
367 cam_iosched_schedule(softc->cam_iosched, periph); in ndaschedule()
374 struct cam_periph *periph; in ndaioctl() local
376 periph = (struct cam_periph *)dp->d_drv1; in ndaioctl()
391 xpt_path_inq(&cpi, periph->path); in ndaioctl()
410 xpt_setup_ccb(&ccb->ccb_h, periph->path, CAM_PRIORITY_NORMAL); in ndaioctl()
432 cam_periph_lock(periph); in ndaioctl()
439 cam_periph_unlock(periph); in ndaioctl()
444 cam_periph_lock(periph); in ndaioctl()
446 cam_periph_unlock(periph); in ndaioctl()
463 struct cam_periph *periph; in ndastrategy() local
466 periph = (struct cam_periph *)bp->bio_disk->d_drv1; in ndastrategy()
467 softc = (struct nda_softc *)periph->softc; in ndastrategy()
469 cam_periph_lock(periph); in ndastrategy()
471 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ndastrategy(%p)\n", bp)); in ndastrategy()
476 if ((periph->flags & CAM_PERIPH_INVALID) != 0) { in ndastrategy()
477 cam_periph_unlock(periph); in ndastrategy()
493 ndaschedule(periph); in ndastrategy()
494 cam_periph_unlock(periph); in ndastrategy()
502 struct cam_periph *periph; in ndadump() local
512 periph = dp->d_drv1; in ndadump()
513 softc = (struct nda_softc *)periph->softc; in ndadump()
518 if ((periph->flags & CAM_PERIPH_INVALID) != 0) in ndadump()
524 xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); in ndadump()
536 xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); in ndadump()
543 xpt_print(periph->path, "flush cmd failed\n"); in ndadump()
579 struct cam_periph *periph; in ndadiskgonecb() local
581 periph = (struct cam_periph *)dp->d_drv1; in ndadiskgonecb()
583 cam_periph_release(periph); in ndadiskgonecb()
587 ndaoninvalidate(struct cam_periph *periph) in ndaoninvalidate() argument
591 softc = (struct nda_softc *)periph->softc; in ndaoninvalidate()
596 xpt_register_async(0, ndaasync, periph, periph->path); in ndaoninvalidate()
617 ndacleanup(struct cam_periph *periph) in ndacleanup() argument
621 softc = (struct nda_softc *)periph->softc; in ndacleanup()
623 cam_periph_unlock(periph); in ndacleanup()
633 xpt_print(periph->path, in ndacleanup()
637 xpt_print(periph->path, in ndacleanup()
643 cam_periph_lock(periph); in ndacleanup()
650 struct cam_periph *periph; in ndaasync() local
652 periph = (struct cam_periph *)callback_arg; in ndaasync()
691 softc = periph->softc; in ndaasync()
701 cam_periph_async(periph, code, path, arg); in ndaasync()
707 struct cam_periph *periph; in ndasysctlinit() local
711 periph = (struct cam_periph *)context; in ndasysctlinit()
714 if ((periph->flags & CAM_PERIPH_INVALID) != 0) { in ndasysctlinit()
715 cam_periph_release(periph); in ndasysctlinit()
719 softc = (struct nda_softc *)periph->softc; in ndasysctlinit()
720 snprintf(tmpstr, sizeof(tmpstr), "CAM NDA unit %d", periph->unit_number); in ndasysctlinit()
721 snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); in ndasysctlinit()
730 cam_periph_release(periph); in ndasysctlinit()
770 cam_periph_release(periph); in ndasysctlinit()
793 periph, 0, cam_periph_invalidate_sysctl, "I", in ndasysctlinit()
800 cam_periph_release(periph); in ndasysctlinit()
825 struct cam_periph *periph; in ndagetattr() local
830 periph = (struct cam_periph *)bp->bio_disk->d_drv1; in ndagetattr()
831 cam_periph_lock(periph); in ndagetattr()
833 periph->path); in ndagetattr()
834 cam_periph_unlock(periph); in ndagetattr()
841 ndaregister(struct cam_periph *periph, void *arg) in ndaregister() argument
853 nsd = nvme_get_identify_ns(periph); in ndaregister()
854 cd = nvme_get_identify_cntrl(periph); in ndaregister()
867 periph->softc = softc; in ndaregister()
869 xpt_path_inq(&cpi, periph->path); in ndaregister()
870 TASK_INIT(&softc->sysctl_task, 0, ndasysctlinit, periph); in ndaregister()
875 softc->nsid = (uint32_t)xpt_path_lun_id(periph->path); in ndaregister()
880 (void)cam_periph_acquire(periph); in ndaregister()
881 cam_periph_unlock(periph); in ndaregister()
883 "kern.cam.nda.%d.quirks", periph->unit_number); in ndaregister()
894 if (cam_sim_pollable(periph->sim)) in ndaregister()
898 disk->d_drv1 = periph; in ndaregister()
899 disk->d_unit = periph->unit_number; in ndaregister()
943 disk->d_devstat = devstat_new_entry(periph->periph_name, in ndaregister()
944 periph->unit_number, disk->d_sectorsize, in ndaregister()
949 if (cam_iosched_init(&softc->cam_iosched, periph, disk, in ndaregister()
964 cam_periph_lock(periph); in ndaregister()
971 xpt_announce_periph(periph, announce_buf); in ndaregister()
972 xpt_announce_quirks(periph, softc->quirks, NDA_Q_BIT_STRING); in ndaregister()
978 if (cam_periph_acquire(periph) == 0) in ndaregister()
986 ndaasync, periph, periph->path); in ndaregister()
994 if (cam_periph_acquire(periph) == 0) in ndaregister()
997 cam_periph_release_locked(periph); in ndaregister()
1002 ndastart(struct cam_periph *periph, union ccb *start_ccb) in ndastart() argument
1004 struct nda_softc *softc = (struct nda_softc *)periph->softc; in ndastart()
1007 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ndastart\n")); in ndastart()
1015 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ndastart: bio %p\n", bp)); in ndastart()
1060 ndaschedule(periph); in ndastart()
1090 cam_periph_unlock(periph); in ndastart()
1092 cam_periph_lock(periph); in ndastart()
1094 ndaschedule(periph); in ndastart()
1139 ndaschedule(periph); in ndastart()
1148 cam_periph_unlock(periph); in ndastart()
1150 cam_periph_lock(periph); in ndastart()
1154 ndaschedule(periph); in ndastart()
1161 ndadone(struct cam_periph *periph, union ccb *done_ccb) in ndadone() argument
1168 softc = (struct nda_softc *)periph->softc; in ndadone()
1180 cam_periph_lock(periph); in ndadone()
1185 cam_periph_unlock(periph); in ndadone()
1220 ndaschedule(periph); in ndadone()
1221 cam_periph_unlock(periph); in ndadone()
1248 ndaschedule(periph); in ndadone()
1249 cam_periph_unlock(periph); in ndadone()
1282 struct cam_periph *periph; in ndaerror() local
1284 periph = xpt_path_periph(ccb->ccb_h.path); in ndaerror()
1285 softc = (struct nda_softc *)periph->softc; in ndaerror()
1314 struct cam_periph *periph; in ndaflush() local
1319 CAM_PERIPH_FOREACH(periph, &ndadriver) { in ndaflush()
1320 softc = (struct nda_softc *)periph->softc; in ndaflush()
1329 if (!cam_periph_owned(periph) && in ndaflush()
1339 cam_periph_lock(periph); in ndaflush()
1341 cam_periph_unlock(periph); in ndaflush()
1345 ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); in ndaflush()
1351 xpt_print(periph->path, "Synchronize cache failed\n"); in ndaflush()
1353 cam_periph_unlock(periph); in ndaflush()