aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVishal Verma <vishal.l.verma@intel.com>2013-03-04 20:40:57 -0500
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2013-03-27 07:05:42 -0400
commit13c3b0fcc8e33ba49f252378f6e7290b146042af (patch)
tree8f9e649baaa3d33c2788a46e1cd6f8ae43942315 /include
parent729dd1bd802acb973eec9c73ccb87d3143c13937 (diff)
NVMe: Move structures & definitions to header file
nvme-scsi.c uses several data structures and definitions that were previously private to nvme-core.c. Move the definitions to nvme.h, protected by __KERNEL__. Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nvme.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index bde44c1fd213..6f899add14ab 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -493,4 +493,64 @@ struct nvme_admin_cmd {
493#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) 493#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
494#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) 494#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
495 495
496#ifdef __KERNEL__
497#include <linux/pci.h>
498
499#define NVME_IO_TIMEOUT (5 * HZ)
500
501/*
502 * Represents an NVM Express device. Each nvme_dev is a PCI function.
503 */
504struct nvme_dev {
505 struct list_head node;
506 struct nvme_queue **queues;
507 u32 __iomem *dbs;
508 struct pci_dev *pci_dev;
509 struct dma_pool *prp_page_pool;
510 struct dma_pool *prp_small_pool;
511 int instance;
512 int queue_count;
513 int db_stride;
514 u32 ctrl_config;
515 struct msix_entry *entry;
516 struct nvme_bar __iomem *bar;
517 struct list_head namespaces;
518 char serial[20];
519 char model[40];
520 char firmware_rev[8];
521 u32 max_hw_sectors;
522 u16 oncs;
523};
524
525/*
526 * An NVM Express namespace is equivalent to a SCSI LUN
527 */
528struct nvme_ns {
529 struct list_head list;
530
531 struct nvme_dev *dev;
532 struct request_queue *queue;
533 struct gendisk *disk;
534
535 int ns_id;
536 int lba_shift;
537};
538
539/*
540 * The nvme_iod describes the data in an I/O, including the list of PRP
541 * entries. You can't see it in this data structure because C doesn't let
542 * me express that. Use nvme_alloc_iod to ensure there's enough space
543 * allocated to store the PRP list.
544 */
545struct nvme_iod {
546 void *private; /* For the use of the submitter of the I/O */
547 int npages; /* In the PRP list. 0 means small pool in use */
548 int offset; /* Of PRP list */
549 int nents; /* Used in scatterlist */
550 int length; /* Of data, in bytes */
551 dma_addr_t first_dma;
552 struct scatterlist sg[0];
553};
554#endif
555
496#endif /* _LINUX_NVME_H */ 556#endif /* _LINUX_NVME_H */