diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c --- a/sys/dev/mpi3mr/mpi3mr.c +++ b/sys/dev/mpi3mr/mpi3mr.c @@ -624,7 +624,7 @@ } bzero(op_reply_q->q_base, op_reply_q->qsz); bus_dmamap_load(op_reply_q->q_base_tag, op_reply_q->q_base_dmamap, op_reply_q->q_base, op_reply_q->qsz, - mpi3mr_memaddr_cb, &op_reply_q->q_base_phys, 0); + mpi3mr_memaddr_cb, &op_reply_q->q_base_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Operational Reply queue ID: %d phys addr= %#016jx virt_addr: %pa size= %d\n", qid, (uintmax_t)op_reply_q->q_base_phys, op_reply_q->q_base, op_reply_q->qsz); @@ -772,7 +772,7 @@ bzero(op_req_q->q_base, op_req_q->qsz); bus_dmamap_load(op_req_q->q_base_tag, op_req_q->q_base_dmamap, op_req_q->q_base, op_req_q->qsz, - mpi3mr_memaddr_cb, &op_req_q->q_base_phys, 0); + mpi3mr_memaddr_cb, &op_req_q->q_base_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Operational Request QID: %d phys addr= %#016jx virt addr= %pa size= %d associated Reply QID: %d\n", req_qid, (uintmax_t)op_req_q->q_base_phys, op_req_q->q_base, op_req_q->qsz, reply_qid); @@ -1003,7 +1003,7 @@ } bzero(sc->admin_req, sc->admin_req_q_sz); bus_dmamap_load(sc->admin_req_tag, sc->admin_req_dmamap, sc->admin_req, sc->admin_req_q_sz, - mpi3mr_memaddr_cb, &sc->admin_req_phys, 0); + mpi3mr_memaddr_cb, &sc->admin_req_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Admin Req queue phys addr= %#016jx size= %d\n", (uintmax_t)sc->admin_req_phys, sc->admin_req_q_sz); @@ -1041,7 +1041,7 @@ } bzero(sc->admin_reply, sc->admin_reply_q_sz); bus_dmamap_load(sc->admin_reply_tag, sc->admin_reply_dmamap, sc->admin_reply, sc->admin_reply_q_sz, - mpi3mr_memaddr_cb, &sc->admin_reply_phys, 0); + mpi3mr_memaddr_cb, &sc->admin_reply_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Admin Reply queue phys addr= %#016jx size= %d\n", (uintmax_t)sc->admin_reply_phys, sc->admin_req_q_sz); @@ -1459,7 +1459,7 @@ bzero(data, data_len); bus_dmamap_load(data_tag, data_map, data, data_len, - mpi3mr_memaddr_cb, &data_phys, 0); + mpi3mr_memaddr_cb, &data_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Func: %s line: %d IOCfacts data phys addr= %#016jx size= %d\n", __func__, __LINE__, (uintmax_t)data_phys, data_len); @@ -1726,7 +1726,7 @@ bzero(sc->reply_buf, sz); bus_dmamap_load(sc->reply_buf_tag, sc->reply_buf_dmamap, sc->reply_buf, sz, - mpi3mr_memaddr_cb, &sc->reply_buf_phys, 0); + mpi3mr_memaddr_cb, &sc->reply_buf_phys, BUS_DMA_NOWAIT); sc->reply_buf_dma_min_address = sc->reply_buf_phys; sc->reply_buf_dma_max_address = sc->reply_buf_phys + sz; @@ -1762,7 +1762,7 @@ bzero(sc->reply_free_q, sz); bus_dmamap_load(sc->reply_free_q_tag, sc->reply_free_q_dmamap, sc->reply_free_q, sz, - mpi3mr_memaddr_cb, &sc->reply_free_q_phys, 0); + mpi3mr_memaddr_cb, &sc->reply_free_q_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "reply_free_q (0x%p): depth(%d), frame_size(%d), " "pool_size(%d kB), reply_free_q_dma(0x%llx)\n", @@ -1796,7 +1796,7 @@ bzero(sc->sense_buf, sz); bus_dmamap_load(sc->sense_buf_tag, sc->sense_buf_dmamap, sc->sense_buf, sz, - mpi3mr_memaddr_cb, &sc->sense_buf_phys, 0); + mpi3mr_memaddr_cb, &sc->sense_buf_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "sense_buf (0x%p): depth(%d), frame_size(%d), " "pool_size(%d kB), sense_dma(0x%llx)\n", @@ -1830,7 +1830,7 @@ bzero(sc->sense_buf_q, sz); bus_dmamap_load(sc->sense_buf_q_tag, sc->sense_buf_q_dmamap, sc->sense_buf_q, sz, - mpi3mr_memaddr_cb, &sc->sense_buf_q_phys, 0); + mpi3mr_memaddr_cb, &sc->sense_buf_q_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "sense_buf_q (0x%p): depth(%d), frame_size(%d), " "pool_size(%d kB), sense_dma(0x%llx)\n", @@ -1966,7 +1966,8 @@ bzero(fw_pkg_ver, fw_pkg_ver_len); - bus_dmamap_load(fw_pkg_ver_tag, fw_pkg_ver_map, fw_pkg_ver, fw_pkg_ver_len, mpi3mr_memaddr_cb, &fw_pkg_ver_dma, 0); + bus_dmamap_load(fw_pkg_ver_tag, fw_pkg_ver_map, fw_pkg_ver, + fw_pkg_ver_len, mpi3mr_memaddr_cb, &fw_pkg_ver_dma, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Func: %s line: %d fw package version phys addr= %#016jx size= %d\n", __func__, __LINE__, (uintmax_t)fw_pkg_ver_dma, fw_pkg_ver_len); @@ -2088,7 +2089,7 @@ bzero(drvr_info, drvr_info_len); bus_dmamap_load(drvr_info_tag, drvr_info_map, drvr_info, drvr_info_len, - mpi3mr_memaddr_cb, &drvr_info_phys, 0); + mpi3mr_memaddr_cb, &drvr_info_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Func: %s line: %d IOCfacts drvr_info phys addr= %#016jx size= %d\n", __func__, __LINE__, (uintmax_t)drvr_info_phys, drvr_info_len); @@ -2505,7 +2506,7 @@ bzero(sc->chain_sgl_list[i].buf, sz); bus_dmamap_load(sc->chain_sgl_list_tag, sc->chain_sgl_list[i].buf_dmamap, sc->chain_sgl_list[i].buf, sz, - mpi3mr_memaddr_cb, &sc->chain_sgl_list[i].buf_phys, 0); + mpi3mr_memaddr_cb, &sc->chain_sgl_list[i].buf_phys, BUS_DMA_NOWAIT); mpi3mr_dprint(sc, MPI3MR_XINFO, "Func: %s line: %d phys addr= %#016jx size= %d\n", __func__, __LINE__, (uintmax_t)sc->chain_sgl_list[i].buf_phys, sz); } @@ -2582,7 +2583,7 @@ bzero(sc->pel_seq_number, sc->pel_seq_number_sz); bus_dmamap_load(sc->pel_seq_num_dmatag, sc->pel_seq_num_dmamap, sc->pel_seq_number, - sc->pel_seq_number_sz, mpi3mr_memaddr_cb, &sc->pel_seq_number_dma, 0); + sc->pel_seq_number_sz, mpi3mr_memaddr_cb, &sc->pel_seq_number_dma, BUS_DMA_NOWAIT); if (!sc->pel_seq_number) { printf(IOCNAME "%s:%d Cannot load PEL seq number dma memory for size: %d\n", sc->name, @@ -4910,12 +4911,11 @@ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXPHYS,/* maxsize */ - nsegs, /* nsegments */ - MAXPHYS,/* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - busdma_lock_mutex, /* lockfunc */ - &sc->io_lock, /* lockarg */ + BUS_SPACE_MAXSIZE, /* maxsize */ + nsegs, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ &sc->buffer_dmat); if (ret) { mpi3mr_dprint(sc, MPI3MR_ERROR, "Cannot allocate buffer DMA tag ret: %d\n", ret); @@ -5104,7 +5104,7 @@ } bzero(mem_desc->addr, mem_desc->size); bus_dmamap_load(mem_desc->tag, mem_desc->dmamap, mem_desc->addr, mem_desc->size, - mpi3mr_memaddr_cb, &mem_desc->dma_addr, 0); + mpi3mr_memaddr_cb, &mem_desc->dma_addr, BUS_DMA_NOWAIT); if (!mem_desc->addr) goto out_failed; @@ -5134,7 +5134,7 @@ } bzero(mem_desc->addr, mem_desc->size); bus_dmamap_load(mem_desc->tag, mem_desc->dmamap, mem_desc->addr, mem_desc->size, - mpi3mr_memaddr_cb, &mem_desc->dma_addr, 0); + mpi3mr_memaddr_cb, &mem_desc->dma_addr, BUS_DMA_NOWAIT); if (!mem_desc->addr) goto out_failed; @@ -5163,7 +5163,7 @@ } bzero(mem_desc->addr, mem_desc->size); bus_dmamap_load(mem_desc->tag, mem_desc->dmamap, mem_desc->addr, mem_desc->size, - mpi3mr_memaddr_cb, &mem_desc->dma_addr, 0); + mpi3mr_memaddr_cb, &mem_desc->dma_addr, BUS_DMA_NOWAIT); if (!mem_desc->addr) goto out_failed; diff --git a/sys/dev/mpi3mr/mpi3mr_app.c b/sys/dev/mpi3mr/mpi3mr_app.c --- a/sys/dev/mpi3mr/mpi3mr_app.c +++ b/sys/dev/mpi3mr/mpi3mr_app.c @@ -358,7 +358,7 @@ bzero(sc->nvme_encap_prp_list, dev_pgsz); bus_dmamap_load(sc->nvme_encap_prp_list_dmatag, sc->nvme_encap_prp_list_dma_dmamap, sc->nvme_encap_prp_list, dev_pgsz, mpi3mr_memaddr_cb, &sc->nvme_encap_prp_list_dma, - 0); + BUS_DMA_NOWAIT); if (!sc->nvme_encap_prp_list) { printf(IOCNAME "%s:%d Cannot load ioctl NVME dma memory for size: %d\n", sc->name, diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c --- a/sys/dev/mpi3mr/mpi3mr_cam.c +++ b/sys/dev/mpi3mr/mpi3mr_cam.c @@ -230,19 +230,15 @@ mtx_lock(&sc->io_lock); /* Map data buffer into bus space */ retcode = bus_dmamap_load_ccb(sc->buffer_dmat, cm->dmamap, - cm->ccb, mpi3mr_prepare_sgls, cm, 0); + cm->ccb, mpi3mr_prepare_sgls, cm, BUS_DMA_NOWAIT); mtx_unlock(&sc->io_lock); if (retcode) device_printf(sc->mpi3mr_dev, "bus_dmamap_load(): retcode = %d\n", retcode); - if (retcode == EINPROGRESS) { - device_printf(sc->mpi3mr_dev, "request load in progress\n"); - xpt_freeze_simq(sc->cam_sc->sim, 1); - } } if (cm->error_code) return cm->error_code; if (retcode) - mpi3mr_set_ccbstatus(cm->ccb, CAM_REQ_INVALID); + mpi3mr_set_ccbstatus(cm->ccb, CAM_RESRC_UNAVAIL); return (retcode); } diff --git a/sys/dev/mpi3mr/mpi3mr_pci.c b/sys/dev/mpi3mr/mpi3mr_pci.c --- a/sys/dev/mpi3mr/mpi3mr_pci.c +++ b/sys/dev/mpi3mr/mpi3mr_pci.c @@ -252,6 +252,7 @@ static int mpi3mr_setup_resources(struct mpi3mr_softc *sc) { + bus_dma_template_t t; int i; device_t dev = sc->mpi3mr_dev; @@ -274,20 +275,11 @@ sc->mpi3mr_bhandle = rman_get_bushandle(sc->mpi3mr_regs_resource); /* Allocate the parent DMA tag */ - if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsize */ - BUS_SPACE_UNRESTRICTED, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->mpi3mr_parent_dmat)) { + bus_dma_template_init(&t, bus_get_dma_tag(dev)); + if (bus_dma_template_tag(&t, &sc->mpi3mr_parent_dmat)) { mpi3mr_dprint(sc, MPI3MR_ERROR, "Cannot allocate parent DMA tag\n"); return (ENOMEM); - } + } sc->max_msix_vectors = pci_msix_count(dev);