1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

1488 Commits

Author SHA1 Message Date
Michael Karcher
19e0aacd63 Add W39L040
Corresponding to flashrom svn r1268.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-03-06 17:58:05 +00:00
Michael Karcher
8262e82d1c Add coreboot IDs to make manual selection of HP xw9400 possible
Corresponding to flashrom svn r1267.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-03-06 17:37:30 +00:00
Michael Karcher
242efd491c Board-enable for GA-K8N51GMF
Gigabyte is not really helpful with their PCI IDs for us, the subsystem
IDs used just mean "gigabyte northbridge" and "gigabyte southbridge".
We should investigate whether autodetection of this board is causing
interference with other boards.

real version 2: Extend list of PCI IDs for nvidia southbridges.

flashrom -V: http://paste.flashrom.org/view.php?id=326
lspic: http://paste.flashrom.org/view.php?id=328
superiotool: http://paste.flashrom.org/view.php?id=329

Corresponding to flashrom svn r1266.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-03-06 12:09:05 +00:00
Michael Karcher
cba52dea18 Add HP e-Vectra P2706T
Reported by: Michal Janke <jankeso@gmail.com>

flashrom -V: http://paste.flashrom.org/view.php?id=370
lspci: http://paste.flashrom.org/view.php?id=371
superiotool: http://paste.flashrom.org/view.php?id=372 and
  http://www.flashrom.org/pipermail/flashrom/2011-March/005878.html

Corresponding to flashrom svn r1265.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-03-06 12:07:19 +00:00
Yul Rottmann
6d6ab74f4a I tested a few mainboards and flash chips
Successfully tested MSI MS-7596 (785GM-E51).
Successfully tested ASRock 890GX Extreme3.
Successfully tested Winbond W25x80.
Mention which GIGABYTE GA-MA78G-DS3H board revision was tested.

Corresponding to flashrom svn r1264.

Signed-off-by: Yul Rottmann <yulrottmann@bitel.net>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-03-05 16:31:57 +00:00
David Hendricks
4e74839646 Update the ITE IT8500 EC support to match the current state of the flashrom-chromium tree
This code has been deployed and tested to work on the Cr-48.
There are a few caveats, though:
- The boot BIOS straps register must be modified to select LPC. This
  can be done with the "select_bbs.sh" script (Install iotools at
  http://code.google.com/p/iotools/ before using select_bbs).
- It is very important to disable power management daemons before
  running flashrom on this EC. I commented out the brute force method
  we use in the Chromium OS branch that disables powerd, since IIRC
  Carl-Daniel has a better approach in the works.
- Due to dependencies which may be introduced by the OEM/ODM EC
  firmware, the code is not guaranteed to work for anything other than
  the Cr-48.

Corresponding to flashrom svn r1263.

Signed-off-by: David Hendricks <dhendrix@google.com>

Carl-Daniel comments:
Code is not hooked up yet because probing needs to be sorted out.

Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-02-28 23:58:15 +00:00
Donald Huang
44ebb04f9f Add generalized support for ITE IT8500/IT8502 embedded controllers
The patch was developed by Google.
It was tested for IT8500E on a Chrome OS platform and may require
modification depending on ODM/OEM customization and EC firmware version.
This patch is not officially supported by ITE Tech Inc.

Corresponding to flashrom svn r1262.

Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Signed-off-by: Yung-chieh Lo <yjlou@google.com>
Signed-off-by: David Hendricks <dhendrix@google.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-02-22 17:16:34 +00:00
Carl-Daniel Hailfinger
8a19ef1f67 Support 64-bit MEM BARs wherever possible
Add more sanity checks for BARs and abort if resources are unreachable.
Undecoded resources are reported, but flashrom will proceed anyway just
in case the BIOS screwed up the configuration.

(The empty CardBus handler is intentional, according to the spec no BARs
in PCI config space are used by CardBus.)

Found while working on a driver for the Angelbird PCIe-based SSD which
has 64-bit capable MEM BARs.

Corresponding to flashrom svn r1261.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2011-02-15 22:44:27 +00:00
Carl-Daniel Hailfinger
c753e5bbf9 Add support for some AMD Am29LV* chips
Add support for AMD Am29LV001BB, Am29LV001BT, Am29LV002BB, Am29LV002BT,
Am29LV004BB, Am29LV004BT, Am29LV008BB, Am29LV008BT.

Thanks to Mark Pustjens for testing the Am29LV001BB.

Corresponding to flashrom svn r1260.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2011-02-05 12:11:17 +00:00
Carl-Daniel Hailfinger
146b77d777 Improve debugging for unaligned erase in the flash chip emulator
Fix out-of-bounds access for chip erase in the flash chip emulator.

Corresponding to flashrom svn r1259.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: David Hendricks <dhendrix@google.com>
2011-02-04 22:52:04 +00:00
Carl-Daniel Hailfinger
9a1105cfff Support for Angelbird Wings PCIe SSD (solid-state drive)
It uses a Marvell 88SX7042 SATA controller internally which has access
to a separate flash chip hosting the option ROM.

Thanks to Angelbird Ltd for sponsoring development of this driver!

I expect the code to work for that SATA controller even if it is not
part of the Angelbird SSD.

Corresponding to flashrom svn r1258.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2011-02-04 21:37:59 +00:00
Stefan Reinauer
915b8409d6 Support Dediprog LEDs on devices with 2 and 3 LEDs
Corresponding to flashrom svn r1257.

Signed-off-by: Stefan Reinauer <reinauer@google.com>
Acked-by: Mathias Krause <mathias.krause@secunet.com>
2011-01-28 09:00:15 +00:00
Peter Huewe
3d3fd6ab2c Fix sparse warning: Unknown escape %
This patch fixes wrong escaping of %.
In print.c %%2b is correct instead of \%2b ("%%2b"=%2b=+)
In board_enable.c %d is correct instead of \%d.

Corresponding to flashrom svn r1256.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Stefan Reinauer <stepan@coreboot.org>
2011-01-25 00:23:32 +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
Carl-Daniel Hailfinger
ff30d8a538 Secret knowledge is cool, but public knowledge is better
Implement all Dediprog commands found in USB traces, even if their
purpose is not yet known.
Annotate unknown commands with info about the call sequence they are
embedded in and the firmware version of the log.

Add a new shutdown command for firmware 5.x (of which Stefan thinks it's
"switch the Pass light on" hence it is called late in the game)

Corresponding to flashrom svn r1254.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <reinauer@google.com>
2011-01-20 21:05:15 +00:00
Stefan Reinauer
051e2366fb Avoid printing mapped addresses for programmers that do not map flash chips
Don't print the local memory flash chip address on programmers that
don't actually map the flash chip into local memory (like the dediprog)
because the value does not make sense there.

This version was reworked / rewritten by Mathias Krause to have less
"impact"

Corresponding to flashrom svn r1253.

Signed-off-by: Stefan Reinauer <reinauer@google.com>
Acked-by: Mathias Krause <mathias.krause@secunet.com>
2011-01-19 06:21:54 +00:00
Mathias Krause
a60faab83e Convince compilers to put constant data into the .rodata section
This patch reduces the stack usage by declaring 'const' stack variables
as 'static const' so they end up in the .rodata section instead of being
copied from there to the stack for every invocation of the corresponding
function.

As a plus we end up in having a smaller binary as the "copy from .rodata
to stack" code isn't emitted by the compiler any more (roughly -100
bytes).

Corresponding to flashrom svn r1252.

Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Acked-by: Stefan Reinauer <stepan@coreboot.org>
2011-01-17 07:50:42 +00:00
Mathias Krause
2c3afa34fc The AT26DF081A requires the Write Enable Latch (WLE) to be set for write/erase operations
Also bit 5 is the Erase/Program Error (EPE) bit, so has nothing to do
with the block protection. Ignore it when testing for block protections.

Corresponding to flashrom svn r1251.

Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Tested-by: Mathias Krause <mathias.krause@secunet.com>
Acked-by: Stefan Reinauer <stepan@coreboot.org>
2011-01-17 07:45:54 +00:00
Mathias Krause
9fbdc03d9f Fix decoding of SB600 LPC ROM protection registers
The address part was using a bit of the size, the size was missing the
upper bit, was off by 1023 bytes and included the protection bits.

Corresponding to flashrom svn r1250.

Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-01-01 10:54:09 +00:00
Idwer Vollering
1a6162ed8d Compilation fix for djgpp
This corrects a djgpp build error, seen with r1232 and later.

pcidev.c:210: error: conflicting types for 'rpci_write_long'
programmer.h:226: error: previous declaration of 'rpci_write_long' was here

Corresponding to flashrom svn r1249.

Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-26 23:55:19 +00:00
Idwer Vollering
ecc67072b6 Enable unlocking (erasing/writing) W39V040FB chips
Add code for the unlocking (erasing/writing) of Winbond W39V040FB
chips, enabling erasing/writing this type of chip.

Corresponding to flashrom svn r1248.

Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-26 23:55:12 +00:00
David Hendricks
22e0532caf Mark MX25L3205, W25Q80, W25Q32 and W25Q64 as fully tested
Signed-off-by: David Hendricks <dhendrix@google.com>
Acked-by: Stefan Reinauer <stepan@coreboot.org>

Corresponding to flashrom svn r1247.
2010-12-13 23:54:59 +00:00
Carl-Daniel Hailfinger
202bf5337d Simplify get_next_write in the partial write code
Suggested by Michael Karcher.

Corresponding to flashrom svn r1246.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-06 13:05:44 +00:00
Carl-Daniel Hailfinger
9188240a14 Add support for Winbond W39V040FB and W39V040FC
Print lock status for all supported Winbond W39* chips:
W39V040A, W39V040B, W39V040C, W39V040FA, W39V040FB, W39V040FC,
W39V080A, W39V080FA, W39V080FA (dual mode).

Fill in correct probe timing for Winbond W39V040C and W39V080FA.

Please note that the W39V040B/W39V040FB pair has identical IDs,
identical read/write/erase, but locking differs. Same applies to
W39V040C/W39V040FC. This causes double detection on chipsets which
support LPC and FWH, making flashing more difficult because the user
has to select the correct chip. This is called the evil twin problem.
A better evil twin handling (patch available) will resolve that problem.

Corresponding to flashrom svn r1245.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-05 16:33:59 +00:00
Carl-Daniel Hailfinger
dce73ae622 Clean up erase function checking
Update a few comments and messages to improve readability.

Corresponding to flashrom svn r1244.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-05 15:14:44 +00:00
Carl-Daniel Hailfinger
da53adad31 Stop reading layout info when the max layout count has been reached
Corresponding to flashrom svn r1243.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-12-04 11:56:52 +00:00
David Borg
204f465bee Annotate the following chips with probe timing
Am29F016D, Am29F040B, Am29LV040B, Am29LV081B, A29002B, A29002T, A29040B, 
MX29F001B, MX29F001T, MX29F002B, MX29F002T, MX29LV040, M29F040B 

Corresponding to flashrom svn r1242.

Signed-off-by: David Borg <borg.db@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-12-04 03:26:40 +00:00
Mark Marshall
90021f28ff Add support for the Open Graphics Project development card, OGD1, as a SPI flash programmer
The project is in the the process of designing and making a complete,
open source, graphics card. More info at http://wiki.opengraphics.org.

The first development card is a PCI add in card containing a couple of
FPGAs and a couple of serial flash chips (amongst other things). The
FPGAs are called XP10 and S3 (their part numbers). The XP10 contains its
own flash and does not need to be programmed by flashrom - it ensures
that the device can enumerate on the PCI bus without needing further
configuration.

The larger FPGA is the S3. This is configured from a large SPI flash
(2 MBytes). The second SPI flash is used to store the VGA BIOS. It is
smaller (128 KBytes). This patch adds support for programming either of
the two SPI flash chips.

The programmer device takes one configuration option which selects which
of the two flash chips is accessed. This must be set to either "cprom"
or "bprom". (The project refers to the two chips as "cprom" / "bprom",
"s3" and "bios" are more readable alternatives).

Add support for SST SST25VF010 (REMS). Mark SST SST25VF016B as tested
for write.

Corresponding to flashrom svn r1241.

Signed-off-by: Mark Marshall <mark.marshall@csr.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-12-03 14:48:11 +00:00
Carl-Daniel Hailfinger
859f3f0d75 Avoid printing the chip locks if chip detection was forced
Lock access may involve flash chip registers which will not be mapped
if automatic detection failed.

Corresponding to flashrom svn r1240.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-12-02 21:59:42 +00:00
Uwe Hermann
742999c682 Add a board-enable for the MSI MS-6391 (845 Pro4)
I found this via educated guessing and trial-and-error.

Corresponding to flashrom svn r1239.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-12-02 21:57:42 +00:00
Carl-Daniel Hailfinger
b23b1ebcc9 Handle erase failure in partial write
Corresponding to flashrom svn r1238.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-02 02:41:55 +00:00
Rudy Host
f4e57776ee Add support for Spansion S25FL004A, S25FL032A, and S25FL064A
Tested S25FL064A using a Bus Pirate.

Corresponding to flashrom svn r1237.

Signed-off-by: Rudy Host <segfault@committeeofdoom.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-11-29 00:37:49 +00:00
Carl-Daniel Hailfinger
841d631710 Dump all VIA SPI registers like for ICH7
Handle BBAR on VIA.
Handle SPI lockdown on VIA.

Corresponding to flashrom svn r1236.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Rudolf Marek <r.marek@assembler.cz>
2010-11-24 23:37:22 +00:00
Carl-Daniel Hailfinger
306b81875d Add chunked write ability to the Dediprog SF100 driver
Please note that the write speedup only applies to chips which have SPI
page write (i.e. chips using spi_chip_write_256).

This is a quick fix for write speed until I get around to implementing
full bulk SPI write support.

Corresponding to flashrom svn r1235.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Richard A. Smith  <richard@laptop.org>
Acked-by: Mathias Krause <mathias.krause@secunet.com>
2010-11-23 21:28:16 +00:00
Carl-Daniel Hailfinger
482e97443d Support bulk read on Dediprog SF100
Should result in native speed for plain read and erase.
Should result in a measurable speedup for writes due to a fast verify.
Packet size is 512 bytes. Depending on your USB hardware and the
Dediprog firmware version, this may not work at all. That said, it
worked on the hardware we tested.

Add lots of error checking where it was missing before.

Thanks to Richard A. Smith, Mathias Krause and David Hendricks for
testing multiple iterations of this patch.

Corresponding to flashrom svn r1234.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Richard A. Smith <richard@laptop.org>
Acked-by: Mathias Krause <mathias.krause@secunet.com>
2010-11-16 21:25:29 +00:00
Carl-Daniel Hailfinger
d836941f9e Read the to-be-verified area in one go
Verify_range() and check_erased_range() check each page separately.
While that may have seemed like a good idea back when the code was
introduced, it has no benefits for any of the chips where we support
write because all of them handle cross-page reads nicely.
The only class of chips where this change could be a problem is chips
with non power of two sector sizes which have gaps in the address space.
We simply require their read functions to provide gap-free results
and leave it at that.

Corresponding to flashrom svn r1233.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-11-16 17:21:58 +00:00
Carl-Daniel Hailfinger
2bee8cf898 Revert PCI config space writes on shutdown
This means all chipset enables etc. will be undone on shutdown.
Reversible PCI config space writes now use rpci_write_*().
PCI config space writes which are one-shot (e.g. communication via
config space) should continue to use the permanent pci_write_*
variants.

Extend the number of available register_shutdown slots to 32.

Corresponding to flashrom svn r1232.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-11-10 15:25:18 +00:00
Alex Badea
caf2d42d9a Add support for the OpenMoko debug boards v2 and v3
Add support for the OpenMoko Neo1973/Neo FreeRunner debug board version
2 or 3 (vid:pid 1457:5118).

The new type is called "openmoko".

Information about the debug board can be found at
http://wiki.openmoko.org/wiki/Debug_Board_v3

Corresponding to flashrom svn r1231.

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-11-10 03:26:57 +00:00
Alex Badea
b1b459ce0e Use device-specific vendor ID in ftdi_usb_open() call
ft2232_spi ftdi_usb_open() is called with the constant FTDI_VID vendor
ID.

Fix it by using the programmer-type-dependent ft2232_vid variable, to
allow programmers with other vendor IDs.

Corresponding to flashrom svn r1230.

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-11-10 03:22:39 +00:00
Alex Badea
0b94d05c23 ft2232_spi: allow 5x clock divisor to be set at runtime
Check at init time whether the chip is a type 'H' (FT2232H or FT4232H).
If not, omit the disable-divide-by-5 (0x8a) command which can confuse
older chips.

Corresponding to flashrom svn r1229.

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-11-10 03:18:41 +00:00
Alex Badea
b9556e0fd4 Retry short reads in ft2232_spi
It is possible that ftdi_read_data() returns less data
than requested. Catch this case and retry reading the rest
of the buffer.

Corresponding to flashrom svn r1228.

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-11-10 03:10:41 +00:00
Mathias Krause
db7afc59c9 DediProg firmware version 5.1.5 of the SF-100 works just fine
Allow any firmware version from 2.x.y to 5.x.y.
Handle errors for the initial USB command to catch -EPERM.

Corresponding to flashrom svn r1227.

Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Acked-by: Patrick Georgi <patrick@georgi-clan.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-11-09 23:30:43 +00:00
Carl-Daniel Hailfinger
c24413879c Support setting the Dediprog SF100 SPI voltage
Add a generic voltage parameter parser.
Move tolower_string() from dummyflasher.c to flashrom.c to make it
available everywhere.

Corresponding to flashrom svn r1226.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coreboot.org>
2010-11-09 22:00:31 +00:00
Carl-Daniel Hailfinger
12d6d82141 Fix two memory leaks in doit() and refine get_next_write()
Avoid two memory leaks in doit() which were unproblematic for flashrom
because flashrom terminates after finishing doit(). Rename oldcontents
to curconents in erase_and_write_block_helper(). Unify the code for
all granularities in get_next_write(). Return write length from
get_next_write() instead of filling it as referenced parameter.

Thanks to Michael Karcher for pointing out the first two issues. Thanks
to David Hendricks for pointing out the third issue and suggesting a way
to unify that code.

Corresponding to flashrom svn r1225.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-11-05 14:51:59 +00:00
Carl-Daniel Hailfinger
6e2ea32dc2 This patch makes flashrom use real partial writes
If you write an image full of 0xff, flashrom will erase and detect that
no write is needed. If you write an image which differs only in some
parts from the current flash contents, flashrom will detect that and not
touch unchanged areas.

Fix a long-standing bug in need_erase() for 256 byte granularity as
well.

Nice side benefit: Detailed progress printing. S means skipped E means
erased W means written

Thanks to Andrew Morgan for testing countless iterations of this patch.
Thanks to Richard A. Smith for testing on Dediprog SF100. Thanks to
David Hendricks for the review and for creating a partial write torture
test script and testing with it on Intel NM10 and AMD SB700 SPI. Thanks
to Idwer Vollering for testing with Intel SPI NICs. Thanks to Rudolf
Marek for testing on AMD SB710 and SiI SATA controllers. Thanks to
Michael Karcher for the review.

Corresponding to flashrom svn r1224.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: David Hendricks <dhendrix@google.com>
Acked-by: Rudolf Marek <r.marek@assembler.cz>
Acked-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-11-04 01:04:27 +00:00
Carl-Daniel Hailfinger
cb6ad16395 Change semantics of image building in the layout code
If a layout file was specified, all regions not mentioned in the layout
file were taken from the new image instead of being preserved.
If regions overlap, the non-included regions won.

New behaviour:
If a layout file is specified, only the regions explicitly requested for
inclusion will be taken from the new image.
If regions overlap, the included regions win.

Corresponding to flashrom svn r1223.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: David Hendricks <dhendrix@google.com>
2010-11-02 03:12:51 +00:00
David Hendricks
738f8e2756 Add a line of output for each iteration of the torture test
This serves as a sort of progress indicator.

The output looks like this::
localhost ~ # flashrom="./flashrom" sh flashrom_partial_write_test.sh
testing flashrom binary: ./flashrom
Running test in /tmp/tmp.4xPejwaADU
ffh pattern written in ff_4k.bin
00h pattern written in 00_4k.bin
Reading BIOS image
Original image saved as bios.bin
aligned region 0 test: passed
...
aligned region 15 test: passed
unaligned region 0 test: passed
...
unaligned region 15 test: passed
Result: PASSED
restoring original bios image using system's flashrom
test files remain in /tmp/tmp.4xPejwaADU

Corresponding to flashrom svn r1222.

Signed-off-by: David Hendricks <dhendrix@google.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-11-02 03:03:38 +00:00
Carl-Daniel Hailfinger
eb6337f752 Use mktemp unconditionally for security reasons
Avoid non-portable seq.

Corresponding to flashrom svn r1221.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer@gmail.com>
2010-11-02 00:16:27 +00:00
Carl-Daniel Hailfinger
f68aa8aca0 Add SPI flash emulation capability to the dummy programmer
You have to choose between
- no emulation
- ST M25P10.RES SPI flash chip (RES, page write)
- SST SST25VF040.REMS SPI flash chip (REMS, byte write)
- SST SST25VF032B SPI flash chip (RDID, AAI write)
Example usage: flashrom -p dummy:emulate=SST25VF032B

Flash image persistence is available as well.
Example usage: flashrom -p dummy:image=dummy_simulator.rom

Allow setting the max chunksize for page write with the dummy
programmer.
Example usage: flashrom -p dummy:spi_write_256_chunksize=5

Flash emulation is compiled in by default. 

This code helped me find and fix various bugs in the SPI write code
as well as in the testsuite.

Corresponding to flashrom svn r1220.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: David Hendricks <dhendrix@google.com>
2010-11-01 22:07:04 +00:00
David Hendricks
04c8379e49 Replace "$FLASHROM_PARAM" with ${FLASHROM_PARAM} in util/flashrom_partial_write_test.sh
Replace "$flashrom_PARAM" with ${FLASHROM_PARAM} in
util/flashrom_partial_write_test.sh to avoid passing in quoted
parameters which can cause problems especially if flashrom_PARAM is
empty or contains spaces.

Corresponding to flashrom svn r1219.

Signed-off-by: David Hendricks <dhendrix@google.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-10-29 21:54:16 +00:00