pci: inherit common driver in PCI driver
[dpdk.git] / lib / librte_eal / common / include / rte_pci.h
index e1f695f..f0a9ea2 100644 (file)
@@ -84,6 +84,7 @@ extern "C" {
 
 #include <rte_debug.h>
 #include <rte_interrupts.h>
+#include <rte_dev.h>
 
 TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
 TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */
@@ -107,15 +108,6 @@ const char *pci_get_sysfs_path(void);
 /** Nb. of values in PCI resource format. */
 #define PCI_RESOURCE_FMT_NVAL 3
 
-/**
- * A structure describing a PCI resource.
- */
-struct rte_pci_resource {
-       uint64_t phys_addr;   /**< Physical address, 0 if no resource. */
-       uint64_t len;         /**< Length of the resource. */
-       void *addr;           /**< Virtual address, NULL when not mapped. */
-};
-
 /** Maximum number of PCI resources. */
 #define PCI_MAX_RESOURCE 6
 
@@ -159,7 +151,8 @@ struct rte_pci_device {
        TAILQ_ENTRY(rte_pci_device) next;       /**< Next probed PCI device. */
        struct rte_pci_addr addr;               /**< PCI location. */
        struct rte_pci_id id;                   /**< PCI ID. */
-       struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE];   /**< PCI Memory Resource */
+       struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
+                                               /**< PCI Memory Resource */
        struct rte_intr_handle intr_handle;     /**< Interrupt handle */
        struct rte_pci_driver *driver;          /**< Associated driver */
        uint16_t max_vfs;                       /**< sriov enable if not zero */
@@ -207,7 +200,7 @@ typedef int (pci_remove_t)(struct rte_pci_device *);
  */
 struct rte_pci_driver {
        TAILQ_ENTRY(rte_pci_driver) next;       /**< Next in list. */
-       const char *name;                       /**< Driver name. */
+       struct rte_driver driver;               /**< Inherit core driver. */
        pci_probe_t *probe;                     /**< Device Probe function. */
        pci_remove_t *remove;                   /**< Device Remove function. */
        const struct rte_pci_id *id_table;      /**< ID table, NULL terminated. */
@@ -499,7 +492,7 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);
 RTE_INIT(pciinitfn_ ##nm); \
 static void pciinitfn_ ##nm(void) \
 {\
-       (pci_drv).name = RTE_STR(nm);\
+       (pci_drv).driver.name = RTE_STR(nm);\
        rte_eal_pci_register(&pci_drv); \
 } \
 DRIVER_EXPORT_NAME(nm, __COUNTER__)