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,
171 #define PCI_ANY_ID (0xffff)
175 #define RTE_PCI_DEVICE(vend, dev) \
182 #define RTE_PCI_DEVICE(vend, dev) \
183 .vendor_id = (vend), \
184 .device_id = (dev), \
185 .subsystem_vendor_id = PCI_ANY_ID, \
186 .subsystem_device_id = PCI_ANY_ID
214 #define RTE_PCI_DRV_NEED_MAPPING 0x0001
216 #pragma GCC poison RTE_PCI_DRV_MULTIPLE
218 #define RTE_PCI_DRV_FORCE_UNBIND 0x0004
220 #define RTE_PCI_DRV_INTR_LSC 0x0008
222 #define RTE_PCI_DRV_DETACHABLE 0x0010
246 struct pci_map maps[PCI_MAX_RESOURCE];
253 #define GET_PCIADDR_FIELD(in, fd, lim, dlm) \
258 val = strtoul((in), &end, 16); \
259 if (errno != 0 || end[0] != (dlm) || val > (lim)) \
261 (fd) = (typeof (fd))val; \
282 GET_PCIADDR_FIELD(input, dev_addr->
bus, UINT8_MAX,
':');
283 GET_PCIADDR_FIELD(input, dev_addr->
devid, UINT8_MAX,
'.');
284 GET_PCIADDR_FIELD(input, dev_addr->
function, UINT8_MAX, 0);
303 GET_PCIADDR_FIELD(input, dev_addr->
domain, UINT16_MAX,
':');
304 GET_PCIADDR_FIELD(input, dev_addr->
bus, UINT8_MAX,
':');
305 GET_PCIADDR_FIELD(input, dev_addr->
devid, UINT8_MAX,
'.');
306 GET_PCIADDR_FIELD(input, dev_addr->
function, UINT8_MAX, 0);
309 #undef GET_PCIADDR_FIELD
328 uint64_t dev_addr, dev_addr2;
330 if ((addr == NULL) || (addr2 == NULL))
333 dev_addr = (addr->
domain << 24) | (addr->
bus << 16) |
335 dev_addr2 = (addr2->
domain << 24) | (addr2->
bus << 16) |
338 if (dev_addr > dev_addr2)
340 else if (dev_addr < dev_addr2)
386 void *pci_map_resource(
void *requested_addr,
int fd, off_t offset,
387 size_t size,
int additional_flags);
398 void pci_unmap_resource(
void *requested_addr,
size_t size);
429 int __attribute__ ((deprecated))
472 void *buf,
size_t len, off_t offset);
488 const
void *buf,
size_t len, off_t offset);
490 #ifdef RTE_PCI_CONFIG