Lines Matching refs:sassc

136 static void mprsas_send_smpcmd(struct mprsas_softc *sassc, union ccb *ccb,
138 static void mprsas_action_smpio(struct mprsas_softc *sassc, union ccb *ccb);
141 mprsas_find_target_by_handle(struct mprsas_softc *sassc, int start, in mprsas_find_target_by_handle() argument
147 for (i = start; i < sassc->maxtargets; i++) { in mprsas_find_target_by_handle()
148 target = &sassc->targets[i]; in mprsas_find_target_by_handle()
164 mprsas_startup_increment(struct mprsas_softc *sassc) in mprsas_startup_increment() argument
166 MPR_FUNCTRACE(sassc->sc); in mprsas_startup_increment()
168 if ((sassc->flags & MPRSAS_IN_STARTUP) != 0) { in mprsas_startup_increment()
169 if (sassc->startup_refcount++ == 0) { in mprsas_startup_increment()
171 mpr_dprint(sassc->sc, MPR_INIT, in mprsas_startup_increment()
174 xpt_freeze_simq(sassc->sim, 1); in mprsas_startup_increment()
176 mpr_dprint(sassc->sc, MPR_INIT, "%s refcount %u\n", __func__, in mprsas_startup_increment()
177 sassc->startup_refcount); in mprsas_startup_increment()
182 mprsas_release_simq_reinit(struct mprsas_softc *sassc) in mprsas_release_simq_reinit() argument
184 if (sassc->flags & MPRSAS_QUEUE_FROZEN) { in mprsas_release_simq_reinit()
185 sassc->flags &= ~MPRSAS_QUEUE_FROZEN; in mprsas_release_simq_reinit()
186 xpt_release_simq(sassc->sim, 1); in mprsas_release_simq_reinit()
187 mpr_dprint(sassc->sc, MPR_INFO, "Unfreezing SIM queue\n"); in mprsas_release_simq_reinit()
192 mprsas_startup_decrement(struct mprsas_softc *sassc) in mprsas_startup_decrement() argument
194 MPR_FUNCTRACE(sassc->sc); in mprsas_startup_decrement()
196 if ((sassc->flags & MPRSAS_IN_STARTUP) != 0) { in mprsas_startup_decrement()
197 if (--sassc->startup_refcount == 0) { in mprsas_startup_decrement()
201 mpr_dprint(sassc->sc, MPR_INIT, in mprsas_startup_decrement()
203 sassc->flags &= ~MPRSAS_IN_STARTUP; in mprsas_startup_decrement()
204 xpt_release_simq(sassc->sim, 1); in mprsas_startup_decrement()
207 mpr_dprint(sassc->sc, MPR_INIT, "%s refcount %u\n", __func__, in mprsas_startup_decrement()
208 sassc->startup_refcount); in mprsas_startup_decrement()
264 struct mprsas_softc *sassc = sc->sassc; in mprsas_rescan_target() local
270 pathid = cam_sim_path(sassc->sim); in mprsas_rescan_target()
274 targetid = targ - sassc->targets; in mprsas_rescan_target()
328 cam_sim_name(cm->cm_sc->sassc->sim), in mprsas_log_command()
329 cam_sim_unit(cm->cm_sc->sassc->sim), in mprsas_log_command()
330 cam_sim_bus(cm->cm_sc->sassc->sim), in mprsas_log_command()
412 mprsas_prepare_remove_retry(struct mprsas_softc *sassc) in mprsas_prepare_remove_retry() argument
417 if ((sassc->flags & MPRSAS_TOREMOVE) == 0) in mprsas_prepare_remove_retry()
420 for (i = 0; i < sassc->maxtargets; i++) { in mprsas_prepare_remove_retry()
421 target = &sassc->targets[i]; in mprsas_prepare_remove_retry()
424 if (TAILQ_EMPTY(&sassc->sc->high_priority_req_list)) in mprsas_prepare_remove_retry()
428 mprsas_prepare_volume_remove(sassc, target->handle); in mprsas_prepare_remove_retry()
430 mprsas_prepare_remove(sassc, target->handle); in mprsas_prepare_remove_retry()
432 sassc->flags &= ~MPRSAS_TOREMOVE; in mprsas_prepare_remove_retry()
440 mprsas_prepare_volume_remove(struct mprsas_softc *sassc, uint16_t handle) in mprsas_prepare_volume_remove() argument
447 MPR_FUNCTRACE(sassc->sc); in mprsas_prepare_volume_remove()
448 sc = sassc->sc; in mprsas_prepare_volume_remove()
450 targ = mprsas_find_target_by_handle(sassc, 0, handle); in mprsas_prepare_volume_remove()
464 sassc->flags |= MPRSAS_TOREMOVE; in mprsas_prepare_volume_remove()
505 mprsas_prepare_remove(struct mprsas_softc *sassc, uint16_t handle) in mprsas_prepare_remove() argument
512 MPR_FUNCTRACE(sassc->sc); in mprsas_prepare_remove()
514 sc = sassc->sc; in mprsas_prepare_remove()
516 targ = mprsas_find_target_by_handle(sassc, 0, handle); in mprsas_prepare_remove()
530 sassc->flags |= MPRSAS_TOREMOVE; in mprsas_prepare_remove()
743 &sc->sassc->mprsas_eh); in mprsas_register_events()
751 struct mprsas_softc *sassc; in mpr_attach_sas() local
758 sassc = malloc(sizeof(struct mprsas_softc), M_MPR, M_WAITOK|M_ZERO); in mpr_attach_sas()
766 sassc->maxtargets = sc->facts->MaxTargets + sc->facts->MaxVolumes; in mpr_attach_sas()
767 sassc->targets = malloc(sizeof(struct mprsas_target) * in mpr_attach_sas()
768 sassc->maxtargets, M_MPR, M_WAITOK|M_ZERO); in mpr_attach_sas()
769 sc->sassc = sassc; in mpr_attach_sas()
770 sassc->sc = sc; in mpr_attach_sas()
773 if ((sassc->devq = cam_simq_alloc(reqs)) == NULL) { in mpr_attach_sas()
780 sassc->sim = cam_sim_alloc(mprsas_action, mprsas_poll, "mpr", sassc, in mpr_attach_sas()
781 unit, &sc->mpr_mtx, reqs, reqs, sassc->devq); in mpr_attach_sas()
782 if (sassc->sim == NULL) { in mpr_attach_sas()
788 TAILQ_INIT(&sassc->ev_queue); in mpr_attach_sas()
791 TASK_INIT(&sassc->ev_task, 0, mprsas_firmware_event_work, sc); in mpr_attach_sas()
792 sassc->ev_tq = taskqueue_create("mpr_taskq", M_NOWAIT | M_ZERO, in mpr_attach_sas()
793 taskqueue_thread_enqueue, &sassc->ev_tq); in mpr_attach_sas()
794 taskqueue_start_threads(&sassc->ev_tq, 1, PRIBIO, "%s taskq", in mpr_attach_sas()
804 if ((error = xpt_bus_register(sassc->sim, sc->mpr_dev, 0)) != 0) { in mpr_attach_sas()
816 sassc->flags |= MPRSAS_IN_STARTUP | MPRSAS_IN_DISCOVERY; in mpr_attach_sas()
817 sc->sassc->startup_refcount = 0; in mpr_attach_sas()
818 mprsas_startup_increment(sassc); in mpr_attach_sas()
826 status = xpt_create_path(&sassc->path, /*periph*/NULL, in mpr_attach_sas()
827 cam_sim_path(sc->sassc->sim), CAM_TARGET_WILDCARD, in mpr_attach_sas()
832 sassc->path = NULL; in mpr_attach_sas()
838 sassc->path); in mpr_attach_sas()
844 xpt_free_path(sassc->path); in mpr_attach_sas()
845 sassc->path = NULL; in mpr_attach_sas()
868 struct mprsas_softc *sassc; in mpr_detach_sas() local
875 if (sc->sassc == NULL) in mpr_detach_sas()
878 sassc = sc->sassc; in mpr_detach_sas()
879 mpr_deregister_events(sc, sassc->mprsas_eh); in mpr_detach_sas()
886 if (sassc->ev_tq != NULL) in mpr_detach_sas()
887 taskqueue_free(sassc->ev_tq); in mpr_detach_sas()
890 if (sassc->path != NULL) { in mpr_detach_sas()
891 xpt_register_async(0, mprsas_async, sc, sassc->path); in mpr_detach_sas()
892 xpt_free_path(sassc->path); in mpr_detach_sas()
893 sassc->path = NULL; in mpr_detach_sas()
899 while (sassc->startup_refcount != 0) in mpr_detach_sas()
900 mprsas_startup_decrement(sassc); in mpr_detach_sas()
902 if (sassc->flags & MPRSAS_IN_STARTUP) in mpr_detach_sas()
903 xpt_release_simq(sassc->sim, 1); in mpr_detach_sas()
905 if (sassc->sim != NULL) { in mpr_detach_sas()
906 xpt_bus_deregister(cam_sim_path(sassc->sim)); in mpr_detach_sas()
907 cam_sim_free(sassc->sim, FALSE); in mpr_detach_sas()
912 if (sassc->devq != NULL) in mpr_detach_sas()
913 cam_simq_free(sassc->devq); in mpr_detach_sas()
915 for (i = 0; i < sassc->maxtargets; i++) { in mpr_detach_sas()
916 targ = &sassc->targets[i]; in mpr_detach_sas()
921 free(sassc->targets, M_MPR); in mpr_detach_sas()
922 free(sassc, M_MPR); in mpr_detach_sas()
923 sc->sassc = NULL; in mpr_detach_sas()
929 mprsas_discovery_end(struct mprsas_softc *sassc) in mprsas_discovery_end() argument
931 struct mpr_softc *sc = sassc->sc; in mprsas_discovery_end()
959 struct mprsas_softc *sassc; in mprsas_action() local
961 sassc = cam_sim_softc(sim); in mprsas_action()
963 MPR_FUNCTRACE(sassc->sc); in mprsas_action()
964 mpr_dprint(sassc->sc, MPR_TRACE, "ccb func_code 0x%x\n", in mprsas_action()
966 mtx_assert(&sassc->sc->mpr_mtx, MA_OWNED); in mprsas_action()
972 struct mpr_softc *sc = sassc->sc; in mprsas_action()
979 cpi->max_target = sassc->maxtargets - 1; in mprsas_action()
986 cpi->initiator_id = sassc->maxtargets; in mprsas_action()
1016 KASSERT(cts->ccb_h.target_id < sassc->maxtargets, in mprsas_action()
1019 targ = &sassc->targets[cts->ccb_h.target_id]; in mprsas_action()
1059 mpr_dprint(sassc->sc, MPR_XINFO, "mprsas_action " in mprsas_action()
1061 mprsas_action_resetdev(sassc, ccb); in mprsas_action()
1066 mpr_dprint(sassc->sc, MPR_XINFO, "mprsas_action faking success " in mprsas_action()
1071 mprsas_action_scsiio(sassc, ccb); in mprsas_action()
1074 mprsas_action_smpio(sassc, ccb); in mprsas_action()
1088 path_id_t path_id = cam_sim_path(sc->sassc->sim); in mprsas_announce_reset()
1174 sc->sassc->flags |= MPRSAS_IN_STARTUP; in mprsas_handle_reinit()
1175 sc->sassc->flags |= MPRSAS_IN_DISCOVERY; in mprsas_handle_reinit()
1176 mprsas_startup_increment(sc->sassc); in mprsas_handle_reinit()
1186 __func__, sc->sassc->startup_refcount); in mprsas_handle_reinit()
1192 for (i = 0; i < sc->sassc->maxtargets; i++) { in mprsas_handle_reinit()
1193 if (sc->sassc->targets[i].outstanding != 0) in mprsas_handle_reinit()
1195 i, sc->sassc->targets[i].outstanding); in mprsas_handle_reinit()
1196 sc->sassc->targets[i].handle = 0x0; in mprsas_handle_reinit()
1197 sc->sassc->targets[i].exp_dev_handle = 0x0; in mprsas_handle_reinit()
1198 sc->sassc->targets[i].outstanding = 0; in mprsas_handle_reinit()
1199 sc->sassc->targets[i].flags = MPRSAS_TARGET_INDIAGRESET; in mprsas_handle_reinit()
1840 mprsas_action_scsiio(struct mprsas_softc *sassc, union ccb *ccb) in mprsas_action_scsiio() argument
1853 sc = sassc->sc; in mprsas_action_scsiio()
1858 KASSERT(csio->ccb_h.target_id < sassc->maxtargets, in mprsas_action_scsiio()
1861 targ = &sassc->targets[csio->ccb_h.target_id]; in mprsas_action_scsiio()
1941 if ((sassc->flags & MPRSAS_QUEUE_FROZEN) == 0) { in mprsas_action_scsiio()
1942 xpt_freeze_simq(sassc->sim, 1); in mprsas_action_scsiio()
1943 sassc->flags |= MPRSAS_QUEUE_FROZEN; in mprsas_action_scsiio()
2420 struct mprsas_softc *sassc; in mprsas_scsiio_complete() local
2433 sassc = sc->sassc; in mprsas_scsiio_complete()
2517 if ((sassc->flags & MPRSAS_QUEUE_FROZEN) == 0) { in mprsas_scsiio_complete()
2518 xpt_freeze_simq(sassc->sim, 1); in mprsas_scsiio_complete()
2519 sassc->flags |= MPRSAS_QUEUE_FROZEN; in mprsas_scsiio_complete()
2553 if (sassc->flags & MPRSAS_QUEUE_FROZEN) { in mprsas_scsiio_complete()
2555 sassc->flags &= ~MPRSAS_QUEUE_FROZEN; in mprsas_scsiio_complete()
2580 target = &sassc->targets[target_id]; in mprsas_scsiio_complete()
2713 target = &sassc->targets[target_id]; in mprsas_scsiio_complete()
2821 if (sassc->flags & MPRSAS_QUEUE_FROZEN) { in mprsas_scsiio_complete()
2823 sassc->flags &= ~MPRSAS_QUEUE_FROZEN; in mprsas_scsiio_complete()
2918 mprsas_send_smpcmd(struct mprsas_softc *sassc, union ccb *ccb, uint64_t sasaddr) in mprsas_send_smpcmd() argument
2926 sc = sassc->sc; in mprsas_send_smpcmd()
3086 mprsas_action_smpio(struct mprsas_softc *sassc, union ccb *ccb) in mprsas_action_smpio() argument
3092 sc = sassc->sc; in mprsas_action_smpio()
3097 KASSERT(ccb->ccb_h.target_id < sassc->maxtargets, in mprsas_action_smpio()
3099 targ = &sassc->targets[ccb->ccb_h.target_id]; in mprsas_action_smpio()
3155 parent_target = mprsas_find_target_by_handle(sassc, 0, in mprsas_action_smpio()
3202 mprsas_send_smpcmd(sassc, ccb, sasaddr); in mprsas_action_smpio()
3212 mprsas_action_resetdev(struct mprsas_softc *sassc, union ccb *ccb) in mprsas_action_resetdev() argument
3219 MPR_FUNCTRACE(sassc->sc); in mprsas_action_resetdev()
3220 mtx_assert(&sassc->sc->mpr_mtx, MA_OWNED); in mprsas_action_resetdev()
3222 KASSERT(ccb->ccb_h.target_id < sassc->maxtargets, ("Target %d out of " in mprsas_action_resetdev()
3224 sc = sassc->sc; in mprsas_action_resetdev()
3234 targ = &sassc->targets[ccb->ccb_h.target_id]; in mprsas_action_resetdev()
3309 struct mprsas_softc *sassc; in mprsas_poll() local
3311 sassc = cam_sim_softc(sim); in mprsas_poll()
3313 if (sassc->sc->mpr_debug & MPR_TRACE) { in mprsas_poll()
3317 mpr_dprint(sassc->sc, MPR_XINFO, "%s clearing MPR_TRACE\n", in mprsas_poll()
3319 sassc->sc->mpr_debug &= ~MPR_TRACE; in mprsas_poll()
3322 mpr_intr_locked(sassc->sc); in mprsas_poll()
3337 struct mprsas_softc *sassc; in mprsas_async() local
3348 sassc = sc->sassc; in mprsas_async()
3359 KASSERT(xpt_path_target_id(path) < sassc->maxtargets, in mprsas_async()
3362 target = &sassc->targets[xpt_path_target_id(path)]; in mprsas_async()
3447 path_id = cam_sim_path(sc->sassc->sim); in mprsas_prepare_for_tm()
3508 struct mprsas_softc *sassc; in mprsas_portenable_complete() local
3511 sassc = sc->sassc; in mprsas_portenable_complete()
3539 mprsas_startup_decrement(sassc); in mprsas_portenable_complete()
3543 mprsas_check_id(struct mprsas_softc *sassc, int id) in mprsas_check_id() argument
3545 struct mpr_softc *sc = sassc->sc; in mprsas_check_id()
3563 struct mprsas_softc *sassc; in mprsas_realloc_targets() local
3568 sassc = sc->sassc; in mprsas_realloc_targets()
3575 targ = &sassc->targets[i]; in mprsas_realloc_targets()
3580 free(sassc->targets, M_MPR); in mprsas_realloc_targets()
3582 sassc->targets = malloc(sizeof(struct mprsas_target) * maxtargets, in mprsas_realloc_targets()