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

63 Commits

Author SHA1 Message Date
Carl-Daniel Hailfinger
11990da1d3 Various cross-platform fixes
Improve compilation with libpayload (compiling flashrom.c and
linking is still broken):
 - disable Ponyprog (which enforced serial.c compilation)
 - make errno available where it is needed

Fix internal.c for non-x86 and enable cb parsing on ARM.

Fix mingw builds by using its __USE_MINGW_ANSI_STDIO macro
and gnu_printf definition for printf format style checking.
See http://sourceforge.net/apps/trac/mingw-w64/wiki/gnu%20printf
This requires inclusion of stdio.h in flash.h.

Fix order of libraries in the Makefile:
FEATURE_LIBS needs to come *after* PCILIBS in case ZLIB is needed by it.

Corresponding to flashrom svn r1697.

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: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2013-07-13 23:21:05 +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
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
Stefan Tauner
fa9fa7131a Fix flashrom running on boards with coreboot
In r1577 we removed the discrimination of coreboot IDs and user-specified
mainboards. The problem is that the board enable code required to find
a board enable if either of these model strings were set. Therefore boards
running coreboot that do not need a board enable failed to execute flashrom
since then. This patch fixes this by handling coreboot IDs and user-supplied
IDs differently again.

Corresponding to flashrom svn r1605.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Idwer Vollering <vidwer@gmail.com>
2012-09-24 21:29:29 +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
Carl-Daniel Hailfinger
1c6d2ff03d Some ISO C fixes
This patch just fixes a limited number of bits not conforming to c99 by using
 - __asm__ instead of just asm
 - {0} instead of {} for struct initialization
 - h_addr_list[0] instead of h_addr to access the host address in
   struct hostent
 - #include <strings.h> where needed (for ffs and strcasecmp)

Based on a previous patch by Carl-Daniel.

Corresponding to flashrom svn r1585.

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: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-08-27 00:44:42 +00:00
Stefan Tauner
b4e06bde9b Refactor the -p internal:mainboard handling
This patch gets rid of some global variables and makes lots of bits along
the code path that control the board enable execution more generic and
clearer. From now on flashrom aborts on a few more occasions that should be
safer for the user. For example it aborts if the enable function for the
specified mainboard (enable) can not be found.

Parts of the board_match_cbname refactoring were done by Carl-Daniel.

Corresponding to flashrom svn r1577.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-08-20 00:24:22 +00:00
Niklas Söderlund
2a95e8713b Remove more exit calls
This patch removes the remaining exit calls from
 - sp_openserport
 - sp_opensocket
 - sp_docommand
 - internal_init

Almost all of this was done by Niklas.

Corresponding to flashrom svn r1557.

Signed-off-by: Niklas Söderlund <niso@kth.se>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-07-30 19:42:33 +00:00
Carl-Daniel Hailfinger
d6bb828b01 Automatically release I/O permissions on shutdown
Get_io_perms() is renamed to rget_io_perms() and automatically registers
a function to release I/O permissions on shutdown.

Actually release I/O permissions on Solaris and iopl()-supporting
operating systems like Linux.

This patch fixes quite a few programmers which forgot to release I/O
permissions on shutdown, and it simplifies the shutdown and error
handling code for all others.

Do not call exit(1) if I/O permissions are denied and return an error
instead. This part of the patch was written by Niklas Söderlund.

Corresponding to flashrom svn r1551.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Niklas Söderlund <niso@kth.se>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2012-07-21 17:27:08 +00:00
Patrick Georgi
32508eb304 Hide hwaccess.h from public API
Move hwaccess.h #include from flash.h to individual drivers.
libflashrom users need flash.h, but they do not care about hwaccess.h
and should not see its definitions because they may conflict with
other hardware access functions and #defines used by the libflashrom
user.

Corresponding to flashrom svn r1549.

Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-07-20 20:35:14 +00:00
Carl-Daniel Hailfinger
f5e62cb151 Add Winbond W836xx SuperI/O detection
Add ITE IT8707F/IT8710F detection.

Note that we autodetect those chips, but we don't handle their flash
translation features automatically yet.

Corresponding to flashrom svn r1533.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2012-05-06 22:48:01 +00:00
Carl-Daniel Hailfinger
ccd71c2122 Fix parallel-style programmer access from ITE IT87/Winbond W83627 SPI
The ITE IT87 SPI driver uses a trick to speed up reading and writing:
If a flash chip is 512 kByte or less, the flash chip can be completely
mapped in memory and both read and write accesses are faster that way.
The current IT87 SPI code did use the parallel programmer interface for
memory mapped reads and writes, but that's the wrong abstraction. It has
been fixed to use mmio_read*/mmio_write* for that purpose.

The Winbond W83627 SPI driver uses the same trick in its read path for
all supported chip sizes. Fix it the same way.

Switch internal_chip_readn to use mmio_readn as proper abstraction.

Kudos to Michael Karcher for spotting the bugs.

Tested-by: Johan Svensson <flashrom.js@crypt.se>

Corresponding to flashrom svn r1511.

Reported-by: Johan Svensson <flashrom.js@crypt.se>
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2012-03-01 22:38:27 +00:00
Carl-Daniel Hailfinger
2d927fbd7b Replace --mainboard with -p internal:mainboard
NOTE:
The --list-supported-wiki output changed to use -p internal:mainboard=
instead of -m
The --list-supported output changed the heading of the mainboard list
from

Vendor Board   Status  Required option
to
Vendor Board   Status  Required value for
                       -p internal:mainboard=

Fix lb_vendor_dev_from_string() not to write to the supplied string.

Corresponding to flashrom svn r1483.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-01-04 00:48:27 +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
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
a28087fab9 Make the laptop warning less scary if unsure
Telling the user to use "force_I_want_a_brick" if it is not even a
laptop, is a bit over-the-top. Introduce a new laptop parameter
"this_is_not_a_laptop" that allows to force operation, but only if
the detection is not sure.

Corresponding to flashrom svn r1440.

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-13 23:14:25 +00:00
Tadas Slotkus
ad470347fd Introduce ERROR_FATAL, abort upon failed chipset enables
Corresponding to flashrom svn r1426.

Signed-off-by: Tadas Slotkus <devtadas@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2011-09-03 17:15:00 +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
a34d719037 Be more refined regarding DMI chassis types
We had broken laptops in the past that were not detected as such because
their DMI chassis-type was either undefined/out-of-spec, or set to
'other' or 'unknown'.

this patch tries to mitigate this problem as follows:
- if the DMI chassis-type clearly identifies the system as
  laptop/notebook/mobile platform then nothing changes: the user gets
  the laptop warning without a hint to the force switch.
- if the DMI chassis-type is not specific enough, we warn the user
  similarly, but tell them the switch.

to reduce the number of false positives i have added a few new
chassis types that we have encountered in the last months to the list.

Corresponding to flashrom svn r1390.

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-26 00:54:42 +00:00
Uwe Hermann
24c35e458d Change "class" parameter name to "devclass" to avoid C++ issues
In C++ "class" is a reserved keyword, and as we'll want to use libflashrom
from C++ code at some point, let's make sure it doesn't cause issues.
Other places in the code already used "devclass" anyway, so it also increases
consistency and readability a bit.

Corresponding to flashrom svn r1371.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2011-07-13 11:22:03 +00:00
David Hendricks
8bb2021d77 Use shutdown callback mechanism to shutdown programmers
This patch attempts to resolve some programmer shutdown ordering issues
by having the programmer init functions register shutdown callbacks explicitly
wherever it makes most sense. Before, assumptions were made that could lead to
the internal programmer's state changing before the external programmer could be
shut down properly. Now, each programmer cleans up after itself and (hopefully)
performs each operation in the correct order.

As a side-effect, this patch gives us a better usage model for reverse
operations such as rpci_* and rmmio_*. In the long-run, this should make
reversing the initialization process easier to understand, less tedious, and
less error-prone.

In short, this patch does the following:
- Registers a shutdown callback during initialization for each programmer.
- Kills the .shutdown function pointer from programmer_entry struct. Also,
  make most shutdown functions static.
- Adds a few minor clean-ups and corrections (e.g. missing physunmap() calls).

TODO: Remove forward declaration of serprog_shutdown() (added to simplify diff)

Corresponding to flashrom svn r1338.

Signed-off-by: David Hendricks <dhendrix@google.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-06-14 01:35:36 +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
Carl-Daniel Hailfinger
580d29a9b1 Revamp board-specific quirk handling, allow for laptop support
Handle board-specific quirks in three phases:
1. Before Super I/O probing (e.g. blacklisting of some Super I/O probes,
or unhiding the Super I/O)
2. Before the laptop enforcement decision (e.g. whitelisting a laptop
for flashing)
3. After chipset enabling (all current board enables)

Implementation note: All entries in board_pciid_enables get an
additional phase parameter. Alternative variants (3 tables instead of 1)
also have their downsides, and I chose table bloat over table
multiplication).

With this patch, it should be possible to whitelist supported laptops
with a matching entry (phase P2) in board_pciid_enables which points to
a function setting laptop_ok=1. (In case DMI is broken, matching might
be a little bit more difficult, but it is still doable.)

Corresponding to flashrom svn r1294.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-05-05 07:12:40 +00:00
Carl-Daniel Hailfinger
bfecef6986 Add support for more than one Super I/O or EC per machine
Flashrom currently only supports exactly one Super I/O or Embedded
Controller, and this means quite a few notebooks and a small subset of
desktop/server boards cannot be handled reliably and easily.
Allow detection and initialization of up to 3 Super I/O and/or EC chips.

WARNING! If a Super I/O or EC responds on multiple ports (0x2e and
0x4e), the code will do the wrong thing (namely, initialize the hardware
twice). I have no idea if we should handle such situations, and whether
we should ignore the second chip with identical ID or not. Initializing
the hardware twice for the IT87* family is _not_ a problem, but I don't
know how well IT85* can handle it (and whether IT85* would listen at
more than one port anyway).

Corresponding to flashrom svn r1289.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

Thanks to Thomas Schneider for testing on a board with ITE IT87* SPI.
Test report (success) is here: http://paste.flashrom.org/view.php?id=379

Thanks to David Hendricks for testing on a Google Cr-48 laptop with
ITE IT85* EC SPI. Test report (success) is here:
http://www.flashrom.org/pipermail/flashrom/2011-April/006275.html
Acked-by: David Hendricks <dhendrix@google.com>
2011-04-27 14:34:08 +00:00
Stefan Reinauer
18430a08aa Remove duplicate includes from the code
Corresponding to flashrom svn r1196.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-10-06 02:56:44 +00:00
Vladimir 'phcoder' Serbinenko
5cfc94a98b Support for Loongson-2F (MIPS) flashing
Corresponding to flashrom svn r1183.

Signed-off-by: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-09-29 23:37:24 +00:00
Peter Lemenkov
0a6f9ca171 internal: remove unused variable
The variable 'ret' is unused when compiling on big-endian architecture.

This produces an "unused variable" message, which might be treated as error
if -Werror was passed to compiler.

With this patch I was able to compile flashrom cleanly on ppc and ppc64:

http://koji.fedoraproject.org/koji/taskinfo?taskID=2472482
http://koji.fedoraproject.org/koji/taskinfo?taskID=2472484

Corresponding to flashrom svn r1180.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-09-20 17:23:38 +00:00
Carl-Daniel Hailfinger
5b997c3ed6 Split off programmer.h from flash.h
Programmer specific functions are of absolutely no interest to any file
except those dealing with programmer specific actions (special SPI
commands and the generic core).

The new header structure is as follows (and yes, improvements are
possible):
flashchips.h  flash chip IDs
chipdrivers.h  chip-specific read/write/... functions
flash.h  common header for all stuff that doesn't fit elsewhere
hwaccess.h hardware access functions
programmer.h  programmer specific functions
coreboot_tables.h  header from coreboot, internal programmer only
spi.h SPI command definitions

Corresponding to flashrom svn r1112.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-07-27 22:41:39 +00:00
Carl-Daniel Hailfinger
76d4b373dd Generify support for ITE IT8705 Super I/O
Autodetect the ITE IT8705 Super I/O and enable flash writes if it
performs LPC->Parallel translation. Remove board enables which triggered
the IT8705 write enable manually. Change the IT87 SPI special case to
cover IT87 LPC->SPI and LPC->Parallel translation.

Corresponding to flashrom svn r1073.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

Tested on Syntax SV266A.
Acked-by: Paul Menzel <paulepanter@users.sourceforge.net>

Tested on Shuttle AK38N, all operations work fine.
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-07-10 16:56:32 +00:00
Carl-Daniel Hailfinger
2b6dcb36c4 Unify programmer parameter extraction
Make programmer_param static by converting all users to extract_programmer_param.
Programmer parameters can no longer be separated with a
colon, they have to be separated with a comma.

Corresponding to flashrom svn r1072.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-07-08 10:13:37 +00:00
Carl-Daniel Hailfinger
744132af4b Various places in the flashrom source feature custom parameter extraction from programmer_param
This led to wildly differing syntax for programmer parameters, and
it also voids pretty much every assumption you could make about
programmer_param. The latter is a problem for libflashrom.

Use extract_param everywhere, clean up related code and make it more
foolproof. Add two instances of exit(1) where we have no option to
return an error. Remove six instances of exit(1) where returning an
error was possible.

WARNING: This changes programmer parameter syntax for a few programmers!

Corresponding to flashrom svn r1070.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-07-06 09:55:48 +00:00
Carl-Daniel Hailfinger
dcef67e468 Kill unneeded #include wherever possible
Tested on Linux, FreeBSD, NetBSD, OpenBSD, DOS.
Thanks to Jonathan A. Kollasch and Idwer Vollering for testing.

Corresponding to flashrom svn r1057.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer+lists.flashrom@gmail.com>
2010-06-21 23:20:15 +00:00
Carl-Daniel Hailfinger
b5b161b260 Internal: introduce processor enables and abort if top/bottom alignment is unknown
The internal programmer needs correct information about flash_base and
chip window top/bottom alignment on non-x86 before it can be used. Abort
any internal programmer action for now until the code is fixed.

Add the concept of a processor enable for systems where flashing is
impacted by processor settings or processor model.

Corresponding to flashrom svn r1031.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-06-04 19:05:39 +00:00
Carl-Daniel Hailfinger
71127727dc So far, we have up to 4 different names for the same thing (ignoring capitalization)
CONFIG_FT2232SPI (makefile config option)
FT2232_SPI_SUPPORT (#define)
ft2232spi (programmer name)
ft2232_spi.c (programmer file)

Use CONFIG_* with underscores for makefile config options and #defines
and kill the useless _SUPPORT idiom.
Use lowercase names with underscores for programmer names and programmer
files.

With this, you can run "grep -i ft2232_spi" and find everything related
to the ft2232_spi driver. Same applies to all other programmers.

Corresponding to flashrom svn r1023.

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

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

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

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

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

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

Corresponding to flashrom svn r1013.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Misha Manulis <misha@manulis.com>
Acked-by: Vladimir 'phcoder/φ-coder' Serbinenko <phcoder@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
2010-05-26 01:45:41 +00:00
Carl-Daniel Hailfinger
270237687a One of the problems is that --force had multiple meanings
- Force chip read by faking probe success.
- Force chip access even if the chip is bigger than max decode size for
  the flash bus.
- Force erase even if erase is known bad.
- Force write even if write is known bad.
- Force writing even if cbtable tells us that this is the wrong image
  for this board.

This patch cleans up --force usage:
- Remove any suggestions to use --force for probe/read from flashrom
  output.
- Don't talk about "success" or "Found chip" if the chip is forced.
- Add a new internal programmer parameter boardmismatch=force. This
  overrides any mismatch detection from cbtable/image comparisons.
- Add a new internal programmer parameter laptop=force_I_want_a_brick.
- Adjust the documentation for --force.
- Clean up the man page a bit whereever it talks about --force or
  laptops.

Additional changes in this patch:
- Add warnings about laptops to the documentation.
- Abort if a laptop is detected. Can be overridden with the programmer
parameter mentioned above.
- Add "Portable" to the list of DMI strings indicating laptops.
- Check if a chip specified with -c is known to flashrom.
- Programmer parameter reliability and consistency fixes.
- More paranoid self-checks.
- Improve documentation.

Corresponding to flashrom svn r996.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-04-28 15:22:14 +00:00
Carl-Daniel Hailfinger
01f3ef4fd1 Autodetect ITE IT87* LPC->SPI translation on all boards without the need for a board enable
Move boards which had an IT87* SPI board enable from the board enable
list to the OK list.

Mark the Gigabyte GA-MA78GPM-DS2H as OK.

Change the it87spi forced port parameter to it87spiport=...

Fix incorrect indentation in the man page.

Tested by Ward Vandewege on both variants of the Gigabyte GA-M57SLI-S4
http://www.flashrom.org/pipermail/flashrom/2010-March/002712.html

Tested by 李彥學 (Ian-Xue Li) on the Gigabyte GA-MA78GPM-DS2H
http://www.flashrom.org/pipermail/flashrom/2010-March/002723.html

Corresponding to flashrom svn r983.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Ward Vandewege <ward@gnu.org>
2010-03-25 02:50:40 +00:00
Uwe Hermann
439597032e Various coding style and cosmetic changes
- Fix coding-style, whitespace, and indentation in a few places.

 - Consistently use the same spelling ("Super I/O") everywhere.

Corresponding to flashrom svn r933.

 - Make some flashrom stdout output look a bit nicer.
 
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-03-13 17:28:29 +00:00
Michael Karcher
0bdc0929f5 Implement tested/untested status for board enables
The message printing code greatly exceed the 80 character limit. I can
reformat it on request to obey the limit.

Intended behaviour:
on untested boards an explanation of that status is printed and the board
enable code is not run, unless the option "boardenable=force" has been
passed to the internal programmer.

Corresponding to flashrom svn r919.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-02-28 01:33:48 +00:00
Michael Karcher
8c1df280e3 Warn if running on laptops
Corresponding to flashrom svn r916.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-02-26 09:51:20 +00:00
Carl-Daniel Hailfinger
fb0828f3db Split internal.c into internal.c and hwaccess.c
Linking in support for the internal programmer doesn't make sense if you
only need hardware (ioport, memory) access.

Note: This patch was created by "svn cp internal.c hwaccess.c" and then
removing stuff from both files. That's why you can't apply the patch
as-is before running the svn cp.

Corresponding to flashrom svn r898.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-02-12 19:35:25 +00:00
Michael Karcher
6701ee833c Matching board via DMI
If a board is not uniquely identifiable by PCI device/subsystem IDs, a
string can be specified to be looked for (case-sensitive, substring or
anchored) for now in one of the following DMI items in addition to matching
the PCI IDs:
 - System Manufacturer
 - System Product Name
 - System Version
 - Baseboard Manufacturer
 - Baseboard Product Name
 - Baseboard Version

Strings are anchored re-like (^ at the beginning, $ at the end), but
there are no plans to support full regular expressions and matched to any
of the mentioned fields.

The match is only made if DMI info is available and the string matches.
If no DMI info is available and the PCI IDs match, a warning is printed
as the board can not be autodetected.

It's still open to discussion whether we add an DMI override switch to
specify a string that will definitely match, and whether this switch is
only used if no DMI is available or whether it overrides or augments DMI
data.

DMI data is currently read using dmidecode. This tool is available for
all major platforms except MacOS X. I heard that there also is a MacOS X
version of dmidecode, but didn't investigate that.

Corresponding to flashrom svn r874.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Luc Verhaegen <libv@skynet.be>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-01-20 14:14:11 +00:00
Carl-Daniel Hailfinger
cc1802db50 Move generic programmer function into newly introduced programmer.c
Some programmers (most notably FT2232SPI) use fallback_* and noop_*,
but those functions lived inside internal.c and were unavailable if no
PCI-based programmers were compiled in.

Move those functions to the new file programmer.c. Thanks to Patrick
Georgi for finding this.

Corresponding to flashrom svn r829.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
2010-01-06 10:21:00 +00:00
Carl-Daniel Hailfinger
36cc1c8144 Internal.c was always compiled in because it hosted the function internal_delay()
Move that function to udelay.c and compile internal.c only if really
needed. physmap.c is only needed if the programmer is internal or a PCI
card. Make its compilation conditional.

Corresponding to flashrom svn r822.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer@gmail.com>
2009-12-24 03:11:55 +00:00
Carl-Daniel Hailfinger
14e100c933 SuperI/O detection now happens unconditionally and before the chipset enable
We could run it after chipset enable, but it definitely has to happen
before board enable because the board enable usually accesses the
SuperI/O. With this patch, it is possible to add a struct superio to the
board enable table for more accurate matching in case subsystem IDs are
ambiguous. This patch focuses on the generic infrastructure aspect and
on support for IT8712F/IT8716F.

Thanks go to Adrian Glaubitz and Ward Vandewege for testing.

Corresponding to flashrom svn r813.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Luc Verhaegen <libv@skynet.be>
Acked-by: Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
2009-12-22 23:42:04 +00:00
Carl-Daniel Hailfinger
66ef4e5ff3 Internal (onboard) programming was the only feature which could not be disabled
Make various pieces of code conditional on support for internal
programming. Code shared between PCI device programmers and onboard
programming is now conditional as well.

It is now possible to build only with dummy support:
make CONFIG_INTERNAL=no CONFIG_NIC3COM=no CONFIG_SATASII=no
CONFIG_DRKAISER=no CONFIG_SERPROG=no CONFIG_FT2232SPI=no

This allows building for a specific use case only, and it also
facilitates porting to a new architecture because it is possible to
focus on highlevel code only.

Note: Either internal or dummy programmer needs to be compiled in due to
the current behaviour of always picking a default programmer if -p is
not specified. Picking an arbitrary external programmer as default  
wouldn't make sense.

Build and runtime tested in all 1024 possible build combinations. The
only failures are by design as mentioned above.

Corresponding to flashrom svn r797.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2009-12-13 22:28:00 +00:00
Carl-Daniel Hailfinger
9f46cfca38 Add support for every single SiS chipset out there
The two existing SiS chipset enables (compared to the 28 in this patch)
were refactored, and one of them was fixed.

A function to match PCI vendor/class combinations was added to generic
code.

Tested on the "Elitegroup K7S5A". Results are somewhat unexpected (some
PCI settings seem to be inaccessible, but it still works).

This is not based on any docs, but rather on detailed analysis
of existing opensource code for some of the chipsets.

Thanks to for Adrian Glaubitz testing.

Corresponding to flashrom svn r759.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
2009-11-15 17:13:29 +00:00
Carl-Daniel Hailfinger
4740c6ff3c Allow to exclude each of the external programmer drivers from being compiled in
Example make commandline if you want only internal programmers:
make CONFIG_FT2232SPI=no CONFIG_SERPROG=no CONFIG_NIC3COM=no
CONFIG_SATASII=no CONFIG_DRKAISER=no CONFIG_DUMMY=no

Of course, all of the CONFIG_* symbols can be mixed and matched as
needed. CONFIG_FT2232SPI is special because even if it is enabled, make
will check if the headers are available and skip it otherwise.

Corresponding to flashrom svn r724.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-09-16 10:09:21 +00:00
Carl-Daniel Hailfinger
9246ff4063 Don't abort if chipset init failed because the failing init may have been a warning only
Even a failing chipset init (maybe due to unknown chipset) could still
get us reasonable probe results or at least forced reads.

Corresponding to flashrom svn r708.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-09-02 13:43:56 +00:00