81 #include <sys/queue.h>
99 #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
100 #define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X")
103 #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
106 #define PCI_FMT_NVAL 4
109 #define PCI_RESOURCE_FMT_NVAL 3
112 #define PCI_MAX_RESOURCE 6
138 enum rte_kernel_driver {
139 RTE_KDRV_UNKNOWN = 0,
142 RTE_KDRV_UIO_GENERIC,
167 #define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
170 #define PCI_ANY_ID (0xffff)
171 #define RTE_CLASS_ANY_ID (0xffffff)
175 #define RTE_PCI_DEVICE(vend, dev) \
183 #define RTE_PCI_DEVICE(vend, dev) \
184 .class_id = RTE_CLASS_ANY_ID, \
185 .vendor_id = (vend), \
186 .device_id = (dev), \
187 .subsystem_vendor_id = PCI_ANY_ID, \
188 .subsystem_device_id = PCI_ANY_ID
216 #define RTE_PCI_DRV_NEED_MAPPING 0x0001
218 #define RTE_PCI_DRV_INTR_LSC 0x0008
242 struct pci_map maps[PCI_MAX_RESOURCE];
249 #define GET_PCIADDR_FIELD(in, fd, lim, dlm) \
254 val = strtoul((in), &end, 16); \
255 if (errno != 0 || end[0] != (dlm) || val > (lim)) \
257 (fd) = (typeof (fd))val; \
278 GET_PCIADDR_FIELD(input, dev_addr->
bus, UINT8_MAX,
':');
279 GET_PCIADDR_FIELD(input, dev_addr->
devid, UINT8_MAX,
'.');
280 GET_PCIADDR_FIELD(input, dev_addr->
function, UINT8_MAX, 0);
299 GET_PCIADDR_FIELD(input, dev_addr->
domain, UINT16_MAX,
':');
300 GET_PCIADDR_FIELD(input, dev_addr->
bus, UINT8_MAX,
':');
301 GET_PCIADDR_FIELD(input, dev_addr->
devid, UINT8_MAX,
'.');
302 GET_PCIADDR_FIELD(input, dev_addr->
function, UINT8_MAX, 0);
305 #undef GET_PCIADDR_FIELD
321 char *output,
size_t size)
323 RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
346 uint64_t dev_addr, dev_addr2;
348 if ((addr == NULL) || (addr2 == NULL))
351 dev_addr = (addr->
domain << 24) | (addr->
bus << 16) |
353 dev_addr2 = (addr2->
domain << 24) | (addr2->
bus << 16) |
356 if (dev_addr > dev_addr2)
358 else if (dev_addr < dev_addr2)
430 void *pci_map_resource(
void *requested_addr,
int fd, off_t offset,
431 size_t size,
int additional_flags);
442 void pci_unmap_resource(
void *requested_addr,
size_t size);
492 #define RTE_PMD_REGISTER_PCI(nm, pci_drv) \
493 RTE_INIT(pciinitfn_ ##nm); \
494 static void pciinitfn_ ##nm(void) \
496 (pci_drv).driver.name = RTE_STR(nm);\
497 rte_eal_pci_register(&pci_drv); \
499 RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
524 void *buf,
size_t len, off_t offset);
540 const void *buf,
size_t len, off_t offset);
594 void *data,
size_t len, off_t offset);
609 const void *data,
size_t len, off_t offset);