summaryrefslogtreecommitdiffstats
path: root/flashrom.c
Commit message (Collapse)AuthorAgeFilesLines
* Clarify a comment about verification routine usageCarl-Daniel Hailfinger2009-11-251-1/+2
| | | | | | | 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>
* Add the ability to set Bus Pirate SPI speed via the command lineCarl-Daniel Hailfinger2009-11-241-0/+54
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Cleanly validate ICH SPI preopcodesCarl-Daniel Hailfinger2009-11-241-0/+19
| | | | | | | | | | | | | | | | | | | 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>
* Add the ability to generate test patterns for write testingCarl-Daniel Hailfinger2009-11-231-0/+136
| | | | | | | | | | | | | | | | | | 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>
* Refactor main loop in preparation of libflashromCarl-Daniel Hailfinger2009-11-171-19/+19
| | | | | | | | | | | | | | 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>
* Add infrastructure to check the maximum supported flash size of chipsets and ↵Carl-Daniel Hailfinger2009-10-311-3/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Cosmetics and small coding style fixesUwe Hermann2009-10-011-4/+4
| | | | | | | | | 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>
* Make bitbang_spi naming consistentCarl-Daniel Hailfinger2009-10-011-1/+1
| | | | | | | 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>
* Add initial support for flashing some NVIDIA graphics cardsUwe Hermann2009-09-301-1/+39
| | | | | | | | | | | | | | | | | | | | 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>
* This is the bitbanging SPI driver infrastructureCarl-Daniel Hailfinger2009-09-281-0/+6
| | | | | | | | | | | | | 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>
* Fix copy-paste errors by s/CONFIG_PRINT_WIKI/PRINT_WIKI_SUPPORT/Uwe Hermann2009-09-181-6/+6
| | | | | | | | | 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>
* Compile out wiki output on request and move wiki stuff into a separate fileCarl-Daniel Hailfinger2009-09-161-2/+18
| | | | | | | | | | | | | 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>
* Allow to exclude each of the external programmer drivers from being compiled inCarl-Daniel Hailfinger2009-09-161-6/+20
| | | | | | | | | | | | | | | 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>
* Store block sizes and corresponding erase functions in struct flashchipCarl-Daniel Hailfinger2009-09-051-25/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add support for parallel flash on Dr. Kaiser PC-Waechter PCI devicesTURBO J2009-09-021-0/+18
| | | | | | | | | | | | | | 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>
* Adept layout handling to new programmer infrastructure and fix off-by-one errorCarl-Daniel Hailfinger2009-08-191-2/+1
| | | | | | | | | | | | | 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>
* Change programmer options separator from = to :Carl-Daniel Hailfinger2009-08-191-2/+2
| | | | | | | | | | | | | | | | | | | 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>
* Disallow erase/write for known bad chips so people won't try without a clear ↵Carl-Daniel Hailfinger2009-08-191-2/+53
| | | | | | | | | | | | | | | | | | | | | 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>
* If FT2232H SPI is not enabled, it should be compiled out completelyCarl-Daniel Hailfinger2009-08-191-0/+6
| | | | | | | | | | | 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>
* Generate the usage message by walking the list of available programmersCarl-Daniel Hailfinger2009-08-131-3/+32
| | | | | | | | | | | 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>
* Allow to compile out serprog completelyCarl-Daniel Hailfinger2009-08-121-0/+2
| | | | | | | | | | | | | | | | 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>
* Add a new field for the names of programmers and use it to match against ↵Carl-Daniel Hailfinger2009-08-121-30/+38
| | | | | | | | | | | | | | 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>
* Use a common parameter variable for all programmersCarl-Daniel Hailfinger2009-08-121-6/+9
| | | | | | | | | | 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>
* Add fallback functions for programmer shutdown and memory mapping and fix ↵Carl-Daniel Hailfinger2009-08-121-9/+10
| | | | | | | | | | | | | | | | | | 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>
* The project's new home is flashrom.org nowStefan Reinauer2009-07-301-1/+1
| | | | | | | | | 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>
* If writing failed, verifying is pointlessCarl-Daniel Hailfinger2009-07-241-3/+8
| | | | | | | | | 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>
* Continue erase/write verification after the first errorCarl-Daniel Hailfinger2009-07-231-6/+13
| | | | | | | | | | | 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>
* Eliminate version string duplicationCarl-Daniel Hailfinger2009-07-221-1/+2
| | | | | | | 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>
* Add an optional flash port parameter for IT87* SPI controllers in standalone ↵Carl-Daniel Hailfinger2009-07-111-0/+2
| | | | | | | | | | | | | 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>
* ft2232_spi: Allow runtime selection of FT2232H vs. FT4232H and interface A vsCarl-Daniel Hailfinger2009-07-011-4/+6
| | | | | | | | | | 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>
* Random minor flashrom fixesUwe Hermann2009-06-281-1/+0
| | | | | | | | | | | | | | | - 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>
* Print the bus type(s) of both chipset and chip in the flashrom outputUwe Hermann2009-06-281-2/+4
| | | | | | | Corresponding to flashrom svn r635. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Handle programmer init errors and abortCarl-Daniel Hailfinger2009-06-281-1/+4
| | | | | | | | | | | | | | 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>
* Always verify write operations automaticallyUwe Hermann2009-06-241-2/+11
| | | | | | | | | | | 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>
* Use correct abstraction for verify_range()Carl-Daniel Hailfinger2009-06-241-34/+10
| | | | | | | | | | | | | | | The new abstraction can handle out-of-band chip communication protocols as well. The old abstraction caused spurious false positives for erase on SPI and spurious false negatives for verify on SPI. Make verify_flash() use verify_range(). Tested by Uwe on SB600. Corresponding to flashrom svn r629. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Remove duplicated [file] from usage helpCarl-Daniel Hailfinger2009-06-241-4/+3
| | | | | | | | | A file is already specified directly in conjunction for -r/-w/-v. Corresponding to flashrom svn r628. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Initial commit of an external serial flasher protocolUrja Rannikko2009-06-231-1/+20
| | | | | | | | | | | | | | Supports RS-232, USB serial converters (untested) and TCP streams. All functionality is stubbed out to allow multiplatform compile testing of the headers we use. The real serial flasher protocol driver will be committed next. Corresponding to flashrom svn r625. Signed-off-by: Urja Rannikko <urjaman@gmail.com> 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>
* Various wiki output changesUwe Hermann2009-06-201-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | - Move board_info_url struct to print.c, doesn't have to be global. - Simplify flashrom.c a bit by moving stuff to print.c. Eliminate two now-useless mini-functions in print.c. - Add a note that the wiki page contents are semi-automatically generated. - Mention date of last wiki page update as well as the flashrom revision that was used to generate the wiki output. - Also generate list of supported laptops in -z output now. - Add some more board URLs. - Add a boards_notes[] table to allow for arbitrary footnotes/comments for each board in the table. All notes will automatically be turned into wiki footnotes with correct numbers and will appear at the end of the respective table. Corresponding to flashrom svn r615. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Kill obsolete exclude range featureCarl-Daniel Hailfinger2009-06-191-45/+6
| | | | | | | | | | | It is ignored by almost every chip and does not work for external flashers. Plus, it gives the user a false sense of security in some corner cases. Corresponding to flashrom svn r608. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Allow to print an auto-generated hardware support list in MediaWiki markupUwe Hermann2009-06-191-8/+25
| | | | | | | | | | | | | | | | | | | Add a --list-supported-wiki / -z option which outputs the currently supported flash chips (and their status, size, and type), chipsets (plus status), mainboards (plus status), and external PCI devices usable as programmer to stdout. This allows for very easy pasting into the http://coreboot.org/flashrom page, so we can keep that page up-to-date without much hassle. The list of boards is mostly new (known good ones which don't need write-enable code, and known-bad ones) and also lists URLs to the vendor's mainboard pages. Corresponding to flashrom svn r607. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Move all printing code to print.cUwe Hermann2009-06-171-121/+0
| | | | | | | | | Drop no longer needed MAX macro, we have a max() function. Corresponding to flashrom svn r601. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* List the size (in KB) and type of supported flash chips in 'flashrom -L'Uwe Hermann2009-06-161-13/+35
| | | | | | | | | Also, list how many chips/chipsets/boards we support in 'flashrom -L'. Corresponding to flashrom svn r599. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* This patch adds support for a new SPI programmer, based on the FT2232H/4232H ↵Paul Fox2009-06-161-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | chip from FTDI FTDI support is autodetected during compilation. Paul writes: There are certainly possible improvements: The code has hard-coded values for which interface of the ftdi chip to use (interface B was chosen because libftdi seems to have trouble with A right now), what clock rate use for the SPI interface (I've been running at 30Mhz, but the patch sets it to 10Mhz), and possibly others. I think this means that per-programmer options might be a good idea at some point. Carl-Daniel writes: There is one additional FIXME comment in the code, but AFAICS that problem is not solvable with current libftdi. Corresponding to flashrom svn r598. Signed-off-by: Paul Fox <pgf@laptop.org> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Support reads of arbitrary rangeCarl-Daniel Hailfinger2009-06-161-5/+6
| | | | | | | | | | | | That means you can tell flashrom to read exactly bytes 12345-56789 (start 12345, length 44445) and it will not fetch a single byte more. Uwe tested this on one LPC, one SPI, and one parallel flash board. Corresponding to flashrom svn r596. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Flashrom only checks for very few chips if the erase workedCarl-Daniel Hailfinger2009-06-151-0/+88
| | | | | | | | | | | | | | | | | | | And even when it checks if the erase worked, the result of that check is often ignored. Convert all erase functions and actually check return codes almost everywhere. Check inside all erase_* routines if erase worked, not outside. erase_sector_jedec and erase_block_jedec have changed prototypes to enable erase checking. Uwe successfully tested LPC on an CK804 box and SPI on some SB600 box. Corresponding to flashrom svn r595. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Urja Rannikko <urjaman@gmail.com> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Split flashchips.h from flash.hCarl-Daniel Hailfinger2009-06-151-0/+1
| | | | | | | | | | | | | | Flash.h not only contains function prototypes and general settings, it also has a huge chunk of chip and vendor IDs in the middle. Split them out into a separate flashchips.h and adjust #include wherever needed. Corresponding to flashrom svn r594. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Urja Rannikko <urjaman@gmail.com> Acked-by: Stefan Reinauer <stepan@coresystems.de>
* Every SPI host controller implemented its own way to read flash chipsCarl-Daniel Hailfinger2009-06-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | This was partly due to a design problem in the abstraction layer. There should be exactly two different functions for reading SPI chips: - memory mapped reads - SPI command reads. Each of them should be contained in a separate function, optionally taking parameters where needed. This patch solves the problems mentioned above, shortens the code and makes the code logic a lot more obvious. Since open-coding the min() function leads to errors, include it in this patch as well. Corresponding to flashrom svn r589. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Ronald G. Minnich <rminnich@gmail.com>
* Flashrom does not honor argument ordering for operationsCarl-Daniel Hailfinger2009-06-121-2/+24
| | | | | | | | | | | | | | Not only does this violate the principle of least surprise, it also caused one bug where -Ewv was specified and the flash ended up being empty. Support only one operation at a time. As a side benefit, this allows us to clean up main() quite a bit. Corresponding to flashrom svn r585. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
* Tell the user about the beginning and end of the write operationPaul Fox2009-06-121-0/+2
| | | | | | | Corresponding to flashrom svn r582. Signed-off-by: Paul Fox <pgf@laptop.org> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
* Sometimes we want to read/write more than 4 bytes of chip content at onceCarl-Daniel Hailfinger2009-06-051-17/+30
| | | | | | | | | | | | | | | | | | | | Add chip_{read,write}n to the external flasher infrastructure which read/write n bytes at once. Fix a few places where the code used memcpy/memcmp although that is strictly impossible with external flashers. Place a FIXME in the layout.c code because usage is not totally clear and needs to be fixed to support external flashers. As a nice side benefit, we get a noticeable speedup for builtin flash reading which is now a memcpy() of the full flash area instead of a series of single-byte reads. Corresponding to flashrom svn r579. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Urja Rannikko <urjaman@gmail.com> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
OpenPOWER on IntegriCloud