On 09.08.2009 18:01, Stefan Reinauer wrote: > I separated the direct io access code from the flashrom changes, to make > this code easily available for the other coreboot utilities, too. > > The remaining windows patch is rather small. > > I'll clean up the directio code some more and make a release asap. >
I cleaned up the Windows patch, rewrote the Makefile changes and updated it to apply against latest svn. Signed-off-by: Carl-Daniel Hailfinger <[email protected]> Index: flashrom-windows/hwaccess.h =================================================================== --- flashrom-windows/hwaccess.h (Revision 1028) +++ flashrom-windows/hwaccess.h (Arbeitskopie) @@ -31,8 +31,12 @@ #endif #if NEED_PCI == 1 +#if defined (__MINGW32_VERSION) && ( defined (__i386__) || defined (__x86_64__) ) +#include "directio.h" +#else #include <pci/pci.h> #endif +#endif #if defined (__i386__) || defined (__x86_64__) Index: flashrom-windows/physmap.c =================================================================== --- flashrom-windows/physmap.c (Revision 1028) +++ flashrom-windows/physmap.c (Arbeitskopie) @@ -30,7 +30,25 @@ #include <errno.h> #include "flash.h" -#ifdef __DJGPP__ +#if defined (__MINGW32_VERSION) + +#define MEM_DEV "DirectIO" + +void *sys_physmap(unsigned long phys_addr, size_t len) +{ + return map_physical_addr_range(phys_addr, len); +} + +#define sys_physmap_rw_uncached sys_physmap +#define sys_physmap_ro_cached sys_physmap + +void physunmap(void *virt_addr, size_t len) +{ + unmap_physical_addr_range(virt_addr, len); +} + +#elif defined (__DJGPP__) + #include <dpmi.h> #include <sys/nearptr.h> Index: flashrom-windows/Makefile =================================================================== --- flashrom-windows/Makefile (Revision 1028) +++ flashrom-windows/Makefile (Arbeitskopie) @@ -213,8 +213,11 @@ endif ifeq ($(NEED_PCI), yes) +ifeq ($(OS_ARCH), Windows_NT) +else CHECK_LIBPCI = yes endif +endif ifeq ($(NEED_PCI), yes) FEATURE_CFLAGS += -D'NEED_PCI=1' @@ -227,10 +230,14 @@ # FIXME There needs to be a better way to do this LIBS += ../libpci/lib/libpci.a ../libgetopt/libgetopt.a else +ifeq ($(OS_ARCH), Windows_NT) +LIBS += -L. -ldirectio +else LIBS += -lpci endif endif endif +endif ifeq ($(CONFIG_PRINT_WIKI), yes) FEATURE_CFLAGS += -D'CONFIG_PRINT_WIKI=1' Index: flashrom-windows/README =================================================================== --- flashrom-windows/README (Revision 1028) +++ flashrom-windows/README (Arbeitskopie) @@ -101,6 +101,10 @@ To run flashrom.exe, download http://clio.rice.edu/djgpp/csdpmi7b.zip and make sure CWSDPMI.EXE is in the current directory. +To compile on Windows: + Make sure you use gcc for compilation. This can be specified with + make CC=gcc + Installation ------------ Index: flashrom-windows/cbtable.c =================================================================== --- flashrom-windows/cbtable.c (Revision 1028) +++ flashrom-windows/cbtable.c (Arbeitskopie) @@ -226,6 +226,12 @@ start = forward->forward; start &= ~(getpagesize() - 1); physunmap(table_area, BYTES_TO_MAP); +#if defined (__MINGW32_VERSION) + /* For some reason MINGW/directio does not like + * mapping the high table area yet + */ + lb_table=NULL; +#else table_area = physmap_try_ro("high tables", start, BYTES_TO_MAP); if (!table_area) { msg_perr("Failed getting access to coreboot " @@ -233,6 +239,7 @@ return -1; } lb_table = find_lb_table(table_area, 0x00000, 0x1000); +#endif } } -- http://www.hailfinger.org/ _______________________________________________ flashrom mailing list [email protected] http://www.flashrom.org/mailman/listinfo/flashrom
