Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/58883 )
Change subject: pci.h: move include into own wrapper ......................................................................
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 thomas.heijligen@secunet.com --- M amd_imc.c M atahpt.c M atapromise.c M atavia.c M board_enable.c M chipset_enable.c M drkaiser.c M gfxnvidia.c M hwaccess.h M internal.c M it8212.c M mcp6x_spi.c M nic3com.c M nicintel.c M nicintel_eeprom.c M nicintel_spi.c M nicnatsemi.c M nicrealtek.c M ogp_spi.c M pcidev.c A platform/pci.h M satamv.c M satasii.c M sb600spi.c 24 files changed, 47 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/83/58883/1
diff --git a/amd_imc.c b/amd_imc.c index a3959e6..f2f0972 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 d9b56bc..d2712b8 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 0c187e3..92eba0c 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 b110d54..6370d91 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 9cf0103..339408a 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 cb0fbf1..c87d47a 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 27c15fb..34b204e 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 048471d..e85ce68 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 46335f3..e5edcfa 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 <pci/pci.h> -#else -#include <pciutils/pci.h> -#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 43bed9e..4a8e27b 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 e47f6f8..60997f7 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 29d2663..2429346 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 79964ac..f7d2a97 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 c5b9012..1730ca4 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 5887073..ab75343 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 5dcdf7d..f1ed129 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 6216728..9dd3915 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 70daeec..0bf60fd 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 2e5e274..105f468 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 9ffe05c..bd558ed 100644 --- a/pcidev.c +++ b/pcidev.c @@ -19,7 +19,7 @@ #include <string.h> #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 0000000..f63529b --- /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 <pciutils/pci.h> +#else +#include <pci/pci.h> +#endif + +#undef index + +#endif /* __PLATFORM_PCI_H__ */ \ No newline at end of file diff --git a/satamv.c b/satamv.c index cdd2f27..b69350f 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 321ef7f..d015f7f 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 7fa01af..7126566 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 {