diff options
author | jimharris <jimharris@FreeBSD.org> | 2013-04-12 17:48:45 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2013-04-12 17:48:45 +0000 |
commit | 72eb2cf9e36619cc7b1dcbf99fd83a5cbf8d0ca4 (patch) | |
tree | 56772b7cdcea64177bec77fa37bcba9791b6ba4a | |
parent | 3b35b1fc99f4811a83934c659912d37fecc7483f (diff) | |
download | FreeBSD-src-72eb2cf9e36619cc7b1dcbf99fd83a5cbf8d0ca4.zip FreeBSD-src-72eb2cf9e36619cc7b1dcbf99fd83a5cbf8d0ca4.tar.gz |
Move the busdma mapping functions to nvme_qpair.c.
This removes nvme_uio.c completely.
Sponsored by: Intel
-rw-r--r-- | sys/dev/nvme/nvme.c | 37 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_private.h | 4 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_qpair.c | 45 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_uio.c | 43 | ||||
-rw-r--r-- | sys/modules/nvme/Makefile | 1 |
5 files changed, 45 insertions, 85 deletions
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 616b84c..bd8c897 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -229,43 +229,6 @@ nvme_dump_completion(struct nvme_completion *cpl) cpl->status.m, cpl->status.dnr); } -void -nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - struct nvme_tracker *tr = arg; - uint32_t cur_nseg; - - /* - * If the mapping operation failed, return immediately. The caller - * is responsible for detecting the error status and failing the - * tracker manually. - */ - if (error != 0) - return; - - /* - * Note that we specified PAGE_SIZE for alignment and max - * segment size when creating the bus dma tags. So here - * we can safely just transfer each segment to its - * associated PRP entry. - */ - tr->req->cmd.prp1 = seg[0].ds_addr; - - if (nseg == 2) { - tr->req->cmd.prp2 = seg[1].ds_addr; - } else if (nseg > 2) { - cur_nseg = 1; - tr->req->cmd.prp2 = (uint64_t)tr->prp_bus_addr; - while (cur_nseg < nseg) { - tr->prp[cur_nseg-1] = - (uint64_t)seg[cur_nseg].ds_addr; - cur_nseg++; - } - } - - nvme_qpair_submit_tracker(tr->qpair, tr); -} - static int nvme_attach(device_t dev) { diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index c78b1ea..12d8691 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -429,10 +429,6 @@ void nvme_ctrlr_cmd_set_async_event_config(struct nvme_controller *ctrlr, void nvme_ctrlr_cmd_abort(struct nvme_controller *ctrlr, uint16_t cid, uint16_t sqid, nvme_cb_fn_t cb_fn, void *cb_arg); -void nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, - int error); -void nvme_payload_map_uio(void *arg, bus_dma_segment_t *seg, int nseg, - bus_size_t mapsize, int error); void nvme_completion_poll_cb(void *arg, const struct nvme_completion *cpl); int nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev); diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 9a73bd2..b9bc027 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -699,6 +699,51 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) } static void +nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) +{ + struct nvme_tracker *tr = arg; + uint32_t cur_nseg; + + /* + * If the mapping operation failed, return immediately. The caller + * is responsible for detecting the error status and failing the + * tracker manually. + */ + if (error != 0) + return; + + /* + * Note that we specified PAGE_SIZE for alignment and max + * segment size when creating the bus dma tags. So here + * we can safely just transfer each segment to its + * associated PRP entry. + */ + tr->req->cmd.prp1 = seg[0].ds_addr; + + if (nseg == 2) { + tr->req->cmd.prp2 = seg[1].ds_addr; + } else if (nseg > 2) { + cur_nseg = 1; + tr->req->cmd.prp2 = (uint64_t)tr->prp_bus_addr; + while (cur_nseg < nseg) { + tr->prp[cur_nseg-1] = + (uint64_t)seg[cur_nseg].ds_addr; + cur_nseg++; + } + } + + nvme_qpair_submit_tracker(tr->qpair, tr); +} + +static void +nvme_payload_map_uio(void *arg, bus_dma_segment_t *seg, int nseg, + bus_size_t mapsize, int error) +{ + + nvme_payload_map(arg, seg, nseg, error); +} + +static void _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) { struct nvme_tracker *tr; diff --git a/sys/dev/nvme/nvme_uio.c b/sys/dev/nvme/nvme_uio.c deleted file mode 100644 index 08f7c6f..0000000 --- a/sys/dev/nvme/nvme_uio.c +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (C) 2012 Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/proc.h> -#include <sys/uio.h> - -#include "nvme_private.h" - -void -nvme_payload_map_uio(void *arg, bus_dma_segment_t *seg, int nseg, - bus_size_t mapsize, int error) -{ - - nvme_payload_map(arg, seg, nseg, error); -} diff --git a/sys/modules/nvme/Makefile b/sys/modules/nvme/Makefile index 8c1210a..17004bc 100644 --- a/sys/modules/nvme/Makefile +++ b/sys/modules/nvme/Makefile @@ -12,7 +12,6 @@ SRCS = nvme.c \ nvme_qpair.c \ nvme_sysctl.c \ nvme_test.c \ - nvme_uio.c \ \ bus_if.h \ device_if.h \ |