Hi,
attached patch hides hwaccess.h (which is usually not necessary to use
flashrom as library) from the public interface at flash.h.
For the most part, this simply adds the header to driver .c files, but
it also required a small workaround to handle libpci types used in a
bunch of prototypes.
Rationale: hwaccess.h at that place conflicts with libpayload which
brings its own hardware access functions (which are wrapped properly to
match flashrom's expectations in hwaccess.h already). They should also
not matter in other contexts (and if someone requires them, they can
still include hwaccess.h where needed).
Librarification of flashrom requires some more patches, like pulling
out some functions of the CLI code - even if doit() is by no means a
pretty interface, it makes things simpler. But one step after the
other...
Signed-off-by: Patrick Georgi <[email protected]>
Index: nicintel.c
===================================================================
--- nicintel.c (Revision 1548)
+++ nicintel.c (Arbeitskopie)
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
uint8_t *nicintel_bar;
uint8_t *nicintel_control_bar;
Index: sb600spi.c
===================================================================
--- sb600spi.c (Revision 1548)
+++ sb600spi.c (Arbeitskopie)
@@ -25,6 +25,7 @@
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#include "spi.h"
/* This struct is unused, but helps visualize the SB600 SPI BAR layout.
Index: it87spi.c
===================================================================
--- it87spi.c (Revision 1548)
+++ it87spi.c (Arbeitskopie)
@@ -30,6 +30,7 @@
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"
+#include "hwaccess.h"
#include "spi.h"
#define ITE_SUPERIO_PORT1 0x2e
Index: ichspi.c
===================================================================
--- ichspi.c (Revision 1548)
+++ ichspi.c (Arbeitskopie)
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#include "spi.h"
#include "ich_descriptors.h"
Index: nicnatsemi.c
===================================================================
--- nicnatsemi.c (Revision 1548)
+++ nicnatsemi.c (Arbeitskopie)
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define PCI_VENDOR_ID_NATSEMI 0x100b
Index: board_enable.c
===================================================================
--- board_enable.c (Revision 1548)
+++ board_enable.c (Arbeitskopie)
@@ -27,6 +27,7 @@
#include <string.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#if defined(__i386__) || defined(__x86_64__)
/*
Index: wbsio_spi.c
===================================================================
--- wbsio_spi.c (Revision 1548)
+++ wbsio_spi.c (Arbeitskopie)
@@ -23,6 +23,7 @@
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"
+#include "hwaccess.h"
#include "spi.h"
#define WBSIO_PORT1 0x2e
Index: hwaccess.c
===================================================================
--- hwaccess.c (Revision 1548)
+++ hwaccess.c (Arbeitskopie)
@@ -30,6 +30,7 @@
#include <errno.h>
#endif
#include "flash.h"
+#include "hwaccess.h"
#if defined(__i386__) || defined(__x86_64__)
Index: drkaiser.c
===================================================================
--- drkaiser.c (Revision 1548)
+++ drkaiser.c (Arbeitskopie)
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define PCI_VENDOR_ID_DRKAISER 0x1803
Index: mcp6x_spi.c
===================================================================
--- mcp6x_spi.c (Revision 1548)
+++ mcp6x_spi.c (Arbeitskopie)
@@ -29,6 +29,7 @@
#include <ctype.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
/* Bit positions for each pin. */
Index: atahpt.c
===================================================================
--- atahpt.c (Revision 1548)
+++ atahpt.c (Arbeitskopie)
@@ -24,6 +24,7 @@
#include <string.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define BIOS_ROM_ADDR 0x90
#define BIOS_ROM_DATA 0x94
Index: flash.h
===================================================================
--- flash.h (Revision 1548)
+++ flash.h (Arbeitskopie)
@@ -26,7 +26,6 @@
#include <stdint.h>
#include <stddef.h>
-#include "hwaccess.h"
#ifdef _WIN32
#include <windows.h>
#undef min
Index: it85spi.c
===================================================================
--- it85spi.c (Revision 1548)
+++ it85spi.c (Arbeitskopie)
@@ -32,6 +32,7 @@
#include "flash.h"
#include "spi.h"
#include "programmer.h"
+#include "hwaccess.h"
#define MAX_TIMEOUT 100000
#define MAX_TRY 5
Index: chipset_enable.c
===================================================================
--- chipset_enable.c (Revision 1548)
+++ chipset_enable.c (Arbeitskopie)
@@ -34,6 +34,7 @@
#include <errno.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define NOT_DONE_YET 1
Index: internal.c
===================================================================
--- internal.c (Revision 1548)
+++ internal.c (Arbeitskopie)
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#if NEED_PCI == 1
struct pci_dev *pci_dev_find_filter(struct pci_filter filter)
Index: gfxnvidia.c
===================================================================
--- gfxnvidia.c (Revision 1548)
+++ gfxnvidia.c (Arbeitskopie)
@@ -22,6 +22,7 @@
#include <string.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define PCI_VENDOR_ID_NVIDIA 0x10de
Index: programmer.h
===================================================================
--- programmer.h (Revision 1548)
+++ programmer.h (Arbeitskopie)
@@ -144,6 +144,7 @@
};
#if CONFIG_INTERNAL == 1
+struct pci_dev;
struct penable {
uint16_t vendor_id;
uint16_t device_id;
@@ -294,6 +295,7 @@
#define SUPERIO_VENDOR_WINBOND 0x2
#endif
#if NEED_PCI == 1
+struct pci_filter;
struct pci_dev *pci_dev_find_filter(struct pci_filter filter);
struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t devclass);
struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
Index: nicintel_spi.c
===================================================================
--- nicintel_spi.c (Revision 1548)
+++ nicintel_spi.c (Arbeitskopie)
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define PCI_VENDOR_ID_INTEL 0x8086
Index: physmap.c
===================================================================
--- physmap.c (Revision 1548)
+++ physmap.c (Arbeitskopie)
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include "flash.h"
+#include "hwaccess.h"
/* Do we need any file access or ioctl for physmap or MSR? */
#if !defined(__DJGPP__) && !defined(__LIBPAYLOAD__)
Index: nic3com.c
===================================================================
--- nic3com.c (Revision 1548)
+++ nic3com.c (Arbeitskopie)
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define BIOS_ROM_ADDR 0x04
#define BIOS_ROM_DATA 0x08
Index: satasii.c
===================================================================
--- satasii.c (Revision 1548)
+++ satasii.c (Arbeitskopie)
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define PCI_VENDOR_ID_SII 0x1095
Index: pcidev.c
===================================================================
--- pcidev.c (Revision 1548)
+++ pcidev.c (Arbeitskopie)
@@ -23,6 +23,7 @@
#include <string.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
uint32_t io_base_addr;
struct pci_access *pacc;
Index: nicrealtek.c
===================================================================
--- nicrealtek.c (Revision 1548)
+++ nicrealtek.c (Arbeitskopie)
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define PCI_VENDOR_ID_REALTEK 0x10ec
#define PCI_VENDOR_ID_SMC1211 0x1113
Index: satamv.c
===================================================================
--- satamv.c (Revision 1548)
+++ satamv.c (Arbeitskopie)
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
uint8_t *mv_bar;
uint16_t mv_iobar;
Index: rayer_spi.c
===================================================================
--- rayer_spi.c (Revision 1548)
+++ rayer_spi.c (Arbeitskopie)
@@ -34,6 +34,7 @@
#include <string.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
enum rayer_type {
TYPE_RAYER,
Index: ogp_spi.c
===================================================================
--- ogp_spi.c (Revision 1548)
+++ ogp_spi.c (Arbeitskopie)
@@ -21,6 +21,7 @@
#include <string.h>
#include "flash.h"
#include "programmer.h"
+#include "hwaccess.h"
#define PCI_VENDOR_ID_OGP 0x1227
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom