1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

33 Commits

Author SHA1 Message Date
Carl-Daniel Hailfinger
60d9bd267e Portability fixes and cleanups
Move Mac OS X IOKit/DirectHW availability checks in the Makefile from
compiler check to pciutils check.

Print the compiler error messages for feature detection.

Add DOS libpci in the Makefile includes only if a PCI-based programmer
was requested.

Restrict mmap usage in ich_descriptors_tool to Unix style systems.

Build ich_descriptors_tool with the correct .exe extension on
DOS/Windows.

Build ich_descriptors_tool by default on x86. (Patch by Stefan Tauner)

Print the Windows version instead of "unknown machine" on Windows.

Don't #define our own __DARWIN__, use the standard OS X detection
method.

Update the README.

Add more generated files to svn:ignore

Corresponding to flashrom svn r1567.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-08-09 23:34:41 +00:00
Patrick Georgi
32508eb304 Hide hwaccess.h from public API
Move hwaccess.h #include from flash.h to individual drivers.
libflashrom users need flash.h, but they do not care about hwaccess.h
and should not see its definitions because they may conflict with
other hardware access functions and #defines used by the libflashrom
user.

Corresponding to flashrom svn r1549.

Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-07-20 20:35:14 +00:00
Carl-Daniel Hailfinger
a5eecdab44 Support Debian/kFreeBSD
Corresponding to flashrom svn r1507.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: Robert Millan <rmh@debian.org>
Tested-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-02-25 22:50:21 +00:00
Carl-Daniel Hailfinger
082c8b559c Fixup of r1397
- Mixing uninitialized and initialized local variables leads to
  confusion.
- ft2232_spi error cases should have gotten some error handling, and
  that's the reason the curly braces were there.
- Fixing typos/wording in some places would have been nice given that
  those places were touched anyway.

Corresponding to flashrom svn r1413.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-08-15 19:54:20 +00:00
Uwe Hermann
91f4afa110 Random whitespace and coding-style fixes
Also, indentation fixes, e.g. due to conversion to msg_*, use ARRAY_SIZE
where possible, wrap overly long line, etc.

Compile-tested. There should be no functional changes.

Corresponding to flashrom svn r1397.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2011-07-28 08:13:25 +00:00
Stefan Reinauer
83704c5a09 Update port of flashrom package to Mac OS X using DirectHW
http://www.coreboot.org/DirectHW

Corresponding to flashrom svn r1282.

Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Paul Menzel <paulepanter@users.sourceforge.net>
2011-03-18 22:00:15 +00:00
Patrick Georgi
97bc95ce2b Fix and improve libpayload platform support
- Fix various minor compile issues (eg. include necessary standard headers)
- Fix compilation of libpayload code paths
- Provide libpayload support in Makefile
- Add make target "libflashrom.a" which links non-CLI code to static
  library

Corresponding to flashrom svn r1280.

Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Tested-with-DOS-crosscompiler-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-03-08 07:17:44 +00:00
Peter Huewe
73f8ec8b1e Fix sparse warning: Using plain integer as NULL pointer
This patch fixes the "using plain integer as NULL pointer" warnings
generated by running sparse on the flashrom source.

Corresponding to flashrom svn r1255.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Mathias Krause <mathias.krause@secunet.com>
Acked-by: Stefan Reinauer <stepan@coreboot.org>
2011-01-24 19:15:51 +00:00
Stefan Reinauer
18430a08aa Remove duplicate includes from the code
Corresponding to flashrom svn r1196.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-10-06 02:56:44 +00:00
Carl-Daniel Hailfinger
602de9829c DJGPP: Avoid leaking memory on lowmem mapping error
Add a clarifying comment about why low memory is never unmapped.

Corresponding to flashrom svn r1195.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Rudolf Marek <r.marek@assembler.cz>
2010-10-05 23:21:51 +00:00
Patrick Georgi
a9095a9545 Add support for building flashrom against libpayload
This doesn't include changes to the frontend which must be
done separately, so this won't work out of the box.
This code was tested on hardware.

Corresponding to flashrom svn r1184.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-09-30 17:03:32 +00:00
Patrick Georgi
ed7a964786 Implement libpayload support and improve life for DOS based flashrom, too
Corresponding to flashrom svn r1181.

Change the physmap* behaviour to use (void*)-1 as error code instead
of NULL. That way, 1:1 mapped memory can be supported properly
because (void*)0 is not a magic pointer anymore.
(void*)-1 on the other hand is a rather unlikely memory offset, so that
should be safe.
  
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-09-25 22:53:44 +00:00
Carl-Daniel Hailfinger
ad3cc55e13 Kill global variables, constants and functions if local scope suffices
Constify variables where possible.
Initialize programmer-related variables explicitly in programmer_init to
allow running programmer_init from a clean state after
programmer_shutdown.
Prohibit registering programmer shutdown functions before init or after
shutdown.
Kill some dead code.
Rename global variables with namespace-polluting names.
Use a previously unused locking helper function in sst49lfxxxc.c.

This is needed for libflashrom.

Effects on the binary size of flashrom are minimal (300 bytes
shrinkage), but the data section shrinks by 4384 bytes, and that's a
good thing if flashrom is operating in constrained envionments.

Corresponding to flashrom svn r1068.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-07-03 11:02:10 +00:00
Carl-Daniel Hailfinger
b63b067ae2 Add OpenBSD support
Add a requirements section to the man page which lists the needed access
permissions for each programmer.

This feature needs my pciutils/libpci 8/16-bit write emulation patch at
http://marc.info/?l=openbsd-ports&m=127780030728045 titled
[PATCH] Fix pciutils non-32bit PCI write on OpenBSD

Corresponding to flashrom svn r1067.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stuart Henderson <sthen@openbsd.org>
2010-07-02 17:12:50 +00:00
Carl-Daniel Hailfinger
dcef67e468 Kill unneeded #include wherever possible
Tested on Linux, FreeBSD, NetBSD, OpenBSD, DOS.
Thanks to Jonathan A. Kollasch and Idwer Vollering for testing.

Corresponding to flashrom svn r1057.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer+lists.flashrom@gmail.com>
2010-06-21 23:20:15 +00:00
Carl-Daniel Hailfinger
831e8f4abb Remove unneeded #include statements completely
Unistd.h was only used to get a definition of NULL in all files. Add our
own NULL #define and remove unistd.h from flash.h
stdio.h has no place in flash.h, it should be included only in files
which really need it.
Add #include statements in individual .c files where needed.

Replace a few printf with msg_* to eliminate the need for stdio.h.

Corresponding to flashrom svn r1021.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-05-30 22:24:40 +00:00
Carl-Daniel Hailfinger
cceafa2ad0 Handle the following architectures in generic flashrom code
- x86/x86_64 (little endian)
- PowerPC (big endian)
- MIPS (big+little endian)

No changes to programmer specific code. This means any drivers with MMIO
access will _not_ suddenly start working on big endian systems, but with
this patch everything is in place to fix them.

Compilation should work on all architectures listed above for all
drivers except nic3com and nicrealtek which require PCI Port IO which is
x86-only for now.

To compile without nic3com and nicrealtek, run
make distclean
make CONFIG_NIC3COM=no CONFIG_NICREALTEK=no

Thanks to Misha Manulis for testing early versions of this patch on
PowerPC (big endian) with the satasii programmer.
Thanks to Segher Boessenkool for design review and for helping out with
compiler tricks and pointing out that we need eieio on PowerPC.
Thanks to Vladimir Serbinenko for compile testing on MIPS (little
endian) and PowerPC (big endian) and for runtime testing on MIPS (little
endian).
Thanks to David Daney for compile testing on MIPS (big endian).
Thanks to Uwe Hermann for compile and runtime testing on x86_64.

DO NOT RUN flashrom ON NON-X86 AFTER APPLYING THIS PATCH!
This patch only provides the infrastructure, but does not convert any
drivers, so flashrom will compile, but it won't do the right thing on
non-x86 platforms.

Corresponding to flashrom svn r1013.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Misha Manulis <misha@manulis.com>
Acked-by: Vladimir 'phcoder/φ-coder' Serbinenko <phcoder@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
2010-05-26 01:45:41 +00:00
Anti Sullin
be24d8198c Write MSRs in a platform and compiler-independent form
Msr_t memory layout may depend on compiler; with optimizations this may
lead to writing incorrect data to MSR. Create a temporary buffer with
correct layout to avoid this problem.

Corresponding to flashrom svn r999.

Signed-off-by: Anti Sullin <anti.sullin@artecdesign.ee>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-05-17 23:19:22 +00:00
Sean Nelson
316a29f33f Convert various prints to use msg_p* and msg_g* respectively
Convert programmer print messages to msg_p* convert general print messages to msg_g* a few fixes as suggested by Carl-Daniel.

Corresponding to flashrom svn r997.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-05-07 20:09:04 +00:00
Rudolf Marek
837d810796 Fix the DOS port
Now the DS selector limit is set to 4GB and all mmio accesses goes
through DS, the 1:1 mapping is fixed so the _DS base is taken onto
account. Plus is that the hwaccess.c needs no change and memcpy etc can
be used on mmaped space.

Corresponding to flashrom svn r995.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz> 
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-04-25 22:47:50 +00:00
Rudolf Marek
03ae5c117a Add MS-DOS crosscompilation support
Tested, works fine. Part 1: Code changes.

Corresponding to flashrom svn r944.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-03-16 23:59:19 +00:00
Carl-Daniel Hailfinger
baaffe0831 Create a physical memory mapping function which requests cached readonly memory
This should take care of picky Linux kernels which do not allow uncached
mappings to cached areas. Handle mapping failure gracefully (no forced
exit()) if the caller specifies it.

Such cached areas which can handle mapping failure are DMI tables and
coreboot tables. On failure we just ignore those tables. That is not
perfect, but a lot better than aborting flashrom due to an error in
nonessential functionality.

This should fix flashrom on a sizable number of machines where it
currently aborts early.

Yes, I could have exploited a Linux kernel bug to "solve" this, but
relying on such bugs is not exactly the best idea.

Corresponding to flashrom svn r889.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Vincent Pelletier <plr.vincent@gmail.com>
2010-02-02 11:09:03 +00:00
Stefan Reinauer
95e892b9d3 Fix for gcc 4.4 strict aliasing rules
Corresponding to flashrom svn r714.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2009-09-04 13:57:07 +00:00
Stefan Reinauer
173e3eaabe Support rdmsr/wrmsr operations on FreeBSD
So far, AMD Geode LX is the only user of this infrastructure. It needs
/dev/cpu0 from ports/sysutils on FreeBSD during runtime on Geode LX.

Corresponding to flashrom svn r690.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: <putlinuxonit@gmail.com>
2009-08-19 10:46:23 +00:00
Stefan Reinauer
8fa64816ae Fix up MSR handling to support more OSes than Linux.
Corresponding to flashrom svn r677.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2009-08-12 09:27:45 +00:00
Stephan Guilloux
6d08a3ea04 There are some non-C99 compilers out there used to compile flashrom
This fixes compilation for them.

Corresponding to flashrom svn r624.

Signed-off-by: Stephan Guilloux <stephan.guilloux@free.fr>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-06-23 10:44:36 +00:00
Uwe Hermann
eaefb48ee5 Various smaller flashrom improvements
- Document new 'satasii' programmer in -L output and manpage.

 - Drop PCI_IO_BASE_ADDRESS, pci.h has such #defines already.

 - Beautify flashrom output and make it more consistent.
 
 - Same for the 'make' output (reordered some $CC parameters).
   Build-tested on i386, shouldn't break any builds, I think.

 - Some variable renaming and other cosmetic fixes.

Corresponding to flashrom svn r529.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-05-17 22:57:34 +00:00
Carl-Daniel Hailfinger
1455b2baea Abstract mapping/unmapping of flash regions
Flash mapping/unmapping was performed without an abstraction layer,
so even the dummy flasher caused memory mappings to be set up. Add
map/unmap functions to the external flasher abstraction.

Fix a possible scribble-over-low-memory corner case which fortunately
never triggered so far.

With this patch, --programmer dummy works fine as non-root.

Corresponding to flashrom svn r493.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-05-11 14:13:25 +00:00
Uwe Hermann
7b2969be53 Some coding style and consistency fixes
Corresponding to flashrom svn r429 and coreboot v2 svn r4117.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-04-15 10:52:49 +00:00
Peter Stuge
43438ba7d1 exit(2) on /dev/mem open() failure and exit(3) on mmap() failure
Corresponding to flashrom svn r401 and coreboot v2 svn r3907.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Ward Vandewege <ward@gnu.org>
2009-01-26 02:04:19 +00:00
Peter Stuge
33fefcad5c Add license header to physmap.c so everyone is happy
:)

Corresponding to flashrom svn r400 and coreboot v2 svn r3906.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-26 01:33:02 +00:00
Stefan Reinauer
f79edb9a11 Darwin / Mac OS X
Through DirectIO from coresystems GmbH we now support Darwin/Mac OS X.
DirectIO is available at http://www.coresystems.de/en/directio

Corresponding to flashrom svn r399 and coreboot v2 svn r3905.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-26 01:23:31 +00:00
Stefan Reinauer
0593f21f10 Abstract mmap() in physmap.c and only open /dev/mem on the first physmap() call
Corresponding to flashrom svn r397 and coreboot v2 svn r3903.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-26 01:10:48 +00:00