Lines Matching refs:cm
223 typedef void mpr_command_callback_t(struct mpr_softc *, struct mpr_command *cm);
614 mpr_free_command(struct mpr_softc *sc, struct mpr_command *cm) in mpr_free_command() argument
619 KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, in mpr_free_command()
620 ("state not busy, state = %u\n", cm->cm_state)); in mpr_free_command()
622 if (cm->cm_reply != NULL) in mpr_free_command()
623 mpr_free_reply(sc, cm->cm_reply_data); in mpr_free_command()
624 cm->cm_reply = NULL; in mpr_free_command()
625 cm->cm_flags = 0; in mpr_free_command()
626 cm->cm_complete = NULL; in mpr_free_command()
627 cm->cm_complete_data = NULL; in mpr_free_command()
628 cm->cm_ccb = NULL; in mpr_free_command()
629 cm->cm_targ = NULL; in mpr_free_command()
630 cm->cm_max_segs = 0; in mpr_free_command()
631 cm->cm_lun = 0; in mpr_free_command()
632 cm->cm_state = MPR_CM_STATE_FREE; in mpr_free_command()
633 cm->cm_data = NULL; in mpr_free_command()
634 cm->cm_length = 0; in mpr_free_command()
635 cm->cm_out_len = 0; in mpr_free_command()
636 cm->cm_sglsize = 0; in mpr_free_command()
637 cm->cm_sge = NULL; in mpr_free_command()
639 TAILQ_FOREACH_SAFE(chain, &cm->cm_chain_list, chain_link, chain_temp) { in mpr_free_command()
640 TAILQ_REMOVE(&cm->cm_chain_list, chain, chain_link); in mpr_free_command()
643 TAILQ_FOREACH_SAFE(prp_page, &cm->cm_prp_page_list, prp_page_link, in mpr_free_command()
645 TAILQ_REMOVE(&cm->cm_prp_page_list, prp_page, prp_page_link); in mpr_free_command()
648 TAILQ_INSERT_TAIL(&sc->req_list, cm, cm_link); in mpr_free_command()
654 struct mpr_command *cm; in mpr_alloc_command() local
656 cm = TAILQ_FIRST(&sc->req_list); in mpr_alloc_command()
657 if (cm == NULL) in mpr_alloc_command()
660 KASSERT(cm->cm_state == MPR_CM_STATE_FREE, in mpr_alloc_command()
661 ("mpr: Allocating busy command, state = %u\n", cm->cm_state)); in mpr_alloc_command()
663 TAILQ_REMOVE(&sc->req_list, cm, cm_link); in mpr_alloc_command()
664 cm->cm_state = MPR_CM_STATE_BUSY; in mpr_alloc_command()
665 cm->cm_timeout_handler = NULL; in mpr_alloc_command()
666 return (cm); in mpr_alloc_command()
672 mpr_free_high_priority_command(struct mpr_softc *sc, struct mpr_command *cm) in mpr_free_high_priority_command() argument
676 KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, in mpr_free_high_priority_command()
677 ("state not busy, state = %u\n", cm->cm_state)); in mpr_free_high_priority_command()
679 if (cm->cm_reply != NULL) in mpr_free_high_priority_command()
680 mpr_free_reply(sc, cm->cm_reply_data); in mpr_free_high_priority_command()
681 cm->cm_reply = NULL; in mpr_free_high_priority_command()
682 cm->cm_flags = 0; in mpr_free_high_priority_command()
683 cm->cm_complete = NULL; in mpr_free_high_priority_command()
684 cm->cm_complete_data = NULL; in mpr_free_high_priority_command()
685 cm->cm_ccb = NULL; in mpr_free_high_priority_command()
686 cm->cm_targ = NULL; in mpr_free_high_priority_command()
687 cm->cm_lun = 0; in mpr_free_high_priority_command()
688 cm->cm_state = MPR_CM_STATE_FREE; in mpr_free_high_priority_command()
689 TAILQ_FOREACH_SAFE(chain, &cm->cm_chain_list, chain_link, chain_temp) { in mpr_free_high_priority_command()
690 TAILQ_REMOVE(&cm->cm_chain_list, chain, chain_link); in mpr_free_high_priority_command()
693 TAILQ_INSERT_TAIL(&sc->high_priority_req_list, cm, cm_link); in mpr_free_high_priority_command()
702 struct mpr_command *cm; in mpr_alloc_high_priority_command() local
704 cm = TAILQ_FIRST(&sc->high_priority_req_list); in mpr_alloc_high_priority_command()
705 if (cm == NULL) in mpr_alloc_high_priority_command()
708 KASSERT(cm->cm_state == MPR_CM_STATE_FREE, in mpr_alloc_high_priority_command()
709 ("mpr: Allocating busy command, state = %u\n", cm->cm_state)); in mpr_alloc_high_priority_command()
711 TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); in mpr_alloc_high_priority_command()
712 cm->cm_state = MPR_CM_STATE_BUSY; in mpr_alloc_high_priority_command()
713 cm->cm_timeout_handler = NULL; in mpr_alloc_high_priority_command()
714 cm->cm_desc.HighPriority.RequestFlags = in mpr_alloc_high_priority_command()
716 return (cm); in mpr_alloc_high_priority_command()
826 void mpr_build_nvme_prp(struct mpr_softc *sc, struct mpr_command *cm,
838 void mpr_init_sge(struct mpr_command *cm, void *req, void *sge);
844 int mpr_map_command(struct mpr_softc *sc, struct mpr_command *cm);
845 int mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cm, int timeout,
847 int mpr_request_polled(struct mpr_softc *sc, struct mpr_command **cm);