From e120b47de078c8fc09deb92f3a2b7315b171d4c7 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 25 Oct 2024 15:40:02 -0300 Subject: [PATCH] clib: Some PCI define cleanups --- clib/clib_pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clib/clib_pci.c b/clib/clib_pci.c index da4a00a..7917f6f 100644 --- a/clib/clib_pci.c +++ b/clib/clib_pci.c @@ -32,7 +32,8 @@ uint8_t pci_mechanism = 0, pci_device_count = 0; #ifdef PCI_LIB_VERSION static struct pci_access *pacc; static struct pci_dev *pdev = NULL; -# ifdef _WIN32 +# if defined(_WIN32) && (PCI_LIB_VERSION >= 0x030800) +# define DUMMY_CONFIG_SPACE 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 @@ -142,7 +143,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) +# ifdef DUMMY_CONFIG_SPACE /* 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 */ @@ -179,7 +180,7 @@ pci_init_dev(uint8_t bus, uint8_t dev, uint8_t func) } } } -#endif +# endif } for (pdev = pacc->devices; pdev; pdev = pdev->next) {