summaryrefslogtreecommitdiffstats
path: root/sys/dev/nvme/nvme_private.h
diff options
context:
space:
mode:
authorjimharris <jimharris@FreeBSD.org>2012-10-18 00:40:40 +0000
committerjimharris <jimharris@FreeBSD.org>2012-10-18 00:40:40 +0000
commit9becceac55c4255e0e79ae97f5b86b3c6f689cfc (patch)
tree373ef04b4408aaa99c6b09bb07639ef4b35324ac /sys/dev/nvme/nvme_private.h
parentc9e224f9c92699211c2ddfe2284967950e341d37 (diff)
downloadFreeBSD-src-9becceac55c4255e0e79ae97f5b86b3c6f689cfc.zip
FreeBSD-src-9becceac55c4255e0e79ae97f5b86b3c6f689cfc.tar.gz
Cleanup uio-related code to use struct nvme_request and
nvme_ctrlr_submit_io_request(). While here, also fix case where a uio may have more than 1 iovec. NVMe's definition of SGEs (called PRPs) only allows for the first SGE to start on a non-page boundary. The simplest way to handle this is to construct a temporary uio for each iovec, and submit an NVMe request for each. Sponsored by: Intel
Diffstat (limited to 'sys/dev/nvme/nvme_private.h')
-rw-r--r--sys/dev/nvme/nvme_private.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
index 3ad1d67..e91509b 100644
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -101,6 +101,7 @@ struct nvme_request {
struct nvme_command cmd;
void *payload;
uint32_t payload_size;
+ struct uio *uio;
nvme_cb_fn_t cb_fn;
void *cb_arg;
SLIST_ENTRY(nvme_request) slist;
@@ -333,6 +334,8 @@ void nvme_ctrlr_cmd_asynchronous_event_request(struct nvme_controller *ctrlr,
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);
int nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev);
int nvme_ctrlr_reset(struct nvme_controller *ctrlr);
@@ -392,6 +395,22 @@ nvme_allocate_request(void *payload, uint32_t payload_size, nvme_cb_fn_t cb_fn,
return (req);
}
+static __inline struct nvme_request *
+nvme_allocate_request_uio(struct uio *uio, nvme_cb_fn_t cb_fn, void *cb_arg)
+{
+ struct nvme_request *req;
+
+ req = uma_zalloc(nvme_request_zone, M_NOWAIT | M_ZERO);
+ if (req == NULL)
+ return (NULL);
+
+ req->uio = uio;
+ req->cb_fn = cb_fn;
+ req->cb_arg = cb_arg;
+
+ return (req);
+}
+
#define nvme_free_request(req) uma_zfree(nvme_request_zone, req)
#endif /* __NVME_PRIVATE_H__ */
OpenPOWER on IntegriCloud