summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.com>2021-11-02 21:03:00 +0100
committerNico Huber <nico.h@gmx.de>2021-12-22 12:33:15 +0000
commit88c871e74cb9d8b6f6f38747d1caae916364e2a2 (patch)
tree976da5400ced468d2b1862977a2c138c2ae32f54
parent9469f81d8f8154e7e71890ca94aaee8d550093ac (diff)
downloadflashrom-88c871e74cb9d8b6f6f38747d1caae916364e2a2.tar.gz
flashrom-88c871e74cb9d8b6f6f38747d1caae916364e2a2.tar.bz2
flashrom-88c871e74cb9d8b6f6f38747d1caae916364e2a2.zip
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> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58883 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--amd_imc.c1
-rw-r--r--atahpt.c1
-rw-r--r--atapromise.c1
-rw-r--r--atavia.c1
-rw-r--r--board_enable.c1
-rw-r--r--chipset_enable.c1
-rw-r--r--drkaiser.c1
-rw-r--r--gfxnvidia.c1
-rw-r--r--hwaccess.h17
-rw-r--r--internal.c1
-rw-r--r--it8212.c1
-rw-r--r--mcp6x_spi.c1
-rw-r--r--nic3com.c1
-rw-r--r--nicintel.c1
-rw-r--r--nicintel_eeprom.c1
-rw-r--r--nicintel_spi.c1
-rw-r--r--nicnatsemi.c1
-rw-r--r--nicrealtek.c1
-rw-r--r--ogp_spi.c1
-rw-r--r--pcidev.c2
-rw-r--r--platform/pci.h25
-rw-r--r--satamv.c1
-rw-r--r--satasii.c1
-rw-r--r--sb600spi.c1
24 files changed, 47 insertions, 18 deletions
diff --git a/amd_imc.c b/amd_imc.c
index a3959e63f..f2f09728f 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 d9b56bc41..d2712b86d 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 0c187e3cf..92eba0c2b 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 b110d5424..6370d91e9 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 9cf01031a..339408a55 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 2e4bb1e4a..858844318 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 27c15fbbf..34b204e68 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 048471d3c..e85ce68c7 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 46335f38c..e5edcfa96 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 43bed9e2a..4a8e27b23 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 e47f6f8ee..60997f743 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 29d26634b..242934658 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 79964ac86..f7d2a9776 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 c5b9012ba..1730ca463 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 58870732c..ab7534349 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 5dcdf7dde..f1ed12941 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 621672817..9dd39158f 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 70daeec06..0bf60fd2d 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 2e5e27401..105f46813 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 9ffe05cae..bd558ed27 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 000000000..f63529b73
--- /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 cdd2f2754..b69350feb 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 321ef7fe0..d015f7fa0 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 d5e228c1d..92fcc8109 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 {