mirror of
https://github.com/86Box/probing-tools.git
synced 2026-02-25 04:45:33 -07:00
clib: Fix build with old libpci on Linux
This commit is contained in:
@@ -33,7 +33,9 @@ uint8_t pci_mechanism = 0, pci_device_count = 0;
|
||||
static struct pci_access *pacc;
|
||||
static struct pci_dev *pdev;
|
||||
static uint32_t last_addr = -1;
|
||||
# ifdef _WIN32
|
||||
static const char win_notice[] = "NOTICE: These are dummy configuration registers generated by libpci, as it cannot access the real ones under Windows. It does not reflect the device's actual configuration.";
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Configuration functions. */
|
||||
@@ -144,6 +146,7 @@ pci_init_dev(uint8_t bus, uint8_t dev, uint8_t func)
|
||||
if (!pacc->devices) {
|
||||
libpci_scan_bus(pacc);
|
||||
|
||||
#if defined(_WIN32) && PCI_LIB_VERSION > 0x030800
|
||||
/* Generate additional configuration values not generated by
|
||||
libpci's emulated configuration space code on Windows. */
|
||||
if ((pacc->method == PCI_ACCESS_WIN32_CFGMGR32) && !pacc->backend_data) { /* backend_data is NULL if no usable raw access method was found */
|
||||
@@ -180,6 +183,7 @@ pci_init_dev(uint8_t bus, uint8_t dev, uint8_t func)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
for (pdev = pacc->devices; pdev; pdev = pdev->next) {
|
||||
@@ -194,17 +198,9 @@ int
|
||||
pci_init()
|
||||
{
|
||||
#ifdef PCI_LIB_VERSION
|
||||
# ifndef _WIN32
|
||||
if (iopl(3)) {
|
||||
perror("iopl");
|
||||
goto pci_init_fail;
|
||||
}
|
||||
# endif
|
||||
|
||||
pacc = pci_alloc();
|
||||
if (!pacc) {
|
||||
printf("Failed to allocate pci_access structure.\n");
|
||||
pci_init_fail:
|
||||
pci_mechanism = 0;
|
||||
return pci_mechanism;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user