Import of 0.9.3 pre-release

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
Peter Lemenkov 2010-10-26 12:31:54 +04:00
parent 8d53e8ae07
commit a1e5088739
17 changed files with 1029 additions and 19796 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
flashrom-0.9.2.tar.bz2
/flashrom-0.9.2.tar.bz2
/flashrom-0.9.3.tar.xz

View File

@ -1,7 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
iD8DBQBMBr4iRdNMz2eF/AERApwwAKDmS3Vic3XoKJ8AfcheBy39wNcWGwCgzMK/
EmgHzE4fu1YkkTi1zfpnO9g=
=U3pC
-----END PGP SIGNATURE-----

View File

@ -1,40 +1,24 @@
From 457ef87be837eb1dab7e62fb22f2b3fc29e2619c Mon Sep 17 00:00:00 2001
From ea547fead702d32b58cfe48f9f998edea02cb427 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Fri, 17 Sep 2010 22:32:07 +0400
Subject: [PATCH 2/2] Initial commit of autotools-related files
Date: Fri, 17 Sep 2010 18:58:28 +0400
Subject: [PATCH 01/12] Initial commit of autotools-related files
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
Makefile | 451 ----------------------------------------------------------
Makefile | 452 ----------------------------------------------------------
Makefile.am | 166 +++++++++++++++++++++
configure.ac | 197 +++++++++++++++++++++++++
dmi.c | 2 +-
flash.h | 1 -
flashrom.c | 12 +-
hwaccess.h | 6 +-
ichspi.c | 4 -
internal.c | 3 +-
it87spi.c | 4 -
mcp6x_spi.c | 4 -
nic3com.c | 6 -
nicnatsemi.c | 6 -
nicrealtek.c | 6 -
print_wiki.c | 3 +-
programmer.h | 6 +-
rayer_spi.c | 5 -
sb600spi.c | 4 -
wbsio_spi.c | 4 -
19 files changed, 383 insertions(+), 507 deletions(-)
configure.ac | 204 ++++++++++++++++++++++++++
3 files changed, 370 insertions(+), 452 deletions(-)
delete mode 100644 Makefile
create mode 100644 Makefile.am
create mode 100644 configure.ac
diff --git a/Makefile b/Makefile
deleted file mode 100644
index e83fc0b..0000000
index c525e39..0000000
--- a/Makefile
+++ /dev/null
@@ -1,451 +0,0 @@
@@ -1,452 +0,0 @@
-#
-# This file is part of the flashrom project.
-#
@ -79,6 +63,7 @@ index e83fc0b..0000000
-endif
-ifeq ($(OS_ARCH), Darwin)
-CPPFLAGS += -I/opt/local/include -I/usr/local/include
-# DirectIO framework can be found in the DirectHW library.
-LDFLAGS += -framework IOKit -framework DirectIO -L/opt/local/lib -L/usr/local/lib
-endif
-ifeq ($(OS_ARCH), FreeBSD)
@ -136,7 +121,7 @@ index e83fc0b..0000000
-# will not require subversion. The downloadable snapshots are already exported.
-SVNVERSION := $(shell LC_ALL=C svnversion -cn . 2>/dev/null | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/" | grep "[0-9]" || LC_ALL=C svn info . 2>/dev/null | awk '/^Revision:/ {print $$2 }' | grep "[0-9]" || LC_ALL=C git svn info . 2>/dev/null | awk '/^Revision:/ {print $$2 }' | grep "[0-9]" || echo unknown)
-
-RELEASE := 0.9.2
-RELEASE := 0.9.3
-VERSION := $(RELEASE)-r$(SVNVERSION)
-RELEASENAME ?= $(VERSION)
-
@ -151,21 +136,6 @@ index e83fc0b..0000000
-# RayeR SPIPGM hardware support
-CONFIG_RAYER_SPI ?= yes
-
-# Bitbanging SPI infrastructure, default off unless needed.
-ifeq ($(CONFIG_RAYER_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_INTERNAL), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_NICINTEL_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-CONFIG_BITBANG_SPI ?= no
-endif
-endif
-endif
-
-# Always enable 3Com NICs for now.
-CONFIG_NIC3COM ?= yes
-
@ -206,6 +176,21 @@ index e83fc0b..0000000
-# Disable wiki printing by default. It is only useful if you have wiki access.
-CONFIG_PRINT_WIKI ?= no
-
-# Bitbanging SPI infrastructure, default off unless needed.
-ifeq ($(CONFIG_RAYER_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_INTERNAL), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_NICINTEL_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-CONFIG_BITBANG_SPI ?= no
-endif
-endif
-endif
-
-ifeq ($(CONFIG_INTERNAL), yes)
-FEATURE_CFLAGS += -D'CONFIG_INTERNAL=1'
-PROGRAMMER_OBJS += processor_enable.o chipset_enable.o board_enable.o cbtable.o dmi.o internal.o
@ -660,17 +645,17 @@ index 0000000..671287c
+ $(serial_SOURCES)
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..18c1262
index 0000000..a77cb26
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,197 @@
+AC_INIT([flashrom], [0.9.2-r1180], [flashrom@flashrom.org], [flashrom], [http://www.flashrom.org/])
@@ -0,0 +1,204 @@
+AC_INIT([flashrom], [0.9.3-r1205], [flashrom@flashrom.org], [flashrom], [http://www.flashrom.org/])
+
+AC_CANONICAL_TARGET
+
+AC_CONFIG_SRCDIR([flashrom.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([foreign dist-xz])
+AM_INIT_AUTOMAKE([foreign])
+
+AC_ARG_WITH([dummy],
+ AC_HELP_STRING([--with-dummy],[dummy flashing support.]),
@ -734,6 +719,13 @@ index 0000000..18c1262
+ AC_HELP_STRING([--with-print-wiki],[enable wiki export support. It is only useful if you have Flashrom wiki access.]),
+ [print_wiki="$withval"],[print_wiki="no"])
+
+AC_C_BIGENDIAN(
+ [AC_DEFINE([__FLASHROM_BIG_ENDIAN__], [1], [Big endian])],
+ [AC_DEFINE([__FLASHROM_LITTLE_ENDIAN__], [1], [Little endian])],
+ [AC_MSG_ERROR([Unknown endianness])],
+ [AC_MSG_ERROR([No support for universal binaries yet])]
+ )
+
+# Check for CPU-specific features
+case $target_cpu in
+ i386|i486|i586|i686|x86_64)
@ -799,7 +791,7 @@ index 0000000..18c1262
+AC_PATH_PROG([DMIDECODE], dmidecode, [dmidecode], [$PATH$PATH_SEPARATOR/usr/sbin])
+
+# Checks for header files.
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/socket.h sys/time.h sys/utsname.h termios.h unistd.h])
+AC_CHECK_HEADERS([DirectIO/darwinio.h arpa/inet.h asm/sunddi.h fcntl.h inttypes.h limits.h machine/cpufunc.h machine/sysarch.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/io.h sys/ioctl.h sys/psw.h sys/socket.h sys/sysi86.h sys/time.h sys/utsname.h termios.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
@ -861,356 +853,6 @@ index 0000000..18c1262
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/dmi.c b/dmi.c
index f18907f..09009e7 100644
--- a/dmi.c
+++ b/dmi.c
@@ -55,7 +55,7 @@ static const char *dmidecode_names[] = {
};
#define DMI_COMMAND_LEN_MAX 260
-static const char *dmidecode_command = "dmidecode";
+static const char *dmidecode_command = DMIDECODE_PATH;
static char *dmistrings[ARRAY_SIZE(dmidecode_names)];
diff --git a/flash.h b/flash.h
index 6f0d7c0..4aba5ab 100644
--- a/flash.h
+++ b/flash.h
@@ -182,7 +182,6 @@ enum write_granularity {
};
extern enum chipbustype buses_supported;
extern int verbose;
-extern const char * const flashrom_version;
extern char *chip_to_probe;
void map_flash_registers(struct flashchip *flash);
int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, int len);
diff --git a/flashrom.c b/flashrom.c
index f722029..a2be2fc 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -28,14 +28,16 @@
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
-#if HAVE_UTSNAME == 1
+
+#include "config.h"
+
+#if HAVE_SYS_UTSNAME_H == 1
#include <sys/utsname.h>
#endif
#include "flash.h"
#include "flashchips.h"
#include "programmer.h"
-const char * const flashrom_version = FLASHROM_VERSION;
char *chip_to_probe = NULL;
int verbose = 0;
@@ -1332,7 +1334,7 @@ void list_programmers(char *delim)
void print_sysinfo(void)
{
-#if HAVE_UTSNAME == 1
+#if HAVE_UNAME == 1
struct utsname osinfo;
uname(&osinfo);
@@ -1342,7 +1344,7 @@ void print_sysinfo(void)
msg_ginfo(" on unknown machine");
#endif
msg_ginfo(", built with");
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
#ifdef PCILIB_VERSION
msg_ginfo(" libpci %s,", PCILIB_VERSION);
#else
@@ -1376,7 +1378,7 @@ void print_sysinfo(void)
void print_version(void)
{
- msg_ginfo("flashrom v%s", flashrom_version);
+ msg_ginfo("flashrom v%s", PACKAGE_VERSION);
print_sysinfo();
}
diff --git a/hwaccess.h b/hwaccess.h
index 2d17326..bd78539 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -24,13 +24,15 @@
#ifndef __HWACCESS_H__
#define __HWACCESS_H__ 1
+#include "config.h"
+
#if defined (__i386__) || defined (__x86_64__)
#if defined(__GLIBC__)
#include <sys/io.h>
#endif
#endif
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
/*
* libpci headers use the variable name "index" which triggers shadowing
* warnings on systems which have the index() function in a default #include
@@ -160,7 +162,7 @@ cpu_to_be(64)
#define le_to_cpu32 cpu_to_le32
#define le_to_cpu64 cpu_to_le64
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
#if defined (__i386__) || defined (__x86_64__)
#define __FLASHROM_HAVE_OUTB__ 1
diff --git a/ichspi.c b/ichspi.c
index bb6007e..7ac8e37 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -33,8 +33,6 @@
*
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <string.h>
#include "flash.h"
#include "chipdrivers.h"
@@ -1072,5 +1070,3 @@ int via_init_spi(struct pci_dev *dev)
return 0;
}
-
-#endif
diff --git a/internal.c b/internal.c
index 497ce6c..71965de 100644
--- a/internal.c
+++ b/internal.c
@@ -24,8 +24,9 @@
#include <sys/types.h>
#include "flash.h"
#include "programmer.h"
+#include "config.h"
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
struct pci_dev *pci_dev_find_filter(struct pci_filter filter)
{
struct pci_dev *temp;
diff --git a/it87spi.c b/it87spi.c
index 9ecc414..1750cf8 100644
--- a/it87spi.c
+++ b/it87spi.c
@@ -23,8 +23,6 @@
* Contains the ITE IT87* SPI specific routines
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <string.h>
#include <stdlib.h>
#include "flash.h"
@@ -371,5 +369,3 @@ int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start,
return 0;
}
-
-#endif
diff --git a/mcp6x_spi.c b/mcp6x_spi.c
index 97c0a1c..a277983 100644
--- a/mcp6x_spi.c
+++ b/mcp6x_spi.c
@@ -23,8 +23,6 @@
* created by Michael Karcher.
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdint.h>
#include <stdlib.h>
#include <ctype.h>
@@ -172,5 +170,3 @@ int mcp6x_spi_init(int want_spi)
return 0;
}
-
-#endif
diff --git a/nic3com.c b/nic3com.c
index 0eb781a..7084edf 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
@@ -114,7 +112,3 @@ uint8_t nic3com_chip_readb(const chipaddr addr)
OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR);
return INB(io_base_addr + BIOS_ROM_DATA);
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/nicnatsemi.c b/nicnatsemi.c
index 1683857..e3a2807 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
@@ -89,7 +87,3 @@ uint8_t nicnatsemi_chip_readb(const chipaddr addr)
*/
return INB(io_base_addr + BOOT_ROM_DATA);
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/nicrealtek.c b/nicrealtek.c
index c32e5d6..b5bcbaf 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
@@ -109,7 +107,3 @@ uint8_t nicrealtek_chip_readb(const chipaddr addr)
return val;
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/print_wiki.c b/print_wiki.c
index 313fdea..c061116 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -26,6 +26,7 @@
#include "flash.h"
#include "flashchips.h"
#include "programmer.h"
+#include "config.h"
static const char * const wiki_header = "= Supported devices =\n\n\
<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
@@ -267,7 +268,7 @@ void print_supported_wiki(void)
{
time_t t = time(NULL);
- printf(wiki_header, ctime(&t), flashrom_version);
+ printf(wiki_header, ctime(&t), PACKAGE_VERSION);
#if CONFIG_INTERNAL == 1
print_supported_chips_wiki(2);
print_supported_chipsets_wiki(3);
diff --git a/programmer.h b/programmer.h
index 6407695..dfd99b4 100644
--- a/programmer.h
+++ b/programmer.h
@@ -24,6 +24,8 @@
#ifndef __PROGRAMMER_H__
#define __PROGRAMMER_H__ 1
+#include "config.h"
+
enum programmer {
#if CONFIG_INTERNAL == 1
PROGRAMMER_INTERNAL,
@@ -198,7 +200,7 @@ void myusec_delay(int usecs);
void myusec_calibrate_delay(void);
void internal_delay(int usecs);
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
/* pcidev.c */
extern uint32_t io_base_addr;
extern struct pci_access *pacc;
@@ -253,7 +255,7 @@ void dmi_init(void);
int dmi_match(const char *pattern);
/* internal.c */
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
struct superio {
uint16_t vendor;
uint16_t port;
diff --git a/rayer_spi.c b/rayer_spi.c
index 722ad14..df6d972 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -28,7 +28,6 @@
* most OS parport drivers will perform many unnecessary accesses although
* this driver just treats the parallel port as a GPIO set.
*/
-#if defined(__i386__) || defined(__x86_64__)
#include "flash.h"
#include "programmer.h"
@@ -117,7 +116,3 @@ int rayer_spi_init(void)
return 0;
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/sb600spi.c b/sb600spi.c
index 4e3e079..c468ca3 100644
--- a/sb600spi.c
+++ b/sb600spi.c
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"
@@ -319,5 +317,3 @@ int sb600_probe_spi(struct pci_dev *dev)
spi_controller = SPI_CONTROLLER_SB600;
return 0;
}
-
-#endif
diff --git a/wbsio_spi.c b/wbsio_spi.c
index acf9cb2..1a583a8 100644
--- a/wbsio_spi.c
+++ b/wbsio_spi.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"
@@ -185,5 +183,3 @@ int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len)
{
return read_memmapped(flash, buf, start, len);
}
-
-#endif
--
1.7.2.3
1.7.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
From 4c2775e9957db3722c07c9c7b710867d868cfc2f Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 12 Jun 2010 22:13:53 +0400
Subject: [PATCH 02/12] Use dmidecode path defined at configure stage
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
dmi.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dmi.c b/dmi.c
index cda6656..2853c93 100644
--- a/dmi.c
+++ b/dmi.c
@@ -75,7 +75,7 @@ static const struct {
};
#define DMI_COMMAND_LEN_MAX 260
-static const char *dmidecode_command = "dmidecode";
+static const char *dmidecode_command = DMIDECODE_PATH;
static char *dmistrings[ARRAY_SIZE(dmidecode_names)];
--
1.7.3.1

View File

@ -0,0 +1,79 @@
From b5d6b6405a831a0b8694629fefa228b7f1f2eb84 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Fri, 17 Sep 2010 22:32:07 +0400
Subject: [PATCH 03/12] Use flashrom's version from config.h
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
flash.h | 1 -
flashrom.c | 6 ++++--
print_wiki.c | 3 ++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/flash.h b/flash.h
index 9566af9..33a7890 100644
--- a/flash.h
+++ b/flash.h
@@ -187,7 +187,6 @@ enum write_granularity {
};
extern enum chipbustype buses_supported;
extern int verbose;
-extern const char * const flashrom_version;
extern char *chip_to_probe;
void map_flash_registers(struct flashchip *flash);
int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, int len);
diff --git a/flashrom.c b/flashrom.c
index e5e334c..dd6d6df 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -30,6 +30,9 @@
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
+
+#include "config.h"
+
#if HAVE_UTSNAME == 1
#include <sys/utsname.h>
#endif
@@ -37,7 +40,6 @@
#include "flashchips.h"
#include "programmer.h"
-const char * const flashrom_version = FLASHROM_VERSION;
char *chip_to_probe = NULL;
int verbose = 0;
@@ -1420,7 +1422,7 @@ void print_sysinfo(void)
void print_version(void)
{
- msg_ginfo("flashrom v%s", flashrom_version);
+ msg_ginfo("flashrom v%s", PACKAGE_VERSION);
print_sysinfo();
}
diff --git a/print_wiki.c b/print_wiki.c
index 1b46dd0..4363eba 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -26,6 +26,7 @@
#include "flash.h"
#include "flashchips.h"
#include "programmer.h"
+#include "config.h"
static const char * const wiki_header = "= Supported devices =\n\n\
<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
@@ -267,7 +268,7 @@ void print_supported_wiki(void)
{
time_t t = time(NULL);
- printf(wiki_header, ctime(&t), flashrom_version);
+ printf(wiki_header, ctime(&t), PACKAGE_VERSION);
print_supported_chips_wiki(2);
#if CONFIG_INTERNAL == 1
print_supported_chipsets_wiki(3);
--
1.7.3.1

View File

@ -0,0 +1,105 @@
From 39bd06642030c29b202ae52162de0f437cfffedc Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Fri, 17 Sep 2010 22:33:12 +0400
Subject: [PATCH 04/12] Use HAVE_LIBPCI from config.h instead of NEED_PCI
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
flashrom.c | 2 +-
hwaccess.h | 6 ++++--
internal.c | 3 ++-
programmer.h | 6 ++++--
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/flashrom.c b/flashrom.c
index dd6d6df..df4cc67 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1388,7 +1388,7 @@ void print_sysinfo(void)
msg_ginfo(" on unknown machine");
#endif
msg_ginfo(", built with");
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
#ifdef PCILIB_VERSION
msg_ginfo(" libpci %s,", PCILIB_VERSION);
#else
diff --git a/hwaccess.h b/hwaccess.h
index 63a2bf2..920b82c 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -24,13 +24,15 @@
#ifndef __HWACCESS_H__
#define __HWACCESS_H__ 1
+#include "config.h"
+
#if defined (__i386__) || defined (__x86_64__)
#if defined(__GLIBC__)
#include <sys/io.h>
#endif
#endif
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
/*
* libpci headers use the variable name "index" which triggers shadowing
* warnings on systems which have the index() function in a default #include
@@ -160,7 +162,7 @@ cpu_to_be(64)
#define le_to_cpu32 cpu_to_le32
#define le_to_cpu64 cpu_to_le64
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
#if defined (__i386__) || defined (__x86_64__)
#define __FLASHROM_HAVE_OUTB__ 1
diff --git a/internal.c b/internal.c
index c96db99..8bc49b9 100644
--- a/internal.c
+++ b/internal.c
@@ -22,8 +22,9 @@
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
+#include "config.h"
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
struct pci_dev *pci_dev_find_filter(struct pci_filter filter)
{
struct pci_dev *temp;
diff --git a/programmer.h b/programmer.h
index 6407695..dfd99b4 100644
--- a/programmer.h
+++ b/programmer.h
@@ -24,6 +24,8 @@
#ifndef __PROGRAMMER_H__
#define __PROGRAMMER_H__ 1
+#include "config.h"
+
enum programmer {
#if CONFIG_INTERNAL == 1
PROGRAMMER_INTERNAL,
@@ -198,7 +200,7 @@ void myusec_delay(int usecs);
void myusec_calibrate_delay(void);
void internal_delay(int usecs);
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
/* pcidev.c */
extern uint32_t io_base_addr;
extern struct pci_access *pacc;
@@ -253,7 +255,7 @@ void dmi_init(void);
int dmi_match(const char *pattern);
/* internal.c */
-#if NEED_PCI == 1
+#if HAVE_LIBPCI == 1
struct superio {
uint16_t vendor;
uint16_t port;
--
1.7.3.1

View File

@ -0,0 +1,35 @@
From a03c6656f46d44d48229571bde54f6c2e1192380 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 18 Sep 2010 09:05:43 +0400
Subject: [PATCH 05/12] Use macros from config.h instead of HAVE_UTSNAME
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
flashrom.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/flashrom.c b/flashrom.c
index df4cc67..b9285a3 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -33,7 +33,7 @@
#include "config.h"
-#if HAVE_UTSNAME == 1
+#if HAVE_SYS_UTSNAME_H == 1
#include <sys/utsname.h>
#endif
#include "flash.h"
@@ -1378,7 +1378,7 @@ void list_programmers_linebreak(int startcol, int cols, int paren)
void print_sysinfo(void)
{
-#if HAVE_UTSNAME == 1
+#if HAVE_UNAME == 1
struct utsname osinfo;
uname(&osinfo);
--
1.7.3.1

View File

@ -0,0 +1,199 @@
From eaa749e886343597ddf01353f19c260e42d66270 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 18 Sep 2010 09:40:01 +0400
Subject: [PATCH 06/12] Kill some x86-related ifdefs in code - this is now controlled via autotools
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
ichspi.c | 4 ----
it87spi.c | 4 ----
mcp6x_spi.c | 4 ----
nic3com.c | 6 ------
nicnatsemi.c | 6 ------
nicrealtek.c | 6 ------
rayer_spi.c | 5 -----
sb600spi.c | 4 ----
wbsio_spi.c | 4 ----
9 files changed, 0 insertions(+), 43 deletions(-)
diff --git a/ichspi.c b/ichspi.c
index c26366e..5438efe 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -34,8 +34,6 @@
*
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <string.h>
#include "flash.h"
#include "chipdrivers.h"
@@ -1131,5 +1129,3 @@ int via_init_spi(struct pci_dev *dev)
return 0;
}
-
-#endif
diff --git a/it87spi.c b/it87spi.c
index 9ecc414..1750cf8 100644
--- a/it87spi.c
+++ b/it87spi.c
@@ -23,8 +23,6 @@
* Contains the ITE IT87* SPI specific routines
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <string.h>
#include <stdlib.h>
#include "flash.h"
@@ -371,5 +369,3 @@ int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start,
return 0;
}
-
-#endif
diff --git a/mcp6x_spi.c b/mcp6x_spi.c
index 0e0d311..d9bb893 100644
--- a/mcp6x_spi.c
+++ b/mcp6x_spi.c
@@ -23,8 +23,6 @@
* created by Michael Karcher.
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdlib.h>
#include <ctype.h>
#include "flash.h"
@@ -171,5 +169,3 @@ int mcp6x_spi_init(int want_spi)
return 0;
}
-
-#endif
diff --git a/nic3com.c b/nic3com.c
index 0eb781a..7084edf 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
@@ -114,7 +112,3 @@ uint8_t nic3com_chip_readb(const chipaddr addr)
OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR);
return INB(io_base_addr + BIOS_ROM_DATA);
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/nicnatsemi.c b/nicnatsemi.c
index 1683857..e3a2807 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
@@ -89,7 +87,3 @@ uint8_t nicnatsemi_chip_readb(const chipaddr addr)
*/
return INB(io_base_addr + BOOT_ROM_DATA);
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/nicrealtek.c b/nicrealtek.c
index c32e5d6..b5bcbaf 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include <stdlib.h>
#include "flash.h"
#include "programmer.h"
@@ -109,7 +107,3 @@ uint8_t nicrealtek_chip_readb(const chipaddr addr)
return val;
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/rayer_spi.c b/rayer_spi.c
index a01ee80..e64137b 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -28,7 +28,6 @@
* most OS parport drivers will perform many unnecessary accesses although
* this driver just treats the parallel port as a GPIO set.
*/
-#if defined(__i386__) || defined(__x86_64__)
#include <stdlib.h>
#include "flash.h"
@@ -139,7 +138,3 @@ int rayer_spi_init(void)
return 0;
}
-
-#else
-#error PCI port I/O access is not supported on this architecture yet.
-#endif
diff --git a/sb600spi.c b/sb600spi.c
index 4e3e079..c468ca3 100644
--- a/sb600spi.c
+++ b/sb600spi.c
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"
@@ -319,5 +317,3 @@ int sb600_probe_spi(struct pci_dev *dev)
spi_controller = SPI_CONTROLLER_SB600;
return 0;
}
-
-#endif
diff --git a/wbsio_spi.c b/wbsio_spi.c
index acf9cb2..1a583a8 100644
--- a/wbsio_spi.c
+++ b/wbsio_spi.c
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__i386__) || defined(__x86_64__)
-
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"
@@ -185,5 +183,3 @@ int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len)
{
return read_memmapped(flash, buf, start, len);
}
-
-#endif
--
1.7.3.1

View File

@ -0,0 +1,146 @@
From c3103091f40eaedd03a1f1bcb3503311a6072927 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 21 Sep 2010 17:51:08 +0400
Subject: [PATCH 07/12] Simplify hwaccess.c
This file is saturated with superfluous ifdefs arranged into
several nested levels. This in turn adds additional complexity
to process of adding another architecture.
I re-arranged all ifdef blocks and killed duplicated function
definitions. Also I added define(__amd64) to the list of x86-arches.
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
hwaccess.c | 85 +++++++++++++++++++++--------------------------------------
1 files changed, 30 insertions(+), 55 deletions(-)
diff --git a/hwaccess.c b/hwaccess.c
index bbb91a6..e700b67 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -31,30 +31,47 @@
#endif
#include "flash.h"
+#if !( defined(__i386__) || \
+ defined(__x86_64__) || defined(__amd64) || \
+ defined (__mips) || defined (__mips__) || defined (_mips) || defined (mips) || \
+ defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__))
+#error Unknown architecture
+#endif
+
#if defined(__i386__) || defined(__x86_64__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+int io_fd;
+#endif
+#endif
-/* sync primitive is not needed because x86 uses uncached accesses
- * which have a strongly ordered memory model.
- */
static inline void sync_primitive(void)
{
-}
-
-#if defined(__FreeBSD__) || defined(__DragonFly__)
-int io_fd;
+/* sync primitive is needed only on PowerPC because
+ * x86 uses uncached accesses which have a strongly ordered memory model
+ * /dev/mem on MIPS uses uncached accesses in mode 2 which has a strongly ordered memory model.
+ */
+#if defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
+ /* Prevent reordering and/or merging of reads/writes to hardware.
+ * Such reordering and/or merging would break device accesses which
+ * depend on the exact access order.
+ */
+ asm("eieio" : : : "memory");
#endif
+}
void get_io_perms(void)
{
+/* PCI port I/O is not yet implemented on PowerPC or MIPS. */
+#if defined(__i386__) || defined(__x86_64__) || defined(__amd64)
#if defined(__DJGPP__) || defined(__LIBPAYLOAD__)
/* We have full permissions by default. */
return;
#else
-#if defined (__sun) && (defined(__i386) || defined(__amd64))
+#if defined (__sun)
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) {
#elif defined(__FreeBSD__) || defined (__DragonFly__)
if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
-#else
+#else
if (iopl(3) != 0) {
#endif
msg_perr("ERROR: Could not get I/O privileges (%s).\n"
@@ -67,60 +84,18 @@ void get_io_perms(void)
exit(1);
}
#endif
+#endif
}
void release_io_perms(void)
{
+/* PCI port I/O is not yet implemented on PowerPC or MIPS. */
+#if defined(__i386__) || defined(__x86_64__) || defined(__amd64)
#if defined(__FreeBSD__) || defined(__DragonFly__)
close(io_fd);
#endif
-}
-
-#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
-
-static inline void sync_primitive(void)
-{
- /* Prevent reordering and/or merging of reads/writes to hardware.
- * Such reordering and/or merging would break device accesses which
- * depend on the exact access order.
- */
- asm("eieio" : : : "memory");
-}
-
-/* PCI port I/O is not yet implemented on PowerPC. */
-void get_io_perms(void)
-{
-}
-
-/* PCI port I/O is not yet implemented on PowerPC. */
-void release_io_perms(void)
-{
-}
-
-#elif defined (__mips) || defined (__mips__) || defined (_mips) || defined (mips)
-
-/* sync primitive is not needed because /dev/mem on MIPS uses uncached accesses
- * in mode 2 which has a strongly ordered memory model.
- */
-static inline void sync_primitive(void)
-{
-}
-
-/* PCI port I/O is not yet implemented on MIPS. */
-void get_io_perms(void)
-{
-}
-
-/* PCI port I/O is not yet implemented on MIPS. */
-void release_io_perms(void)
-{
-}
-
-#else
-
-#error Unknown architecture
-
#endif
+}
void mmio_writeb(uint8_t val, void *addr)
{
--
1.7.3.1

View File

@ -0,0 +1,91 @@
From f0185abacc6a326a0778f480d1fde1cc4380c442 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sun, 26 Sep 2010 18:25:31 +0400
Subject: [PATCH 08/12] Use endiannes determined at the configure stage
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
hwaccess.h | 53 ++---------------------------------------------------
1 files changed, 2 insertions(+), 51 deletions(-)
diff --git a/hwaccess.h b/hwaccess.h
index 920b82c..4655003 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -43,51 +43,6 @@
#undef index
#endif
-#if defined (__i386__) || defined (__x86_64__)
-
-/* All x86 is little-endian. */
-#define __FLASHROM_LITTLE_ENDIAN__ 1
-
-#elif defined (__mips) || defined (__mips__) || defined (_mips) || defined (mips)
-
-/* MIPS can be either endian. */
-#if defined (__MIPSEL) || defined (__MIPSEL__) || defined (_MIPSEL) || defined (MIPSEL)
-#define __FLASHROM_LITTLE_ENDIAN__ 1
-#elif defined (__MIPSEB) || defined (__MIPSEB__) || defined (_MIPSEB) || defined (MIPSEB)
-#define __FLASHROM_BIG_ENDIAN__ 1
-#endif
-
-#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
-
-/* PowerPC can be either endian. */
-#if defined (_BIG_ENDIAN) || defined (__BIG_ENDIAN__)
-#define __FLASHROM_BIG_ENDIAN__ 1
-/* Error checking in case some weird header has #defines for LE as well. */
-#if defined (_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__)
-#error Conflicting endianness #define
-#endif
-#else
-#error Little-endian PowerPC #defines are unknown
-#endif
-
-#endif
-
-#if !defined (__FLASHROM_BIG_ENDIAN__) && !defined (__FLASHROM_LITTLE_ENDIAN__)
-/* Nonstandard libc-specific macros for determining endianness. */
-#if defined(__GLIBC__)
-#include <endian.h>
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define __FLASHROM_LITTLE_ENDIAN__ 1
-#elif BYTE_ORDER == BIG_ENDIAN
-#define __FLASHROM_BIG_ENDIAN__ 1
-#endif
-#endif
-#endif
-
-#if !defined (__FLASHROM_BIG_ENDIAN__) && !defined (__FLASHROM_LITTLE_ENDIAN__)
-#error Unable to determine endianness. Please add support for your arch or libc.
-#endif
-
#define ___constant_swab8(x) ((uint8_t) ( \
(((uint8_t)(x) & (uint8_t)0xffU))))
@@ -129,7 +84,7 @@ cpu_to_le(64)
#define cpu_to_be32
#define cpu_to_be64
-#elif defined (__FLASHROM_LITTLE_ENDIAN__)
+#else /* defined (__FLASHROM_BIG_ENDIAN__) */
#define cpu_to_be(bits) \
static inline uint##bits##_t cpu_to_be##bits(uint##bits##_t val) \
@@ -147,11 +102,7 @@ cpu_to_be(64)
#define cpu_to_le32
#define cpu_to_le64
-#else
-
-#error Could not determine endianness.
-
-#endif
+#endif /* defined (__FLASHROM_BIG_ENDIAN__) */
#define be_to_cpu8 cpu_to_be8
#define be_to_cpu16 cpu_to_be16
--
1.7.3.1

View File

@ -0,0 +1,26 @@
From aa1ca481e2f28fd442c129884fdb08d169efdd41 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sun, 26 Sep 2010 20:14:18 +0400
Subject: [PATCH 09/12] Kill unused __FLASHROM_HAVE_OUTB__ define
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
hwaccess.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/hwaccess.h b/hwaccess.h
index 4655003..111f7d9 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -116,8 +116,6 @@ cpu_to_be(64)
#if HAVE_LIBPCI == 1
#if defined (__i386__) || defined (__x86_64__)
-#define __FLASHROM_HAVE_OUTB__ 1
-
/* for iopl and outb under Solaris */
#if defined (__sun) && (defined(__i386) || defined(__amd64))
#include <strings.h>
--
1.7.3.1

View File

@ -0,0 +1,123 @@
From 0ed4f34440b0da7957b4f301da35ba2c8354405a Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sun, 26 Sep 2010 21:05:50 +0400
Subject: [PATCH 10/12] Use HAVE_*_H macro for detecting includes
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
hwaccess.h | 62 ++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/hwaccess.h b/hwaccess.h
index 111f7d9..3326383 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -26,13 +26,11 @@
#include "config.h"
-#if defined (__i386__) || defined (__x86_64__)
-#if defined(__GLIBC__)
+#if defined (HAVE_SYS_IO_H)
#include <sys/io.h>
-#endif
-#endif
+#endif /* defined (HAVE_SYS_IO_H) */
-#if HAVE_LIBPCI == 1
+#if defined (HAVE_LIBPCI)
/*
* libpci headers use the variable name "index" which triggers shadowing
* warnings on systems which have the index() function in a default #include
@@ -41,7 +39,47 @@
#define index shadow_workaround_index
#include <pci/pci.h>
#undef index
-#endif
+
+#if defined (HAVE_STRINGS_H)
+#include <strings.h>
+#endif /* defined (HAVE_STRINGS_H) */
+
+#if defined (HAVE_STDINT_H)
+#include <stdint.h>
+#endif /* defined (HAVE_STDINT_H) */
+
+#if defined (HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#endif /* defined (HAVE_SYS_TYPES_H) */
+
+#if defined (HAVE_MACHINE_SYSARCH_H)
+#include <machine/sysarch.h>
+#endif /* defined (HAVE_MACHINE_SYSARCH_H) */
+
+#if defined (HAVE_MACHINE_CPUFUNC_H)
+#include <machine/cpufunc.h>
+#endif /* defined (HAVE_MACHINE_CPUFUNC_H) */
+
+/* for iopl and outb under Solaris */
+#if defined HAVE_ASM_SUNDDI_H
+#include <asm/sunddi.h>
+#endif /* defined HAVE_ASM_SUNDDI_H */
+#if defined HAVE_SYS_SYSI86_H
+#include <sys/sysi86.h>
+#endif /* defined HAVE_SYS_SYSI86_H */
+#if defined HAVE_SYS_PSW_H
+#include <sys/psw.h>
+#endif /* defined HAVE_SYS_PSW_H */
+
+#ifdef __DJGPP__
+#include <pc.h>
+#endif /* __DJGPP__ */
+
+#if defined HAVE_DIRECTIO_DARWINIO_H
+#include <DirectIO/darwinio.h>
+#endif /* defined HAVE_DIRECTIO_DARWINIO_H */
+
+#endif /* defined (HAVE_LIBPCI) */
#define ___constant_swab8(x) ((uint8_t) ( \
(((uint8_t)(x) & (uint8_t)0xffU))))
@@ -116,13 +154,6 @@ cpu_to_be(64)
#if HAVE_LIBPCI == 1
#if defined (__i386__) || defined (__x86_64__)
-/* for iopl and outb under Solaris */
-#if defined (__sun) && (defined(__i386) || defined(__amd64))
-#include <strings.h>
-#include <sys/sysi86.h>
-#include <sys/psw.h>
-#include <asm/sunddi.h>
-#endif
#if (defined(__MACH__) && defined(__APPLE__))
#define __DARWIN__
@@ -133,7 +164,6 @@ cpu_to_be(64)
*/
#if defined(__FreeBSD__) || defined(__DragonFly__)
- #include <machine/cpufunc.h>
#define off64_t off_t
#define lseek64 lseek
#define OUTB(x, y) do { u_int outb_tmp = (y); outb(outb_tmp, (x)); } while (0)
@@ -161,8 +191,6 @@ cpu_to_be(64)
#ifdef __DJGPP__
-#include <pc.h>
-
#define OUTB(x,y) outportb(y, x)
#define OUTW(x,y) outportw(y, x)
#define OUTL(x,y) outportl(y, x)
@@ -189,8 +217,6 @@ cpu_to_be(64)
#define off64_t off_t
#define lseek64 lseek
#if defined(__i386__) || defined(__x86_64__)
- #include <sys/types.h>
- #include <machine/sysarch.h>
#if defined(__NetBSD__)
#if defined(__i386__)
#define iopl i386_iopl
--
1.7.3.1

View File

@ -0,0 +1,49 @@
From 074d25561454e4f6f23c3c0b2c27bb0454a25f90 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sun, 17 Oct 2010 12:52:02 +0400
Subject: [PATCH 11/12] Add more comments (cosmetic change)
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
hwaccess.h | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/hwaccess.h b/hwaccess.h
index 3326383..9fb078f 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -152,8 +152,10 @@ cpu_to_be(64)
#define le_to_cpu64 cpu_to_le64
#if HAVE_LIBPCI == 1
-#if defined (__i386__) || defined (__x86_64__)
+/* PCI port I/O is not yet implemented on PowerPC. */
+/* PCI port I/O is not yet implemented on MIPS. */
+#if defined (__i386__) || defined (__x86_64__)
#if (defined(__MACH__) && defined(__APPLE__))
#define __DARWIN__
@@ -273,7 +275,8 @@ static inline uint32_t inl(uint16_t port)
typedef struct { uint32_t hi, lo; } msr_t;
msr_t rdmsr(int addr);
int wrmsr(int addr, msr_t msr);
-#endif
+#endif /* !defined(__DARWIN__) && !defined(__FreeBSD__) && !defined(__DragonFly__) */
+
#if defined(__FreeBSD__) || defined(__DragonFly__)
/* FreeBSD already has conflicting definitions for wrmsr/rdmsr. */
#undef rdmsr
@@ -283,7 +286,8 @@ int wrmsr(int addr, msr_t msr);
typedef struct { uint32_t hi, lo; } msr_t;
msr_t freebsd_rdmsr(int addr);
int freebsd_wrmsr(int addr, msr_t msr);
-#endif
+#endif /* defined(__FreeBSD__) || defined(__DragonFly__) */
+
#if defined(__LIBPAYLOAD__)
#include <arch/io.h>
#include <arch/msr.h>
--
1.7.3.1

View File

@ -0,0 +1,78 @@
From 25d6e8fc99c76e37af16ec068e35b4c053b2fc3c Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sun, 17 Oct 2010 12:53:18 +0400
Subject: [PATCH 12/12] Move arch-checking #ifdef block into header
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
hwaccess.c | 7 -------
hwaccess.h | 21 ++++++++-------------
2 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/hwaccess.c b/hwaccess.c
index e700b67..5fcc83e 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -31,13 +31,6 @@
#endif
#include "flash.h"
-#if !( defined(__i386__) || \
- defined(__x86_64__) || defined(__amd64) || \
- defined (__mips) || defined (__mips__) || defined (_mips) || defined (mips) || \
- defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__))
-#error Unknown architecture
-#endif
-
#if defined(__i386__) || defined(__x86_64__)
#if defined(__FreeBSD__) || defined(__DragonFly__)
int io_fd;
diff --git a/hwaccess.h b/hwaccess.h
index 9fb078f..b166429 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -26,6 +26,13 @@
#include "config.h"
+#if !( defined(__i386__) || \
+ defined(__x86_64__) || defined(__amd64) || \
+ defined (__mips) || defined (__mips__) || defined (_mips) || defined (mips) || \
+ defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__))
+#error Unknown architecture
+#endif
+
#if defined (HAVE_SYS_IO_H)
#include <sys/io.h>
#endif /* defined (HAVE_SYS_IO_H) */
@@ -181,7 +188,7 @@ cpu_to_be(64)
#define off64_t off_t
#define lseek64 lseek
#endif
-#if defined (__sun) && (defined(__i386) || defined(__amd64))
+#if defined (__sun)
/* Note different order for outb */
#define OUTB(x,y) outb(y, x)
#define OUTW(x,y) outw(y, x)
@@ -299,18 +306,6 @@ int libpayload_wrmsr(int addr, msr_t msr);
#define wrmsr libpayload_wrmsr
#endif
-#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
-
-/* PCI port I/O is not yet implemented on PowerPC. */
-
-#elif defined (__mips) || defined (__mips__) || defined (_mips) || defined (mips)
-
-/* PCI port I/O is not yet implemented on MIPS. */
-
-#else
-
-#error Unknown architecture, please check if it supports PCI port IO.
-
#endif
#endif
--
1.7.3.1

View File

@ -1,14 +1,27 @@
Summary: Simple program for reading/writing BIOS chips content
Name: flashrom
Version: 0.9.2
Release: 7.svn1180%{?dist}
Version: 0.9.3
Release: 0.1.svn1205%{?dist}
License: GPLv2
Group: Applications/System
URL: http://flashrom.org
Source0: http://qa.coreboot.org/releases/%{name}-%{version}.tar.bz2
Source1: http://qa.coreboot.org/releases/%{name}-%{version}.tar.bz2.asc
Patch1: flashrom-0001-Sync-with-svn-ver.-1180.patch
Patch2: flashrom-0002-Initial-commit-of-autotools-related-files.patch
#Source0: http://qa.coreboot.org/releases/%{name}-%{version}.tar.bz2
#Source1: http://qa.coreboot.org/releases/%{name}-%{version}.tar.bz2.asc
## svn co svn://coreboot.org/flashrom/tags/flashrom-0.9.3
## tar cJf flashrom-0.9.3.tar.xz flashrom-0.9.3/
Source0: %{name}-%{version}.tar.xz
Patch1: flashrom-0001-Initial-commit-of-autotools-related-files.patch
Patch2: flashrom-0002-Use-dmidecode-path-defined-at-configure-stage.patch
Patch3: flashrom-0003-Use-flashrom-s-version-from-config.h.patch
Patch4: flashrom-0004-Use-HAVE_LIBPCI-from-config.h-instead-of-NEED_PCI.patch
Patch5: flashrom-0005-Use-macros-from-config.h-instead-of-HAVE_UTSNAME.patch
Patch6: flashrom-0006-Kill-some-x86-related-ifdefs-in-code-this-is-now-con.patch
Patch7: flashrom-0007-Simplify-hwaccess.c.patch
Patch8: flashrom-0008-Use-endiannes-determined-at-the-configure-stage.patch
Patch9: flashrom-0009-Kill-unused-__FLASHROM_HAVE_OUTB__-define.patch
Patch10: flashrom-0010-Use-HAVE_-_H-macro-for-detecting-includes.patch
Patch11: flashrom-0011-Add-more-comments-cosmetic-change.patch
Patch12: flashrom-0012-Move-arch-checking-ifdef-block-into-header.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: pciutils-devel
@ -30,6 +43,16 @@ and write new contents on the chips ("flash the chip").
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
autoreconf -ivf
@ -51,6 +74,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/%{name}.*
%changelog
* Tue Oct 26 2010 Peter Lemenkov <lemenkov@gmail.com> 0.9.3-0.1.svn1205
- Ver. 0.9.3 (pre-release, exported from SCM)
* Wed Sep 29 2010 jkeating - 0.9.2-7.svn1180
- Rebuilt for gcc bug 634757

View File

@ -1 +1 @@
21751b4ea93c5a82c725adae7b63014a flashrom-0.9.2.tar.bz2
0ebf2b296798ba27c6cced35b9fb4a8c flashrom-0.9.3.tar.xz