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

109 Commits

Author SHA1 Message Date
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
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
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
d7d423bbc1 Add a bunch of new/tested stuff and various small changes 15
Tested Mainboards:
OK:
 - Foxconn P55MX
   http://www.flashrom.org/pipermail/flashrom/2012-October/010002.html

Tested flash chips:
 - Eon EN25F64 to PR (+PR)
   http://paste.flashrom.org/view.php?id=1426
 - Macronix MX25L1005 to PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2012-October/010004.html
 - Set SST39VF512 to PREW (+W)
   http://www.flashrom.org/pipermail/flashrom/2012-September/009958.html

Tested chipsets:
 - Z77 (only reading was really tested)

Miscellaneous:
 - Fix ft2232_spi's parameter parsing.
 - Fix nicrealtek's init (always segfaulted since r1586 oops).
 - Add another T60 variant to the laptop whitelist.
 - Improve message shown when image file size does not match flash chip
 - Refine messages regarding the flash descriptor override strap according
   to the findings by Vladislav Bykov on his P55MX.
 - Fix the ID of EN25F64.
 - Demote and clarify debug message in serprog_delay().
 - Minor other cleanups.

Corresponding to flashrom svn r1613.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-10-20 09:13:16 +00:00
Stefan Tauner
eb58257b96 Add a bunch of new/tested stuff and various small changes 14
Tested Mainboards:
OK:
 - ASUS M3A78-EH
   http://www.flashrom.org/pipermail/flashrom/2010-October/005297.html
 - ASUS P2B-LS
   http://www.flashrom.org/pipermail/flashrom/2010-November/005506.html
 - Biostar TA790GX A3+
   http://paste.flashrom.org/view.php?id=1350
 - ECS 848P-A7
   http://www.flashrom.org/pipermail/flashrom/2011-January/005781.html
 - GIGABYTE GA-G41MT-S2PT
   Reported on IRC
 - GIGABYTE GA-H77-D3H
   Reported and tested by Alexander Gordeev on IRC.
 - Gigabyte GA-X79-UD5
   http://www.flashrom.org/pipermail/flashrom/2012-August/009811.html
 - Shuttle FN78S
   http://www.flashrom.org/pipermail/flashrom/2012-August/009714.html
 - VIA EITX-3000
   Reported on IRC by Tuju

NOT OK:
 - Dell PowerEdge C6220 (0HYFFG)
   http://www.flashrom.org/pipermail/flashrom/2012-September/009900.html
 - Foxconn Q45M
   http://www.flashrom.org/pipermail/flashrom/2012-September/009923.html
 - MSI MS-7309 (K9N6SGM-V)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009712.html
 - Supermicro X9QRi-F+
   http://www.flashrom.org/pipermail/flashrom/2012-September/009887.html
 - ZOTAC H61-ITX WiFi (H61ITX-A-E)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009649.html

ASUS CUSL2-C has been tested to be working with the board enable once
implemented for the TUSL2-C board. They seem to have the same PCI IDs
as shown in the links below. Since only the CUSL2-C board enable has been
tested yet, we distinguish the two by DMI strings.
http://paste.flashrom.org/view.php?id=1393
http://www.flashrom.org/pipermail/flashrom/attachments/20091206/ddca2c6c/attachment-0002.eml

Tested flash chips:
 - Set EMST F25L008A to PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009714.html
 - Set GigaDevice GD25Q64 to PREW (+PREW)
   http://git.chromium.org/gitweb/?p=chromiumos/third_party/flashrom.git;a=commit;h=9e8ef49b1f626c2197e131fba6c5b65c8af4eeea
 - Set Macronix MX25L12805 to P (+P)
   http://www.flashrom.org/pipermail/flashrom/2012-September/009887.html
 - Set SST SST49LF003A/B to PREW (+EW)
   http://paste.flashrom.org/view.php?id=467
 - Set Winbond W49V002FA to PREW (+EW)
   http://www.flashrom.org/pipermail/flashrom/2011-January/005781.html

Tested chipsets:
 - Intel X79 (0x1d41)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009811.html

Board enables:
 - add ASUS P4P800-X
   Created by Idwer Vollering and tested by Mingsen Bao:
   http://paste.flashrom.org/view.php?id=467
 - add DMI string to P4P800-VM

Miscellaneous:
 - Add remaining Intel 7 series chipset (LPC) PCI IDs
 - Add generic SPI detection for chips from Winbond
 - Minor manpage changes
 - Minor other cleanups
 - Escape full stops after abbreviations in the manpage.
 - Add ICH9 and successors to spi_get_valid_read_addr

Corresponding to flashrom svn r1601.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-09-21 12:52:50 +00:00
Stefan Tauner
e3adea0864 ichspi: ignore bogus FREGs
Some vendors forget to disable regions properly and set their FRAP bits
and FREG to 0. While not documented publicly this is being ignored by the
chipset(s)[1] and hence flashrom should do so too. Without this patch
flashrom prints a warning and disables writes.
The check for i (region index) excludes the descriptor region which should not
be becessary because specs suggest that the descriptor region should not
be locked, but if vendors would follow the specs this patch would not have
been necessary in the first place.

[1]: http://www.flashrom.org/pipermail/flashrom/2012-May/009303.html

Corresponding to flashrom svn r1587.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-08-27 15:12:36 +00:00
Carl-Daniel Hailfinger
5a7cb847f0 Make struct flashchip a field in struct flashctx instead of a complete copy
All the driver conversion work and cleanup has been done by Stefan.
flashrom.c and cli_classic.c are a joint work of Stefan and Carl-Daniel.

Corresponding to flashrom svn r1579.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-08-25 01:17:58 +00:00
Helge Wagner
dd73d830f7 Fix VIA VX*** support
Helge Wagner's patch that added VIA VX900 chipset support made me look
closer at the datasheets which led to some concise documentation about
newer VIA chipsets: http://flashrom.org/VIA

Based on that this patch adds full support for VX800/VX820, VX855/VX875
and VX900, including SPI and LPC. VT8237S was not changed (SPI support
only) because there is no public datasheet and it is not clear how to
distinguish between LPC and SPI strapping and investigations in (NDAed)
documents have not brought up anything conclusively.

enable_flash_vt823x could probably be enhanced too due to various
ignored LPC options of the chipset.

Corresponding to flashrom svn r1578.

Signed-off-by: Helge Wagner <Helge.Wagner@ge.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Tested-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-08-24 23:03:46 +00:00
Stefan Tauner
d94d25d75b Add a bunch of new/tested stuff and various small changes 13
Tested Mainboards:
OK:
 - ASRock A780FullHD
   http://www.flashrom.org/pipermail/flashrom/2012-July/009599.html
 - ASRock 880G Pro3
   http://www.flashrom.org/pipermail/flashrom/2012-July/009492.html
 - ASRock N61P-S
   http://www.flashrom.org/pipermail/flashrom/2012-May/009316.html
 - ASUS M2N68-VM
   http://www.flashrom.org/pipermail/flashrom/2012-May/009334.html
 - ASUS M3N78 PRO
   http://www.flashrom.org/pipermail/flashrom/2012-July/009519.html
 - ASUS M4N68T V2
   http://www.flashrom.org/pipermail/flashrom/2012-May/009277.html
 - ASUS M5A78L-M LX
   reported by clavile on IRC
 - ASUS P8P67 PRO (rev. 3.0)
   http://www.flashrom.org/pipermail/flashrom/2012-April/009188.html
 - ASUS P8Z68-V
   reported by Kano on IRC
   http://paste.flashrom.org/view.php?id=1232
 - ASUS SABERTOOTH 990FX
   http://paste.flashrom.org/view.php?id=1214
 - Dell Inspiron 1420
   http://www.flashrom.org/pipermail/flashrom/2012-May/009196.html
 - ECS GF8200A
   http://www.flashrom.org/pipermail/flashrom/2012-May/009256.html
 - GIGABYTE GA-H61M-D2H-USB3
   http://www.flashrom.org/pipermail/flashrom/2012-May/009333.html
 - MSI MS-7250 (K9N SLI (rev 2.1))
   http://www.flashrom.org/pipermail/flashrom/2012-June/009436.html
 - MSI MS-7676 (Z68MA-G45 (B3))
   http://www.flashrom.org/pipermail/flashrom/2012-June/009424.html
 - Palit N61S
   http://www.flashrom.org/pipermail/flashrom/2012-May/009212.html

NOT OK:
 - ASRock H61M-ITX
   http://www.flashrom.org/pipermail/flashrom/2012-May/009224.html
 - Dell Latitude E6520
   http://www.flashrom.org/pipermail/flashrom/2012-May/009197.html
 - Dell Vostro 3700
   http://www.flashrom.org/pipermail/flashrom/2012-May/009197.html
 - Intel DH61AG
   http://www.flashrom.org/pipermail/flashrom/2012-June/009417.html
 - Intel DQ965GF
   http://www.flashrom.org/pipermail/flashrom/2012-May/009295.html
 - HP/Compaq 8100 Elite CMT PC (304Bh)
   http://paste.flashrom.org/view.php?id=1182
 - HP Z400 Workstation (0AE4h)
   http://www.flashrom.org/pipermail/flashrom/2012-June/009350.html
 - Supermicro X9DR3-F
   http://www.flashrom.org/pipermail/flashrom/2012-June/009422.html
   

Tested flash chips:
 - mark AMIC A25L032 as TEST_OK_PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2012-June/009363.html
 - mark Atmel AT25DF321A as TEST_OK_PREW (+REW)
   http://www.flashrom.org/pipermail/flashrom/2012-July/009492.html
 - mark Atmel AT26DF161 as TEST_OK_PR (+PR)
   http://www.flashrom.org/pipermail/flashrom/2012-June/009350.html
 - mark Eon EN25QH16 as TEST_OK_PR (+PR)
   http://www.flashrom.org/pipermail/flashrom/2012-July/009566.html
 - mark SST SST39VF010 as TEST_OK_PREW (+W)
   http://www.flashrom.org/pipermail/flashrom/2012-June/009425.html
 - mark ST M25P64 as TEST_OK_PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2012-May/009332.html

Tested chipset enables:
 - Intel 3420
   http://www.flashrom.org/pipermail/flashrom/2012-May/009332.html

 - Add board enable for ASUS P5GD2-X
   lspci: http://paste.flashrom.org/view.php?id=1234
   write: http://paste.flashrom.org/view.php?id=1240

Miscellaneous
 - Reorder some boards in print.c.
 - Remove broken abit URLs.
 - Whitespace changes.
 - Fix the maximum number of southbridge straps in the ICH descriptor structs.
 - Refine documentation regarding ICH region lock bits.
 - Demote verbosity of ICH Opcode reprogramming to -VV.
 - Exclude Pony-SPI for DOS targets (missing serial support).

Corresponding to flashrom svn r1554.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-07-28 03:17:15 +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
Nico Huber
7bca126561 Let the programmer driver decide how to do AAI transfers
Currently spi_aai_write() is implemented without an abstraction
mechanism for the programmer driver. This adds another function
pointer 'write_aai' to struct spi_programmer, which is set to
default_spi_write_aai (renamed spi_aai_write) for all programmers
for now.

A patch which utilises this abstraction in the dediprog driver will
follow.

Corresponding to flashrom svn r1543.

Signed-off-by: Nico Huber <nico.huber@secunet.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-06-15 22:28:12 +00:00
Stefan Tauner
dc704edad4 Refine reprogram_opcode_on_the_fly to indicate wrong readcnt/writecnt combinations
Corresponding to flashrom svn r1531.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-05-06 15:11:26 +00:00
Paul Menzel
ac427b22c4 Add a bunch of new/tested stuff and various small changes 10
Tested mainboards:
OK:
 - ABIT A-S78H
   http://www.flashrom.org/pipermail/flashrom/2012-January/008603.html
 - ASRock AM2NF6G-VSTA
   http://www.flashrom.org/pipermail/flashrom/2012-January/008534.html
 - ASUS KFSN4-DRE/SAS
   reported by ted on IRC
 - ASUS M2A-VM (HDMI variant)
   http://www.flashrom.org/pipermail/flashrom/2012-January/008509.html
 - ASUS M4N78 PRO
   http://www.flashrom.org/pipermail/flashrom/2012-January/008598.html
 - ASUS P5K-V
   http://www.flashrom.org/pipermail/flashrom/2012-February/008737.html
 - ASUS P5KPL-CM
   http://www.flashrom.org/pipermail/flashrom/2012-January/008522.html
 - ASUS P5N7A-VM
   http://www.flashrom.org/pipermail/flashrom/2012-January/008508.html
 - ASUS P5QPL-AM
   http://www.flashrom.org/pipermail/flashrom/2012-January/008557.html
 - ECS GF7100PVT-M3
   http://www.flashrom.org/pipermail/flashrom/2011-December/008412.html
 - ECS K7SEM
   http://www.flashrom.org/pipermail/flashrom/2011-December/008362.html
 - ECS P4M800PRO-M V2.0
   http://www.flashrom.org/pipermail/flashrom/2012-January/008478.html
 - Gigabyte 880GMA-USB3
   http://www.flashrom.org/pipermail/flashrom/2012-February/008715.html
 - Gigabyte GA-EP31-DS3L
   http://www.flashrom.org/pipermail/flashrom/2012-January/008601.html
 - Gigabyte GA-X58A-UDR3
   http://www.flashrom.org/pipermail/flashrom/2012-January/008572.html
 - Gigabyte GA-Z68XP-UD3
   http://paste.flashrom.org/view.php?id=1058
 - HP ProLiant N40L
   http://www.flashrom.org/pipermail/flashrom/2012-February/008650.html
 - MSI MS-7309 (K9N6PGM2-V2)
   http://www.flashrom.org/pipermail/flashrom/2011-December/008441.html
 - MSI MS-7548 (Aspen-GL8E used in HP Pavilion a6750f)
   http://www.flashrom.org/pipermail/flashrom/2012-February/008666.html
 - MSI MS-7676 (H67MA-ED55(B3))
   http://www.flashrom.org/pipermail/flashrom/2012-January/008547.html
 - PC Engines Alix.6f2
   Reported by Philip Prindeville on IRC
 - Shuttle AV18E2
   http://www.flashrom.org/pipermail/flashrom/2011-December/008459.html
 - Supermicro X8DTE-F
   http://www.flashrom.org/pipermail/flashrom/2011-November/008304.html
 - Supermicro X8DTT-HIBQF
   http://www.flashrom.org/pipermail/flashrom/2012-January/008520.html
NOT OK:
 - ASUS P8H61-M LE/USB3
   http://www.flashrom.org/pipermail/flashrom/2012-January/008491.html
 - ASUS P8H67-M PRO
   http://www.flashrom.org/pipermail/flashrom/2011-December/008321.html
 - ASUS P8Z68-V PRO
   http://www.flashrom.org/pipermail/flashrom/2012-January/008469.html
 - Clevo P150HM (laptop)
   http://www.flashrom.org/pipermail/flashrom/2012-February/008717.html
 - Intel D425KT
   http://www.flashrom.org/pipermail/flashrom/2012-January/008600.html
 - Supermicro X9SCA-F
   http://www.flashrom.org/pipermail/flashrom/2011-December/008313.html

Tested flash chips:
 - mark AT29C512 as TEST_OK_PREW
   http://paste.flashrom.org/view.php?id=977
 - mark M25P40 as TEST_OK_PREW
   http://www.flashrom.org/pipermail/flashrom/2011-December/008351.html
 - mark M25PE80 as TEST_OK_PREW
   http://paste.flashrom.org/view.php?id=1061
 - mark MX25L6405 as TEST_OK_PREW
   tested myself with an MX25L6436E variant on serprog
 - mark W39V080A as TEST_OK_PREW
   http://www.flashrom.org/pipermail/flashrom/2012-January/008509.html

Tested chipsets:
 - SiS 730 (:0730)
   http://www.flashrom.org/pipermail/flashrom/2011-December/008362.html
 - NVIDIA MCP61 (:03e0)
   http://www.flashrom.org/pipermail/flashrom/2012-January/008534.html
 - NVIDIA MCP73 (:07d7)
   http://www.flashrom.org/pipermail/flashrom/2011-December/008412.html
 - NVIDIA MCP79 (:0aac)
   http://www.flashrom.org/pipermail/flashrom/2012-January/008508.html
 - VIA VT82C69x (0691) and VT82C686A/B (:0686)
   http://www.flashrom.org/pipermail/flashrom/2011-December/008459.html

 - AMD's SB950 (and presumably also SB920) have the same PCI ID as previous
   generations, hence change the chipset enable device string. Thanks to
   Christian Ruppert for the suggestion.
 - Fix the board enable of the abit NF-M2 nView which had the IDs of its onboard
   graphics card in its pattern. Change this to the LPC controller.
 - Intel X79 SPI registers are identical to 6 Series', so use the chipsetenable
   wrapper of it (enable_flash_pch6).
 - Fix two paranoid checks for address < 0 in ichspi.c which became futile (and
   generate clang warnings) with the unsignify patch committed in r1470.
 - Rename AT25DF641 to AT25DF641(A). They are almost idencical, but could
   be distinguished by an extended RDID probe (Atmel's patented EDI procedure),
   which we do not support yet, hence handle them as one model for now.
 - Source format fixes and typos

Corresponding to flashrom svn r1499.

the addition of the ASRock AM2NF6G-VSTA to print.c is
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
everything else is
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-02-16 21:07:07 +00:00
Stefan Tauner
5210e72d13 ichspi.c: warn user and disable writes when a protected address range is detected
This includes not only the notorious read-only flash descriptors and locked ME
regions, but also the more rarely used PRs (Protected Ranges).
The user can enforce write support by specifying ich_spi_force=yes in the
programmer options, but we don't tell him the exact syntax interactively. He
has to read it up in the man page.

Corresponding to flashrom svn r1494.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-02-16 01:13:00 +00:00
Carl-Daniel Hailfinger
c40cff7b86 Have all programmer init functions register bus masters/programmers
All programmer types (Parallel, SPI, Opaque) now register themselves
into a generic programmer list and probing is now programmer-centric
instead of chip-centric.
Registering multiple SPI/... masters at the same time is now possible
without any problems. Handling multiple flash chips is still unchanged,
but now we have the infrastructure to deal with "dual BIOS" and "one
flash behind southbridge and one flash behind EC" sanely.

A nice side effect is that this patch kills quite a few global variables
and improves the situation for libflashrom.

Hint for developers:
struct {spi,par,opaque}_programmer now have a void *data pointer to
store any additional programmer-specific data, e.g. hardware
configuration info.

Note:
flashrom -f -c FOO -r forced_read.bin
does not work anymore. We have to find an architecturally clean way to
solve this.

Corresponding to flashrom svn r1475.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-12-20 00:19:29 +00:00
Carl-Daniel Hailfinger
8a3c60cdd0 Add struct flashctx * parameter to all functions accessing flash chips
All programmer access function prototypes except init have been made
static and moved to the respective file.

A few internal functions in flash chip drivers had chipaddr parameters
which are no longer needed.

The lines touched by flashctx changes have been adjusted to 80 columns
except in header files.

Corresponding to flashrom svn r1474.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-12-18 15:01:24 +00:00
Carl-Daniel Hailfinger
63fd9026f1 Use struct flashctx instead of struct flashchip for flash chip access
Struct flashchip is used only for the flashchips array and for
operations which do not access hardware, e.g. printing a list of
supported flash chips.

struct flashctx (flash context) contains all data available in
struct flashchip, but it also contains runtime information like
mapping addresses. struct flashctx is expected to grow additional
members over time, a prime candidate being programmer info.
struct flashctx contains all of struct flashchip with identical
member layout, but struct flashctx has additional members at the end.

The separation between struct flashchip/flashctx shrinks the memory
requirement of the big flashchips array and allows future extension
of flashctx without having to worry about bloat.

Corresponding to flashrom svn r1473.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-12-14 22:25:15 +00:00
Stefan Tauner
c69c9c84e0 Unsignify lengths and addresses in chip functions and structs
Push those changes forward where needed to prevent new sign
conversion warnings where possible.

Corresponding to flashrom svn r1470.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-11-23 09:13:48 +00:00
Stefan Tauner
745f6bbec2 ichspi: fix ich_init_opcodes() calls in ich_init_spi()
By calling it early ichspi_lock was not set up correctly in accordance
with the corresponding register, hence ich_init_opcodes() was always
trying to programming the opcodes instead of reading them in from the
opmenu in case of a locked down configuration.

Thanks to Jonathan A. Kollasch for reporting this bug.

Corresponding to flashrom svn r1464.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-11-13 15:17:10 +00:00
Carl-Daniel Hailfinger
eaacd2d4e7 Register Parallel/LPC/FWH programmers the same way SPI programmers are registered
All programmers are now calling programmer registration functions and
direct manipulations of buses_supported are not needed/possible anymore.

Note: Programmers without parallel/LPC/FWH chip support should not call
register_par_programmer().

Additional fixes:
Set max_rom_decode.parallel for drkaiser.
Remove abuse of programmer_map_flash_region in it85spi.
Annotate several FIXMEs in it85spi.

Corresponding to flashrom svn r1463.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-11-09 23:40:00 +00:00
Stefan Tauner
f382e352ac ichspi: print flash descriptor dependent information only when it is valid
Also, fix some coding style issues.

Corresponding to flashrom svn r1462.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-11-08 11:55:24 +00:00
Stefan Tauner
50e7c603f7 ichspi: add support for Intel Hardware Sequencing
Based on the new opaque programmer framework this patch adds support
for Intel Hardware Sequencing on ICH8 and its successors.

By default (or when setting the ich_spi_mode option to auto)
the module tries to use swseq and only activates hwseq if need be:
- if important opcodes are inaccessible due to lockdown
- if more than one flash chip is attached.
The other options (swseq, hwseq) select the respective mode (if possible).

A general description of Hardware Sequencing can be found in this blog entry:
http://blogs.coreboot.org/blog/2011/06/11/gsoc-2011-flashrom-part-1/

Besides adding hwseq this patch also introduces these unrelated changes:

- Fix enable_flash_ich_dc_spi to pass ERROR_FATAL from ich_init_spi.
  The whole error handling looks a bit odd to me, so this patch does
  change very little. Also, it does not touch the tunnelcreek method,
  which should be refactored anyway.

- Add null-pointer guards to find_opcode and find_preop
  to matches the other opcode methods better:
  curopcodes == NULL has some meaning and is actively used/checked in
  other functions.

TODO: adding real documentation when we have a directory for it

Corresponding to flashrom svn r1461.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-11-08 10:55:54 +00:00
Stefan Tauner
a8d838d9d3 ichspi: use a variable to distinguish ich generations instead of spi_programmer->type
The type member is enough most of the time to derive the wanted
information, but
 - not always (e.g. ich_set_bbar),
 - only available after registration, which we want to delay till the
   end of init, and
 - we really want to distinguish between chipset version-grained
   attributes which are not reflected by the registered programmer.

Hence this patch introduces a new static variable which is set up
early by the init functions and allows us to get rid of all "switch
(spi_programmer->type)" in ichspi.c. We reuse the enum introduced
for descriptor mode for the type of the new variable.

Previously magic numbers were passed by chipset_enable wrappers. Now
they use the enumeration items too. To get this working the enum
definition had to be moved to programmer.h.

Another noteworthy detail: previously we have checked for a valid
programmer/ich generation all over the place. I have removed those
checks and added one single check in the init method. Calling any
function of a programmer without executing the init method first, is
undefined behavior.

Corresponding to flashrom svn r1460.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-11-06 23:51:09 +00:00
Stefan Tauner
d0c5dc23e2 ichspi: add (partially) dead support code for Intel Hardware Sequencing
This was done to ease the review. Another patch will hook up (and
explain) this code later.

Corresponding to flashrom svn r1452.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-10-20 12:57:14 +00:00
Stefan Tauner
e3185c0599 ichspi: inform the user about the consequences of the security override strap
Ibex Peak SPI Programming Guide:
The PCH has a mechanism to set up to 5 address ranges from HOST access. These are
defined in PR0, PR1, PR2, PR3 and PR4 in the PCH EDS. These address ranges are NOT
unlocked by assertion of Flash descriptor Override.

Also, the datasheets mention the bit in their description of FRAP but not PR[N].

Corresponding to flashrom svn r1449.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-09-18 15:15:31 +00:00
Stefan Tauner
75da80c17b ichspi: unlock PR register restrictions on ICH8+ if not locked down
Tested-by: Shailendra Sodhi
(predecessor/proof of concept patch)
http://www.flashrom.org/pipermail/flashrom/2011-August/007717.html

Corresponding to flashrom svn r1447.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-09-17 22:21:55 +00:00
Stefan Tauner
bf69aaa9ca ichspi: add prettyprinting for PR registers on ICH8+
Corresponding to flashrom svn r1446.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-09-17 21:21:48 +00:00
Stefan Tauner
7783f31249 ichspi: don't touch the nonexistent(?) BBAR register on ICH8
There is no sign of BBAR (BIOS Base Address Configuration Register)
in the public datasheet (or specification update) of the ICH8. Also,
the offset of that register has changed between ICH7 (SPIBAR + 50h)
and ICH9 (SPIBAR + A0h), so we have no clue if or where it is on
ICH8. Better don't try to touch it at all and assume/hope it is 0.

Corresponding to flashrom svn r1445.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-09-17 21:21:42 +00:00
Stefan Tauner
84e1ddea5f ichspi: improve prettyprint_opcodes
Add headers for the columns and some decoding into human readable format.

Corresponding to flashrom svn r1444.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-09-17 19:53:11 +00:00
Stefan Tauner
1e14639f42 ichspi: add ICH/PCH flash descriptor decoding via FDOC/FDOD
Based on the work of Matthias 'mazzoo' Wenzel this patch adds pretty
printing of those ICH/PCH flash descriptor sections that are
cached/mapped by the chipset (and which are therefore reachable via
FDOC/FDOD registers).

this includes the following:
- content section:
    describes the image and some generic properties (number of
    sections, offset of sections, PCH/ICH and MCH/PROC strap
    offsets and lengths)
- component section:
    identify the different SPI flash chips and their capabilities.
- region section
    similarly to a partition table this describes the different regions.
    the content of FLREG* is derived from this section.
- master section
    defines SPI master (host, ME, GbE) access rights of the
    individual regions. the content of PR* is derived from this section.

this is only a part of the data included in the descriptor. other
information can be retrieved from a complete binary dump of the
descriptor region only.

this patch also adds macros and pretty printing for "Vendor Specific
Component Capabilities" registers: there are two of them: lower and
upper. they describe the properties of the address space divided by
FPBA (which allows to use multiple flash chips or partitions with
different properties). the properties of all supported flash chips
(together with their RDIDs) are stored in the same format in table
in a descriptor section (which is used by the ME apparently). a
later patch will use the macros outside of ichspi.c which is the
reason why the prettyprinting function and the register bit macros
are not defined in ichspi.c but ich_descriptors.h (else they would
be moved in the follow-up patch).

because this patch relies on (compiler) implementation-specific
layouting of bit-fields, it checks for correct layout before taking
any action on runtime.

Corresponding to flashrom svn r1443.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-09-15 23:52:55 +00:00
Stefan Tauner
a63c7c4496 Remove unneeded inclusions of chipdrivers.h
This is related to the spi split patch as discussed in:
http://www.flashrom.org/pipermail/flashrom/2010-February/thread.html#2364
the old commit (r914) log notes:
"Some of the spi programmer drivers required chipdrivers.h, needs fixing later: it87spi.c
  ichspi.c   sb600spi.c   wbsio_spi.c   buspirate_spi.c   ft2232spi.c   bitbang_spi.c   dediprog.c"

there still remain a few cases where chipdrivers.h is needed:
dediprog.c (spi_read_chunked and spi_write_chunked)
it87spi.c (due to spi_write_enable and spi_read_status_register)
wbsio_spi.c (spi_programmer registration only)

besides that, there are also non-spi files that do not need it.
also, add flash.h to chipdrivers.h because it uses some types of it
and remove flashchips.h from print.c

Corresponding to flashrom svn r1414.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-08-16 12:08:22 +00:00
Stefan Tauner
8b391b8e27 ichspi.c: refactor filling and reading the fdata/spid registers
- add ich_fill_data to fill the chipset registers from an array
- add ich_read_data to copy the data from the chipset register into an array
- replace the existing code with calls to those functions
- minor cosmetic changes

Corresponding to flashrom svn r1409.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-08-09 01:49:34 +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
Carl-Daniel Hailfinger
1a227954f2 Rename CHIP_BUSTYPE_FOO to BUS_FOO
It's shorter to type, and we have less problems with the 80 column limit.

Corresponding to flashrom svn r1396.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2011-07-27 07:13:06 +00:00
Stefan Tauner
122dd126df ichspi.c: do not print PBR[3] for ICH7 because it does not exist
Intel document 307013 (ICH7 datasheet) section 21.1.9 does only
define PBR[0] (at SPIBAR + 60h) to PBR[2] (SPIBAR + 68h). SPIBAR + 6Ch
and following are not defined, but we were printing them as PBR[3]
anyway. i could not find any references to PBR[3] in documentation of
other related chips (NM10, atom e6xx) either, hence kill it.

Corresponding to flashrom svn r1381.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-07-24 15:34:56 +00:00
Stefan Tauner
5ffe65be31 ichspi.c: print FADDR in ich_init_spi
We print the address registers for ICH7 and VIA at init.
We should do so for ICH9 too.

Corresponding to flashrom svn r1365.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: David Hendricks <dhendrix@google.com>
2011-07-07 04:10:57 +00:00
Stefan Tauner
10b3e22870 ichspi.c: preserve reserved bits in address registers
Corresponding to flashrom svn r1362.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-07-01 00:39:23 +00:00
Stefan Tauner
bd649e450c ichspi.c: add FPB (Flash Partition Boundary) macros and init printing
Corresponding to flashrom svn r1361.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-07-01 00:39:16 +00:00
Stefan Tauner
e27b2d4184 ichspi.c: simplify ich_set_bbar
Less code, documenting better what the differences are (i.e. offset of BBAR only).

Corresponding to flashrom svn r1360.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-07-01 00:39:09 +00:00
Stefan Tauner
ccd92a19d4 ichspi.c: make REGWRITE* macros safer
'+' does have a quite high precedence so "calling" those macros with a
term including weaker operators in the off parameter may have unexpected
consequences.

Corresponding to flashrom svn r1359.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-07-01 00:39:01 +00:00
Stefan Tauner
29c80838ae ichspi.c: add missing ICH9 register macros and eliminate magic numbers
- add macros for FRAP, FREG0, PR0-PR4 and BBAR
 - eliminate magic numbers representing those registers and some other bits too
 - remove printing out the contents of FDOC because it is useless

Corresponding to flashrom svn r1334.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-06-12 08:14:10 +00:00
Stefan Tauner
b2d5f6abbc Use the max_data_read field of the new spi_programmer struct to simplify run_opcode
Also, explain the transformation of the read/write array/count in
ich_spi_send_command better.

Corresponding to flashrom svn r1333.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-06-11 19:44:31 +00:00
Stefan Tauner
5520694cab ichspi.c: add macros and pretty printing for HSFS and HSFC
Corresponding to flashrom svn r1330.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-06-11 09:53:22 +00:00
Stefan Tauner
2a8b26281c ichspi.c: add pretty printing for SSFS+SSFC and the OPCODE struct
Corresponding to flashrom svn r1329.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-06-11 09:53:16 +00:00
Stefan Tauner
0c1ec450f9 ichspi.c: improve macros for SSFS and SSFC bits
- introduce offset macros and use them to (re)define the existing mask macros
 - fix masks of SSFC_COP, SSFC_DBC, SSFC_SCF (were single-bit masks erroneously)
 - add comments
 - rename SSFS_CDS to SSFS_FDONE (abbr. used in datasheet; not in SSFS but HSFS)
 - use those for refactoring and magic number elemination.

 following patch uses them for pretty printing.

Corresponding to flashrom svn r1328.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-06-11 09:53:09 +00:00
Stefan Tauner
355cbfdbef Small fixes
- missing spaces in code and output
- improved documentation/naming/output
- missing line breaks in spi probing functions

Corresponding to flashrom svn r1321.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-05-28 02:37:14 +00:00
Joshua Roys
d172ecdb34 ichspi: fix detection of unused regions
Corresponding to flashrom svn r1319.

Signed-off-by: Joshua Roys <roysjosh@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-05-26 13:30:51 +00:00
Stefan Tauner
c0aaf95487 Whitespace, documentation and other small stuff
This patch combines three previously posted patches in a revised form.
one is even stolen from Stefan Reinauer (remove umlauts from man page).

Corresponding to flashrom svn r1317.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Signed-off-by: Stefan Reinauer <reinauer@google.com>

Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-05-19 02:58:17 +00:00
Michael Karcher
b9dbe48b77 Kill central list of SPI programmers
Remove the array spi_programmer, replace it by dynamic registration
instead. Also initially start with no busses supported, and switch to
the default non-SPI only for the internal programmer.

Also this patch changes the initialization for the buses_supported variable
from "everything-except-SPI" to "nothing". All programmers have to set the
bus type on their own, and this enables register_spi_programmer to just add
the SPI both for on-board SPI interfaces (where the internal programmer
already detected the other bus types), as well as for external programmers
(where we have the default "none").

Corresponding to flashrom svn r1299.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-05-11 17:07:07 +00:00
Michael Karcher
627975196d Factor out SPI write/read chunking wrappers
Corresponding to flashrom svn r1298.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-05-11 17:07:02 +00:00