Override incompatible CONFIG_FOO settings for DOS. This allows you to
specify CONFIG_FOO=yes for all drivers and still get only those which
compile under DOS.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-dos_override_incompatible_config_foo/Makefile
===================================================================
--- flashrom-dos_override_incompatible_config_foo/Makefile (Revision 1031)
+++ flashrom-dos_override_incompatible_config_foo/Makefile (Arbeitskopie)
@@ -50,9 +50,12 @@
endif
ifeq ($(OS_ARCH), DOS)
CPPFLAGS += -I../libgetopt -I../libpci/include
-# Bus Pirate and Serprog are not supported under DOS.
-CONFIG_BUSPIRATE_SPI = no
-CONFIG_SERPROG = no
+# Bus Pirate and Serprog are not supported under DOS (missing serial support).
+override CONFIG_BUSPIRATE_SPI = no
+override CONFIG_SERPROG = no
+# Dediprog and FT2232 are not supported under DOS (missing USB support).
+override CONFIG_DEDIPROG = no
+override CONFIG_FT2232_SPI = no
endif
CHIP_OBJS = jedec.o stm50flw0x0x.o w39v040c.o w39v080fa.o w29ee011.o \
--
http://www.hailfinger.org/
Author: hailfinger
Date: Mon Jun 14 20:40:59 2010
New Revision: 1048
URL: http://flashrom.org/trac/coreboot/changeset/1048
Log:
Detect incompatible CONFIG_FOO=yes for the specified target and refuse
to compile with a meaningful error message.
Set the default for incompatible CONFIG_FOO to no.
Just running "make" should result in a a build which compiles the common
subset of available and working features.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Acked-by: Idwer Vollering <vidwer+lists.flashrom(a)gmail.com>
Modified:
trunk/Makefile
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile Mon Jun 14 16:44:08 2010 (r1047)
+++ trunk/Makefile Mon Jun 14 20:40:59 2010 (r1048)
@@ -53,9 +53,28 @@
CPPFLAGS += -I../libgetopt -I../libpci/include
# FIXME Check if we can achieve the same effect with -L../libgetopt -lgetopt
LIBS += ../libgetopt/libgetopt.a
-# Bus Pirate and Serprog are not supported under DOS.
-CONFIG_BUSPIRATE_SPI = no
-CONFIG_SERPROG = no
+# Bus Pirate and Serprog are not supported under DOS (missing serial support).
+ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes
+else
+override CONFIG_BUSPIRATE_SPI = no
+endif
+ifeq ($(CONFIG_SERPROG), yes)
+UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
+else
+override CONFIG_SERPROG = no
+endif
+# Dediprog and FT2232 are not supported under DOS (missing USB support).
+ifeq ($(CONFIG_DEDIPROG), yes)
+UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes
+else
+override CONFIG_DEDIPROG = no
+endif
+ifeq ($(CONFIG_FT2232_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes
+else
+override CONFIG_FT2232_SPI = no
+endif
endif
CHIP_OBJS = jedec.o stm50flw0x0x.o w39v040c.o w39v080fa.o w29ee011.o \
@@ -279,7 +298,7 @@
strip: $(PROGRAM)$(EXEC_SUFFIX)
$(STRIP) $(STRIP_ARGS) $(PROGRAM)$(EXEC_SUFFIX)
-compiler:
+compiler: featuresavailable
@printf "Checking for a C compiler... "
@$(shell ( echo "int main(int argc, char **argv)"; \
echo "{ return 0; }"; ) > .test.c )
@@ -318,6 +337,17 @@
.features: features
+# If a user does not explicitly request a non-working feature, we should
+# silently disable it. However, if a non-working (does not compile) feature
+# is explicitly requested, we should bail out with a descriptive error message.
+ifeq ($(UNSUPPORTED_FEATURES), )
+featuresavailable:
+else
+featuresavailable:
+ @echo "The following features are unavailable on your machine: $(UNSUPPORTED_FEATURES)"
+ @false
+endif
+
ifeq ($(CONFIG_FT2232_SPI), yes)
features: compiler
@echo "FEATURES := yes" > .features.tmp
@@ -375,6 +405,6 @@
djgpp-dos: clean
make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip WARNERROR=no OS_ARCH=DOS
-.PHONY: all clean distclean compiler pciutils features export tarball dos
+.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable
-include $(OBJS:.o=.d)
I just read nicrealtek and realized that the code uses magic constants,
but they are not explained. That's OK if you know the datasheet well,
but for casual readers some comments are really helpful.
I'm not sure whether we want to disable hardware flash access forever
without enabling it again on shutdown. A few other places made me wonder
as well. I've added FIXME comments in those places.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-nicrealtek_comments/nicrealtek.c
===================================================================
--- flashrom-nicrealtek_comments/nicrealtek.c (Revision 1028)
+++ flashrom-nicrealtek_comments/nicrealtek.c (Arbeitskopie)
@@ -65,6 +65,7 @@
int nicrealtek_shutdown(void)
{
+ /* FIXME: We forgot to disable software access again. */
free(programmer_param);
pci_cleanup(pacc);
release_io_perms();
@@ -73,8 +74,14 @@
void nicrealtek_chip_writeb(uint8_t val, chipaddr addr)
{
+ /* Output addr and data, set WE to 0, set OE to 1, set CS to 0,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x0A0000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);
+ /* Output addr and data, set WE to 1, set OE to 1, set CS to 1,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x1E0000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);
}
@@ -83,11 +90,20 @@
{
uint8_t val;
+ /* FIXME: Can we skip reading the old data and simply use 0? */
+ /* Read old data. */
val = INB(io_base_addr + BIOS_ROM_DATA);
+ /* Output new addr and old data, set WE to 1, set OE to 0, set CS to 0,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x060000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);
+ /* Read new data. */
val = INB(io_base_addr + BIOS_ROM_DATA);
+ /* Output addr and new data, set WE to 1, set OE to 1, set CS to 1,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x1E0000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);
--
http://www.hailfinger.org/
Author: hailfinger
Date: Mon Jun 14 16:18:37 2010
New Revision: 1046
URL: http://flashrom.org/trac/coreboot/changeset/1046
Log:
The nicrealtek code uses magic constants, but they are not explained.
That's OK if you know the datasheet well, but for casual readers some
comments are really helpful.
I'm not sure whether we want to disable hardware flash access forever
without enabling it again on shutdown. A few other places made me wonder
as well. I've added FIXME comments in those places.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Acked-by: Andrew Morgan <ziltro(a)ziltro.com>
Modified:
trunk/nicrealtek.c
Modified: trunk/nicrealtek.c
==============================================================================
--- trunk/nicrealtek.c Mon Jun 14 14:58:06 2010 (r1045)
+++ trunk/nicrealtek.c Mon Jun 14 16:18:37 2010 (r1046)
@@ -65,6 +65,7 @@
int nicrealtek_shutdown(void)
{
+ /* FIXME: We forgot to disable software access again. */
free(programmer_param);
pci_cleanup(pacc);
release_io_perms();
@@ -73,8 +74,14 @@
void nicrealtek_chip_writeb(uint8_t val, chipaddr addr)
{
+ /* Output addr and data, set WE to 0, set OE to 1, set CS to 0,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x0A0000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);
+ /* Output addr and data, set WE to 1, set OE to 1, set CS to 1,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x1E0000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);
}
@@ -83,11 +90,20 @@
{
uint8_t val;
+ /* FIXME: Can we skip reading the old data and simply use 0? */
+ /* Read old data. */
val = INB(io_base_addr + BIOS_ROM_DATA);
+ /* Output new addr and old data, set WE to 1, set OE to 0, set CS to 0,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x060000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);
+ /* Read new data. */
val = INB(io_base_addr + BIOS_ROM_DATA);
+ /* Output addr and new data, set WE to 1, set OE to 1, set CS to 1,
+ * enable software access.
+ */
OUTL(((uint32_t)addr & 0x01FFFF) | 0x1E0000 | (val << 24),
io_base_addr + BIOS_ROM_ADDR);