1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 14:42:36 +02:00

1696 Commits

Author SHA1 Message Date
Stefan Tauner
b6b00e99aa Add support for Nantronics N25 series
Add...
 - N25S10
 - N25S20
 - N25S40
 - N25S80
 - N25S16

Corresponding to flashrom svn r1683.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-06-28 21:28:43 +00:00
Nikolay Nikolaev
579f1e0b67 Introduce spi_block_erase_db()
Used for page erase on some chips (e.g. Numonyx M45PE and
Sanyo LF25FW series).

Corresponding to flashrom svn r1682.

Signed-off-by: Nikolay Nikolaev <evrinoma@gmail.com>
Reviewed-by: Steven Zakulec <spzakulec@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-28 21:28:37 +00:00
Stefan Tauner
278ba6e967 Introduce additional SPI status register helpers
- spi_prettyprint_status_register_default_welwip():
   It just prettyprints the plain hex value and the welwip bits.
 - spi_prettyprint_status_register_default_bp4():
   Prints the hex value, welwip, bp0-5 and srwd bits.
 - spi_disable_blockprotect_bp2_srwd(),
 - spi_disable_blockprotect_bp3_srwd() and
   spi_disable_blockprotect_bp4_srwd():
   Three new common block unprotection functions for the frequent
   cases where there is a status register lock bit at bit #7 and some
   block protection bits at bits #2-#4, #2-#5 and #2-#6 respectively.

Corresponding to flashrom svn r1681.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-28 21:28:27 +00:00
Stefan Tauner
682122bce7 Warn if we skipped all blocks while writing
Quick hack to print a warning if we skip all blocks in a write
process because they are already equal to the requested image. We
want something like this to make users aware... and some developers
who regularly fall for this too *coughcough*. There might be more
elegant solutions for this... patches welcome.

This does not work for erasing because we do that unconditionally.

Corresponding to flashrom svn r1680.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Idwer Vollering <vidwer@gmail.com>
2013-06-23 22:15:39 +00:00
Stefan Tauner
cecb2c56d0 Fix unlocking function for most Atmel AT2[56]D* chips
I broke unlocking them correctly in r1635 while refactoring (NB: the
commit log including the overly selfconfident statement about the
"bug in spi_disable_blockprotect_at25df()").

Affected chips have per sector protection bits and the write protection bits
in the status register do indicate if none, some or all sectors are protected.
It is possible to globally (un)lock all sectors at once but in a way that was
not anticipated when refactoring the spi25 unlocking functions into
spi_disable_blockprotect_generic(). To globally unprotect not only the
protection bits (2 and 3) have 0 to be written to them but also bits 4 and 5
which normally would not be touched by spi_disable_blockprotect_generic().
Some of the chips also support a permanent lockdown with fuses which we
do not handle yet.

To fix this without copying the whole method I introduce another mask
parameter to spi_disable_blockprotect_generic() namely unprotect_mask.
See verbose comments inline for details.

Also, prettyprint the status register after trying to disable the block
protection fails.

Corresponding to flashrom svn r1679.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Tested-by: Chi Zhang <zhangchi866@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-20 22:55:41 +00:00
Stefan Tauner
0466c819e2 sbxxx: spibar[0] debug print refinements
Newer models support a 66 MHz clock and fast reads.
We should probably distinguish the models better (as we do in ichspi)
and add support for frequency selection etc. For now this has to
suffice.

Corresponding to flashrom svn r1678.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-16 10:30:08 +00:00
Yung-Chieh Lo
b13d4e6992 Add W25Q...W series
- Use ".V" (and "_V" in macros) for 3.3V Winbond 25Q chips.
   Rename the existing chips and add a .voltage entry where it was missing.
 - Use ".W" (and "_W" in macros) for 1.8V Winbond 25Q chips.
 - Add W25Q20.W, W25Q40.W, W25Q80.W, W25Q16.W, W25Q32.W, W25Q64.W.
 Based on chromiumos' 469707f0d9b7d81b6c6bb2cace13f09db70f4382
 http://git.chromium.org/gitweb/?p=chromiumos/third_party/flashrom.git;a=commitdiff;h=469707f0d9b7d81b6c6bb2cace13f09db70f4382

Corresponding to flashrom svn r1677.

Signed-off-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-09 14:00:46 +00:00
Stefan Tauner
27cb34b8a9 Change warning regarding protected ICH regions
There is no good reason to collect further log files of locked Intel-
based boards. Forward affected users directly to an explanation in
the wiki instead.

Corresponding to flashrom svn r1675.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-01 00:06:12 +00:00
Patrick Georgi
efe2d43056 dediprog: fix SPI clock setting
Avoid setting SPI speed on firmware versions < 5.0.0 and note this
limitation in the man page.
Use the correct offset of the "12M" element in the spispeeds array to
match our manpage and the default of Dediprog's dpcmd.

Corresponding to flashrom svn r1674.

Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-05-23 21:47:46 +00:00
Stefan Tauner
e659d2dfe3 dediprog: add support for chip select
Thanks to the traces captured and tests done by Martin Roth, and confirmed
by tests and analysis by Joshua Zarr too, we can now use both target chips
on the Dediprog SF100.

Corresponding to flashrom svn r1673.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-05-03 21:58:28 +00:00
Stefan Tauner
730e7e74eb Update spi_get_erasefn_from_opcode()
We forgot to add a few SPI erase functions to the helper function that is
used for SFDP. Also, sort the declarations in the header.

Corresponding to flashrom svn r1672.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-05-01 14:04:19 +00:00
Stefan Tauner
f44516121a Add support for PMC Pm25LD series
This patch adds support for
 - Pm25LD256C
 - Pm25LD512(C)
 - Pm25LD010(C)
 - Pm25LD020(C)
 - Pm25LD040(C)

These seem to be the successors of the Pm25LV series.
The main difference seems to be the dual I/O and additional erase opcodes.
Some support an additional, complex locking register (maybe all of the
above, but available datahsheets do not indicate it for all).

The Pm25LD512C was tested by Chi Zhang:
http://paste.flashrom.org/view.php?id=1579

Corresponding to flashrom svn r1671.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-19 01:59:15 +00:00
Stefan Tauner
3f5e35db4b Refine PMC Pm25LV series
- Add missing bits and resort chips
 - Refine Pm25LV512(A) and Pm25LV010
   Due to manufacturer ID continuation this one needs a new probing
   function: probe_spi_res3() which should be refactored in the future.
   The datasheet describes a very weird order of ID bytes:
   Vendor byte, model byte, vendor continuation byte. Let's pretend we did
   not read that or the datasheet is bogus (although the datasheet of the
   successor series describes the same but luckily additionally to RDID).
 - Add Pm25LV010A
   This was tested by Chi Zhang:
   http://paste.flashrom.org/view.php?id=1573

Corresponding to flashrom svn r1670.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-19 01:58:33 +00:00
Stefan Tauner
e33c40eb7d Initialize sp_fd and fix baud rate setting on windows
Corresponding to flashrom svn r1669.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-13 00:29:30 +00:00
Stefan Tauner
363fd7e827 Get rid of perror()
It prints to stderr and that's not what we want necesserily;
using msg_*err gives us more control.

Corresponding to flashrom svn r1668.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-04-07 13:08:30 +00:00
Maksim Kuleshov
73dc0db725 Usleep() is not found in all versions of MinGW, use Sleep() on Windows
Handle long sleeps on non-Windows correctly.

Corresponding to flashrom svn r1667.

Signed-off-by: Maksim Kuleshov <mmcx@mail.ru>
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-05 08:06:10 +00:00
Stefan Tauner
02437458a6 Refine granularity handling in preparation of AT45DB series support
This adds a number of new granularitie and refines the handling of
n-byte granularities by extracting the respective code into a helper
function which reduces the pain of the above significantly.

Corresponding to flashrom svn r1666.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-04-01 19:34:53 +00:00
Stefan Tauner
52b6e9dc54 Enable serprog on Windows
Sockets are not ported (yet).

Tested on Windows 7 with my Atmega32U2 serprog implementation.
http://paste.flashrom.org/view.php?id=1566

Corresponding to flashrom svn r1665.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-01 00:46:05 +00:00
Stefan Tauner
f966cc4810 serial.c: be more pedantic
Check more return codes and close the file handle in case of errors in
sp_openserport().

Corresponding to flashrom svn r1664.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-01 00:45:57 +00:00
Stefan Tauner
79587f565f Replace native calls in serprog with wrapper calls
Read(), write(), usleep() are replaced.

Corresponding to flashrom svn r1663.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-01 00:45:51 +00:00
Stefan Tauner
ae3d83765c Introduce serialport_write_nonblock()
It seems useful to have a generic and platform-independent method to
read and write to a serial port without blocking. This is the write part.

This allows to get rid of the explicit temporary disabling of blocking I/O in
serprog's sp_synchronize().

Corresponding to flashrom svn r1662.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-01 00:45:45 +00:00
Stefan Tauner
00e1608501 Replace sp_sync_read_timeout() with serialport_read_nonblock()
It seems useful to have a generic and platform-independent method to
read and write to a serial port without blocking. This is the read part.

It stores the current blocking properties before disabling blocking and
restores them after reading. The timeout is implemented as previously
by retrying every millisecond until the timeout is reached or enough
characters are available.

Corresponding to flashrom svn r1661.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-01 00:45:38 +00:00
Stefan Tauner
da5b17c0a2 serial.c: round baudrates to valid ones
MSDN says: "The baud rate at which the communications device
operates. This member can be an actual baud rate value, or one of
the following indexes." But it is not specified what happens for
different values, so we round down to valid ones (or to the minimum
of 9600) by reusing the existing struct baudentry sp_baudtable[] and
the new function round_baud().

Do similarly on non-Windows where arbitrary values are not allowed
anyway.

Corresponding to flashrom svn r1660.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-01 00:45:32 +00:00
Stefan Tauner
bf88be9291 serial.c: abstract system error printing
Windows is awkward. The win32 API does not support errno/strerror as one
might expect. Introduce a new msg_* function that alleviates the pain a bit
(my head still hurts very badly).

Corresponding to flashrom svn r1659.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-01 00:45:08 +00:00
James Laird
c60de0e87f Add Altera USB-Blaster SPI programmer
Adds support for the Altera USB-Blaster programming dongle in Active
Serial (AS) mode. Tested on both original product and a clone dongle.

Corresponding to flashrom svn r1658.

Signed-off-by: James Laird <jhl@mafipulation.org>
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-03-27 13:00:23 +00:00
Stefan Tauner
226037da3d Fix evil twins of Macronix MX25L1605, MX25L3205, MX25L6405
Similarly to the patch in r1647 this one updates the chips identified as above
with references to and data about their respective twins. Unlike previously this
one deals with the more evil details.

Helge Wagner from GE discovered some problems with chips sharing IDs
and proposed a patch to tackle (some of) them, see:
http://patchwork.coreboot.org/patch/3709/
That patch was bitrotting in our mailboxes for a long time and it is still not
ready for merge, but we increasingly get reports about problems (e.g.
http://paste.flashrom.org/view.php?id=1525) regarding these chips and
hence must act to ensure users' safety.

This patch splits the chip definitions of evil twins into separate ones which
correctly declare the respective attributes (the main problems are the erase
block sizes for the 0x20 opcode and hence my changes combine different
chips with partly different attributes apart from their names as long as the
erasers layout it the same). This forces the user to select the (right) chip
definition with the -c/--chip parameter and hence will break a number of
previously perfectly working environments.

0x2015 is used by and split to
 - MX25L1605 (64kB sectors in 0x20 erases)
 - MX25L1605A/MX25L1606E (4kB in 0x20 erases and an additional 0x52 opcode with 64kB blocks)
 - MX25L1605D/MX25L1608D (4k sectors in 0x20 erases)

0x2016 is used by and split to
 - MX25L3205/MX25L3205A (64kB 0x20)
 - MX25L3205D/MX25L3208D (4kB 0x20)
 - MX25L3206E (4k 0x20, 64k 0x52)

0x2017 is used by and split to
 - MX25L6405/MX25L6405D (64k 0x20)
 - MX25L6406E/MX25L6436E (4k 0x20)
 - MX25L6445E (4k 0x20, 64k 0x52)

Bonus: add some minor details to MX25L1635D, MX25L1635E, MX25L3235D,
MX25L12805D.

Tested with MX25L3206E, MX25L64036E.

Corresponding to flashrom svn r1657.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-03-16 01:22:12 +00:00
Duncan Laurie
90eb2269c2 Add support for Intel Lynx Point low-power and Wellsburg
New IDs taken from Intel's patches for the Linux kernel.
Also, refine original Lynx Point naming etc.

Corresponding to flashrom svn r1656.

Based on the chromiumos patch
Change-Id: I303a05baa80e4449e70d20adf78ebc7128b88d8e
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-03-15 03:12:29 +00:00
Vincent Palatin
f800f55b05 Add support for Macronix MX25U1635E, MX25U3235E/F and MX25U6435E/F
Macronix MX25U3235 is a 4MB (32Mbits) 1.8v SPI flash supporting QPI.
Code for it was refined after merging it from chromium:
Change-Id: I62c7db070254ba3ec68090e783f57b25a6e8d15a
Reviewed-on: https://gerrit.chromium.org/gerrit/44395
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>

Based on that support for MX25U1635E and MX25U6435E/F was added
by Stefan Tauner.
Also, add a feature flag for QPI-enabled chips: FEATURE_QPI.

Corresponding to flashrom svn r1655.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-03-15 02:03:16 +00:00
Stefan Tauner
bf97bdc420 Add utility to print all chip names in flashchips.h that are not in flashchips.c
This allows to list yet unsupported chips easily.

First it tries to find the directory containing the files, then it uses sed to
extract the macro names of chips from flashchips.h, greps for them in
flashchips.c and prints it if it is not found.
If verbose mode is activated by giving at least one additional parameter
it prints the chip ID and comment following the macro definition too.

Corresponding to flashrom svn r1654.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-03-09 17:55:35 +00:00
Stefan Tauner
d3b98fb833 Add (untested) board enable for ASUS P4PE-X/TE
REed by roxfan and Michael Karcher, patch by Stefan Tauner.

Corresponding to flashrom svn r1653.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-03-04 01:41:56 +00:00
Kyösti Mälkki
c54adc5852 Add M25P20-old
This older (ST-branded) revision of M25P20 chip does not support RDID and
hence was not detected correctly. This patch adds a workaround similar
to M25P40-old.

Corresponding to flashrom svn r1652.

Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-03-04 01:20:28 +00:00
Stefan Tauner
50d67aaa79 Make write granularity a chip attribute
Corresponding to flashrom svn r1651.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-03-03 23:49:48 +00:00
Stefan Tauner
352e50b79e Add a bunch of new/tested stuff and various small changes 17
Tested Mainboards:
OK:
 - Acer V75-M (used in IBM Aptiva 2170-G)
   http://www.flashrom.org/pipermail/flashrom/2012-December/010300.html
 - Acorp 6M810C
   http://www.flashrom.org/pipermail/flashrom/2013-January/010433.html
 - ASRock G31M-S rev 2.0
   http://www.flashrom.org/pipermail/flashrom/2013-February/010538.html
 - ASUS F1A75-V PRO
   http://paste.flashrom.org/view.php?id=1528
 - ASUS M5A97 (rev. 1.0)
   http://www.flashrom.org/pipermail/flashrom/2013-February/010483.html
 - ASUS P5KPL-AM IN/GB
   http://www.flashrom.org/pipermail/flashrom/2013-January/010455.html
 - GABYTE GA-H77M-D3H
   http://www.flashrom.org/pipermail/flashrom/2013-February/010538.html

NOT OK:
 - GIGABYTE GA-Z77MX-D3H
   http://paste.flashrom.org/view.php?id=1529
   http://paste.flashrom.org/view.php?id=1530

Tested flash chips:
 - Winbond W25X10 to PREW (+PREW)
   Reported on IRC(?)
 - Eon EN25Q32(A/B) to PREW (+REW)
   http://www.flashrom.org/pipermail/flashrom/2013-February/010533.html
 - Eon EN25Q64 to PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2013-January/010466.html

Miscellaneous:
- Fix superflouos line breaks in wiki mainboard and laptop output.
- Use the .nh (no hyphenation) command in the manpage to enforce
  single-line URLs where useful.
- Reference the manpage (besides the Laptops wiki page) in the laptop warning.
- Minor output and whitespace fixes.
- Add Fidelix IDs.
- Add ISSE clones of PMC chips.
- Fix typo: EMST -> ESMT.
- Add ID of ESMT F25D08QA.
- Refine GigaDevice GD25Q series (missing voltages and comments).
- Use underscore instead of lower-case x as wildcard in Sharp chip names.

Corresponding to flashrom svn r1650.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-02-22 15:58:45 +00:00
Nico Huber
77fa67d2df dedirpog: add a parameter 'spispeed' to set the SPI clock rate
The following rates are
available (in Hz):
  375k, 750k, 1.5M, 2.18M, 3M, 8M, 12M and 24M

The original driver reinitializes the programmer after setting the
speed, so the initialization calls have moved into a new function
dediprog_setup() which is called twice.

Corresponding to flashrom svn r1649.

Signed-off-by: Nico Huber <nico.huber@secunet.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-02-20 18:03:36 +00:00
Stefan Tauner
e038e9082c Fix building for MacOSX
- Add a new macro named IS_MACOSX to hwaccess.c and use it to enable iopl().
  This was broken since r1638. This fix does *not* restore the very permissive
  concept where iopl() was activated in an #else branch that was inplace before
  r1638.
- Make printing the image file's size in flashrom.c platform independent.

Bonus: remove definitions of off64_t and lseek64 which are not necessary
anymore for about 1000 commits.

Thanks to SJ for reporting the issue and testing the solution.

Corresponding to flashrom svn r1648.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-02-04 04:38:42 +00:00
Stefan Tauner
f656e8088e Update Macronix MX25L512, MX25L1005, MX25L2005, MX25L4005, MX25L8005
Update MX25L512 with references to and data about
  MX25L512E, MX25V512, MX25V512C.
Update MX25L1005 with references to and data about
  MX25L1005C, MX25L1006E.
Update MX25L2005 with references to and data about
  MX25L2005C.
Update MX25L4005 with references to and data about
  MX25L4005A, MX25L4005C.
Update MX25L8005 with references to and data about
  MX25V8005.

Bonus: add chip IDs of MX25U1635E, MX25U3235E/F, MX25U6435E/F.

Corresponding to flashrom svn r1647.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-02-02 15:35:44 +00:00
Stefan Tauner
67d163d2fa Fix duplicate 'const' declaration specifiers
Thanks to Idwer and clang for noticing these problems.

Corresponding to flashrom svn r1646.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-01-15 17:37:48 +00:00
Carl-Daniel Hailfinger
8225868465 Fix compilation for DOS and non-x86 targets
Fixup for r1638.
Thanks to Idwer Vollering for testing.

Corresponding to flashrom svn r1645.

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>
2013-01-08 22:49:12 +00:00
Carl-Daniel Hailfinger
a2faddf7d3 Decouple BAR reading from pci device init, handle errors gracefully
Pcidev_init() now returns struct pci_device * instead of a BAR stored in
PCI config space. This allows for real error checking instead of having
exit(1) everywhere in pcidev.c.
Thanks to Niklas Söderlund for coming up with the original error
handling patch which was slightly modified and folded into this patch.
Move the declaration of struct pci_device in programmer.h before the
first user.

Corresponding to flashrom svn r1644.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-01-05 23:52:45 +00:00
Stefan Tauner
c6fa32d2b5 Introduce msg_*warn
Also, unify all outputs of "Warning:" and "Error:" to use normal
capitalization instead of mixing it with all capitals.

Corresponding to flashrom svn r1643.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Idwer Vollering <vidwer@gmail.com>
2013-01-04 22:54:07 +00:00
Stefan Tauner
5561955b11 Unify PCI init and let pcidev clean itself up
Previously the internal programmer used its own code to initialize pcilib.
This patch extracts the common code from the internal programmer and
pcidev_init() into pcidev_init_common().
This fixes the non-existent PCI cleanup of the internal programmer and adds
an additional safety by checking for an already existing PCI context.

We got a nice shutdown function registration infrastructure, but did not use it
very wisely. Instead we added shutdown functions to a myriad of programmers
unnecessarily. In this patch we get rid of those that do only call pci_cleanup(pacc)
by adding a shutdown function the pcidev.c itself that gets registered by
pcidev_init().

Corresponding to flashrom svn r1642.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-01-04 22:24:58 +00:00
Brian Salcedo
30dfdbaf3a Add user interface to activate the Bus Pirate pull-up resistors
When working with some flash chips using the Bus Pirate programmer, the
use of the Bus Pirate's on-board pull-up resistors is sometimes
necessary.

On v3 hardware the use of said pull-up resistors requires the user to apply a
voltage to the VPU pin of the Bus Pirate, and then command it to use them.
For v4 hardware which supports also fixed internal 3.3V and 5V sources no
documentation could be found.

Here is a link to information pertaining to what this patch does:
http://dangerousprototypes.com/docs/SPI_(binary)#0100wxyz_-_Configure_peripherals_w.3Dpower.2C_x.3Dpull-ups.2C_y.3DAUX.2C_z.3DCS

Bonus: small cleanup of superfluous stack variables.

Corresponding to flashrom svn r1641.

Signed-off-by: Brian Salcedo <bsalcedo@gmx.us>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Tested-by: Brian Salcedo <bsalcedo@gmx.us>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-01-03 20:44:30 +00:00
Stefan Tauner
e34e3e8a49 Add a bunch of new/tested stuff and various small changes 16
Tested Mainboards:
OK:
 - Acer V75-M (used in IBM Aptiva 2170-G
   http://www.flashrom.org/pipermail/flashrom/2012-December/010300.html
 - ASRock 4CoreDual-VSTA with W39V040FB
   http://paste.flashrom.org/view.php?id=1446
 - ASRock 775Dual-VSTA
   http://www.flashrom.org/pipermail/flashrom/2012-December/010294.html
 - ASRock E350M1/USB3
   http://paste.flashrom.org/view.php?id=1465
 - ASUS P5B-VM
   http://www.flashrom.org/pipermail/flashrom/2012-December/010351.html
 - ASUS SABERTOOTH 990FX R2.0
   http://www.flashrom.org/pipermail/flashrom/2012-December/010210.html
 - Elitegroup A928 (including a laptop whitelist board enable)
   http://www.flashrom.org/pipermail/flashrom/2012-November/010119.html
 - EVGA 122-CK-NF68
   Reported by Stephanie Daugherty on IRC
   http://paste.flashrom.org/view.php?id=1431
 - GIGABYTE GA-A75M-UD2H
   Reported by Soul_keeper on IRC
   http://paste.flashrom.org/view.php?id=1490
 - Intel D945GCNL
   Add board enable to override laptop detection too.
   http://www.flashrom.org/pipermail/flashrom/2012-December/010276.html
 - MSI G33M (MS-7357)
   http://www.flashrom.org/pipermail/flashrom/2012-October/010056.html
 - Shuttle FB61
   http://www.flashrom.org/pipermail/flashrom/2012-November/010105.html
 - Tyan S4882 (Thunder K8QS Pro)
   Reported on IRC
NOT OK:
   Alienware Aurora-R2
   http://www.flashrom.org/pipermail/flashrom/2012-December/010225.html
   Biostar H61MU3
   http://www.flashrom.org/pipermail/flashrom/2012-November/010144.html
   Dell OptiPlex 7010
   http://paste.flashrom.org/view.php?id=1481
   Intel DH67CL
   http://www.flashrom.org/pipermail/flashrom/2012-November/010112.html
   Supermicro X9DRT-HF+
   http://www.flashrom.org/pipermail/flashrom/2012-November/010155.html
   Supermicro X9DRW
   http://www.flashrom.org/pipermail/flashrom/2012-November/010150.html

Tested flash chips:
 - Atmel AT25FS010 to PREW (+PREW)
   http://paste.flashrom.org/view.php?id=1484
 - Eon EN25F64 to PREW (+EW)
   http://www.flashrom.org/pipermail/flashrom/2012-December/010210.html
 - Spansion S25FL032A/P to PREW (+EW)
   http://paste.flashrom.org/view.php?id=1510
 - ST M29F002T/NT to PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2012-December/010300.html
 - Winbond W25X10 to PREW (+PREW)
   http://paste.flashrom.org/view.php?id=1486

Tested chipsets:
 - NVIDIA MCP78S http://www.flashrom.org/pipermail/flashrom/2012-November/010176.html
 - SiS 650 http://www.flashrom.org/pipermail/flashrom/2012-November/010119.html

Miscellaneous:
- Typo in GA-X58A-UDR3 (correct is GA-X58A-UD3R).
- Force 2-digit hex numbers in prints were it makes sense.
- Share code between enable_flash_sis530() and enable_flash_sis540().
- Some SST 25 series chips support both WRSR enable commands...
- S25FL032A and S25FL064A share the IDs with their P versions, so rename them.
- Fix a few memleaks in serprog.
- Dediprog uses UINT_MAX so include limits.h (fixes the Windows build of dediprog)
- Add (another) hint regarding the mandatory -p parameter to the manpage
  to make Debian bug #690478 happy.
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690478
- Fix whitespace issues.
- On shutdown, reset count of registered programmers (by Nico Huber)
- Fix atahpt.c shutdown.
  The order of pcidev_init, register_shutdown and rpci_write_* is important!
  Thanks to Roy for reporting the problem and testing the fix.

Corresponding to flashrom svn r1640.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-01-01 00:06:51 +00:00
Nico Huber
bcb2e5a708 Constify parameters and globals
This makes some stuff const (partially to get a more convenient
libflashrom interface).

Corresponding to flashrom svn r1639.

Signed-off-by: Nico Huber <nico.huber@secunet.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-30 01:23:17 +00:00
Peter Lemenkov
6282966cc0 Simplify hwaccess.c
Previously the code was focused on architectures which led to lots of
duplicate code and spread the information regarding differences between
the architectures accross the file.

With this patch there is a single function header for any function and the
differentiation between architectures (and OS where needed) happens
in one place for each function. Also, this patch adds simple defines to bundle
often used arch and os checks. A central check for unknown architectures
and OSes has been added on top.

Corresponding to flashrom svn r1638.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 19:26:55 +00:00
Stefan Tauner
57794ac158 Add support for Atmel's AT25F series of SPI flash chips
This adds support for the following chips:
 - AT25F512, AT25F512A, AT25F512B
 - AT25F1024, AT25F1024A
 - AT25F2048
 - AT25F4096

Besides the definitions of the the chips in flashchips.c this includes
- a dedicated probing method (probe_spi_at25f)
- pretty printing methods (spi_prettyprint_status_register_at25f*), and
- unlocking methods (spi_disable_blockprotect_at25f*)

Corresponding to flashrom svn r1637.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 15:04:20 +00:00
Stefan Tauner
54aaa4ae2b Add support for Intel S33 series flash chips
This includes:
Bottom boot block:
* 16Mb/2MB:
  QB25F160S33B8, QB25F016S33B8, QH25F160S33B8, QH25F016S33B8
* 32Mb/4MB:
  QB25F320S33B8, QH25F320S33B8
* 64Mb/8MB:
  QB25F640S33B8, QH25F640S33B8

Top boot block:
* 16Mb/2MB:
  QB25F160S33T8, QB25F016S33T8, QH25F160S33T8, QH25F016S33T8
* 32Mb/4MB:
  QB25F320S33T8, QH25F320S33T8
* 64Mb/8MB:
  QB25F640S33T8, QH25F640S33T8

At least some seem to be marketed by other vendors (too?) but also with
Intel's vendor ID.

Besides a 0xC7 chip erase and a 0xD8 uniform 64kB block erase they
support also erasing the top/bottom 8 8kB blocks with opcode 0x40.
But since this command fails for all addresses outside those ranges,
it is not easily implemented with flashrom's current code base and
hence left out.

Corresponding to flashrom svn r1636.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 15:04:12 +00:00
Stefan Tauner
9530a02212 Add a generic SPI block unprotect function
This does not only remove a huge pile of duplicate code, it does
also fix a bug in spi_disable_blockprotect_at25df(), which is also
a good example why duplicated code is a bad idea.

Corresponding to flashrom svn r1635.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 15:04:05 +00:00
Stefan Tauner
6ee37e2836 Improve SPI status register pretty printing
- Move all functions related to SPI status registers to a new file
   spi25_statusreg.c. This includes the generic as well as the
   SST-specific functions from spi25.c and the chip-specific functions
   from a25.c and at25.c.
 - introduce helper functions
    * spi_prettyprint_status_register_hex()
    * spi_prettyprint_status_register_bpl()
    * spi_prettyprint_status_register_plain()
   Use the latter on every compatible flash chip that has no better printlock
   function set and get rid of the implicit pretty printing in the SPI probing
   functions.
 - remove
    * spi_prettyprint_status_register_common()
    * spi_prettyprint_status_register_amic_a25lq032() because it can be fully
      substituted with spi_prettyprint_status_register_amic_a25l032().
    * spi_prettyprint_status_register() (old switch, no longer needed)
 - promote and export
    * spi_prettyprint_status_register_amic_a25l05p() as spi_prettyprint_status_register_default_bp1().
    * spi_prettyprint_status_register_amic_a25l40p() as spi_prettyprint_status_register_default_bp2().
    * spi_prettyprint_status_register_st_m25p() as spi_prettyprint_status_register_default_bp3().
 - add #define TEST_BAD_REW and use it for a number of Atmel chips which
   had only TEST_BAD_READ set even though they dont have erasers or a write
   function set.

Corresponding to flashrom svn r1634.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 15:03:51 +00:00
Stefan Tauner
2c421199ab print_wiki.c: print programmers of type OTHER too
Corresponding to flashrom svn r1633.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-27 18:40:40 +00:00