From 7672976a6aca7593a2fadf928c2f02d6ef0c8b56 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 9 Feb 2016 09:31:09 -0700 Subject: [PATCH] nvme: move class code to pci_ids.h Move toward collecting PCI IDs, class codes, etc. in pci_ids.h instead of individual device-specific headers. Change-Id: Icff162d48ac663db71d0576ceee16a9bd7a751cd Signed-off-by: Daniel Verkamp --- include/spdk/nvme_spec.h | 9 --------- include/spdk/pci_ids.h | 9 +++++++++ lib/nvme/nvme_impl.h | 5 +++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index fa684c3ac..1486f0bd8 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -44,15 +44,6 @@ * */ -/** - * PCI class code for NVMe devices. - * - * Base class code 01h: mass storage - * Subclass code 08h: non-volatile memory - * Programming interface 02h: NVM Express - */ -#define NVME_CLASS_CODE 0x10802 - /** * Use to mark a command to apply to all namespaces, or to retrieve global * log pages. diff --git a/include/spdk/pci_ids.h b/include/spdk/pci_ids.h index 999319f1a..67d7f8866 100644 --- a/include/spdk/pci_ids.h +++ b/include/spdk/pci_ids.h @@ -38,4 +38,13 @@ #define SPDK_PCI_VID_INTEL 0x8086 +/** + * PCI class code for NVMe devices. + * + * Base class code 01h: mass storage + * Subclass code 08h: non-volatile memory + * Programming interface 02h: NVM Express + */ +#define SPDK_PCI_CLASS_NVME 0x010802 + #endif /* SPDK_PCI_IDS */ diff --git a/lib/nvme/nvme_impl.h b/lib/nvme/nvme_impl.h index 427de04b6..c3169693c 100644 --- a/lib/nvme/nvme_impl.h +++ b/lib/nvme/nvme_impl.h @@ -50,6 +50,7 @@ #endif #include "spdk/pci.h" +#include "spdk/pci_ids.h" #include "spdk/nvme_spec.h" /** @@ -141,7 +142,7 @@ nvme_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev) { struct nvme_pci_enum_ctx *ctx = enum_ctx; - if (spdk_pci_device_get_class(pci_dev) != NVME_CLASS_CODE) { + if (spdk_pci_device_get_class(pci_dev) != SPDK_PCI_CLASS_NVME) { return 0; } @@ -195,7 +196,7 @@ nvme_pcicfg_unmap_bar(void *devhandle, uint32_t bar, void *addr) } /* - * TODO: once DPDK supports matching class code instead of device ID, switch to NVME_CLASS_CODE + * TODO: once DPDK supports matching class code instead of device ID, switch to SPDK_PCI_CLASS_NVME */ static struct rte_pci_id nvme_pci_driver_id[] = { {RTE_PCI_DEVICE(0x8086, 0x0953)},