Lines Matching refs:vdp

108 #define	USE_WRITE_BARRIER(vdp)						\  argument
109 ((vdp)->xdf_feature_barrier && !(vdp)->xdf_flush_supported)
110 #define USE_FLUSH_DISKCACHE(vdp) \ argument
111 ((vdp)->xdf_feature_barrier && (vdp)->xdf_flush_supported)
112 #define IS_WRITE_BARRIER(vdp, bp) \ argument
113 (!IS_READ(bp) && USE_WRITE_BARRIER(vdp) && \
114 ((bp)->b_un.b_addr == (vdp)->xdf_cache_flush_block))
116 (!IS_READ(bp) && USE_FLUSH_DISKCACHE(vdp) && ((bp)->b_bcount == 0))
183 xdf_t *vdp = arg; in xdf_timeout_handler() local
185 mutex_enter(&vdp->xdf_dev_lk); in xdf_timeout_handler()
186 vdp->xdf_timeout_id = 0; in xdf_timeout_handler()
187 mutex_exit(&vdp->xdf_dev_lk); in xdf_timeout_handler()
190 xdf_io_start(vdp); in xdf_timeout_handler()
202 xdf_t *vdp = (xdf_t *)arg; in xdf_dmacallback() local
203 ASSERT(vdp != NULL); in xdf_dmacallback()
206 vdp->xdf_addr)); in xdf_dmacallback()
208 ddi_trigger_softintr(vdp->xdf_softintr_id); in xdf_dmacallback()
213 gs_get(xdf_t *vdp, int isread) in gs_get() argument
221 if (vdp->xdf_gnt_callback.next == NULL) { in gs_get()
222 SETDMACBON(vdp); in gs_get()
224 &vdp->xdf_gnt_callback, in gs_get()
226 (void *)vdp, in gs_get()
235 if (vdp->xdf_timeout_id == 0) in gs_get()
237 vdp->xdf_timeout_id = in gs_get()
238 timeout(xdf_timeout_handler, vdp, hz); in gs_get()
243 gs->gs_oeid = vdp->xdf_peer; in gs_get()
282 vreq_get(xdf_t *vdp, buf_t *bp) in vreq_get() argument
290 if (vdp->xdf_timeout_id == 0) in vreq_get()
292 vdp->xdf_timeout_id = in vreq_get()
293 timeout(xdf_timeout_handler, vdp, hz); in vreq_get()
305 list_insert_head(&vdp->xdf_vreq_act, (void *)vreq); in vreq_get()
311 vreq_free(xdf_t *vdp, v_req_t *vreq) in vreq_free() argument
315 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in vreq_free()
318 list_remove(&vdp->xdf_vreq_act, vreq); in vreq_free()
358 check_fbwrite(xdf_t *vdp, buf_t *bp, daddr_t blkno) in check_fbwrite() argument
363 if (IS_WRITE_BARRIER(vdp, bp)) in check_fbwrite()
376 vdp->xdf_cache_flush_block, DEV_BSIZE); in check_fbwrite()
386 vreq_setup(xdf_t *vdp, v_req_t *vreq) in vreq_setup() argument
407 if ((gs = gs_get(vdp, IS_READ(bp))) == NULL) { in vreq_setup()
409 "get ge_slotfailed\n", vdp->xdf_addr)); in vreq_setup()
421 if (IS_WRITE_BARRIER(vdp, bp)) in vreq_setup()
426 if (!IS_READ(bp) && USE_WRITE_BARRIER(vdp)) in vreq_setup()
427 check_fbwrite(vdp, bp, vreq->v_blkno); in vreq_setup()
435 rc = ddi_dma_alloc_handle(vdp->xdf_dip, &xb_dma_attr, in vreq_setup()
436 xdf_dmacallback, (caddr_t)vdp, &dh); in vreq_setup()
438 SETDMACBON(vdp); in vreq_setup()
440 vdp->xdf_addr)); in vreq_setup()
460 rc = ddi_dma_alloc_handle(vdp->xdf_dip, &dmaattr, in vreq_setup()
461 xdf_dmacallback, (caddr_t)vdp, &mdh); in vreq_setup()
463 SETDMACBON(vdp); in vreq_setup()
466 vdp->xdf_addr)); in vreq_setup()
483 DDI_DMA_STREAMING, xdf_dmacallback, (caddr_t)vdp, in vreq_setup()
486 SETDMACBON(vdp); in vreq_setup()
489 vdp->xdf_addr)); in vreq_setup()
510 dma_flags, xdf_dmacallback, (caddr_t)vdp, in vreq_setup()
515 xdf_dmacallback, (caddr_t)vdp, &dc, &ndcs); in vreq_setup()
526 SETDMACBON(vdp); in vreq_setup()
528 vdp->xdf_addr)); in vreq_setup()
545 if ((gs = gs_get(vdp, IS_READ(bp))) == NULL) { in vreq_setup()
547 vdp->xdf_addr)); in vreq_setup()
567 if ((gs = gs_get(vdp, IS_READ(bp))) == NULL) { in vreq_setup()
569 vdp->xdf_addr)); in vreq_setup()
589 xdf_cmlb_attach(xdf_t *vdp) in xdf_cmlb_attach() argument
591 dev_info_t *dip = vdp->xdf_dip; in xdf_cmlb_attach()
594 XD_IS_CD(vdp) ? DTYPE_RODIRECT : DTYPE_DIRECT, in xdf_cmlb_attach()
595 XD_IS_RM(vdp), in xdf_cmlb_attach()
597 XD_IS_CD(vdp) ? DDI_NT_CD_XVMD : DDI_NT_BLOCK_XVMD, in xdf_cmlb_attach()
599 (XD_IS_CD(vdp) ? 0 : CMLB_CREATE_ALTSLICE_VTOC_16_DTYPE_DIRECT) | in xdf_cmlb_attach()
602 XD_IS_CD(vdp) ? 0 : CMLB_FAKE_LABEL_ONE_PARTITION, in xdf_cmlb_attach()
604 vdp->xdf_vd_lbl, NULL)); in xdf_cmlb_attach()
617 xdf_kstat_enter(xdf_t *vdp, buf_t *bp) in xdf_kstat_enter() argument
621 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_kstat_enter()
623 if (vdp->xdf_xdev_iostat == NULL) in xdf_kstat_enter()
626 kstat_runq_enter(KSTAT_IO_PTR(vdp->xdf_xdev_iostat)); in xdf_kstat_enter()
628 kstat_waitq_enter(KSTAT_IO_PTR(vdp->xdf_xdev_iostat)); in xdf_kstat_enter()
633 xdf_kstat_exit(xdf_t *vdp, buf_t *bp) in xdf_kstat_exit() argument
637 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_kstat_exit()
639 if (vdp->xdf_xdev_iostat == NULL) in xdf_kstat_exit()
642 kstat_runq_exit(KSTAT_IO_PTR(vdp->xdf_xdev_iostat)); in xdf_kstat_exit()
644 kstat_waitq_exit(KSTAT_IO_PTR(vdp->xdf_xdev_iostat)); in xdf_kstat_exit()
649 xdf_kstat_waitq_to_runq(xdf_t *vdp, buf_t *bp) in xdf_kstat_waitq_to_runq() argument
653 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_kstat_waitq_to_runq()
657 if (vdp->xdf_xdev_iostat == NULL) in xdf_kstat_waitq_to_runq()
659 kstat_waitq_to_runq(KSTAT_IO_PTR(vdp->xdf_xdev_iostat)); in xdf_kstat_waitq_to_runq()
663 xdf_kstat_runq_to_waitq(xdf_t *vdp, buf_t *bp) in xdf_kstat_runq_to_waitq() argument
667 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_kstat_runq_to_waitq()
671 if (vdp->xdf_xdev_iostat == NULL) in xdf_kstat_runq_to_waitq()
673 kstat_runq_back_to_waitq(KSTAT_IO_PTR(vdp->xdf_xdev_iostat)); in xdf_kstat_runq_to_waitq()
679 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_kstat_create() local
689 mutex_enter(&vdp->xdf_iostat_lk); in xdf_kstat_create()
690 mutex_enter(&vdp->xdf_dev_lk); in xdf_kstat_create()
693 if (vdp->xdf_xdev_iostat != NULL) { in xdf_kstat_create()
694 mutex_exit(&vdp->xdf_dev_lk); in xdf_kstat_create()
695 mutex_exit(&vdp->xdf_iostat_lk); in xdf_kstat_create()
700 vdp->xdf_xdev_iostat = kstat; in xdf_kstat_create()
701 vdp->xdf_xdev_iostat->ks_lock = &vdp->xdf_dev_lk; in xdf_kstat_create()
702 kstat_install(vdp->xdf_xdev_iostat); in xdf_kstat_create()
719 bp = vdp->xdf_f_act; in xdf_kstat_create()
721 xdf_kstat_enter(vdp, bp); in xdf_kstat_create()
724 if (vdp->xdf_ready_tq_bp != NULL) in xdf_kstat_create()
725 xdf_kstat_enter(vdp, vdp->xdf_ready_tq_bp); in xdf_kstat_create()
727 mutex_exit(&vdp->xdf_dev_lk); in xdf_kstat_create()
728 mutex_exit(&vdp->xdf_iostat_lk); in xdf_kstat_create()
735 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_kstat_delete() local
748 mutex_enter(&vdp->xdf_iostat_lk); in xdf_kstat_delete()
749 mutex_enter(&vdp->xdf_dev_lk); in xdf_kstat_delete()
751 if (vdp->xdf_xdev_iostat == NULL) { in xdf_kstat_delete()
752 mutex_exit(&vdp->xdf_dev_lk); in xdf_kstat_delete()
753 mutex_exit(&vdp->xdf_iostat_lk); in xdf_kstat_delete()
769 bp = vdp->xdf_f_act; in xdf_kstat_delete()
771 xdf_kstat_exit(vdp, bp); in xdf_kstat_delete()
774 if (vdp->xdf_ready_tq_bp != NULL) in xdf_kstat_delete()
775 xdf_kstat_exit(vdp, vdp->xdf_ready_tq_bp); in xdf_kstat_delete()
777 kstat = vdp->xdf_xdev_iostat; in xdf_kstat_delete()
778 vdp->xdf_xdev_iostat = NULL; in xdf_kstat_delete()
779 mutex_exit(&vdp->xdf_dev_lk); in xdf_kstat_delete()
781 mutex_exit(&vdp->xdf_iostat_lk); in xdf_kstat_delete()
795 xdf_bp_push(xdf_t *vdp, buf_t *bp) in xdf_bp_push() argument
797 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_bp_push()
800 xdf_kstat_enter(vdp, bp); in xdf_bp_push()
802 if (curthread == vdp->xdf_ready_tq_thread) { in xdf_bp_push()
804 ASSERT(vdp->xdf_ready_tq_bp == NULL); in xdf_bp_push()
805 vdp->xdf_ready_tq_bp = bp; in xdf_bp_push()
810 ASSERT(bp != vdp->xdf_ready_tq_bp); in xdf_bp_push()
812 if (vdp->xdf_f_act == NULL) { in xdf_bp_push()
814 ASSERT(vdp->xdf_l_act == NULL); in xdf_bp_push()
815 ASSERT(vdp->xdf_i_act == NULL); in xdf_bp_push()
816 vdp->xdf_f_act = vdp->xdf_l_act = vdp->xdf_i_act = bp; in xdf_bp_push()
821 vdp->xdf_l_act->av_forw = bp; in xdf_bp_push()
822 vdp->xdf_l_act = bp; in xdf_bp_push()
823 if (vdp->xdf_i_act == NULL) in xdf_bp_push()
824 vdp->xdf_i_act = bp; in xdf_bp_push()
828 xdf_bp_pop(xdf_t *vdp, buf_t *bp) in xdf_bp_pop() argument
832 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_bp_pop()
835 if (vdp->xdf_ready_tq_bp == bp) { in xdf_bp_pop()
838 vdp->xdf_ready_tq_bp = NULL; in xdf_bp_pop()
843 ASSERT((bp->av_forw != NULL) || (bp == vdp->xdf_l_act)); in xdf_bp_pop()
844 ASSERT((bp->av_forw == NULL) || (bp != vdp->xdf_l_act)); in xdf_bp_pop()
845 ASSERT(VREQ_DONE(BP_VREQ(vdp->xdf_f_act))); in xdf_bp_pop()
846 ASSERT(vdp->xdf_f_act != vdp->xdf_i_act); in xdf_bp_pop()
848 if (bp == vdp->xdf_f_act) { in xdf_bp_pop()
850 vdp->xdf_f_act = bp->av_forw; in xdf_bp_pop()
851 if (bp == vdp->xdf_l_act) in xdf_bp_pop()
852 vdp->xdf_l_act = NULL; in xdf_bp_pop()
855 bp_iter = vdp->xdf_f_act; in xdf_bp_pop()
859 ASSERT(bp_iter != vdp->xdf_i_act); in xdf_bp_pop()
862 if (bp == vdp->xdf_l_act) in xdf_bp_pop()
863 vdp->xdf_l_act = bp_iter; in xdf_bp_pop()
869 xdf_bp_next(xdf_t *vdp) in xdf_bp_next() argument
874 if (vdp->xdf_state == XD_CONNECTED) { in xdf_bp_next()
879 if ((bp = vdp->xdf_ready_tq_bp) == NULL) in xdf_bp_next()
887 if (vdp->xdf_state != XD_READY) in xdf_bp_next()
890 ASSERT(vdp->xdf_ready_tq_bp == NULL); in xdf_bp_next()
892 if ((bp = vdp->xdf_i_act) == NULL) in xdf_bp_next()
898 vdp->xdf_i_act = bp->av_forw; in xdf_bp_next()
903 xdf_io_fini(xdf_t *vdp, uint64_t id, int bioerr) in xdf_io_fini() argument
909 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_io_fini()
921 xdf_bp_pop(vdp, bp); in xdf_io_fini()
924 xdf_kstat_exit(vdp, bp); in xdf_io_fini()
926 vreq_free(vdp, vreq); in xdf_io_fini()
942 xdf_intr_locked(xdf_t *vdp) in xdf_intr_locked() argument
952 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_intr_locked()
954 if ((xbr = vdp->xdf_xb_ring) == NULL) in xdf_intr_locked()
957 acchdl = vdp->xdf_xb_ring_hdl; in xdf_intr_locked()
971 vdp->xdf_addr, in xdf_intr_locked()
978 xdf_io_fini(vdp, id, bioerr); in xdf_intr_locked()
990 xdf_t *vdp = (xdf_t *)arg; in xdf_intr() local
993 mutex_enter(&vdp->xdf_dev_lk); in xdf_intr()
994 rv = xdf_intr_locked(vdp); in xdf_intr()
995 mutex_exit(&vdp->xdf_dev_lk); in xdf_intr()
998 xdf_io_start(vdp); in xdf_intr()
1004 xdf_ring_push(xdf_t *vdp) in xdf_ring_push() argument
1006 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_ring_push()
1008 if (vdp->xdf_xb_ring == NULL) in xdf_ring_push()
1011 if (xvdi_ring_push_request(vdp->xdf_xb_ring)) { in xdf_ring_push()
1014 vdp->xdf_addr)); in xdf_ring_push()
1017 if (xvdi_get_evtchn(vdp->xdf_dip) != INVALID_EVTCHN) in xdf_ring_push()
1018 xvdi_notify_oe(vdp->xdf_dip); in xdf_ring_push()
1022 xdf_ring_drain_locked(xdf_t *vdp) in xdf_ring_drain_locked() argument
1026 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_ring_drain_locked()
1032 if (vdp->xdf_xb_ring == NULL) in xdf_ring_drain_locked()
1035 if (xvdi_ring_has_unconsumed_responses(vdp->xdf_xb_ring)) in xdf_ring_drain_locked()
1036 (void) xdf_intr_locked(vdp); in xdf_ring_drain_locked()
1037 if (!xvdi_ring_has_incomp_request(vdp->xdf_xb_ring)) in xdf_ring_drain_locked()
1039 xdf_ring_push(vdp); in xdf_ring_drain_locked()
1042 mutex_exit(&vdp->xdf_dev_lk); in xdf_ring_drain_locked()
1047 mutex_enter(&vdp->xdf_dev_lk); in xdf_ring_drain_locked()
1049 cmn_err(CE_WARN, "xdf@%s: xdf_ring_drain: timeout", vdp->xdf_addr); in xdf_ring_drain_locked()
1052 if (vdp->xdf_xb_ring != NULL) { in xdf_ring_drain_locked()
1053 if (xvdi_ring_has_incomp_request(vdp->xdf_xb_ring) || in xdf_ring_drain_locked()
1054 xvdi_ring_has_unconsumed_responses(vdp->xdf_xb_ring)) in xdf_ring_drain_locked()
1059 vdp->xdf_addr, rv); in xdf_ring_drain_locked()
1064 xdf_ring_drain(xdf_t *vdp) in xdf_ring_drain() argument
1067 mutex_enter(&vdp->xdf_dev_lk); in xdf_ring_drain()
1068 rv = xdf_ring_drain_locked(vdp); in xdf_ring_drain()
1069 mutex_exit(&vdp->xdf_dev_lk); in xdf_ring_drain()
1077 xdf_ring_destroy(xdf_t *vdp) in xdf_ring_destroy() argument
1083 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_ring_destroy()
1084 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_ring_destroy()
1086 if ((vdp->xdf_state != XD_INIT) && in xdf_ring_destroy()
1087 (vdp->xdf_state != XD_CONNECTED) && in xdf_ring_destroy()
1088 (vdp->xdf_state != XD_READY)) { in xdf_ring_destroy()
1089 ASSERT(vdp->xdf_xb_ring == NULL); in xdf_ring_destroy()
1090 ASSERT(vdp->xdf_xb_ring_hdl == NULL); in xdf_ring_destroy()
1091 ASSERT(vdp->xdf_peer == INVALID_DOMID); in xdf_ring_destroy()
1092 ASSERT(vdp->xdf_evtchn == INVALID_EVTCHN); in xdf_ring_destroy()
1093 ASSERT(list_is_empty(&vdp->xdf_vreq_act)); in xdf_ring_destroy()
1102 ec_unbind_evtchn(vdp->xdf_evtchn); in xdf_ring_destroy()
1104 (void) ddi_remove_intr(vdp->xdf_dip, 0, NULL); in xdf_ring_destroy()
1113 (void) xdf_ring_drain_locked(vdp); in xdf_ring_destroy()
1116 xvdi_free_evtchn(vdp->xdf_dip); in xdf_ring_destroy()
1117 vdp->xdf_evtchn = INVALID_EVTCHN; in xdf_ring_destroy()
1119 while ((vreq = list_head(&vdp->xdf_vreq_act)) != NULL) { in xdf_ring_destroy()
1129 xdf_kstat_runq_to_waitq(vdp, bp); in xdf_ring_destroy()
1135 vreq_free(vdp, vreq); in xdf_ring_destroy()
1141 vdp->xdf_i_act = vdp->xdf_f_act; in xdf_ring_destroy()
1144 xvdi_free_ring(vdp->xdf_xb_ring); in xdf_ring_destroy()
1145 vdp->xdf_xb_ring = NULL; in xdf_ring_destroy()
1146 vdp->xdf_xb_ring_hdl = NULL; in xdf_ring_destroy()
1147 vdp->xdf_peer = INVALID_DOMID; in xdf_ring_destroy()
1161 xdf_eject_pending(xdf_t *vdp) in xdf_eject_pending() argument
1163 dev_info_t *dip = vdp->xdf_dip; in xdf_eject_pending()
1166 if (!vdp->xdf_media_req_supported) in xdf_eject_pending()
1185 xdf_media_req(xdf_t *vdp, char *req, boolean_t media_required) in xdf_media_req() argument
1187 dev_info_t *dip = vdp->xdf_dip; in xdf_media_req()
1196 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_media_req()
1197 ASSERT(MUTEX_NOT_HELD(&vdp->xdf_dev_lk)); in xdf_media_req()
1203 if (!XD_IS_CD(vdp) || !vdp->xdf_media_req_supported) in xdf_media_req()
1207 if (xdf_eject_pending(vdp)) in xdf_media_req()
1211 if (media_required && (vdp->xdf_xdev_nblocks == 0)) in xdf_media_req()
1215 if (vdp->xdf_state != XD_READY) in xdf_media_req()
1228 xdf_process_rreq(xdf_t *vdp, struct buf *bp, blkif_request_t *rreq) in xdf_process_rreq() argument
1235 dev_info_t *dip = vdp->xdf_dip; in xdf_process_rreq()
1240 ddi_acc_handle_t acchdl = vdp->xdf_xb_ring_hdl; in xdf_process_rreq()
1245 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_process_rreq()
1266 if (!vdp->xdf_wce) in xdf_process_rreq()
1307 vdp->xdf_addr, seg, vreq->v_dmac.dmac_size, blk_off)); in xdf_process_rreq()
1310 vdp->xdf_addr, seg, fsect, lsect, gr, dma_addr)); in xdf_process_rreq()
1327 vdp->xdf_addr, rreq->id)); in xdf_process_rreq()
1331 xdf_io_start(xdf_t *vdp) in xdf_io_start() argument
1338 mutex_enter(&vdp->xdf_dev_lk); in xdf_io_start()
1346 if (vdp->xdf_suspending) in xdf_io_start()
1348 if ((bp = xdf_bp_next(vdp)) == NULL) in xdf_io_start()
1353 ((vreq = vreq_get(vdp, bp)) == NULL)) in xdf_io_start()
1357 if (vreq_setup(vdp, vreq) != DDI_SUCCESS) in xdf_io_start()
1361 if ((rreq = xvdi_ring_get_request(vdp->xdf_xb_ring)) == NULL) in xdf_io_start()
1367 xdf_process_rreq(vdp, bp, rreq); in xdf_io_start()
1374 xdf_kstat_waitq_to_runq(vdp, bp); in xdf_io_start()
1379 xdf_ring_push(vdp); in xdf_io_start()
1381 mutex_exit(&vdp->xdf_dev_lk); in xdf_io_start()
1387 xdf_isopen(xdf_t *vdp, int partition) in xdf_isopen() argument
1402 if (vdp->xdf_vd_open[i] & parbit) in xdf_isopen()
1415 xdf_busy(xdf_t *vdp) in xdf_busy() argument
1417 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_busy()
1419 if ((vdp->xdf_xb_ring != NULL) && in xdf_busy()
1420 xvdi_ring_has_unconsumed_responses(vdp->xdf_xb_ring)) { in xdf_busy()
1421 ASSERT(vdp->xdf_state != XD_CLOSED); in xdf_busy()
1425 if (!list_is_empty(&vdp->xdf_vreq_act) || (vdp->xdf_f_act != NULL)) { in xdf_busy()
1426 ASSERT(vdp->xdf_state != XD_CLOSED); in xdf_busy()
1430 if (xdf_isopen(vdp, -1)) { in xdf_busy()
1431 ASSERT(vdp->xdf_state != XD_CLOSED); in xdf_busy()
1435 if (vdp->xdf_connect_req > 0) { in xdf_busy()
1436 ASSERT(vdp->xdf_state != XD_CLOSED); in xdf_busy()
1444 xdf_set_state(xdf_t *vdp, xdf_state_t new_state) in xdf_set_state() argument
1446 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_set_state()
1447 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_set_state()
1449 vdp->xdf_addr, vdp->xdf_state, new_state)); in xdf_set_state()
1450 vdp->xdf_state = new_state; in xdf_set_state()
1451 cv_broadcast(&vdp->xdf_dev_cv); in xdf_set_state()
1455 xdf_disconnect(xdf_t *vdp, xdf_state_t new_state, boolean_t quiet) in xdf_disconnect() argument
1457 dev_info_t *dip = vdp->xdf_dip; in xdf_disconnect()
1460 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_disconnect()
1461 ASSERT(MUTEX_NOT_HELD(&vdp->xdf_dev_lk)); in xdf_disconnect()
1465 if (vdp->xdf_state == new_state) in xdf_disconnect()
1468 mutex_enter(&vdp->xdf_dev_lk); in xdf_disconnect()
1469 busy = xdf_busy(vdp); in xdf_disconnect()
1472 if (vdp->xdf_state == XD_CLOSED) { in xdf_disconnect()
1474 xdf_set_state(vdp, new_state); in xdf_disconnect()
1475 mutex_exit(&vdp->xdf_dev_lk); in xdf_disconnect()
1481 if (!quiet && busy && (vdp->xdf_state == XD_READY) && in xdf_disconnect()
1482 (vdp->xdf_xdev_nblocks != 0)) { in xdf_disconnect()
1484 vdp->xdf_addr); in xdf_disconnect()
1488 xdf_ring_destroy(vdp); in xdf_disconnect()
1491 xdf_set_state(vdp, (busy) ? XD_UNKNOWN : new_state); in xdf_disconnect()
1492 mutex_exit(&vdp->xdf_dev_lk); in xdf_disconnect()
1495 if (vdp->xdf_state == XD_CLOSED) in xdf_disconnect()
1507 xdf_setstate_init(xdf_t *vdp) in xdf_setstate_init() argument
1509 dev_info_t *dip = vdp->xdf_dip; in xdf_setstate_init()
1515 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_setstate_init()
1516 ASSERT(MUTEX_NOT_HELD(&vdp->xdf_dev_lk)); in xdf_setstate_init()
1517 ASSERT((vdp->xdf_state == XD_UNKNOWN) || in xdf_setstate_init()
1518 (vdp->xdf_state == XD_CLOSED)); in xdf_setstate_init()
1521 ("xdf@%s: starting connection process\n", vdp->xdf_addr)); in xdf_setstate_init()
1527 if (xdf_eject_pending(vdp)) in xdf_setstate_init()
1533 if ((vdp->xdf_peer = xvdi_get_oeid(dip)) == INVALID_DOMID) in xdf_setstate_init()
1550 vdp->xdf_evtchn = xvdi_get_evtchn(dip); in xdf_setstate_init()
1552 ec_bind_evtchn_to_handler(vdp->xdf_evtchn, IPL_VBD, xdf_intr, vdp); in xdf_setstate_init()
1554 if (ddi_add_intr(dip, 0, NULL, NULL, xdf_intr, (caddr_t)vdp) != in xdf_setstate_init()
1557 "failed to add intr handler", vdp->xdf_addr); in xdf_setstate_init()
1563 sizeof (union blkif_sring_entry), &gref, &vdp->xdf_xb_ring) != in xdf_setstate_init()
1566 vdp->xdf_addr); in xdf_setstate_init()
1569 vdp->xdf_xb_ring_hdl = vdp->xdf_xb_ring->xr_acc_hdl; /* ugly!! */ in xdf_setstate_init()
1577 vdp->xdf_addr); in xdf_setstate_init()
1592 XBP_EVENT_CHAN, "%u", vdp->xdf_evtchn)) != 0) || in xdf_setstate_init()
1609 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_setstate_init()
1610 mutex_enter(&vdp->xdf_dev_lk); in xdf_setstate_init()
1611 xdf_set_state(vdp, XD_INIT); in xdf_setstate_init()
1612 mutex_exit(&vdp->xdf_dev_lk); in xdf_setstate_init()
1617 xvdi_free_ring(vdp->xdf_xb_ring); in xdf_setstate_init()
1620 ec_unbind_evtchn(vdp->xdf_evtchn); in xdf_setstate_init()
1622 (void) ddi_remove_intr(vdp->xdf_dip, 0, NULL); in xdf_setstate_init()
1626 vdp->xdf_evtchn = INVALID_EVTCHN; in xdf_setstate_init()
1628 xdf_disconnect(vdp, XD_UNKNOWN, B_FALSE); in xdf_setstate_init()
1630 vdp->xdf_addr); in xdf_setstate_init()
1635 xdf_get_flush_block(xdf_t *vdp) in xdf_get_flush_block() argument
1640 vdp->xdf_flush_mem = kmem_alloc(vdp->xdf_xdev_secsize * 2, KM_SLEEP); in xdf_get_flush_block()
1641 vdp->xdf_cache_flush_block = in xdf_get_flush_block()
1642 (char *)P2ROUNDUP((uintptr_t)(vdp->xdf_flush_mem), in xdf_get_flush_block()
1643 (int)vdp->xdf_xdev_secsize); in xdf_get_flush_block()
1645 if (xdf_lb_rdwr(vdp->xdf_dip, TG_READ, vdp->xdf_cache_flush_block, in xdf_get_flush_block()
1646 xdf_flush_block, vdp->xdf_xdev_secsize, NULL) != 0) in xdf_get_flush_block()
1654 xdf_t *vdp = (xdf_t *)arg; in xdf_setstate_ready() local
1656 vdp->xdf_ready_tq_thread = curthread; in xdf_setstate_ready()
1665 mutex_enter(&vdp->xdf_dev_lk); in xdf_setstate_ready()
1666 if (vdp->xdf_cmbl_reattach) { in xdf_setstate_ready()
1667 vdp->xdf_cmbl_reattach = B_FALSE; in xdf_setstate_ready()
1669 mutex_exit(&vdp->xdf_dev_lk); in xdf_setstate_ready()
1670 if (xdf_cmlb_attach(vdp) != 0) { in xdf_setstate_ready()
1671 xdf_disconnect(vdp, XD_UNKNOWN, B_FALSE); in xdf_setstate_ready()
1674 mutex_enter(&vdp->xdf_dev_lk); in xdf_setstate_ready()
1678 if (vdp->xdf_state != XD_CONNECTED) { in xdf_setstate_ready()
1679 mutex_exit(&vdp->xdf_dev_lk); in xdf_setstate_ready()
1682 mutex_exit(&vdp->xdf_dev_lk); in xdf_setstate_ready()
1688 vdp->xdf_flush_supported = B_FALSE; in xdf_setstate_ready()
1689 if (vdp->xdf_feature_barrier) { in xdf_setstate_ready()
1694 vdp->xdf_flush_supported = B_TRUE; in xdf_setstate_ready()
1695 if (xdf_lb_rdwr(vdp->xdf_dip, TG_WRITE, NULL, 0, 0, 0) == 0) { in xdf_setstate_ready()
1696 vdp->xdf_flush_supported = B_TRUE; in xdf_setstate_ready()
1698 vdp->xdf_flush_supported = B_FALSE; in xdf_setstate_ready()
1710 if (xdf_get_flush_block(vdp) != DDI_SUCCESS) { in xdf_setstate_ready()
1711 xdf_disconnect(vdp, XD_UNKNOWN, B_FALSE); in xdf_setstate_ready()
1717 mutex_enter(&vdp->xdf_cb_lk); in xdf_setstate_ready()
1718 mutex_enter(&vdp->xdf_dev_lk); in xdf_setstate_ready()
1719 if (vdp->xdf_state == XD_CONNECTED) in xdf_setstate_ready()
1720 xdf_set_state(vdp, XD_READY); in xdf_setstate_ready()
1721 mutex_exit(&vdp->xdf_dev_lk); in xdf_setstate_ready()
1724 xdf_io_start(vdp); in xdf_setstate_ready()
1726 mutex_exit(&vdp->xdf_cb_lk); in xdf_setstate_ready()
1738 xdf_t *vdp; in xdf_synthetic_pgeom() local
1741 vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip)); in xdf_synthetic_pgeom()
1743 ncyl = vdp->xdf_xdev_nblocks / (XDF_NHEADS * XDF_NSECTS); in xdf_synthetic_pgeom()
1750 geomp->g_secsize = vdp->xdf_xdev_secsize; in xdf_synthetic_pgeom()
1751 geomp->g_capacity = vdp->xdf_xdev_nblocks; in xdf_synthetic_pgeom()
1763 xdf_setstate_connected(xdf_t *vdp) in xdf_setstate_connected() argument
1765 dev_info_t *dip = vdp->xdf_dip; in xdf_setstate_connected()
1772 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_setstate_connected()
1773 ASSERT(MUTEX_NOT_HELD(&vdp->xdf_dev_lk)); in xdf_setstate_connected()
1774 ASSERT(vdp->xdf_state == XD_INIT); in xdf_setstate_connected()
1785 if (!(vdp->xdf_feature_barrier = xenbus_exists(oename, XBP_FB))) in xdf_setstate_connected()
1787 vdp->xdf_addr); in xdf_setstate_connected()
1802 "cannot read backend info", vdp->xdf_addr); in xdf_setstate_connected()
1807 vdp->xdf_addr); in xdf_setstate_connected()
1816 vdp->xdf_xdev_nblocks = nblocks; in xdf_setstate_connected()
1817 vdp->xdf_xdev_secsize = secsize; in xdf_setstate_connected()
1819 if (vdp->xdf_xdev_nblocks > DK_MAX_BLOCKS) { in xdf_setstate_connected()
1822 " 32-bit kernel", vdp->xdf_addr, vdp->xdf_xdev_nblocks); in xdf_setstate_connected()
1833 if (vdp->xdf_pgeom_fixed && in xdf_setstate_connected()
1834 (vdp->xdf_pgeom.g_capacity > vdp->xdf_xdev_nblocks)) { in xdf_setstate_connected()
1837 vdp->xdf_addr); in xdf_setstate_connected()
1841 vdp->xdf_media_req_supported = xenbus_exists(oename, XBP_MEDIA_REQ_SUP); in xdf_setstate_connected()
1844 mutex_enter(&vdp->xdf_dev_lk); in xdf_setstate_connected()
1845 xdf_set_state(vdp, XD_CONNECTED); in xdf_setstate_connected()
1849 if ((vdp->xdf_dinfo != dinfo) || in xdf_setstate_connected()
1850 (!vdp->xdf_pgeom_fixed && in xdf_setstate_connected()
1851 (memcmp(&vdp->xdf_pgeom, &pgeom, sizeof (pgeom)) != 0))) { in xdf_setstate_connected()
1852 vdp->xdf_cmbl_reattach = B_TRUE; in xdf_setstate_connected()
1854 vdp->xdf_dinfo = dinfo; in xdf_setstate_connected()
1855 if (!vdp->xdf_pgeom_fixed) in xdf_setstate_connected()
1856 vdp->xdf_pgeom = pgeom; in xdf_setstate_connected()
1859 if (XD_IS_CD(vdp) || XD_IS_RM(vdp)) { in xdf_setstate_connected()
1860 if (vdp->xdf_xdev_nblocks == 0) { in xdf_setstate_connected()
1861 vdp->xdf_mstate = DKIO_EJECTED; in xdf_setstate_connected()
1862 cv_broadcast(&vdp->xdf_mstate_cv); in xdf_setstate_connected()
1864 vdp->xdf_mstate = DKIO_INSERTED; in xdf_setstate_connected()
1865 cv_broadcast(&vdp->xdf_mstate_cv); in xdf_setstate_connected()
1868 if (vdp->xdf_mstate != DKIO_NONE) { in xdf_setstate_connected()
1869 vdp->xdf_mstate = DKIO_NONE; in xdf_setstate_connected()
1870 cv_broadcast(&vdp->xdf_mstate_cv); in xdf_setstate_connected()
1874 mutex_exit(&vdp->xdf_dev_lk); in xdf_setstate_connected()
1876 cmn_err(CE_CONT, "?xdf@%s: %"PRIu64" blocks", vdp->xdf_addr, in xdf_setstate_connected()
1877 (uint64_t)vdp->xdf_xdev_nblocks); in xdf_setstate_connected()
1880 xdf_io_start(vdp); in xdf_setstate_connected()
1890 (void) ddi_taskq_dispatch(vdp->xdf_ready_tq, xdf_setstate_ready, vdp, in xdf_setstate_connected()
1902 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_oe_change() local
1905 vdp->xdf_addr, new_state)); in xdf_oe_change()
1907 mutex_enter(&vdp->xdf_cb_lk); in xdf_oe_change()
1910 ASSERT(vdp->xdf_oe_change_thread == NULL); in xdf_oe_change()
1911 DEBUG_EVAL(vdp->xdf_oe_change_thread = curthread); in xdf_oe_change()
1914 if (vdp->xdf_suspending || (vdp->xdf_state == XD_SUSPEND)) { in xdf_oe_change()
1915 DEBUG_EVAL(vdp->xdf_oe_change_thread = NULL); in xdf_oe_change()
1916 mutex_exit(&vdp->xdf_cb_lk); in xdf_oe_change()
1925 if (vdp->xdf_state == XD_INIT) in xdf_oe_change()
1928 xdf_disconnect(vdp, XD_UNKNOWN, B_FALSE); in xdf_oe_change()
1929 if (xdf_setstate_init(vdp) != DDI_SUCCESS) in xdf_oe_change()
1931 ASSERT(vdp->xdf_state == XD_INIT); in xdf_oe_change()
1935 if ((vdp->xdf_state == XD_CONNECTED) || in xdf_oe_change()
1936 (vdp->xdf_state == XD_READY)) in xdf_oe_change()
1939 if (vdp->xdf_state != XD_INIT) { in xdf_oe_change()
1940 xdf_disconnect(vdp, XD_UNKNOWN, B_FALSE); in xdf_oe_change()
1941 if (xdf_setstate_init(vdp) != DDI_SUCCESS) in xdf_oe_change()
1943 ASSERT(vdp->xdf_state == XD_INIT); in xdf_oe_change()
1946 if (xdf_setstate_connected(vdp) != DDI_SUCCESS) { in xdf_oe_change()
1947 xdf_disconnect(vdp, XD_UNKNOWN, B_FALSE); in xdf_oe_change()
1950 ASSERT(vdp->xdf_state == XD_CONNECTED); in xdf_oe_change()
1954 if (xdf_isopen(vdp, -1)) { in xdf_oe_change()
1957 vdp->xdf_addr); in xdf_oe_change()
1962 xdf_disconnect(vdp, XD_CLOSED, B_FALSE); in xdf_oe_change()
1967 cv_broadcast(&vdp->xdf_dev_cv); in xdf_oe_change()
1968 DEBUG_EVAL(vdp->xdf_oe_change_thread = NULL); in xdf_oe_change()
1969 mutex_exit(&vdp->xdf_cb_lk); in xdf_oe_change()
1973 xdf_connect_locked(xdf_t *vdp, boolean_t wait) in xdf_connect_locked() argument
1977 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_connect_locked()
1978 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_connect_locked()
1981 if (vdp->xdf_state == XD_CLOSED) in xdf_connect_locked()
1984 vdp->xdf_connect_req++; in xdf_connect_locked()
1985 while (vdp->xdf_state != XD_READY) { in xdf_connect_locked()
1986 mutex_exit(&vdp->xdf_dev_lk); in xdf_connect_locked()
1989 if (vdp->xdf_connect_thread == NULL) in xdf_connect_locked()
1990 vdp->xdf_connect_thread = curthread; in xdf_connect_locked()
1992 if (vdp->xdf_connect_thread == curthread) { in xdf_connect_locked()
2000 (void) xdf_disconnect(vdp, XD_UNKNOWN, B_TRUE); in xdf_connect_locked()
2003 if (vdp->xdf_state == XD_UNKNOWN) in xdf_connect_locked()
2004 (void) xdf_setstate_init(vdp); in xdf_connect_locked()
2005 if (vdp->xdf_state == XD_INIT) in xdf_connect_locked()
2006 (void) xdf_setstate_connected(vdp); in xdf_connect_locked()
2009 mutex_enter(&vdp->xdf_dev_lk); in xdf_connect_locked()
2010 if (!wait || (vdp->xdf_state == XD_READY)) in xdf_connect_locked()
2013 mutex_exit((&vdp->xdf_cb_lk)); in xdf_connect_locked()
2014 if (vdp->xdf_connect_thread != curthread) { in xdf_connect_locked()
2015 rv = cv_wait_sig(&vdp->xdf_dev_cv, &vdp->xdf_dev_lk); in xdf_connect_locked()
2018 rv = cv_reltimedwait_sig(&vdp->xdf_dev_cv, in xdf_connect_locked()
2019 &vdp->xdf_dev_lk, drv_usectohz(100*1000), in xdf_connect_locked()
2024 mutex_exit((&vdp->xdf_dev_lk)); in xdf_connect_locked()
2025 mutex_enter((&vdp->xdf_cb_lk)); in xdf_connect_locked()
2026 mutex_enter((&vdp->xdf_dev_lk)); in xdf_connect_locked()
2032 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_connect_locked()
2033 ASSERT(MUTEX_HELD(&vdp->xdf_dev_lk)); in xdf_connect_locked()
2035 if (vdp->xdf_connect_thread == curthread) { in xdf_connect_locked()
2040 cv_signal(&vdp->xdf_dev_cv); in xdf_connect_locked()
2041 vdp->xdf_connect_thread = NULL; in xdf_connect_locked()
2045 mutex_exit((&vdp->xdf_dev_lk)); in xdf_connect_locked()
2046 (void) xdf_media_req(vdp, XBV_MEDIA_REQ_LOCK, B_TRUE); in xdf_connect_locked()
2047 mutex_enter((&vdp->xdf_dev_lk)); in xdf_connect_locked()
2049 vdp->xdf_connect_req--; in xdf_connect_locked()
2050 return (vdp->xdf_state); in xdf_connect_locked()
2056 xdf_t *vdp = (xdf_t *)arg; in xdf_iorestart() local
2058 ASSERT(vdp != NULL); in xdf_iorestart()
2060 mutex_enter(&vdp->xdf_dev_lk); in xdf_iorestart()
2061 ASSERT(ISDMACBON(vdp)); in xdf_iorestart()
2062 SETDMACBOFF(vdp); in xdf_iorestart()
2063 mutex_exit(&vdp->xdf_dev_lk); in xdf_iorestart()
2065 xdf_io_start(vdp); in xdf_iorestart()
2177 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_hvm_connect() local
2181 mutex_enter(&vdp->xdf_cb_lk); in xdf_hvm_connect()
2189 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_hvm_connect()
2198 mutex_exit(&vdp->xdf_cb_lk); in xdf_hvm_connect()
2211 if (cv_wait_sig(&vdp->xdf_hp_status_cv, &vdp->xdf_cb_lk) == 0) { in xdf_hvm_connect()
2213 mutex_exit(&vdp->xdf_cb_lk); in xdf_hvm_connect()
2219 ASSERT(MUTEX_HELD(&vdp->xdf_cb_lk)); in xdf_hvm_connect()
2233 if (XD_IS_CD(vdp) && !xenbus_exists(oename, XBP_MEDIA_REQ_SUP)) { in xdf_hvm_connect()
2234 mutex_exit(&vdp->xdf_cb_lk); in xdf_hvm_connect()
2238 mutex_enter(&vdp->xdf_dev_lk); in xdf_hvm_connect()
2239 rv = xdf_connect_locked(vdp, B_TRUE); in xdf_hvm_connect()
2240 mutex_exit(&vdp->xdf_dev_lk); in xdf_hvm_connect()
2241 mutex_exit(&vdp->xdf_cb_lk); in xdf_hvm_connect()
2249 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_hvm_setpgeom() local
2252 mutex_enter(&vdp->xdf_dev_lk); in xdf_hvm_setpgeom()
2255 mutex_exit(&vdp->xdf_dev_lk); in xdf_hvm_setpgeom()
2264 if ((vdp->xdf_xdev_nblocks != 0) && in xdf_hvm_setpgeom()
2265 (geomp->g_capacity > vdp->xdf_xdev_nblocks)) { in xdf_hvm_setpgeom()
2266 mutex_exit(&vdp->xdf_dev_lk); in xdf_hvm_setpgeom()
2270 bzero(&vdp->xdf_pgeom, sizeof (vdp->xdf_pgeom)); in xdf_hvm_setpgeom()
2271 vdp->xdf_pgeom.g_ncyl = geomp->g_ncyl; in xdf_hvm_setpgeom()
2272 vdp->xdf_pgeom.g_acyl = geomp->g_acyl; in xdf_hvm_setpgeom()
2273 vdp->xdf_pgeom.g_nhead = geomp->g_nhead; in xdf_hvm_setpgeom()
2274 vdp->xdf_pgeom.g_nsect = geomp->g_nsect; in xdf_hvm_setpgeom()
2275 vdp->xdf_pgeom.g_secsize = geomp->g_secsize; in xdf_hvm_setpgeom()
2276 vdp->xdf_pgeom.g_capacity = geomp->g_capacity; in xdf_hvm_setpgeom()
2277 vdp->xdf_pgeom.g_intrlv = geomp->g_intrlv; in xdf_hvm_setpgeom()
2278 vdp->xdf_pgeom.g_rpm = geomp->g_rpm; in xdf_hvm_setpgeom()
2280 vdp->xdf_pgeom_fixed = B_TRUE; in xdf_hvm_setpgeom()
2281 mutex_exit(&vdp->xdf_dev_lk); in xdf_hvm_setpgeom()
2284 cmlb_invalidate(vdp->xdf_vd_lbl, NULL); in xdf_hvm_setpgeom()
2292 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_is_cd() local
2295 mutex_enter(&vdp->xdf_cb_lk); in xdf_is_cd()
2296 rv = XD_IS_CD(vdp); in xdf_is_cd()
2297 mutex_exit(&vdp->xdf_cb_lk); in xdf_is_cd()
2304 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_is_rm() local
2307 mutex_enter(&vdp->xdf_cb_lk); in xdf_is_rm()
2308 rv = XD_IS_RM(vdp); in xdf_is_rm()
2309 mutex_exit(&vdp->xdf_cb_lk); in xdf_is_rm()
2316 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_media_req_supported() local
2319 mutex_enter(&vdp->xdf_cb_lk); in xdf_media_req_supported()
2320 rv = vdp->xdf_media_req_supported; in xdf_media_req_supported()
2321 mutex_exit(&vdp->xdf_cb_lk); in xdf_media_req_supported()
2330 xdf_t *vdp; in xdf_lb_getcap() local
2331 vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip)); in xdf_lb_getcap()
2333 if (vdp == NULL) in xdf_lb_getcap()
2336 mutex_enter(&vdp->xdf_dev_lk); in xdf_lb_getcap()
2337 *capp = vdp->xdf_pgeom.g_capacity; in xdf_lb_getcap()
2338 DPRINTF(LBL_DBG, ("xdf@%s:capacity %llu\n", vdp->xdf_addr, *capp)); in xdf_lb_getcap()
2339 mutex_exit(&vdp->xdf_dev_lk); in xdf_lb_getcap()
2346 xdf_t *vdp; in xdf_lb_getpgeom() local
2348 if ((vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip))) == NULL) in xdf_lb_getpgeom()
2350 *geomp = vdp->xdf_pgeom; in xdf_lb_getpgeom()
2367 xdf_t *vdp; in xdf_lb_getattribute() local
2369 if (!(vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip)))) in xdf_lb_getattribute()
2372 if (XD_IS_RO(vdp)) in xdf_lb_getattribute()
2385 xdf_t *vdp; in xdf_lb_getinfo() local
2389 if ((vdp = ddi_get_soft_state(xdf_ssp, instance)) == NULL) in xdf_lb_getinfo()
2400 mutex_enter(&vdp->xdf_cb_lk); in xdf_lb_getinfo()
2401 *(uint32_t *)arg = vdp->xdf_xdev_secsize; in xdf_lb_getinfo()
2402 mutex_exit(&vdp->xdf_cb_lk); in xdf_lb_getinfo()
2416 xdf_t *vdp; in xdf_lb_rdwr() local
2420 vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip)); in xdf_lb_rdwr()
2423 ASSERT(curthread != vdp->xdf_oe_change_thread); in xdf_lb_rdwr()
2425 if ((start + ((reqlen / (vdp->xdf_xdev_secsize / DEV_BSIZE)) in xdf_lb_rdwr()
2426 >> DEV_BSHIFT)) > vdp->xdf_pgeom.g_capacity) in xdf_lb_rdwr()
2437 bp->b_blkno = start * (vdp->xdf_xdev_secsize / DEV_BSIZE); in xdf_lb_rdwr()
2440 mutex_enter(&vdp->xdf_dev_lk); in xdf_lb_rdwr()
2441 xdf_bp_push(vdp, bp); in xdf_lb_rdwr()
2442 mutex_exit(&vdp->xdf_dev_lk); in xdf_lb_rdwr()
2443 xdf_io_start(vdp); in xdf_lb_rdwr()
2444 if (curthread == vdp->xdf_ready_tq_thread) in xdf_lb_rdwr()
2445 (void) xdf_ring_drain(vdp); in xdf_lb_rdwr()
2457 xdf_ioctl_mlock(xdf_t *vdp) in xdf_ioctl_mlock() argument
2460 mutex_enter(&vdp->xdf_cb_lk); in xdf_ioctl_mlock()
2461 rv = xdf_media_req(vdp, XBV_MEDIA_REQ_LOCK, B_TRUE); in xdf_ioctl_mlock()
2462 mutex_exit(&vdp->xdf_cb_lk); in xdf_ioctl_mlock()
2470 xdf_ioctl_munlock(xdf_t *vdp) in xdf_ioctl_munlock() argument
2473 mutex_enter(&vdp->xdf_cb_lk); in xdf_ioctl_munlock()
2474 rv = xdf_media_req(vdp, XBV_MEDIA_REQ_NONE, B_TRUE); in xdf_ioctl_munlock()
2475 mutex_exit(&vdp->xdf_cb_lk); in xdf_ioctl_munlock()
2484 xdf_ioctl_eject(xdf_t *vdp) in xdf_ioctl_eject() argument
2488 mutex_enter(&vdp->xdf_cb_lk); in xdf_ioctl_eject()
2489 if ((rv = xdf_media_req(vdp, XBV_MEDIA_REQ_EJECT, B_FALSE)) != 0) { in xdf_ioctl_eject()
2490 mutex_exit(&vdp->xdf_cb_lk); in xdf_ioctl_eject()
2500 (void) xdf_disconnect(vdp, XD_UNKNOWN, B_TRUE); in xdf_ioctl_eject()
2501 mutex_enter(&vdp->xdf_dev_lk); in xdf_ioctl_eject()
2502 if (xdf_connect_locked(vdp, B_TRUE) != XD_READY) { in xdf_ioctl_eject()
2503 mutex_exit(&vdp->xdf_dev_lk); in xdf_ioctl_eject()
2504 mutex_exit(&vdp->xdf_cb_lk); in xdf_ioctl_eject()
2507 mutex_exit(&vdp->xdf_dev_lk); in xdf_ioctl_eject()
2508 mutex_exit(&vdp->xdf_cb_lk); in xdf_ioctl_eject()
2519 xdf_dkstate(xdf_t *vdp, enum dkio_state mstate) in xdf_dkstate() argument
2523 mutex_enter(&vdp->xdf_cb_lk); in xdf_dkstate()
2524 prev_state = vdp->xdf_mstate; in xdf_dkstate()
2526 if (vdp->xdf_mstate == mstate) { in xdf_dkstate()
2527 while (vdp->xdf_mstate == prev_state) { in xdf_dkstate()
2528 if (cv_wait_sig(&vdp->xdf_mstate_cv, in xdf_dkstate()
2529 &vdp->xdf_cb_lk) == 0) { in xdf_dkstate()
2530 mutex_exit(&vdp->xdf_cb_lk); in xdf_dkstate()
2537 (vdp->xdf_mstate == DKIO_INSERTED)) { in xdf_dkstate()
2538 (void) xdf_media_req(vdp, XBV_MEDIA_REQ_LOCK, B_TRUE); in xdf_dkstate()
2539 mutex_exit(&vdp->xdf_cb_lk); in xdf_dkstate()
2543 mutex_exit(&vdp->xdf_cb_lk); in xdf_dkstate()
2554 xdf_t *vdp; in xdf_ioctl() local
2557 if (((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) || in xdf_ioctl()
2558 (!xdf_isopen(vdp, part))) in xdf_ioctl()
2562 vdp->xdf_addr, cmd, cmd)); in xdf_ioctl()
2585 return (cmlb_ioctl(vdp->xdf_vd_lbl, dev, cmd, arg, mode, credp, in xdf_ioctl()
2590 return (xdf_ioctl_eject(vdp)); in xdf_ioctl()
2592 return (xdf_ioctl_mlock(vdp)); in xdf_ioctl()
2594 return (xdf_ioctl_munlock(vdp)); in xdf_ioctl()
2597 if (!XD_IS_CD(vdp)) in xdf_ioctl()
2606 media_info.dki_lbsize = vdp->xdf_xdev_secsize; in xdf_ioctl()
2607 media_info.dki_capacity = vdp->xdf_pgeom.g_capacity; in xdf_ioctl()
2608 if (XD_IS_CD(vdp)) in xdf_ioctl()
2622 if (XD_IS_CD(vdp)) in xdf_ioctl()
2631 info.dki_unit = ddi_get_instance(vdp->xdf_dip); in xdf_ioctl()
2651 if ((rv = xdf_dkstate(vdp, mstate)) != 0) in xdf_ioctl()
2653 mstate = vdp->xdf_mstate; in xdf_ioctl()
2660 int i = BOOLEAN2VOID(XD_IS_RM(vdp)); in xdf_ioctl()
2666 int i = BOOLEAN2VOID(XD_IS_RM(vdp)); in xdf_ioctl()
2675 vdp->xdf_wce = VOID2BOOLEAN(i); in xdf_ioctl()
2681 if (vdp->xdf_flush_supported) { in xdf_ioctl()
2682 rv = xdf_lb_rdwr(vdp->xdf_dip, TG_WRITE, in xdf_ioctl()
2684 } else if (vdp->xdf_feature_barrier && in xdf_ioctl()
2686 rv = xdf_lb_rdwr(vdp->xdf_dip, TG_WRITE, in xdf_ioctl()
2687 vdp->xdf_cache_flush_block, xdf_flush_block, in xdf_ioctl()
2688 vdp->xdf_xdev_secsize, (void *)dev); in xdf_ioctl()
2707 xdf_t *vdp; in xdf_strategy() local
2716 vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor)); in xdf_strategy()
2718 mutex_enter(&vdp->xdf_dev_lk); in xdf_strategy()
2719 if (!xdf_isopen(vdp, part)) { in xdf_strategy()
2720 mutex_exit(&vdp->xdf_dev_lk); in xdf_strategy()
2726 ASSERT(curthread != vdp->xdf_oe_change_thread); in xdf_strategy()
2729 if (!IS_READ(bp) && XD_IS_RO(vdp)) { in xdf_strategy()
2730 mutex_exit(&vdp->xdf_dev_lk); in xdf_strategy()
2738 p_blkct = vdp->xdf_xdev_nblocks; in xdf_strategy()
2742 mutex_exit(&vdp->xdf_dev_lk); in xdf_strategy()
2743 if (cmlb_partinfo(vdp->xdf_vd_lbl, part, &p_blkct, in xdf_strategy()
2748 mutex_enter(&vdp->xdf_dev_lk); in xdf_strategy()
2755 blkno = bp->b_blkno / (vdp->xdf_xdev_secsize / XB_BSIZE); in xdf_strategy()
2760 vdp->xdf_addr, (longlong_t)blkno, (uint64_t)p_blkct)); in xdf_strategy()
2761 mutex_exit(&vdp->xdf_dev_lk); in xdf_strategy()
2768 mutex_exit(&vdp->xdf_dev_lk); in xdf_strategy()
2780 if (vdp->xdf_xdev_secsize != 0 && in xdf_strategy()
2781 vdp->xdf_xdev_secsize != XB_BSIZE) { in xdf_strategy()
2782 nblks = bp->b_bcount / vdp->xdf_xdev_secsize; in xdf_strategy()
2788 if (vdp->xdf_xdev_secsize != 0 && in xdf_strategy()
2789 vdp->xdf_xdev_secsize != XB_BSIZE) { in xdf_strategy()
2792 vdp->xdf_xdev_secsize; in xdf_strategy()
2802 vdp->xdf_addr, (longlong_t)blkno, (ulong_t)bp->b_bcount)); in xdf_strategy()
2808 xdf_bp_push(vdp, bp); in xdf_strategy()
2809 mutex_exit(&vdp->xdf_dev_lk); in xdf_strategy()
2810 xdf_io_start(vdp); in xdf_strategy()
2812 (void) xdf_ring_drain(vdp); in xdf_strategy()
2820 xdf_t *vdp; in xdf_read() local
2826 if ((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) in xdf_read()
2830 vdp->xdf_addr, (int64_t)uiop->uio_offset)); in xdf_read()
2833 if (!xdf_isopen(vdp, part)) in xdf_read()
2836 if (cmlb_partinfo(vdp->xdf_vd_lbl, part, &p_blkcnt, in xdf_read()
2840 if (uiop->uio_loffset >= XB_DTOB(p_blkcnt, vdp)) in xdf_read()
2853 xdf_t *vdp; in xdf_write() local
2859 if ((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) in xdf_write()
2863 vdp->xdf_addr, (int64_t)uiop->uio_offset)); in xdf_write()
2866 if (!xdf_isopen(vdp, part)) in xdf_write()
2869 if (cmlb_partinfo(vdp->xdf_vd_lbl, part, &p_blkcnt, in xdf_write()
2873 if (uiop->uio_loffset >= XB_DTOB(p_blkcnt, vdp)) in xdf_write()
2886 xdf_t *vdp; in xdf_aread() local
2893 if ((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) in xdf_aread()
2897 if (!xdf_isopen(vdp, part)) in xdf_aread()
2900 if (cmlb_partinfo(vdp->xdf_vd_lbl, part, &p_blkcnt, in xdf_aread()
2904 if (uiop->uio_loffset >= XB_DTOB(p_blkcnt, vdp)) in xdf_aread()
2917 xdf_t *vdp; in xdf_awrite() local
2924 if ((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) in xdf_awrite()
2928 if (!xdf_isopen(vdp, part)) in xdf_awrite()
2931 if (cmlb_partinfo(vdp->xdf_vd_lbl, part, &p_blkcnt, in xdf_awrite()
2935 if (uiop->uio_loffset >= XB_DTOB(p_blkcnt, vdp)) in xdf_awrite()
2948 xdf_t *vdp; in xdf_dump() local
2955 if ((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) in xdf_dump()
2959 vdp->xdf_addr, (void *)addr, blkno, nblk)); in xdf_dump()
2962 ASSERT(curthread != vdp->xdf_oe_change_thread); in xdf_dump()
2965 if (!xdf_isopen(vdp, part)) in xdf_dump()
2968 if (cmlb_partinfo(vdp->xdf_vd_lbl, part, &p_blkcnt, &p_blkst, in xdf_dump()
2973 (p_blkcnt * (vdp->xdf_xdev_secsize / XB_BSIZE))) { in xdf_dump()
2975 vdp->xdf_addr, (daddr_t)((blkno + nblk) / in xdf_dump()
2976 (vdp->xdf_xdev_secsize / XB_BSIZE)), (uint64_t)p_blkcnt); in xdf_dump()
2988 mutex_enter(&vdp->xdf_dev_lk); in xdf_dump()
2989 xdf_bp_push(vdp, dbp); in xdf_dump()
2990 mutex_exit(&vdp->xdf_dev_lk); in xdf_dump()
2991 xdf_io_start(vdp); in xdf_dump()
2992 err = xdf_ring_drain(vdp); in xdf_dump()
3002 xdf_t *vdp; in xdf_close() local
3007 if ((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) in xdf_close()
3010 mutex_enter(&vdp->xdf_dev_lk); in xdf_close()
3012 if (!xdf_isopen(vdp, part)) { in xdf_close()
3013 mutex_exit(&vdp->xdf_dev_lk); in xdf_close()
3018 ASSERT((vdp->xdf_vd_open[otyp] & parbit) != 0); in xdf_close()
3020 ASSERT(vdp->xdf_vd_lyropen[part] > 0); in xdf_close()
3021 if (--vdp->xdf_vd_lyropen[part] == 0) in xdf_close()
3022 vdp->xdf_vd_open[otyp] &= ~parbit; in xdf_close()
3024 vdp->xdf_vd_open[otyp] &= ~parbit; in xdf_close()
3026 vdp->xdf_vd_exclopen &= ~parbit; in xdf_close()
3028 mutex_exit(&vdp->xdf_dev_lk); in xdf_close()
3036 xdf_t *vdp; in xdf_open() local
3044 if ((vdp = ddi_get_soft_state(xdf_ssp, XDF_INST(minor))) == NULL) in xdf_open()
3049 DPRINTF(DDI_DBG, ("xdf@%s: opening\n", vdp->xdf_addr)); in xdf_open()
3052 mutex_enter(&vdp->xdf_cb_lk); in xdf_open()
3053 mutex_enter(&vdp->xdf_dev_lk); in xdf_open()
3054 if (!nodelay && (xdf_connect_locked(vdp, B_TRUE) != XD_READY)) { in xdf_open()
3055 mutex_exit(&vdp->xdf_dev_lk); in xdf_open()
3056 mutex_exit(&vdp->xdf_cb_lk); in xdf_open()
3059 mutex_exit(&vdp->xdf_cb_lk); in xdf_open()
3061 if ((flag & FWRITE) && XD_IS_RO(vdp)) { in xdf_open()
3062 mutex_exit(&vdp->xdf_dev_lk); in xdf_open()
3068 if ((vdp->xdf_vd_exclopen & parbit) || in xdf_open()
3069 ((flag & FEXCL) && xdf_isopen(vdp, part))) { in xdf_open()
3070 mutex_exit(&vdp->xdf_dev_lk); in xdf_open()
3075 firstopen = !xdf_isopen(vdp, -1); in xdf_open()
3078 vdp->xdf_vd_lyropen[part]++; in xdf_open()
3080 vdp->xdf_vd_open[otyp] |= parbit; in xdf_open()
3083 vdp->xdf_vd_exclopen |= parbit; in xdf_open()
3085 mutex_exit(&vdp->xdf_dev_lk); in xdf_open()
3089 cmlb_invalidate(vdp->xdf_vd_lbl, NULL); in xdf_open()
3100 if ((cmlb_partinfo(vdp->xdf_vd_lbl, part, &p_blkct, in xdf_open()
3113 xdf_t *vdp = (xdf_t *)ddi_get_driver_private(dip); in xdf_watch_hp_status_cb() local
3114 cv_broadcast(&vdp->xdf_hp_status_cv); in xdf_watch_hp_status_cb()
3121 xdf_t *vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip)); in xdf_prop_op() local
3134 if (vdp == NULL) in xdf_prop_op()
3138 return (cmlb_prop_op(vdp->xdf_vd_lbl, in xdf_prop_op()
3172 xdf_t *vdp; in xdf_resume() local
3175 if ((vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip))) == NULL) in xdf_resume()
3179 xen_printf("xdf@%s: xdf_resume\n", vdp->xdf_addr); in xdf_resume()
3181 mutex_enter(&vdp->xdf_cb_lk); in xdf_resume()
3184 mutex_exit(&vdp->xdf_cb_lk); in xdf_resume()
3191 mutex_exit(&vdp->xdf_cb_lk); in xdf_resume()
3195 mutex_enter(&vdp->xdf_dev_lk); in xdf_resume()
3196 ASSERT(vdp->xdf_state != XD_READY); in xdf_resume()
3197 xdf_set_state(vdp, XD_UNKNOWN); in xdf_resume()
3198 mutex_exit(&vdp->xdf_dev_lk); in xdf_resume()
3200 if (xdf_setstate_init(vdp) != DDI_SUCCESS) { in xdf_resume()
3201 mutex_exit(&vdp->xdf_cb_lk); in xdf_resume()
3205 mutex_exit(&vdp->xdf_cb_lk); in xdf_resume()
3208 xen_printf("xdf@%s: xdf_resume: done\n", vdp->xdf_addr); in xdf_resume()
3212 xen_printf("xdf@%s: xdf_resume: fail\n", vdp->xdf_addr); in xdf_resume()
3222 xdf_t *vdp; in xdf_attach() local
3276 vdp = ddi_get_soft_state(xdf_ssp, instance); in xdf_attach()
3277 ddi_set_driver_private(dip, vdp); in xdf_attach()
3278 vdp->xdf_dip = dip; in xdf_attach()
3279 vdp->xdf_addr = ddi_get_name_addr(dip); in xdf_attach()
3280 vdp->xdf_suspending = B_FALSE; in xdf_attach()
3281 vdp->xdf_media_req_supported = B_FALSE; in xdf_attach()
3282 vdp->xdf_peer = INVALID_DOMID; in xdf_attach()
3283 vdp->xdf_evtchn = INVALID_EVTCHN; in xdf_attach()
3284 list_create(&vdp->xdf_vreq_act, sizeof (v_req_t), in xdf_attach()
3286 cv_init(&vdp->xdf_dev_cv, NULL, CV_DEFAULT, NULL); in xdf_attach()
3287 cv_init(&vdp->xdf_hp_status_cv, NULL, CV_DEFAULT, NULL); in xdf_attach()
3288 cv_init(&vdp->xdf_mstate_cv, NULL, CV_DEFAULT, NULL); in xdf_attach()
3289 mutex_init(&vdp->xdf_dev_lk, NULL, MUTEX_DRIVER, (void *)ibc); in xdf_attach()
3290 mutex_init(&vdp->xdf_cb_lk, NULL, MUTEX_DRIVER, (void *)ibc); in xdf_attach()
3291 mutex_init(&vdp->xdf_iostat_lk, NULL, MUTEX_DRIVER, (void *)ibc); in xdf_attach()
3292 vdp->xdf_cmbl_reattach = B_TRUE; in xdf_attach()
3294 vdp->xdf_dinfo |= VDISK_CDROM; in xdf_attach()
3295 vdp->xdf_mstate = DKIO_EJECTED; in xdf_attach()
3297 vdp->xdf_mstate = DKIO_NONE; in xdf_attach()
3300 if ((vdp->xdf_ready_tq = ddi_taskq_create(dip, "xdf_ready_tq", in xdf_attach()
3308 if (ddi_add_softintr(dip, DDI_SOFTINT_LOW, &vdp->xdf_softintr_id, in xdf_attach()
3309 &softibc, NULL, xdf_iorestart, (caddr_t)vdp) != DDI_SUCCESS) { in xdf_attach()
3322 xdf_synthetic_pgeom(dip, &vdp->xdf_pgeom); in xdf_attach()
3323 vdp->xdf_pgeom_fixed = B_FALSE; in xdf_attach()
3329 cmlb_alloc_handle(&vdp->xdf_vd_lbl); in xdf_attach()
3330 if (xdf_cmlb_attach(vdp) != 0) { in xdf_attach()
3340 vdp->xdf_wce = B_TRUE; in xdf_attach()
3342 mutex_enter(&vdp->xdf_cb_lk); in xdf_attach()
3346 mutex_exit(&vdp->xdf_cb_lk); in xdf_attach()
3350 if (xdf_setstate_init(vdp) != DDI_SUCCESS) { in xdf_attach()
3353 mutex_exit(&vdp->xdf_cb_lk); in xdf_attach()
3356 mutex_exit(&vdp->xdf_cb_lk); in xdf_attach()
3379 DPRINTF(DDI_DBG, ("xdf@%s: attached\n", vdp->xdf_addr)); in xdf_attach()
3383 (void) xvdi_switch_state(vdp->xdf_dip, XBT_NULL, XenbusStateClosed); in xdf_attach()
3386 if (vdp->xdf_vd_lbl != NULL) { in xdf_attach()
3387 cmlb_detach(vdp->xdf_vd_lbl, NULL); in xdf_attach()
3388 cmlb_free_handle(&vdp->xdf_vd_lbl); in xdf_attach()
3389 vdp->xdf_vd_lbl = NULL; in xdf_attach()
3391 if (vdp->xdf_softintr_id != NULL) in xdf_attach()
3392 ddi_remove_softintr(vdp->xdf_softintr_id); in xdf_attach()
3394 if (vdp->xdf_ready_tq != NULL) in xdf_attach()
3395 ddi_taskq_destroy(vdp->xdf_ready_tq); in xdf_attach()
3396 mutex_destroy(&vdp->xdf_cb_lk); in xdf_attach()
3397 mutex_destroy(&vdp->xdf_dev_lk); in xdf_attach()
3398 cv_destroy(&vdp->xdf_dev_cv); in xdf_attach()
3399 cv_destroy(&vdp->xdf_hp_status_cv); in xdf_attach()
3411 xdf_t *vdp; in xdf_suspend() local
3413 if ((vdp = ddi_get_soft_state(xdf_ssp, instance)) == NULL) in xdf_suspend()
3417 xen_printf("xdf@%s: xdf_suspend\n", vdp->xdf_addr); in xdf_suspend()
3421 mutex_enter(&vdp->xdf_cb_lk); in xdf_suspend()
3422 mutex_enter(&vdp->xdf_dev_lk); in xdf_suspend()
3424 vdp->xdf_suspending = B_TRUE; in xdf_suspend()
3425 xdf_ring_destroy(vdp); in xdf_suspend()
3426 xdf_set_state(vdp, XD_SUSPEND); in xdf_suspend()
3427 vdp->xdf_suspending = B_FALSE; in xdf_suspend()
3429 mutex_exit(&vdp->xdf_dev_lk); in xdf_suspend()
3430 mutex_exit(&vdp->xdf_cb_lk); in xdf_suspend()
3433 xen_printf("xdf@%s: xdf_suspend: done\n", vdp->xdf_addr); in xdf_suspend()
3441 xdf_t *vdp; in xdf_detach() local
3461 vdp = ddi_get_soft_state(xdf_ssp, instance); in xdf_detach()
3463 if (vdp == NULL) in xdf_detach()
3466 mutex_enter(&vdp->xdf_cb_lk); in xdf_detach()
3467 xdf_disconnect(vdp, XD_CLOSED, B_FALSE); in xdf_detach()
3468 if (vdp->xdf_state != XD_CLOSED) { in xdf_detach()
3469 mutex_exit(&vdp->xdf_cb_lk); in xdf_detach()
3472 mutex_exit(&vdp->xdf_cb_lk); in xdf_detach()
3474 ASSERT(!ISDMACBON(vdp)); in xdf_detach()
3480 if (vdp->xdf_timeout_id != 0) in xdf_detach()
3481 (void) untimeout(vdp->xdf_timeout_id); in xdf_detach()
3484 ddi_taskq_destroy(vdp->xdf_ready_tq); in xdf_detach()
3486 cmlb_detach(vdp->xdf_vd_lbl, NULL); in xdf_detach()
3487 cmlb_free_handle(&vdp->xdf_vd_lbl); in xdf_detach()
3494 list_destroy(&vdp->xdf_vreq_act); in xdf_detach()
3497 ddi_remove_softintr(vdp->xdf_softintr_id); in xdf_detach()
3500 cv_destroy(&vdp->xdf_dev_cv); in xdf_detach()
3501 mutex_destroy(&vdp->xdf_cb_lk); in xdf_detach()
3502 mutex_destroy(&vdp->xdf_dev_lk); in xdf_detach()
3503 if (vdp->xdf_cache_flush_block != NULL) in xdf_detach()
3504 kmem_free(vdp->xdf_flush_mem, 2 * vdp->xdf_xdev_secsize); in xdf_detach()