1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 15:12:36 +02:00

258 Commits

Author SHA1 Message Date
Uwe Hermann
ad216bf3a0 MAX may already be defined
Also, fix smaller cosmetics

Corresponding to flashrom svn r442 and coreboot v2 svn r4205.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-04-24 16:17:41 +00:00
Peter Stuge
816139e06d Fix broken flash chip base address logic
Elan SC520 requries us to deal with flash chip base addresses at locations
other than top of 4GB. The logic for that was incorrectly triggered also when
a board had more than one flash chip. This patch will honor flashbase only when
probing for the first flash chip on the board, and look at top of 4GB for later
chips.

Corresponding to flashrom svn r415 and coreboot v2 svn r3932.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Myles Watson <mylesgw@gmail.com>
2009-02-09 20:26:14 +00:00
Carl-Daniel Hailfinger
7314cc3de0 Factor out read and erase functions from flashrom main()
Corresponding to flashrom svn r412 and coreboot v2 svn r3923.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-28 00:27:54 +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
Peter Stuge
776d2021fd Change flashrom.c:map_flash_registers() from int to void
The function exit()s on failure, and no callers check the return value.

Corresponding to flashrom svn r396 and coreboot v2 svn r3901.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-26 00:39:57 +00:00
Peter Stuge
9371dc3cb1 Fix stupid off-by-one error in erase verification
As reported by Jody McIntyre. Thanks!

Corresponding to flashrom svn r389 and coreboot v2 svn r3894.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-25 20:41:51 +00:00
Peter Stuge
ccf8c6c794 Check all mmap() calls and print helpful Linux error message
Corresponding to flashrom svn r386 and coreboot v2 svn r3890.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-23 05:23:06 +00:00
Peter Stuge
72c9668b95 Provide some hints for the user in case /dev/mem mmap fails
Resolves #121

Corresponding to flashrom svn r385 and coreboot v2 svn r3889.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2009-01-22 22:53:59 +00:00
Peter Stuge
f9ad0bb5c1 Always print address when verification fails, not only with -V
Corresponding to flashrom svn r381 and coreboot v2 svn r3860.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2009-01-13 14:32:27 +00:00
Peter Stuge
1fec0f35c7 Check return value of fscanf()/fwrite()/fread()
Fix build error on distros with warn_unused_result attributes in glibc.

Corresponding to flashrom svn r378 and coreboot v2 svn r3857.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Yul Rottmann <yulrottmann@bitel.net>
2009-01-12 21:00:35 +00:00
Peter Stuge
f0ef27bc5a Display test status in -L chip listing
Looks like this:

Supported flash chips:          Tested OK operations:   Known BAD operations:

AMD Am29F002(N)BB                                       
AMD Am29F002(N)BT               PROBE READ ERASE WRITE  
AMD Am29F016D                                           
AMD Am29F040B                   PROBE READ ERASE WRITE  
AMD Am29LV040B                                          
Atmel AT45CS1282                                        READ 

Corresponding to flashrom svn r362 and coreboot v2 svn r3803.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2008-12-06 01:37:09 +00:00
Peter Stuge
2fcc0b52e4 Fix compilation of r3797 with gcc-4.3.2
Thanks to Niels Ole Salscheider for the problem report.

Corresponding to flashrom svn r360 and coreboot v2 svn r3798.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2008-12-05 11:56:57 +00:00
Peter Stuge
f0c811dd15 Check if erase succeeds and exit with error on failure
Flashrom used to exit 0 even if erase failed. Not anymore.

Corresponding to flashrom svn r359 and coreboot v2 svn r3797.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-12-05 02:22:30 +00:00
Peter Stuge
7ccce54a69 Gcc thinks base could be used uninitialized, so shut it up
Bug from r3791.

Corresponding to flashrom svn r357 and coreboot v2 svn r3792.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2008-12-03 23:36:48 +00:00
Peter Stuge
73bdb92b5d Fix bug in r3790
If flashbase was set before probe_flash() it would only ever be used once, for
the very first flash chip probe.

Corresponding to flashrom svn r356 and coreboot v2 svn r3791.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2008-12-03 21:39:56 +00:00
Stefan Reinauer
9a6d1764a2 Replace #ifdefs for sc520 systems by run time probing
Fixes #109

Corresponding to flashrom svn r355 and coreboot v2 svn r3790.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2008-12-03 21:24:40 +00:00
Carl-Daniel Hailfinger
6a0a25cada Do not indicate known-bad functions as untested
If a chip has any TEST_BAD_* flag set, we don't even list the
unsupported functions, giving the user the impression that the
unsupported functions are tested.

Corresponding to flashrom svn r352 and coreboot v2 svn r3780.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Peter Stuge <peter@stuge.se>
2008-11-28 23:45:27 +00:00
Jason Wang
a3f04be761 Add support for the AMD/ATI SB600 southbridge SPI functionality
This has been tested by Uwe Hermann on an RS690/SB600 board.

Corresponding to flashrom svn r351 and coreboot v2 svn r3779.

Signed-off-by: Jason Wang <Qingpei.Wang@amd.com>
Reviewed-by: Joe Bao <zheng.bao@amd.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2008-11-28 21:36:51 +00:00
Uwe Hermann
394131ef14 Coding-style fixes for flashrom, partly indent-aided
Corresponding to flashrom svn r326 and coreboot v2 svn r3669.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2008-10-18 21:14:13 +00:00
Peter Stuge
23dc1df565 Check that a filename was specified also when using force read
Corresponding to flashrom svn r322 and coreboot v2 svn r3647.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2008-10-10 20:43:17 +00:00
Peter Stuge
483b8f0c0d Only find "unknown .. SPI chip" if no other chip was found
This removes the false positive matches we've been seeing, and also removes
the true positive match in case there is more than one flash chip and the 2nd
or 3rd are unknown - but I think that case is uncommon enough to warrant the
improvement in the common case. Use flashrom -frc forced read if you have the
uncommon case, and/or please add the flash chip to the flashchips array.

Corresponding to flashrom svn r313 and coreboot v2 svn r3562.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-09-03 23:10:05 +00:00
Segher Boessenkool
0d29b60641 Fix error -EINVAL on mmap()
Don't calculate "flash_baseaddr" until the final value of "size"
is known, otherwise we end up trying to map a page right after
the end of memory.

Fixes #112.

Corresponding to flashrom svn r308 and coreboot v2 svn r3502.

Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-08-12 11:58:00 +00:00
Stefan Reinauer
566ce1bea0 Update copyright year
Corresponding to flashrom svn r306 and coreboot v2 svn r3464.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-08-02 15:13:58 +00:00
Peter Stuge
27c3e2dc23 Probe_flash() cleanup for better code readability
Corresponding to flashrom svn r291 and coreboot v2 svn r3407.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-07-02 17:15:47 +00:00
Carl-Daniel Hailfinger
a0a791963b Use symbolic constants for PCI subsystem probing
Corresponding to flashrom svn r279 and coreboot v2 svn r3394.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-06-28 23:02:22 +00:00
Stefan Reinauer
a9424d597d Multiple unrelated changes
* ICH7 SPI support
* fix some variable names in ichspi.c (Offset -> offset)
* Dump ICH7 SPI bar with -V
* Improve error message in case IOPL goes wrong. (It might not even be an IOPL)

Corresponding to flashrom svn r278 and coreboot v2 svn r3393.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Peter Stuge <peter@stuge.se>
2008-06-27 16:28:34 +00:00
Peter Stuge
cb5c211a48 Show expected and read byte on verify failure
Corresponding to flashrom svn r261 and coreboot v2 svn r3372.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
2008-06-20 02:58:42 +00:00
Peter Stuge
7ffbc6f94d Force read unknown flash chips
When flash chip detection fails, it is still useful and possible to read the
flash chip contents. If no flash chip is found in normal probes and the
-f -r -c CHIPNAME options are given, a successful probe for the specified
chip is forced, and then flashrom reads the flash chip using either the read
function for the specified chip, or if there is none, a simple memcpy().

The patch also moves the global variable int force in flashrom.c into main()
and passes it as a parameter to layout.c:show_id(), which was the only other
function that used the variable. This is needed to avoid confusion with the
new parameter int force which is added to flashrom.c:probe_flash() and used
to force probe success for the chip named in char *chip_to_probe.

Corresponding to flashrom svn r259 and coreboot v2 svn r3367.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Ward Vandewege <ward@gnu.org>
2008-06-18 02:08:40 +00:00
Uwe Hermann
793bdcd71e A bunch of cosmetic improvements
- Fix typos and inconsistencies.
 - Drop duplicate line which tells us the chip name twice.
 - Also print the chip vendor, not only the name.

Corresponding to flashrom svn r249 and coreboot v2 svn r3348.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2008-05-22 22:47:04 +00:00
Andriy Gapon
65c1b86fe7 Changes to make flashrom compile (and work) on FreeBSD
This patch addresses different argument order of outX() calls,
FreeBSD-specific headers, difference in certain type names and system
interface names, and also FreeBSD-specific way of gaining IO port
access.

Corresponding to flashrom svn r245 and coreboot v2 svn r3344.

Signed-off-by: Andriy Gapon <avg@icyb.net.ua>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2008-05-22 13:22:45 +00:00
Carl-Daniel Hailfinger
6dc1d3b8dc Add more infrastructure for flashrom ICH9 support
Corresponding to flashrom svn r234 and coreboot v2 svn r3314.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-05-14 14:51:22 +00:00
Claus Gindhart
2fd11d6a9b Probe for up to 3 flash chips
Currently there is an ongoing technology migration from LPC/FWH to SPI chips.
For this reason some boards have multiple chips of different technologies
onboard. This patch makes flashrom probe for up to 3 chips and if more than
one chip is found flashrom exits, asking the user to specify -c.

[root@localhost src]# ./flashrom
...
Multiple flash chips were detected: SST49LF008A M25P16@ICH9
Please specify which chip to use with the -c <chipname> option.
[root@localhost src]# 

Corresponding to flashrom svn r222 and coreboot v2 svn r3291.

Signed-off-by: Claus Gindhart <claus.gindhart@kontron.com>
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Claus Gindhart <claus.gindhart@kontron.com>
2008-05-08 00:31:44 +00:00
Peter Stuge
1159d5864a Add a tested bitmap field to the flash chip table
Two bits indicate OK and BAD for each operation PROBE READ ERASE WRITE.
8 bits out of 32 are in use now. No bits set means nothing has been tested.
For chips with at least one operation that is not tested or not working, the
user is asked to email a report to a special email adress so that the table
can be updated.

All chips are TEST_UNTESTED for now.

Corresponding to flashrom svn r221 and coreboot v2 svn r3277.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2008-05-03 04:34:37 +00:00
Peter Stuge
f31104cf3b Handle NULL probe, erase and write function pointers in the flashchips table
The read pointer was already checked properly.

Corresponding to flashrom svn r218 and coreboot v2 svn r3273.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-04-28 14:47:30 +00:00
Stefan Reinauer
ac37897259 Support for the Winbond W39V080FA series of chips
Support for flashing on the Kontron 986LCD-M board.

Corresponding to flashrom svn r213 and coreboot v2 svn r3165.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2008-03-17 22:59:40 +00:00
Stefan Reinauer
72123a5b07 Remove nasty warning that happened due to our vendor detection
Corresponding to flashrom svn r210 and coreboot v2 svn r3151.

mechanism.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-03-15 23:41:19 +00:00
Uwe Hermann
7615868f0b Re-add code erroneously removed in r3140
Corresponding to flashrom svn r209 and coreboot v2 svn r3146.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2008-03-14 23:55:58 +00:00
Carl-Daniel Hailfinger
e7bcb19bf5 Revert the delete of 82802ab.c in r3137
Corresponding to flashrom svn r204 and coreboot v2 svn r3140.

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>
2008-03-14 00:02:25 +00:00
Uwe Hermann
eac1016437 Also print the chip vendor name in --list-supported output
Cosmetic changes in some files, partly bending the 80-characters-per-line
rule in this special case, as the 80-character-limited version looks
equally crappy even in an 80x25 console/xterm, so let's make it at least
look good in a high-resolution xterm.

Corresponding to flashrom svn r203 and coreboot v2 svn r3139.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2008-03-13 18:52:51 +00:00
Uwe Hermann
e5ac16445f Add --list-supported option which lists the supported ROM chips, chipsets, and mainboards
Corresponding to flashrom svn r199 and coreboot v2 svn r3133.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Ward Vandewege <ward@gnu.org>
2008-03-12 11:54:51 +00:00
Peter Stuge
6b53fed02d Make the vendor name optional in the -m flashrom parameter when there's only one board name that matches
The full syntax still works, and is required when two vendors have
boards with the same names.

Corresponding to flashrom svn r190 and coreboot v2 svn r3082.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-01-27 16:21:21 +00:00
Carl-Daniel Hailfinger
d7b5bf3f12 Flashrom did not use the read function for verifying, it used direct memory access instead
That fails if the flash chip is not mapped completely. If the read
function is set in struct flashchip, use it for verification as well.

This fixes verification of all SPI flash chips >512 kByte behind an
IT8716F flash translation chip.

"MX25L8005 found at physical address 0xfff00000. Flash part is MX25L8005
(1024 KB). Flash image seems to be a legacy BIOS. Disabling checks.
Verifying flash... VERIFIED."

Corresponding to flashrom svn r185 and coreboot v2 svn r3070.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Harald Gutmann <harald.gutmann@gmx.net>
2008-01-22 15:19:01 +00:00
Bernhard Walle
201bde33d0 This patch adds version information
Because 'v' and 'V' are already in use, the patch uses 'R' (for release)
and, of course, '--version'.

Corresponding to flashrom svn r182 and coreboot v2 svn r3067.

Signed-off-by: Bernhard Walle <bernhard.walle@gmx.de>
Acked-by: Ulf Jordan <jordan@chalmers.se>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2008-01-21 15:24:22 +00:00
Stefan Reinauer
e3f3e2edb4 Rename LinuxBIOS to coreboot
Corresponding to flashrom svn r178 and coreboot v2 svn r3054.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2008-01-18 15:33:10 +00:00
Bernhard Walle
a3f8a64166 This patch removes '\n' from the help output since this looks a bit strange
After the patch [...] The line length is still below 80 characters.

Corresponding to flashrom svn r177 and coreboot v2 svn r3045.

Signed-off-by: Bernhard Walle <bernhard.walle@gmx.de>
Acked-by: Torsten Duwe <duwe@lst.de>
2008-01-11 00:32:07 +00:00
Uwe Hermann
a502dcea3d Some cosmetic cleanups in the flashrom code and output
Corresponding to flashrom svn r151 and coreboot v2 svn r2873.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2007-10-17 23:55:15 +00:00
Jordan Crouse
144ede66ca Fix the help, and print a message when nothing happens
The help implied that writes happen by default, which they don't. Fix
the text, and say something when we dont specify any commands.

Corresponding to flashrom svn r141 and coreboot v2 svn r2820.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>    
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2007-10-04 06:26:41 +00:00
Uwe Hermann
d22a1d4e53 Add '(C)' where it's missing (for consistency reasons)
Corresponding to flashrom svn r136 and coreboot v2 svn r2768.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2007-09-09 20:21:05 +00:00
Uwe Hermann
d110764ccd Change all flashrom license headers to use our standard format
No changes in content of the files.

Corresponding to flashrom svn r131 and coreboot v2 svn r2751.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2007-08-29 17:52:32 +00:00
Uwe Hermann
ffec5f3ab7 Cosmetic fixes
Corresponding to flashrom svn r130 and coreboot v2 svn r2748.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2007-08-23 16:08:21 +00:00