From 88c871e74cb9d8b6f6f38747d1caae916364e2a2 Mon Sep 17 00:00:00 2001 From: Thomas Heijligen Date: Tue, 2 Nov 2021 21:03:00 +0100 Subject: pci.h: move include into own wrapper Split the include of hwaccess and libpci. There is no need to have pci.h included in hwaccess. Change-Id: Ibf00356f0ef5cc92e0ec99f8fe5cdda56f47b166 Signed-off-by: Thomas Heijligen Reviewed-on: https://review.coreboot.org/c/flashrom/+/58883 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- amd_imc.c | 1 + atahpt.c | 1 + atapromise.c | 1 + atavia.c | 1 + board_enable.c | 1 + chipset_enable.c | 1 + drkaiser.c | 1 + gfxnvidia.c | 1 + hwaccess.h | 17 ----------------- internal.c | 1 + it8212.c | 1 + mcp6x_spi.c | 1 + nic3com.c | 1 + nicintel.c | 1 + nicintel_eeprom.c | 1 + nicintel_spi.c | 1 + nicnatsemi.c | 1 + nicrealtek.c | 1 + ogp_spi.c | 1 + pcidev.c | 2 +- platform/pci.h | 25 +++++++++++++++++++++++++ satamv.c | 1 + satasii.c | 1 + sb600spi.c | 1 + 24 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 platform/pci.h diff --git a/amd_imc.c b/amd_imc.c index a3959e63..f2f09728 100644 --- a/amd_imc.c +++ b/amd_imc.c @@ -19,6 +19,7 @@ #include "programmer.h" #include "hwaccess.h" #include "spi.h" +#include "platform/pci.h" /* same as serverengines */ static void enter_conf_mode_ec(uint16_t port) diff --git a/atahpt.c b/atahpt.c index d9b56bc4..d2712b86 100644 --- a/atahpt.c +++ b/atahpt.c @@ -19,6 +19,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define BIOS_ROM_ADDR 0x90 #define BIOS_ROM_DATA 0x94 diff --git a/atapromise.c b/atapromise.c index 0c187e3c..92eba0c2 100644 --- a/atapromise.c +++ b/atapromise.c @@ -19,6 +19,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define MAX_ROM_DECODE (32 * 1024) #define ADDR_MASK (MAX_ROM_DECODE - 1) diff --git a/atavia.c b/atavia.c index b110d542..6370d91e 100644 --- a/atavia.c +++ b/atavia.c @@ -21,6 +21,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_VIA 0x1106 diff --git a/board_enable.c b/board_enable.c index 9cf01031..339408a5 100644 --- a/board_enable.c +++ b/board_enable.c @@ -26,6 +26,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #if defined(__i386__) || defined(__x86_64__) /* diff --git a/chipset_enable.c b/chipset_enable.c index 2e4bb1e4..85884431 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -34,6 +34,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define NOT_DONE_YET 1 diff --git a/drkaiser.c b/drkaiser.c index 27c15fbb..34b204e6 100644 --- a/drkaiser.c +++ b/drkaiser.c @@ -18,6 +18,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_DRKAISER 0x1803 diff --git a/gfxnvidia.c b/gfxnvidia.c index 048471d3..e85ce68c 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -19,6 +19,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_NVIDIA 0x10de diff --git a/hwaccess.h b/hwaccess.h index 46335f38..e5edcfa9 100644 --- a/hwaccess.h +++ b/hwaccess.h @@ -20,23 +20,6 @@ #ifndef __HWACCESS_H__ #define __HWACCESS_H__ 1 -#if NEED_PCI == 1 -/* - * libpci headers use the variable name "index" which triggers shadowing - * warnings on systems which have the index() function in a default #include - * or as builtin. - */ -#define index shadow_workaround_index - -#if !defined (__NetBSD__) -#include -#else -#include -#endif - -#undef index -#endif /* NEED_PCI == 1 */ - void mmio_writeb(uint8_t val, void *addr); void mmio_writew(uint16_t val, void *addr); void mmio_writel(uint32_t val, void *addr); diff --git a/internal.c b/internal.c index 43bed9e2..4a8e27b2 100644 --- a/internal.c +++ b/internal.c @@ -20,6 +20,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" int is_laptop = 0; int laptop_ok = 0; diff --git a/it8212.c b/it8212.c index e47f6f8e..60997f74 100644 --- a/it8212.c +++ b/it8212.c @@ -18,6 +18,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" static uint8_t *it8212_bar = NULL; diff --git a/mcp6x_spi.c b/mcp6x_spi.c index 29d26634..24293465 100644 --- a/mcp6x_spi.c +++ b/mcp6x_spi.c @@ -24,6 +24,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" /* Bit positions for each pin. */ diff --git a/nic3com.c b/nic3com.c index 79964ac8..f7d2a977 100644 --- a/nic3com.c +++ b/nic3com.c @@ -18,6 +18,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define BIOS_ROM_ADDR 0x04 #define BIOS_ROM_DATA 0x08 diff --git a/nicintel.c b/nicintel.c index c5b9012b..1730ca46 100644 --- a/nicintel.c +++ b/nicintel.c @@ -19,6 +19,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" static uint8_t *nicintel_bar; static uint8_t *nicintel_control_bar; diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c index 58870732..ab753434 100644 --- a/nicintel_eeprom.c +++ b/nicintel_eeprom.c @@ -35,6 +35,7 @@ #include "spi.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_INTEL 0x8086 #define MEMMAP_SIZE 0x1c /* Only EEC, EERD and EEWR are needed. */ diff --git a/nicintel_spi.c b/nicintel_spi.c index 5dcdf7dd..f1ed1294 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -35,6 +35,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_INTEL 0x8086 #define MEMMAP_SIZE getpagesize() diff --git a/nicnatsemi.c b/nicnatsemi.c index 62167281..9dd39158 100644 --- a/nicnatsemi.c +++ b/nicnatsemi.c @@ -18,6 +18,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_NATSEMI 0x100b diff --git a/nicrealtek.c b/nicrealtek.c index 70daeec0..0bf60fd2 100644 --- a/nicrealtek.c +++ b/nicrealtek.c @@ -18,6 +18,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_REALTEK 0x10ec #define PCI_VENDOR_ID_SMC1211 0x1113 diff --git a/ogp_spi.c b/ogp_spi.c index 2e5e2740..105f4681 100644 --- a/ogp_spi.c +++ b/ogp_spi.c @@ -19,6 +19,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_OGP 0x1227 diff --git a/pcidev.c b/pcidev.c index 9ffe05ca..bd558ed2 100644 --- a/pcidev.c +++ b/pcidev.c @@ -19,7 +19,7 @@ #include #include "flash.h" #include "programmer.h" -#include "hwaccess.h" +#include "platform/pci.h" struct pci_access *pacc; diff --git a/platform/pci.h b/platform/pci.h new file mode 100644 index 00000000..f63529b7 --- /dev/null +++ b/platform/pci.h @@ -0,0 +1,25 @@ +/* + * This is a wrapper for libpci. + * ... + */ + + +#ifndef __PLATFORM_PCI_H__ +#define __PLATFORM_PCI_H__ + +/* + * An old libpci version seems to use the variable name "index" which triggers + * shadowing warnings on systems which have the index() function in a default + * #include or as builtin. + */ +#define index shadow_workaround_index + +#if defined (__NetBSD__) +#include +#else +#include +#endif + +#undef index + +#endif /* __PLATFORM_PCI_H__ */ \ No newline at end of file diff --git a/satamv.c b/satamv.c index cdd2f275..b69350fe 100644 --- a/satamv.c +++ b/satamv.c @@ -20,6 +20,7 @@ #include "flash.h" #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" static uint8_t *mv_bar; static uint16_t mv_iobar; diff --git a/satasii.c b/satasii.c index 321ef7fe..d015f7fa 100644 --- a/satasii.c +++ b/satasii.c @@ -18,6 +18,7 @@ #include "programmer.h" #include "hwaccess.h" +#include "platform/pci.h" #define PCI_VENDOR_ID_SII 0x1095 diff --git a/sb600spi.c b/sb600spi.c index d5e228c1..92fcc810 100644 --- a/sb600spi.c +++ b/sb600spi.c @@ -24,6 +24,7 @@ #include "programmer.h" #include "hwaccess.h" #include "spi.h" +#include "platform/pci.h" /* This struct is unused, but helps visualize the SB600 SPI BAR layout. *struct sb600_spi_controller { -- cgit v1.2.3