|
8 | 8 | #include <dev/pci/pcidevs.h> |
9 | 9 | #include <dev/pci/pciio.h> |
10 | 10 |
|
11 | | -static inline int pcibus_conf_read(int fd, uint32_t bus, uint32_t device, uint32_t func, uint32_t reg, uint32_t* result) |
| 11 | +static inline int pciReadConf(int fd, uint32_t bus, uint32_t device, uint32_t func, uint32_t reg, uint32_t* result) |
12 | 12 | { |
13 | 13 | struct pciio_bdf_cfgreg bdfr = { |
14 | 14 | .bus = bus, |
@@ -53,21 +53,21 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* |
53 | 53 | for (uint32_t func = 0; func <= maxfuncs; func++) |
54 | 54 | { |
55 | 55 | uint32_t pciid, pciclass; |
56 | | - if (pcibus_conf_read(pcifd, bus, dev, func, PCI_ID_REG, &pciid) != 0) |
| 56 | + if (pciReadConf(pcifd, bus, dev, func, PCI_ID_REG, &pciid) != 0) |
57 | 57 | continue; |
58 | 58 |
|
59 | 59 | if (PCI_VENDOR(pciid) == PCI_VENDOR_INVALID || PCI_VENDOR(pciid) == 0) |
60 | 60 | continue; |
61 | 61 |
|
62 | | - if (pcibus_conf_read(pcifd, bus, dev, func, PCI_CLASS_REG, &pciclass) != 0) |
| 62 | + if (pciReadConf(pcifd, bus, dev, func, PCI_CLASS_REG, &pciclass) != 0) |
63 | 63 | continue; |
64 | 64 |
|
65 | 65 | if (func == 0) |
66 | 66 | { |
67 | | - // For some reason, pcibus_conf_read returns success even for non-existing devices. |
| 67 | + // For some reason, pciReadConf returns success even for non-existing devices. |
68 | 68 | // So we need to check for `PCI_VENDOR(pciid) == PCI_VENDOR_INVALID` above to filter them out. |
69 | 69 | uint32_t bhlcr; |
70 | | - if (pcibus_conf_read(pcifd, bus, dev, 0, PCI_BHLC_REG, &bhlcr) != 0) |
| 70 | + if (pciReadConf(pcifd, bus, dev, 0, PCI_BHLC_REG, &bhlcr) != 0) |
71 | 71 | continue; |
72 | 72 |
|
73 | 73 | if (PCI_HDRTYPE_MULTIFN(bhlcr)) maxfuncs = 7; |
|
0 commit comments