81 #include <sys/queue.h>
94 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
97 #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
100 #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
103 #define PCI_FMT_NVAL 4
106 #define PCI_RESOURCE_FMT_NVAL 3
109 #define IORESOURCE_MEM 0x00000200
121 #define PCI_MAX_RESOURCE 6
146 enum rte_kernel_driver {
147 RTE_KDRV_UNKNOWN = 0,
150 RTE_KDRV_UIO_GENERIC,
172 #define PCI_ANY_ID (0xffff)
176 #define RTE_PCI_DEVICE(vend, dev) \
183 #define RTE_PCI_DEVICE(vend, dev) \
184 .vendor_id = (vend), \
185 .device_id = (dev), \
186 .subsystem_vendor_id = PCI_ANY_ID, \
187 .subsystem_device_id = PCI_ANY_ID
215 #define RTE_PCI_DRV_NEED_MAPPING 0x0001
217 #pragma GCC poison RTE_PCI_DRV_MULTIPLE
219 #define RTE_PCI_DRV_FORCE_UNBIND 0x0004
221 #define RTE_PCI_DRV_INTR_LSC 0x0008
223 #define RTE_PCI_DRV_DETACHABLE 0x0010
247 struct pci_map maps[PCI_MAX_RESOURCE];
254 #define GET_PCIADDR_FIELD(in, fd, lim, dlm) \
259 val = strtoul((in), &end, 16); \
260 if (errno != 0 || end[0] != (dlm) || val > (lim)) \
262 (fd) = (typeof (fd))val; \
283 GET_PCIADDR_FIELD(input, dev_addr->
bus, UINT8_MAX,
':');
284 GET_PCIADDR_FIELD(input, dev_addr->
devid, UINT8_MAX,
'.');
285 GET_PCIADDR_FIELD(input, dev_addr->
function, UINT8_MAX, 0);
304 GET_PCIADDR_FIELD(input, dev_addr->
domain, UINT16_MAX,
':');
305 GET_PCIADDR_FIELD(input, dev_addr->
bus, UINT8_MAX,
':');
306 GET_PCIADDR_FIELD(input, dev_addr->
devid, UINT8_MAX,
'.');
307 GET_PCIADDR_FIELD(input, dev_addr->
function, UINT8_MAX, 0);
310 #undef GET_PCIADDR_FIELD
329 uint64_t dev_addr, dev_addr2;
331 if ((addr == NULL) || (addr2 == NULL))
334 dev_addr = (addr->
domain << 24) | (addr->
bus << 16) |
336 dev_addr2 = (addr2->
domain << 24) | (addr2->
bus << 16) |
339 if (dev_addr > dev_addr2)
341 else if (dev_addr < dev_addr2)
413 void *pci_map_resource(
void *requested_addr,
int fd, off_t offset,
414 size_t size,
int additional_flags);
425 void pci_unmap_resource(
void *requested_addr,
size_t size);
497 void *buf,
size_t len, off_t offset);
513 const void *buf,
size_t len, off_t offset);
563 void *data,
size_t len, off_t offset);
578 const void *data,
size_t len, off_t offset);
580 #ifdef RTE_PCI_CONFIG
591 void pci_config_space_set(
struct rte_pci_device *dev) __rte_deprecated;