[flashrom] [PATCH] Do not require PCI code for RayeR SPI driver
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Wed Feb 17 01:10:41 CET 2016
This patch depends on
Re: [flashrom] [PATCH] List affected features for missing libraries
CONFIG_RAYER_SPI only needs raw hardware access, but not libpci.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
diff -ur flashrom-libpci_libusb_report_requirements/hwaccess.h flashrom-rayer_do_not_require_libpci/hwaccess.h
--- flashrom-libpci_libusb_report_requirements/hwaccess.h 2016-02-17 00:26:07.221475948 +0100
+++ flashrom-rayer_do_not_require_libpci/hwaccess.h 2016-02-17 01:09:53.270497512 +0100
@@ -196,7 +196,7 @@
#define le_to_cpu32 cpu_to_le32
#define le_to_cpu64 cpu_to_le64
-#if NEED_PCI == 1
+#if NEED_RAW_ACCESS == 1
#if IS_X86
/* sys/io.h provides iopl(2) and x86 I/O port access functions (inb, outb etc).
@@ -376,6 +376,6 @@
#error Unknown architecture, please check if it supports PCI port IO.
#endif /* IS_* */
-#endif /* NEED_PCI == 1 */
+#endif /* NEED_RAW_ACCESS == 1 */
#endif /* !__HWACCESS_H__ */
diff -ur flashrom-libpci_libusb_report_requirements/Makefile flashrom-rayer_do_not_require_libpci/Makefile
--- flashrom-libpci_libusb_report_requirements/Makefile 2016-02-17 00:26:37.497626067 +0100
+++ flashrom-rayer_do_not_require_libpci/Makefile 2016-02-17 00:52:46.457405821 +0100
@@ -599,8 +599,7 @@
ifeq ($(CONFIG_RAYER_SPI), yes)
FEATURE_CFLAGS += -D'CONFIG_RAYER_SPI=1'
PROGRAMMER_OBJS += rayer_spi.o
-# Actually, NEED_LIBPCI is wrong. NEED_IOPORT_ACCESS would be more correct.
-NEED_LIBPCI += CONFIG_RAYER_SPI
+NEED_RAW_ACCESS += CONFIG_RAYER_SPI
endif
ifeq ($(CONFIG_PONY_SPI), yes)
@@ -782,10 +781,14 @@
ifneq ($(NEED_LIBPCI), )
CHECK_LIBPCI = yes
+# This is a dirty hack, but it saves us from checking all PCI drivers and all platforms manually.
+# libpci may need raw memory, MSR or PCI port I/O on some platforms.
+# Individual drivers might have the same needs as well.
+NEED_RAW_ACCESS += $(NEED_LIBPCI)
FEATURE_CFLAGS += -D'NEED_PCI=1'
FEATURE_CFLAGS += $(call debug_shell,grep -q "OLD_PCI_GET_DEV := yes" .libdeps && printf "%s" "-D'OLD_PCI_GET_DEV=1'")
-PROGRAMMER_OBJS += pcidev.o physmap.o hwaccess.o
+PROGRAMMER_OBJS += pcidev.o
ifeq ($(TARGET_OS), NetBSD)
# The libpci we want is called libpciutils on NetBSD and needs NetBSD libpci.
PCILIBS += -lpciutils -lpci
@@ -807,6 +810,11 @@
endif
endif
+ifneq ($(NEED_RAW_ACCESS), )
+FEATURE_CFLAGS += -D'NEED_RAW_ACCESS=1'
+PROGRAMMER_OBJS += physmap.o hwaccess.o
+endif
+
ifneq ($(NEED_LIBUSB0), )
CHECK_LIBUSB0 = yes
FEATURE_CFLAGS += -D'NEED_LIBUSB0=1'
More information about the flashrom
mailing list