print*.c: Refine the do not count nor print generic flash chip entries conditions.

Previously only the generic "unknown XXXX SPI chips" were ignored (because their
name started with "unknown".
This patch adds also all chips whose vendor starts with "Unknown" (none so far)
and "Programmer" (currently used by the opaque flash chip framework) .
A patch will add the SFDP chip template with an "Unknown" vendor field later.

Rationale: these entries do not contain any useful information when shown in -L
or wiki output. It would be better to add them to a general feature section or similar.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

git-svn-id: svn://coreboot.org/flashrom/trunk@1488 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Add support for RDC R6030 chipset

Tested on Bifferboard.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>

git-svn-id: svn://coreboot.org/flashrom/trunk@1489 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
SPI command black-/ignorelisting for the flash chip emulator in the dummy programmer

Usage:
flashrom -p dummy:spi_blacklist=commandlist
flashrom -p dummy:spi_ignorelist=commandlist

If commandlist is 0302, flashrom will refuse (blacklist) or ignore
(ignorelist) command 0x03 (READ) and command 0x02 (WRITE). The
commandlist can be up to 512 bytes (256 commands) long.
Specifying flash chip emulation is a good idea to get useful results.

Very useful for testing corner cases if you don't own a locked down
Intel chipset and want to simulate such a thing.

Example usage:
dd if=/dev/zeros bs=1024k count=4 of=dummy_simulator.rom
dd if=/dev/urandom bs=1024k count=4 of=randomimage.rom
flashrom -p dummy:emulate=SST25VF032B,image=dummy_simulator.rom,\
spi_blacklist=20,spi_ignorelist=52 -w randomimage.rom -V

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: David Hendricks <dhendrix@google.com>


git-svn-id: svn://coreboot.org/flashrom/trunk@1490 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Board enable for TriGem Anaheim-3

lspci: http://paste.flashrom.org/view.php?id=1069
flashrom -V: http://paste.flashrom.org/view.php?id=1072
flashrom -w: http://paste.flashrom.org/view.php?id=1073

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
(ack via IRC Feb 11, 23:14 GMT)

git-svn-id: svn://coreboot.org/flashrom/trunk@1491 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Support compilation for the ARM architecture (little-endian only).

Note: The internal programmer will abort during processor check. This is
intentional.
The other hardware drivers (except those using port I/O) should work.

Signed-off-by: David Hendricks <dhendrix@google.com>
Acked-by: David Hendricks <dhendrix@google.com>
Tested-by: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/flashrom/trunk@1492 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Warn of one-time programmable (OTP) memory

Some flash chips contain OTP memory that we cannot read or write (yet). This
prohibits us from cloning them, hence warn the user if we detect it. Not all
variations of the tagged chips contain OTP memory. They are often only
enabled on request or have there own ordering numbers. There is usually no
way to distinguish them. Because this is a supposedly seldomly used feature
the warning is shown in with dbg verbosity.

The manpage is extended to describe the backgrounds a bit.

This patch is based on the idea and code of Daniel Lenski.
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

git-svn-id: svn://coreboot.org/flashrom/trunk@1493 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
ichspi.c: warn user and disable writes when a protected address range is detected.

This includes not only the notorious read-only flash descriptors and locked ME
regions, but also the more rarely used PRs (Protected Ranges).
The user can enforce write support by specifying ich_spi_force=yes in the
programmer options, but we don't tell him the exact syntax interactively. He
has to read it up in the man page.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

git-svn-id: svn://coreboot.org/flashrom/trunk@1494 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Workaround missing %hhx support in MinGW sscanf

MinGW uses standard Windows C libraries and those apparently don't
support %hhx for sscanf into a uint8_t. SCNx8 isn't available either.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer@gmail.com>


git-svn-id: svn://coreboot.org/flashrom/trunk@1495 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Reenable forced read

Forced read functionality was disabled when programmer registration was
merged in r1475.

We now support registering more than one controller at once for each bus
type. This can happen e.g. if one SPI controller has an attached flash
chip and one controller doesn't. In such a case we rely on the probe
mechanism to find exactly one chip, and the probe mechanism will
remember which controller/bus the flash chip is attached to. A forced
read does not have the luxury of knowing which compatible controller to
use, so this case is handled by always picking the first one. That may
or may not be the correct one, but there is no way (yet) to specify
which controller a flash chip is attached to.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>


git-svn-id: svn://coreboot.org/flashrom/trunk@1496 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Manpage improvements.

The sections describing the various options of the internal and dummy
programmers have grown out of proportions. This patch adds some headlines
to devide the unrelated topics a bit (with .TP commands). The previous indented
paragraphs for the various programmers were transformed to subsections (.SS).

Also, rephrase the documention related to laptops completely to make it
less redundant and more informative.
Document the laptop=this_is_not_a_laptop internal programmer parameter

Change the contact info in the bugs section by removing the trac
reference and adding IRC (and the pastebin) instead.

Remove some superfluous white space and a .RE (restore indentation) command.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

git-svn-id: svn://coreboot.org/flashrom/trunk@1497 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Document and enable the linux_spi driver

The linux_spi driver is now enabled by default on Linux.
A man page entry and a line in --list-supported output have been added.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>


git-svn-id: svn://coreboot.org/flashrom/trunk@1498 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Add a bunch of new/tested stuff and various small changes 10

Tested mainboards:
OK:
 - ABIT A-S78H
   http://www.flashrom.org/pipermail/flashrom/2012-January/008603.html
 - ASRock AM2NF6G-VSTA
   http://www.flashrom.org/pipermail/flashrom/2012-January/008534.html
 - ASUS KFSN4-DRE/SAS
   reported by ted on IRC
 - ASUS M2A-VM (HDMI variant)
   http://www.flashrom.org/pipermail/flashrom/2012-January/008509.html
 - ASUS M4N78 PRO
   http://www.flashrom.org/pipermail/flashrom/2012-January/008598.html
 - ASUS P5K-V
   http://www.flashrom.org/pipermail/flashrom/2012-February/008737.html
 - ASUS P5KPL-CM
   http://www.flashrom.org/pipermail/flashrom/2012-January/008522.html
 - ASUS P5N7A-VM
   http://www.flashrom.org/pipermail/flashrom/2012-January/008508.html
 - ASUS P5QPL-AM
   http://www.flashrom.org/pipermail/flashrom/2012-January/008557.html
 - ECS GF7100PVT-M3
   http://www.flashrom.org/pipermail/flashrom/2011-December/008412.html
 - ECS K7SEM
   http://www.flashrom.org/pipermail/flashrom/2011-December/008362.html
 - ECS P4M800PRO-M V2.0
   http://www.flashrom.org/pipermail/flashrom/2012-January/008478.html
 - Gigabyte 880GMA-USB3
   http://www.flashrom.org/pipermail/flashrom/2012-February/008715.html
 - Gigabyte GA-EP31-DS3L
   http://www.flashrom.org/pipermail/flashrom/2012-January/008601.html
 - Gigabyte GA-X58A-UDR3
   http://www.flashrom.org/pipermail/flashrom/2012-January/008572.html
 - Gigabyte GA-Z68XP-UD3
   http://paste.flashrom.org/view.php?id=1058
 - HP ProLiant N40L
   http://www.flashrom.org/pipermail/flashrom/2012-February/008650.html
 - MSI MS-7309 (K9N6PGM2-V2)
   http://www.flashrom.org/pipermail/flashrom/2011-December/008441.html
 - MSI MS-7548 (Aspen-GL8E used in HP Pavilion a6750f)
   http://www.flashrom.org/pipermail/flashrom/2012-February/008666.html
 - MSI MS-7676 (H67MA-ED55(B3))
   http://www.flashrom.org/pipermail/flashrom/2012-January/008547.html
 - PC Engines Alix.6f2
   Reported by Philip Prindeville on IRC
 - Shuttle AV18E2
   http://www.flashrom.org/pipermail/flashrom/2011-December/008459.html
 - Supermicro X8DTE-F
   http://www.flashrom.org/pipermail/flashrom/2011-November/008304.html
 - Supermicro X8DTT-HIBQF
   http://www.flashrom.org/pipermail/flashrom/2012-January/008520.html
NOT OK:
 - ASUS P8H61-M LE/USB3
   http://www.flashrom.org/pipermail/flashrom/2012-January/008491.html
 - ASUS P8H67-M PRO
   http://www.flashrom.org/pipermail/flashrom/2011-December/008321.html
 - ASUS P8Z68-V PRO
   http://www.flashrom.org/pipermail/flashrom/2012-January/008469.html
 - Clevo P150HM (laptop)
   http://www.flashrom.org/pipermail/flashrom/2012-February/008717.html
 - Intel D425KT
   http://www.flashrom.org/pipermail/flashrom/2012-January/008600.html
 - Supermicro X9SCA-F
   http://www.flashrom.org/pipermail/flashrom/2011-December/008313.html

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

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

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

the addition of the ASRock AM2NF6G-VSTA to print.c is
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
everything else is
Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>

git-svn-id: svn://coreboot.org/flashrom/trunk@1499 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Add support for SFDP (JESD216).

Similar to modules using the opaque programmer framework (e.g. ICH Hardware
Sequencing) this uses a template struct flashchip element in flashchips.c with
a special probe function that fills the obtained values into that struct.

This allows yet unknown SPI chips to be supported (read, erase, write) almost
as if it was already added to flashchips.c.

Documentation used:
http://www.jedec.org/standards-documents/docs/jesd216 (2011-04)
W25Q32BV data sheet Revision F (2011-04-01)
EN25QH16 data sheet Revision F (2011-06-01)
MX25L6436E data sheet Revision 1.8 (2011-12-26)

Tested-by: David Hendricks <dhendrix@google.com>
on W25Q64CV + dediprog
Tested-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
on a 2010 MX25L6436E with preliminary (i.e. incorrect) SFDP implementation + serprog

Thanks also to Michael Karcher for his comments and preliminary review!

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

git-svn-id: svn://coreboot.org/flashrom/trunk@1500 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Add board enable for ASUS OPLX-M.

The vendor enable does some other funky stuff with MTRRs/MSRs, SMIs,
cache and legacy ISA address forward twiddling. I would only use
this patch to read and verify the existing contents, just to be safe.

The PCI IDs of the onboard devices do contain no subsystem IDs at all.

Probing and reading was
Tested-by: Ville Skyttä <ville.skytta@iki.fi>
See http://www.flashrom.org/pipermail/flashrom/2010-October/005256.html

Signed-off-by: Joshua Roys <roysjosh@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>

git-svn-id: svn://coreboot.org/flashrom/trunk@1501 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Add a bunch of new/tested stuff and various small changes 11

Tested Mainboards:
NOT OK:
 - HP dc7800
   http://paste.flashrom.org/view.php?id=1084

 - add "Low Profile Desktop" to our dmi whitelist
 - fix print_wiki (broken since r1488)

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>

git-svn-id: svn://coreboot.org/flashrom/trunk@1502 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Increase flashrom release number to 0.9.5

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>


git-svn-id: svn://coreboot.org/flashrom/trunk@1503 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Fix SFDP probing.

sfdp_add_uniform_eraser checks for existing erasers. Due to a bug it
looked for eraser slots that have no erase functions set instead of
those that have one set.

Postpone adding an erase function for the special 4k block erase
opcode until we know the flash chip size and add an additional check
to sfdp_add_uniform_eraser.

Fix the output of the parameter table contents.

This patch fixes the index used to retrieve the eraser types, which
was off one double word.

Refine some messages and add a few further debugging prints.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

git-svn-id: svn://coreboot.org/flashrom/trunk@1505 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
SFDP: Fetch parameter table in a more portable way

SFDP parameter table reads expect a dummy byte between written data
(opcode+address) and read data on the SPI bus. Read that dummy byte
instead of writing it to be compatible with all programmer drivers.
Reduce SFDP parameter table read chunk size from 8 to 2 to handle
programmers with small readcount limits.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>


git-svn-id: svn://coreboot.org/flashrom/trunk@1506 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Support Debian/kFreeBSD

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: Robert Millan <rmh@debian.org>
Tested-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/flashrom/trunk@1507 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Increase flashrom release number to 0.9.5.1

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>


git-svn-id: svn://coreboot.org/flashrom/trunk@1508 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1