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

259 Commits

Author SHA1 Message Date
Carl-Daniel Hailfinger
12575e5bfe Reduce message severity level for skipped chips
Old verbose log excerpt:
Probing for Atmel AT25DF021, 256 KB: skipped. Host bus type Parallel and
chip bus type SPI are incompatible.

New verbose log excerpt:
Probing for Atmel AT25DF021, 256 KB: skipped.

This makes logs more readable and manageable. If someone really
desperately wants all the bus debugging stuff, he/she can switch to SPEW
mode instead of VERBOSE mode.

Corresponding to flashrom svn r970.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-03-22 23:43:51 +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
Carl-Daniel Hailfinger
e8e369fcc3 Write granularity is chip specific
The following write granularities exist according to my datasheet
survey: - 1 bit. Each bit can be cleared individually. - 1 byte. A byte
can be written once. Further writes to an already written byte cause
the contents to be either undefined or to stay unchanged. - 128 bytes.
If less than 128 bytes are written, the rest will be erased. Each write
to a 128-byte region will trigger an automatic erase before anything is
written. Very uncommon behaviour. - 256 bytes. If less than 256 bytes
are written, the contents of the unwritten bytes are undefined.

Note that chips with default 256-byte writes, which keep the original
contents for unwritten bytes, have a granularity of 1 byte.

Handle 1-bit, 1-byte and 256-byte write granularity.

Corresponding to flashrom svn r927.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: David Hendricks <dhendrix@google.com>
2010-03-08 00:42:32 +00:00
Uwe Hermann
ddd5c9e147 Add initial (non-working) code for Highpoint ATA/RAID controllers
It's disabled by default. The current status is detailed at:
http://www.flashrom.org/pipermail/flashrom/2010-January/001828.html

Corresponding to flashrom svn r908.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-02-21 21:17:00 +00:00
Sean Nelson
6e0b912f46 Here's a very quick patch to fix the missing unlock code
Fixes missing unlock for certain chips:
 * unlock_49lf00x
    * Pm49fl002
    * Pm49fl004

 * unlock_49flxxxc
    * SST49LF160C

 * unlock_winbond_fwhub
    * W39V080FA
    * W39V080FA (dual mode)

Fixes missing printlock for certain chip:
 * printlock_w39v040c
    * W39V040C

Corresponding to flashrom svn r907.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-02-19 00:52:10 +00:00
Carl-Daniel Hailfinger
cc389fc6b1 Allow the registration of functions to be called at programmer shutdown
Some programmers want to run certain functions during programmer
shutdown, but the function choice depends on the code path taken
during programmer init. Rather than rebuilding the whole init logic in
the shutdown function, it is now possible to register functions for
execution on programmer shutdown. The behaviour is similar to atexit(),
but the registered functions will be run on programmer shutdown instead
of on exit and the functions will be called with a void * argument
that is specified on registration. Registered functions must have
the prototype void function(void *); and will be executed in reverse
registration order directly before calling the programmer-specific
shutdown() function. It is recommended to have shutdown() only disable
programmer/hardware access and leave all code path sensitive shutdown to
functions registered with register_shutdown().

The most prominent use case is resetting the EC after flashing on
laptops.

Note: There are quite a few code paths in flashrom which proceed to
terminate flashrom without any programmer shutdown. Those code paths
will not get the benefit of register_shutdown() and they should be
changed wherever possible.

Corresponding to flashrom svn r904.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-02-14 01:20:28 +00:00
Carl-Daniel Hailfinger
48f1d73b5f At long last, the day has come, and we can bury full-chip erase once and for all
Back in November 2008(!) I proposed the first version of the flexible
sector-based erase structure, and now we can finally rip out the old
full-chip erase code without ill effects. Rejoice and party!

Thanks to everyone who made this possible, especially to Sean Nelson who
converted the majority of flash chips to sector erase.

Corresponding to flashrom svn r895.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-02-11 23:03:53 +00:00
Patrick Georgi
0bf842d0ca Open binary files in binary mode
No change on UNIX (or Mac OS, according to its documentation), but fixes
operation on Windows.

Corresponding to flashrom svn r882.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2010-01-25 22:55:33 +00:00
Carl-Daniel Hailfinger
d38fac8c26 Dediprog SF100 support
Reverse engineered from USB logs. I never touched that programmer nor
did I ever see the associated software.
Disabled by default until it is complete. The driver needs to be hooked
up to the SPI core before it will do anything besides init and
diagnostics.

I successfully reverse engineered all commands, but some are still
somewhat magic.
Logs from "flashrom -p dediprog -V" are appreciated.

Probe and read should work, erase/write is expected to explode.
The programmer will set voltage to 0 on exit.

Thanks a lot to Stefan Reinauer and Patrick Georgi for providing USB
logs and for testing the result.

Corresponding to flashrom svn r870.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2010-01-19 11:15:48 +00:00
Carl-Daniel Hailfinger
415afcffc1 Add eraseblock functions to self-check
It doesn't make sense to have different layouts for the same function
on one chip. Keep going if an error is found, we want all errors to be
reported in one fell swoop.

Corresponding to flashrom svn r869.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-01-19 06:42:46 +00:00
Carl-Daniel Hailfinger
293adf0242 Do sanity checks of block erasers at startup and continue check on errors
Flashrom performs a self-check on every startup before it even starts to
initialize any programmer.

That way, compiler errors and code errors will be caught before they can
do any harm. This patch adds an eraseblock structure self-check. It also
modifies the self-check code to consistently run all checks even if one
check failed.

Corresponding to flashrom svn r864.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-01-18 08:14:43 +00:00
Carl-Daniel Hailfinger
1a1415cc67 Refine selection of the default programmer
If neither internal (old default) nor dummy (safe default) programmer
are selected, we must pick a sensible default programmer.

Since there is no reason to prefer a particular external programmer,
we abort compilation if more than one of them is selected. If only one
is selected, it is clear that the user wants that one to become the
default. This fixes single-programmer compilation.

Corresponding to flashrom svn r858.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-01-10 13:28:48 +00:00
Carl-Daniel Hailfinger
a84835a7ea Move the CLI related functions main() and cli_usage() to cli_classic.c
And rename them accordingly. For now, main() just calls cli_classic(),
but alternative frontends can be switched in main().
Annotate remaining help texts with CLI dependency inside flashrom.c with
a FIXME comment.

Now people can go and create different frontends and be happy. Please
note that any other frontend will have to sort of duplicate the probing
code in cli_classic.c. Refactoring that part of the code is possible,
but not easy because we still want to print instructive help messages
for users.

Corresponding to flashrom svn r833.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-01-07 03:24:05 +00:00
Carl-Daniel Hailfinger
552420b0d6 Factor out CLI code by moving generic stuff out of main()
Add a generic programmer list output function to be used by alternative
frontends. The interface between main() and doit is a hack and should
get a clean design, but for now it serves the purpose of shortening
main() by 120 lines. The rest of main() needs to be refactored a bit
more before moving main() away.

Corresponding to flashrom svn r821.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2009-12-24 02:15:55 +00:00
Carl-Daniel Hailfinger
9d48916de6 Fix eraseblock walking and add a few more checks to make sure such bugs get caught in the future
I found this bug during a code review. A consistency check for
eraseblock definitions has been merged as well.

Corresponding to flashrom svn r800.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2009-12-14 04:04:18 +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
d0250a3afd Clarify a comment about verification routine usage
Corresponding to flashrom svn r781.

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>
2009-11-25 17:05:52 +00:00
Carl-Daniel Hailfinger
d5b28fae1d Add the ability to set Bus Pirate SPI speed via the command line
Example usage:
flashrom -p buspiratespi:spispeed=2.6MHz,dev=/dev/foo
flashrom -p buspiratespi:dev=/dev/foo,spispeed=2.6M

Refactor programmer option parsing (this allows cleanups in other
programmers as well).

Increase SPI read size from 8 to 12 bytes (current single-transaction
limit of the Bus Pirate raw SPI protocol).

Add Bus Pirate to the list of programmers supporting 4 byte RDID.

Add Bus Pirate syntax to the man page.

Tested-by: Sean Nelson <audiohacked@gmail.com>

Corresponding to flashrom svn r776.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2009-11-24 18:27:10 +00:00
Carl-Daniel Hailfinger
5cca01f394 Cleanly validate ICH SPI preopcodes
The code should work on Linux/*BSD/MacOSX and relies on the serial code
implementation in serial.c. Support for additional platforms (Windows)
will have to be added to serial.c for this to work. For tests without a
Bus Pirate (or with non-functional serial code) it is possible to
#define FAKE_COMMUNICATION in buspirate_spi.c.
Thanks to Sean Nelson for the SPI mode settings code. I tweaked it a bit
to make configuration from a commandline easier should anybody want that
feature.

Tested-by: Sean Nelson <audiohacked@gmail.com>

Corresponding to flashrom svn r772.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2009-11-24 00:20:03 +00:00
Carl-Daniel Hailfinger
eaac68bf8b Add the ability to generate test patterns for write testing
This will be useful once we create a --test function for flashrom.

The test patterns make it easy to find skipped and duplicated bytes, are
human readable, and the first 8 of them have block numbers to detect
aliasing or wraparounds. Current size limit for aliasing detection is
16 MByte, but since neither LPC nor FWH nor SPI chips exist with bigger
sizes, this is reasonably safe.

Detailed documentation is available as source code comments above the
new function generate_testpattern().

Corresponding to flashrom svn r770.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Maciej Pijanka <maciej.pijanka@gmail.com>
2009-11-23 12:55:31 +00:00
Carl-Daniel Hailfinger
f52920581d Refactor main loop in preparation of libflashrom
To prepare for libflashrom I wanted to make the main loop more readable and more correct and factor out stuff which can be useful in libflashrom.

- Factor out printing of supported devices to print.c.
- Adjust name of wiki printing function to fit the pattern.
- Abort if the user specified --verify and --noverify at the same time.
- Check for extra parameters which don't fit commandline syntax.

Corresponding to flashrom svn r766.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-11-17 09:57:34 +00:00
Carl-Daniel Hailfinger
115d390f1f Add infrastructure to check the maximum supported flash size of chipsets and mainboards
The rationale is to warn users when they, for example, try to flash
a 512KB parallel flash chip but their chipset only supports 256KB,
or they try to flash 512KB and the chipset _does_ theoretically
support 512KB but their special board doesn't wire all address lines
and thus supports only 256 KB ROM chips at maximum.

This has cost Uwe hours of debugging on some board already, until he
figured out what was going on. We should try warn our users where
possible about this.

The chipset and the chip may have more than one bus in common (e.g.
SB600 and Pm49* can both speak LPC+FWH) and on SB600/SB7x0/SB8x0 there
are different limits for LPC and FWH. The only way to tell the user
about the exact circumstances is to spew error messages per bus.

The code will issue a warning during probe (which does fail for some
chips if the size is too big) and abort before the first real
read/write/erase action. If no action is specified, the warning is
printed anyway.
That way, a user can find out why probe might not have worked, and will
be stopped before he/she gets incorrect results.

Add a bitcount function to the infrastructure.

Corresponding to flashrom svn r755.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-10-31 01:53:09 +00:00
Uwe Hermann
c67d03701b Cosmetics and small coding style fixes
Also, introduce BITMODE_BITBANG_SPI to eliminate a magic value.

Corresponding to flashrom svn r742.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-10-01 18:40:02 +00:00
Carl-Daniel Hailfinger
3a4781e76c Make bitbang_spi naming consistent
Corresponding to flashrom svn r741.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-10-01 14:51:25 +00:00
Uwe Hermann
2bc98f6c91 Add initial support for flashing some NVIDIA graphics cards
The new option is '-p gfxnvidia', rest of the interface is as usual.

I tested a successful identify and read on a "RIVA TNT2 Model 64/Model 64 Pro"
card for now, erase and write did NOT work properly so far!

Please do not attempt to write/erase cards yet, unless you can recover!

In addition to the NVIDIA handling code it was required to call
programmer_shutdown() in a lot more places, otherwise the graphics card
will be disabled in the init function, but never enabled again as the
shutdown function is not called.
The shutdown handling may be changed to use atexit() later.

Corresponding to flashrom svn r737.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Luc Verhaegen <libv@skynet.be>
2009-09-30 18:29:55 +00:00
Carl-Daniel Hailfinger
547872b4ea This is the bitbanging SPI driver infrastructure
If you want support for a particular piece of hardware, just fill in
a few functions in spi_bitbang_master_table. That's it.
On top of this, the RayeR SPI flasher should be supportable in ~20 LOC.

Tested, trace looks OK.

Corresponding to flashrom svn r736.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-09-28 13:15:16 +00:00
Uwe Hermann
707f1ebec3 Fix copy-paste errors by s/CONFIG_PRINT_WIKI/PRINT_WIKI_SUPPORT/
Trivial, and build-tested.

Corresponding to flashrom svn r726.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-09-18 13:38:14 +00:00
Carl-Daniel Hailfinger
9c8476b706 Compile out wiki output on request and move wiki stuff into a separate file
This is useful for libflashrom (you don't need wiki output in a coreboot
payload).

Wiki output is now disabled by default. If you want to enable it, run
make CONFIG_PRINT_WIKI=yes

Corresponding to flashrom svn r725.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-09-16 12:19:03 +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
f38431a5b2 Store block sizes and corresponding erase functions in struct flashchip
I decided to fill in the info for a
few chips to illustrate how this works both for uniform and non-uniform
sector sizes.

struct eraseblock{
int size; /* Eraseblock size */
int count; /* Number of contiguous blocks with that size */
};

struct eraseblock doesn't correspond with a single erase block, but with
a group of contiguous erase blocks having the same size.
Given a (top boot block) flash chip with the following weird, but
real-life structure:

top
16384
8192
8192
32768
65536
65536
65536
65536
65536
65536
65536
bottom

we get the following encoding:
{65536,7},{32768,1},{8192,2},{16384,1}

Although the number of blocks is bigger than 4, the number of block
groups is only 4. If you ever add some flash chips with more than 4
contiguous block groups, the definition will not fit into the 4-member
array anymore and gcc will recognize that and error out. No undetected
overflow possible. In that case, you simply increase array size a bit.
For modern flash chips with uniform erase block size, you only need one
array member anyway.

Of course data types will need to be changed if you ever get flash chips
with more than 2^30 erase blocks, but even with the lowest known erase
granularity of 256 bytes, these flash chips will have to have a size of
a quarter Terabyte. I'm pretty confident we won't see such big EEPROMs
in the near future (or at least not attached in a way that makes
flashrom usable). For SPI chips, we even have a guaranteed safety factor
of 4096 over the maximum SPI chip size (which is 2^24). And if such a
big flash chip has uniform erase block size, you could even split it
among the 4 array members. If you change int count to unsigned int
count, the storable size doubles. So with a split and a slight change of
data type, the maximum ROM chip size is 2 Terabytes.

Since many chips have multiple block erase functions where the
eraseblock layout depends on the block erase function, this patch
couples the block erase functions with their eraseblock layouts.
struct block_eraser {
  struct eraseblock{
    unsigned int size; /* Eraseblock size */
    unsigned int count; /* Number of contiguous blocks with that size */
  } eraseblocks[NUM_ERASEREGIONS];
  int (*block_erase) (struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen);
} block_erasers[NUM_ERASEFUNCTIONS];

Corresponding to flashrom svn r719.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-09-05 02:30:58 +00:00
TURBO J
b0912c0adb Add support for parallel flash on Dr. Kaiser PC-Waechter PCI devices
The vendor sold different designs under that name, the patch works with
the one that has an Actel FPGA as PCI-to-Flash bridge.

The Flash chip is a "Macronix MX29F001B" (128 KB, parallel) soldered
directly to the PCB.
Flash operations (PROBE, READ, ERASE, WRITE) work as expected.

Corresponding to flashrom svn r712.

Signed-off-by: TURBO J <turboj@gmx.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-09-02 23:00:46 +00:00
Carl-Daniel Hailfinger
f5fb51c4ba Adept layout handling to new programmer infrastructure and fix off-by-one error
Flashrom has the ability to use layout files with romentries, but
this feature was not adapted to the programmer infrastructure and had
undefined behaviour for flasher!=internal. The romentry handling had an
off-by-one error which caused all copies to end up one byte short. Fix
these issues.

Corresponding to flashrom svn r694.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-19 15:19:18 +00:00
Carl-Daniel Hailfinger
664e7ad995 Change programmer options separator from = to :
Current programmer parameter syntax is -p programmer=parameter
Unfortunately, many parameters are of the form variable=val, so we get
commandlines like this.

flashrom -p it87spi=port=0x820 and this looks horrible.

Using : instead of = would make such parameters look better: flashrom -p
it87spi:port=0x820

As a side benefit, this patch mentions the programmer name in the error
message if it is unknown.

Corresponding to flashrom svn r693.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-19 15:03:28 +00:00
Carl-Daniel Hailfinger
8ab49e72af Disallow erase/write for known bad chips so people won't try without a clear understanding
Allow override with --force.

If write/erase failed, warn the user to get help and not shutdown/reboot
the computer.

Warn that the result of a forced read is often garbage. Too many users
believed that a forced read meant that everything was fine.

Wait 1 second between erase and verify. This fixes a few reports where
verify directly after erase had unpleasant side effects like corrupting
flash or at least getting incorrect verify results.

Corresponding to flashrom svn r692.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-19 13:55:34 +00:00
Carl-Daniel Hailfinger
3426ef6ab8 If FT2232H SPI is not enabled, it should be compiled out completely
We can't remove ft2232_spi.o from unconditional OBJS yet due to our
makefile structure (make features), but this patch adds #ifdefs around
all FT2232H code, so the net effect is the same.

Corresponding to flashrom svn r691.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-19 13:27:58 +00:00
Carl-Daniel Hailfinger
204b076df7 Generate the usage message by walking the list of available programmers
This makes sure compiled out programmers are not listed.

Tested, usage output is identical to the hardcoded variant.

Corresponding to flashrom svn r684.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-13 11:38:44 +00:00
Carl-Daniel Hailfinger
6be741114d Allow to compile out serprog completely
If CONFIG_SERPROG is not set, no stubs and no data of serprog will
remain.

Side benefit: This kills a few dozen lines of code.

r678, r679 and r680 made this possible. Once "Only list available
programers in usage()" is committed, even the usage message will be
adjusted automatically.

Corresponding to flashrom svn r681.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-12 16:17:41 +00:00
Carl-Daniel Hailfinger
37fc469ca2 Add a new field for the names of programmers and use it to match against user input
Use programmer.name to match the --programmer parameter instead of
hardcoding the name of every single programmer in main().

-p dummyfoo won't be mistaken for -p dummy anymore.

Corresponding to flashrom svn r680.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-12 14:34:35 +00:00
Carl-Daniel Hailfinger
ef58a9ce3f Use a common parameter variable for all programmers
This allows us to reduce #ifdef clauses a lot if we compile out some
programmers completely.

Corresponding to flashrom svn r679.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-12 13:32:56 +00:00
Carl-Daniel Hailfinger
415e513d90 Add fallback functions for programmer shutdown and memory mapping and fix FT2232 and IT87
FT2232 and IT87 programmers used functions of the dummy programmer
instead of fallback functions.

The dummy programmer is a "real" programmer with possible side effects
and its functions should not be abused by other programmers. Make
FT2232 and IT87 use official fallback functions instead. Create
fallback_shutdown(). Create fallback_chip_writeb(). Convert the
programmer #defines to an enum.

Corresponding to flashrom svn r678.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-08-12 11:39:29 +00:00
Stefan Reinauer
22ea8cd503 The project's new home is flashrom.org now
Change all occurences in the source code and documentation accordingly.

Corresponding to flashrom svn r669.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-07-30 13:32:26 +00:00
Carl-Daniel Hailfinger
0a3e5aeaf6 If writing failed, verifying is pointless
Abort instead.

Corresponding to flashrom svn r666.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Oliver Niesner <oli@rhce.servebbs.net>
2009-07-24 12:18:54 +00:00
Carl-Daniel Hailfinger
49b9cab392 Continue erase/write verification after the first error
The first error is printed in detail and all subsequent errors are
listed in statistics. This allows users to check if there was just one
error or if the failure was widespread.

Corresponding to flashrom svn r663.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-07-23 01:42:56 +00:00
Carl-Daniel Hailfinger
a80cfbc3d7 Eliminate version string duplication
Corresponding to flashrom svn r659.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2009-07-22 20:13:00 +00:00
Carl-Daniel Hailfinger
bb297f733d Add an optional flash port parameter for IT87* SPI controllers in standalone programmer mode
If the parameter is set, the IT87* SPI driver will set the I/O base
port of the IT87* SPI controller interface to the port specified in the
parameter. Usage: flashrom -p it87spi=port=0x820

Corresponding to flashrom svn r646.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-07-11 18:05:42 +00:00
Carl-Daniel Hailfinger
feea272228 ft2232_spi: Allow runtime selection of FT2232H vs. FT4232H and interface A vs
B.

Corresponding to flashrom svn r638.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: Jakob Bornecrantz <wallbraker@gmail.com>
Acked-by: Jakob Bornecrantz <wallbraker@gmail.com>
2009-07-01 00:02:23 +00:00
Uwe Hermann
1432a60c85 Random minor flashrom fixes
- Properly escape '-' chars in manpage.
 
 - Fix typo in chipset_enable.c.

 - Drop useless 'return' in chip_readn().

 - Random other whitespace or cosmetic fixes.

Corresponding to flashrom svn r636.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-06-28 23:26:37 +00:00
Uwe Hermann
9899cadcd8 Print the bus type(s) of both chipset and chip in the flashrom output
Corresponding to flashrom svn r635.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2009-06-28 21:47:57 +00:00
Carl-Daniel Hailfinger
34cc6cc070 Handle programmer init errors and abort
If the programmer didn't initialize correctly, it is pointless to
continue.

Fix standalone IT87* SPI init to set flashbus to NONE if no IT87* SPI
communication is possible. Print the I/O port detected by the IT87* SPI
code.

Corresponding to flashrom svn r633.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Ward Vandewege <ward@gnu.org>
2009-06-28 10:57:58 +00:00
Uwe Hermann
ea07f6245c Always verify write operations automatically
Should this be undesireable because of speed reasons, --noverify can be
used to suppress an auto-verify.

Corresponding to flashrom svn r631.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Harald Gutmann <harald.gutmann@gmx.net>
2009-06-24 17:31:08 +00:00