nvme_private.h (248763) | nvme_private.h (248767) |
---|---|
1/*- 2 * Copyright (C) 2012 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (C) 2012 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/nvme/nvme_private.h 248763 2013-03-26 21:19:26Z jimharris $ | 26 * $FreeBSD: head/sys/dev/nvme/nvme_private.h 248767 2013-03-26 21:58:38Z jimharris $ |
27 */ 28 29#ifndef __NVME_PRIVATE_H__ 30#define __NVME_PRIVATE_H__ 31 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/lock.h> --- 45 unchanged lines hidden (view full) --- 80 * queues, while NVME_IO_TRACKERS defines the maximum number of I/O that we 81 * will allow outstanding on an I/O qpair at any time. The only advantage in 82 * having IO_ENTRIES > IO_TRACKERS is for debugging purposes - when dumping 83 * the contents of the submission and completion queues, it will show a longer 84 * history of data. 85 */ 86#define NVME_IO_ENTRIES (256) 87#define NVME_IO_TRACKERS (128) | 27 */ 28 29#ifndef __NVME_PRIVATE_H__ 30#define __NVME_PRIVATE_H__ 31 32#include <sys/param.h> 33#include <sys/kernel.h> 34#include <sys/lock.h> --- 45 unchanged lines hidden (view full) --- 80 * queues, while NVME_IO_TRACKERS defines the maximum number of I/O that we 81 * will allow outstanding on an I/O qpair at any time. The only advantage in 82 * having IO_ENTRIES > IO_TRACKERS is for debugging purposes - when dumping 83 * the contents of the submission and completion queues, it will show a longer 84 * history of data. 85 */ 86#define NVME_IO_ENTRIES (256) 87#define NVME_IO_TRACKERS (128) |
88#define NVME_MIN_IO_TRACKERS (16) | 88#define NVME_MIN_IO_TRACKERS (4) |
89#define NVME_MAX_IO_TRACKERS (1024) 90 91/* 92 * NVME_MAX_IO_ENTRIES is not defined, since it is specified in CC.MQES 93 * for each controller. 94 */ 95 96#define NVME_INT_COAL_TIME (0) /* disabled */ --- 17 unchanged lines hidden (view full) --- 114#endif 115 116extern uma_zone_t nvme_request_zone; 117extern int32_t nvme_retry_count; 118 119struct nvme_request { 120 121 struct nvme_command cmd; | 89#define NVME_MAX_IO_TRACKERS (1024) 90 91/* 92 * NVME_MAX_IO_ENTRIES is not defined, since it is specified in CC.MQES 93 * for each controller. 94 */ 95 96#define NVME_INT_COAL_TIME (0) /* disabled */ --- 17 unchanged lines hidden (view full) --- 114#endif 115 116extern uma_zone_t nvme_request_zone; 117extern int32_t nvme_retry_count; 118 119struct nvme_request { 120 121 struct nvme_command cmd; |
122 struct nvme_qpair *qpair; |
|
122 void *payload; 123 uint32_t payload_size; 124 boolean_t timeout; 125 struct uio *uio; 126 nvme_cb_fn_t cb_fn; 127 void *cb_arg; 128 int32_t retries; 129 STAILQ_ENTRY(nvme_request) stailq; --- 115 unchanged lines hidden (view full) --- 245 246 uint32_t num_io_queues; 247 boolean_t per_cpu_io_queues; 248 249 /* Fields for tracking progress during controller initialization. */ 250 struct intr_config_hook config_hook; 251 uint32_t ns_identified; 252 uint32_t queues_created; | 123 void *payload; 124 uint32_t payload_size; 125 boolean_t timeout; 126 struct uio *uio; 127 nvme_cb_fn_t cb_fn; 128 void *cb_arg; 129 int32_t retries; 130 STAILQ_ENTRY(nvme_request) stailq; --- 115 unchanged lines hidden (view full) --- 246 247 uint32_t num_io_queues; 248 boolean_t per_cpu_io_queues; 249 250 /* Fields for tracking progress during controller initialization. */ 251 struct intr_config_hook config_hook; 252 uint32_t ns_identified; 253 uint32_t queues_created; |
254 |
|
253 struct task reset_task; | 255 struct task reset_task; |
256 struct task fail_req_task; |
|
254 struct taskqueue *taskqueue; 255 256 /* For shared legacy interrupt. */ 257 int rid; 258 struct resource *res; 259 void *tag; 260 261 bus_dma_tag_t hw_desc_tag; --- 26 unchanged lines hidden (view full) --- 288 289 uint32_t num_aers; 290 struct nvme_async_event_request aer[NVME_MAX_ASYNC_EVENTS]; 291 292 void *cons_cookie[NVME_MAX_CONSUMERS]; 293 294 uint32_t is_resetting; 295 | 257 struct taskqueue *taskqueue; 258 259 /* For shared legacy interrupt. */ 260 int rid; 261 struct resource *res; 262 void *tag; 263 264 bus_dma_tag_t hw_desc_tag; --- 26 unchanged lines hidden (view full) --- 291 292 uint32_t num_aers; 293 struct nvme_async_event_request aer[NVME_MAX_ASYNC_EVENTS]; 294 295 void *cons_cookie[NVME_MAX_CONSUMERS]; 296 297 uint32_t is_resetting; 298 |
299 struct mtx fail_req_lock; 300 boolean_t is_failed; 301 STAILQ_HEAD(, nvme_request) fail_req; 302 |
|
296#ifdef CHATHAM2 297 uint64_t chatham_size; 298 uint64_t chatham_lbas; 299#endif 300}; 301 302#define nvme_mmio_offsetof(reg) \ 303 offsetof(struct nvme_registers, reg) --- 94 unchanged lines hidden (view full) --- 398int nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr); 399void nvme_ctrlr_reset(struct nvme_controller *ctrlr); 400/* ctrlr defined as void * to allow use with config_intrhook. */ 401void nvme_ctrlr_start_config_hook(void *ctrlr_arg); 402void nvme_ctrlr_submit_admin_request(struct nvme_controller *ctrlr, 403 struct nvme_request *req); 404void nvme_ctrlr_submit_io_request(struct nvme_controller *ctrlr, 405 struct nvme_request *req); | 303#ifdef CHATHAM2 304 uint64_t chatham_size; 305 uint64_t chatham_lbas; 306#endif 307}; 308 309#define nvme_mmio_offsetof(reg) \ 310 offsetof(struct nvme_registers, reg) --- 94 unchanged lines hidden (view full) --- 405int nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr); 406void nvme_ctrlr_reset(struct nvme_controller *ctrlr); 407/* ctrlr defined as void * to allow use with config_intrhook. */ 408void nvme_ctrlr_start_config_hook(void *ctrlr_arg); 409void nvme_ctrlr_submit_admin_request(struct nvme_controller *ctrlr, 410 struct nvme_request *req); 411void nvme_ctrlr_submit_io_request(struct nvme_controller *ctrlr, 412 struct nvme_request *req); |
413void nvme_ctrlr_post_failed_request(struct nvme_controller *ctrlr, 414 struct nvme_request *req); |
|
406 407void nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, 408 uint16_t vector, uint32_t num_entries, 409 uint32_t num_trackers, uint32_t max_xfer_size, 410 struct nvme_controller *ctrlr); 411void nvme_qpair_submit_tracker(struct nvme_qpair *qpair, 412 struct nvme_tracker *tr); 413void nvme_qpair_process_completions(struct nvme_qpair *qpair); 414void nvme_qpair_submit_request(struct nvme_qpair *qpair, 415 struct nvme_request *req); 416void nvme_qpair_reset(struct nvme_qpair *qpair); | 415 416void nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, 417 uint16_t vector, uint32_t num_entries, 418 uint32_t num_trackers, uint32_t max_xfer_size, 419 struct nvme_controller *ctrlr); 420void nvme_qpair_submit_tracker(struct nvme_qpair *qpair, 421 struct nvme_tracker *tr); 422void nvme_qpair_process_completions(struct nvme_qpair *qpair); 423void nvme_qpair_submit_request(struct nvme_qpair *qpair, 424 struct nvme_request *req); 425void nvme_qpair_reset(struct nvme_qpair *qpair); |
426void nvme_qpair_fail(struct nvme_qpair *qpair); 427void nvme_qpair_manual_complete_request(struct nvme_qpair *qpair, 428 struct nvme_request *req, 429 uint32_t sct, uint32_t sc, 430 boolean_t print_on_error); |
|
417 418void nvme_admin_qpair_enable(struct nvme_qpair *qpair); 419void nvme_admin_qpair_disable(struct nvme_qpair *qpair); 420void nvme_admin_qpair_destroy(struct nvme_qpair *qpair); 421 422void nvme_io_qpair_enable(struct nvme_qpair *qpair); 423void nvme_io_qpair_disable(struct nvme_qpair *qpair); 424void nvme_io_qpair_destroy(struct nvme_qpair *qpair); --- 54 unchanged lines hidden (view full) --- 479} 480 481#define nvme_free_request(req) uma_zfree(nvme_request_zone, req) 482 483void nvme_notify_async_consumers(struct nvme_controller *ctrlr, 484 const struct nvme_completion *async_cpl, 485 uint32_t log_page_id, void *log_page_buffer, 486 uint32_t log_page_size); | 431 432void nvme_admin_qpair_enable(struct nvme_qpair *qpair); 433void nvme_admin_qpair_disable(struct nvme_qpair *qpair); 434void nvme_admin_qpair_destroy(struct nvme_qpair *qpair); 435 436void nvme_io_qpair_enable(struct nvme_qpair *qpair); 437void nvme_io_qpair_disable(struct nvme_qpair *qpair); 438void nvme_io_qpair_destroy(struct nvme_qpair *qpair); --- 54 unchanged lines hidden (view full) --- 493} 494 495#define nvme_free_request(req) uma_zfree(nvme_request_zone, req) 496 497void nvme_notify_async_consumers(struct nvme_controller *ctrlr, 498 const struct nvme_completion *async_cpl, 499 uint32_t log_page_id, void *log_page_buffer, 500 uint32_t log_page_size); |
501void nvme_notify_fail_consumers(struct nvme_controller *ctrlr); |
|
487 488#endif /* __NVME_PRIVATE_H__ */ | 502 503#endif /* __NVME_PRIVATE_H__ */ |