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

1947 Commits

Author SHA1 Message Date
Stefan Tauner
2a0feae699 Increase version number to 0.9.9-rc1
Corresponding to flashrom svn r1939.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Urja Rannikko <urjaman@gmail.com>
v0.9.9-rc1
2016-02-21 18:17:14 +00:00
Stefan Tauner
e016826a07 Automatically disable atapromise for libpayload as well
The atapromise module uses the rom_size field of the struct pci_dev found
in pci.h that does not exist in libpayload's implementation and thus does
not compile with libpayload.

Corresponding to flashrom svn r1938.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-21 11:18:24 +00:00
Hatim Kanchwala
e0c7abf219 Add support for GigaDevice GD25VQ41B and GD25Q128C
Corresponding to flashrom svn r1937.

Signed-off-by: Hatim Kanchwala <hatim@hatimak.me>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-21 00:21:11 +00:00
Carl-Daniel Hailfinger
4b2b3151e3 Allow global disable of all drivers requiring libusb* or libpci
This is especially helpful for compile tests with CONFIG_EVERYTHING=yes,
but can also be used without CONFIG_EVERYTHING.

Usage:
make CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no
CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no

Corresponding to flashrom svn r1936.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-20 22:28:16 +00:00
Carl-Daniel Hailfinger
f636ffc4ef Automatically disable atapromise on non-x86
We do not support PCI port I/O on non-x86 (yet).
Atapromise needs PCI port I/O.

Corresponding to flashrom svn r1935.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-20 22:04:39 +00:00
Carl-Daniel Hailfinger
16c0aecebe Do not require PCI code for RayeR SPI driver
CONFIG_RAYER_SPI only needs raw hardware access, but not libpci.
Disable CONFIG_RAYER_SPI on Android because of missing inb/outb.
Introduce NEED_RAW_ACCESS for raw memory access, PCI port I/O
and MSR access.

Corresponding to flashrom svn r1934.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-20 21:43:56 +00:00
Stefan Tauner
74367bf314 dediprog: tremendously improve performance on SF600 by ignoring the spec
The solution was discovered in a collaborative bug hunt with testing done by
David Hendricks. The actual culprit was found by Urja Rannikko by comparing
vanilla flashrom with David's version in chromiumos.

Corresponding to flashrom svn r1933.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Tested-by: David Hendricks <dhendrix@chromium.org>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-20 20:53:46 +00:00
Stefan Tauner
2c57bbee3c Include sys/glibc-syscalls.h instead of inexistent sys/io.h on Android
This won't make raw I/O work magically but at least it would provide iopl()
if some driver requires it and there is no better alternative currently.

Corresponding to flashrom svn r1932.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2016-02-20 20:21:58 +00:00
Stefan Tauner
45207061d8 Makefile: fix overriding of make command line arguments
Command line arguments given when executing make should not stop us
from setting commonly user-configurable variables like CPPFLAGS or
LDFLAGS.
Without this patch 'make CPPFLAGS="-Ifail"' would fail to find
libusb1 headers and abort.
Add override statements where we append mandatory options to
these variables to make (Debian) packagers more happy.

Also, r1920 introduced some explicit calls to pkg-config instead of
$(PKG_CONFIG). This patch corrects that as well.

Corresponding to flashrom svn r1931.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2016-02-19 08:17:24 +00:00
Carl-Daniel Hailfinger
1c2d23a22d Fix chip size limiting in atapromise
The current code is checking model_id to remember if a chip has already
been limited, but if flashchips.c contains two subsequent chips with
different vendor_id but identical model_id the adjustment will not be
done. Switch to checking the chip size instead.

If a chip has multiple whole-chip erase functions, only one will be
modified. Fix that.

Corresponding to flashrom svn r1930.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: Joseph C. Lehner <joseph.c.lehner@gmail.com>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-02-18 23:11:52 +00:00
Nico Huber
d99a2bd049 dediprog: port to libusb1 and use asynchronous bulk transfers for reading
This patch is based on Nico Huber's original version that was rebased
by David Hendricks for Chromium OS in
Change-Id: I84384b9d8ed53911657cf2293733531a6e11fd23

Corresponding to flashrom svn r1929.

Signed-off-by: Nico Huber <nico.huber@secunet.com>
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-18 21:42:49 +00:00
David Hendricks
c05900f3dc dediprog: use command 0x0B (set voltage) only on older SF100s
As per e-mail with Dediprog, command 0x0B (which is not listed in the
command spec) is need on older Dediprogs only. SF100 with firmware
V6.0.0 and newer as well as all SF600 programmers do not support it.

The original wording by Dediprog was: "0x0B is used to adjust voltage
level, but it's available for some version of SF100 only. SF100 of
firmware V6.x.x and all version of SF600/SF600Plus not support this
command. If you have old version of SF100, 0x0B is still needed."

This patch renames dediprog_device_init() to something more
appropriate  and adds comments for clarity, and only runs it
conditionally if we cannot query the devicestring initially.

Based on ChromiumOS'
Change-Id: I42de7d28401d7ad5be8fcf8a8c165e2614a45960

Corresponding to flashrom svn r1928.

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-18 21:42:41 +00:00
David Woodhouse
7f3b89fe02 dediprog: add support for SF600
This patch is based on a number of changes by David Woodhouse and
David Hendricks.

SF600 uses two bulk endpoints, 1 for out and 2 for in unlike the
SF100 that uses only a single one. This patch make endpoint usage
more explicit and sets the in/out endpoint(s) appropriately for
SF100 and SF600.

Also, change all SF100-specific strings in messages and
leave standalone mode on SF600s.

Corresponding to flashrom svn r1927.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-18 21:42:15 +00:00
Carl-Daniel Hailfinger
f2daacac7b List affected features for missing libraries
If libpci, libusb0 or libusb1 are missing, make will now tell you which
currently enabled features require those libraries.

Example output:
Checking for libusb-0.1/libusb-compat headers... not found.
The following features require libusb-0.1/libusb-compat:
CONFIG_PICKIT2_SPI CONFIG_DEDIPROG.
Please install libusb-0.1 headers or libusb-compat headers.
See README for more information.

Corresponding to flashrom svn r1926.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-02-17 22:25:12 +00:00
Todd Broch
6800c953ef ft2232_spi: Add support for Google Servo boards (v1 + v2)
This patch has been cherry-picked from various patches in the chromiumos
tree denoted below.

Change-Id: I4b679e23ab37a4357b1e3d23f6f65a1c31f7d71a
Change-Id: Ibda56201ab4519315431c08206c61ceffb7c7e65
Change-Id: I540ad2d304dc69a7c79ca154beb744ef947ff808

Servo V2 has two FT4232H parts. The first one (denoted 'legacy') is
dedicated to supporting orginal Servo V1 functionality. The second,
residing at USB ID 0x18d1:5003 provides two other SPI interfaces on
port A and B respectively.

Additional changes by Alexandru Gagniuc, Hatim Kanchwala and Urja Rannikko:

 - The clock divisor is set to '6', as this creates a 10MHz SPI clock,
   which is the same SPI clock that the chromiumos branch produced.
 - Add udev rule for Google servo boards to util/flashrom.rules.
 - Add Google servo entry to manpage.

Corresponding to flashrom svn r1925.

Signed-off-by: Todd Broch <tbroch@chromium.org>
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Hatim Kanchwala <hatim@hatimak.me>
Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Hatim Kanchwala <hatim@hatimak.me>
Acked-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-14 15:46:00 +00:00
Stefan Tauner
e5dcc15bea Fix compilation on non-i386 architectures on OpenBSD
We use a header for MSR accesses on AMD Geodes that does only exist
on 32 bit x86 machines.

Corresponding to flashrom svn r1924.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-07 03:35:04 +00:00
Hatim Kanchwala
b3d7fba800 Add support for ESI ES25P40, ES25P80 and ES25P16
Corresponding to flashrom svn r1923.

Signed-off-by: Hatim Kanchwala <hatim@hatimak.me>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-02-01 00:27:25 +00:00
Stefan Tauner
d1ca1e89c1 Separate Am29F0xx from Am29F0xxA/B definitions
The earlier versions of the chip require 0x2AAA for probes thus split the
definitions and set them to untested to provoke reports.

Corresponding to flashrom svn r1922.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-31 23:17:35 +00:00
Urja Rannikko
0870b02516 Add support for WCH CH341A as an SPI programmer
Corresponding to flashrom svn r1921.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-01-31 22:10:29 +00:00
Stefan Tauner
e49edbb898 Add infrastructure to support libusb-1.0
Corresponding to flashrom svn r1920.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-01-31 22:10:14 +00:00
Stefan Tauner
c83ddc1769 Makefile: print compile commands of configure steps to the build details file
This allows for even more easy debugging of build failures due to
problems with libraries.

Corresponding to flashrom svn r1919.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2016-01-24 22:37:10 +00:00
Simon Glass
ae61651bfa dediprog: support new communication protocol, cleanup and enable by default
The new protocol changes some commands, so adjust the code to support
these. Use helper functions to reduce duplication in libusb calls. Testing
with real hardware showed that the maximum read size via the control
endpoint is about 16 bytes although specification does not mention that.

Dediprog SF600 is not supported yet.

Based on the following chromiumos changes:
Change-Id: Ibd1e27d9e8273ba879b9b5d95675b99596255c89
Change-Id: Ifc33e7b1eed5b0cb80f83458fa24741a577fa46a
Additionally, some ideas from Alex for cleaner code were incorporated as well.

Tested on an SF100 V4 with both firmware generations PREWing a M25PX80
and AT45DB041D (the latter is using dediprog_spi_send_command() instead
of optimized functions which make it a good test vehicle).

Corresponding to flashrom svn r1918.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-23 23:27:58 +00:00
Stefan Tauner
23e10b8780 Add a bunch of new/tested stuff and various small changes 24
Tested mainboards:
OK:
 - ASRock G31M-GS
   Reported by Александр Трубицын
 - ASRock G41M-VS3
   Reported by Александр Трубицын
 - ASRock N68C-S UCC
   Reported by Alexey Belyaev
 - ASRock AMCP7AION-HT (ION 330HT(-BD))
   Reported by Stefan Tauner
 - ASUS P5K SE
   Reported by Александр Трубицын
 - ASUS P5KPL-VM
   Reported by Marin Vlah
 - ASUS RAMPAGE III GENE
   Reported by stevessss on IRC
 - GIGABYTE GA-945GM-S2
   Reported by Александр Трубицын
 - GIGABYTE GA-945GCM-S2 (rev. 3.0)
   Reported by Александр Трубицын
 - GIGABYTE GA-965P-S3
   Reported by Александр Трубицын
 - GIGABYTE GA-EG43M-S2H
   Reported by Александр Трубицын
 - GIGABYTE GA-EP31-DS3L (rev. 1.0)
   Reported by Александр Трубицын
 - GIGABYTE GA-G33M-S2
   Reported by Александр Трубицын
 - GIGABYTE GA-G33M-S2L
   Reported by Александр Трубицын
 - GIGABYTE GA-H55M-S2
   Reported by Александр Трубицын
 - GIGABYTE GA-J1900N-D3V
   Reported by Marcos Truchado and Guillermo von Hünefeld
 - GIGABYTE GA-K8NS
   Reported  by nicolae788
 - GIGABYTE GA-M56S-S3
   Reported by Estevo Paz Freire
 - GIGABYTE GA-P31-DS3L
   Reported by Александр Трубицын
 - GIGABYTE GA-P31-S3G
   Reported by Александр Трубицын
 - MSI MS-7336
   Reported by Benjamin Bellec
 - MSI X79A-GD45 (8D) (MS-7760)"
   Reported by mortehu on IRC
 - Supermicro A1SAi-2550F
   Reported by Bernard Grymonpon
 - Supermicro X7DWT
   Reported by Steven Stremciuc

Laptop:
 - ASUS U38N
   Reported by Ultra on IRC
 - Dell Latitude D630
   Reported by Márton Miklós
 - Fujitsu Amilo Xi 3650
   Reported by Elmar Stellnberger
 - Lenovo T400 (whitelisting only)

Chipsets:
 - Mark 8086:1f38 (Intel Avoton/Rangeley) as tested
   Reported by Jeremy Porter and Bernard Grymonpon
 - Add Intel Sunrise Point IDs but no support yet.

Flash chips:
 - Atmel AT45DB321D to PREW (+PREW)
   Reported by The Raven
 - Eon EN25QH32 to PREW (+PREW)
   Reported by Josua Mayer
 - Eon EN25QH64 to PREW (+EW)
   Reported by David s. Alessio
 - GigaDevice GD25LQ64(B) to PREW (+PREW)
   Reported by Greg Tippit
 - Intel 28F001BN/BX-T to PREW (+EW)
   Reported by Lu Xie
 - Micron M25P10-A to PREW (+W)
   Reported by the Raven
 - Micron M25PE40
   Reported by David Wood
 - Micron N25Q128..3E to PREW (+PREW)
   Reported by Miklós Márton
 - Macronix MX25L3273E to PREW (+PREW)
   Reported by Roklobsta on IRC
 - Macronix MX23L6454 to PR (+PR)
   Reported by Steven Honeyman
 - Macronix MX25U6435E/F to PREW (+PREW)
   Reported by Marcos Truchado and Guillermo von Hünefeld
 - PMC Pm25LQ032C to PREW (+EW)
   Reported by Dirk Knop
 - Spansion S25FL016A to PREW (+EW)
   Reported by Márton Miklós
 - Spansion S25FL128S......0 to PREW (+PREW)
   Reported by Jim Houston
 - Spansion S25FL204K to PR (+PR)
   Reported by Thomas Debrunner
 - SST SST49LF016C to PREW (+EW)
   Reported by Steven Stremciuc
 - SST SST39VF040 to PREW (+PREW)
   Reported by Xavier Bourgeois
 - SST SST49LF040B to PREW (+EW)
   Reported by Rikard Åhlund
 - ST M25P10-A to PREW (+W)
   Reported by Martijn Schiedon
 - Winbond W39V040FA to PREW (+EW)
   Reported by Евгений Черкашин
 - Winbond W39V080FA to PREW (+EW)
   Reported by protagonist0 on IRC
 - Winbond W25Q80.W to PREW (+PREW)
   Reported by Miklós Márton
 - Winbond W25X64 to PREW (+REW)
   Reported by Johannes Krampf and Manuel Dejonghe
 - Fix ID of AMIC A25LQ64
   Reported by Roman Titov
 - Fix page size of Spansion S25FL129P......1
   Copy and paste error from the 128S uniform 256kB variant, probably.
 - Add Micron/Numonyx phase-change memory IDs

Miscellaneous:
 - Detect Android target OS.
   No changes are required to build flashrom (excluding programmers
   with NEED_PCI) on Android.
 - Update rayerspi (spipgm) URL
 - Fix max_data_write handling of at45db.
 - Minor refinement of the README
 - Mark board enable for the GA-K8NS variants as tested.
   Tested by "nicolae788" on a board with socket 754.
 - Mark "Multi-system" chassis as non-laptop case.
 - Remove W836xx log requests.
   We got enough (and no one is looking at them for the time being anyway).
 - serprog: improve invalid reply error message, contributed by Urja Rannikko.
 - Remove default include paths for MinGW.
 - Disable implicit rules in the Makefile because we don't need them and they
   just make the build (imperceptibly) slower.
 - Enable our own strnlen() implementation not only on DJGPP but also if
   HAVE_STRNLEN is not defined. This is needed to get older BSDs
   (e.g. NetBSD 6.0, FreeBSD < 8.0) to work.
 - Tiny other stuff.

Corresponding to flashrom svn r1917.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-23 16:16:49 +00:00
Joseph C. Lehner
c2644a3fc1 Add atapromise programmer
Supported controllers are Promise PDC20262 (FastTrak66/Ultra66),
PDC20265 (FastTrak100 Lite/Ultra100), PDC20267 (FastTrak100/Ultra100).
At least the Ultra100 only has address lines A0-A14 wired up, limiting
addressable chip size to 32 kB. The flash chips mounted on those
controllers usually is 128 kB, i.e. parts of the flash chip are
inaccessible. As a workaround, the driver implicitly truncates the
size of all flash chips to 32 kB. Works well for the factory installed
flash.
Do NOT use as a generic programmer for chips >32 kB.

Corresponding to flashrom svn r1916.

Signed-off-by: Joseph C. Lehner <joseph.c.lehner@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-01-16 23:45:25 +00:00
Stefan Tauner
a3712817a2 Fix file descriptor leak in serial.c
Found by Coverity as "CID 1348465:  Resource leaks".

Corresponding to flashrom svn r1915.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-16 18:50:27 +00:00
Stefan Tauner
1ca7c7ff1b Set LC_ALL globally in Makefile
This won't work for the majority of relevant commands because they use the
$(shell) function and GNU make does not relay variables exported within the
makefile to their evironment.

Corresponding to flashrom svn r1914.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-14 23:05:55 +00:00
Stefan Tauner
4c72315c10 Pimp the manpage to create nicer hyperlinks and HTML output
Also, add a target to the makefile to build a flashrom.8.html with groff.
To fix some formatting issues this adds some indention commands as well.

Corresponding to flashrom svn r1913.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2016-01-14 22:47:55 +00:00
Stefan Tauner
bfb067b076 Add support for linking statically with CONFIG_STATIC=yes
This is loosly based on the following changes of chromiumos:

 - flashrom: Add default pkg-config definition.
   Change-Id: I28744af0fd2d2d0bcc4569a5fbef370321691267
 - Fix FT2232 feature on static builds.
   Change-Id: I70d4a7bda573b64cb18429a21792455b018c4cba

Corresponding to flashrom svn r1912.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2016-01-07 18:13:07 +00:00
Stefan Tauner
3f73ffec38 Make make errors more less flashily
Previously we have hid almost all error messages from called tools like
pkg-config or the compiler in the "configure" step. Only exceptions were
the library checks because Carl-Daniel felt it improved usability in
case of missing headers etc.

However, this makes the output of the makefile less readable and in
the case of pkg-config fallbacks the error messages are actually
expected. Instead of throwing a part of the detailed stderr outputs
of the tools into the face of the users and completely hiding
others, write all of them into a separate log file instead.

Corresponding to flashrom svn r1911.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2016-01-07 17:45:59 +00:00
Stefan Tauner
bfaf7b1feb makefile: fix exports of PKG_CONFIG_LIBDIR for pkg-config calls
The parenthesis pushed the exports into a subshell thus made them useless.

Corresponding to flashrom svn r1910.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-07 09:50:26 +00:00
Urja Rannikko
dc44584e92 serial: support arbitrary baud rates on Windows
Available baud rates obviously depend on driver support, but the
CBR_ defines used so far are basically only for backwards source
compatibility with Win16, so dont bother with them.

Corresponding to flashrom svn r1909.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-04 05:08:40 +00:00
Urja Rannikko
27b431bcee serprog: fix missing device parameter error message on Windows
Previously, flashrom -p serprog didnt notice a completely missing dev=
string on Windows. Also, the error message shown if no device name
followed contained a misleading "/dev/...".

Corresponding to flashrom svn r1908.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2016-01-04 03:05:23 +00:00
Stefan Tauner
72587f85ec serprog: allow to omit specifying a baud rate
On USB-based serial connections (VCP) the requested baud rate usually
does not matter (much). Remove the arbitrary restriction and use whatever
default values the OS/hardware provides.

Corresponding to flashrom svn r1907.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-01-04 03:05:15 +00:00
Stefan Tauner
631bb02135 serprog: ignore failures when setting serial port options
There is no good reason to abort earlier just because some options did
not stick. This should improve compatibility without negative effects. If
communication is affected by the missing flag(s) then we abort later
anyway.

Corresponding to flashrom svn r1906.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-01-04 03:05:06 +00:00
Stefan Tauner
a4d60f3101 serprog: clear NDELAY flag only once after opening the port
Change sp_openserport() to directly clear the O_NONBLOCK flag that
is potentially set by opening the device with O_NDELAY instead of
clearing ALL flags in serialport_config() unconditionally.

Corresponding to flashrom svn r1905.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2016-01-04 03:04:36 +00:00
Alexandru Gagniuc
3d06abef13 Add support for libftdi1
Many distros no longer provide libftdi 0.2, and as a result,
programmers that depend on libftdi must be disabled to compile flashrom.
Luckily the libftdi API did not change significantly, so for our
purposes, we can simply use the newer headers and link to the newer
library if it is available.

Corresponding to flashrom svn r1904.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-12-25 22:42:45 +00:00
Stefan Tauner
2f055dfba9 Add support for Sanyo LE25FU406C/LE25U40CMC
Corresponding to flashrom svn r1903.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Tested-by: Jose Luis León <zenky1@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-12-25 22:13:15 +00:00
Stefan Tauner
1668770c6f Rigorously check integrity of I/O stream data
Even if fwrite() succeeds the data is not necessarily out of the clib's buffers
and writing it eventually could fail. Even if the data is flushed out (explicitly by
fflush() or implicitly by fclose()) the kernel might still hold a buffer.

Previously we have ignored this to a large extent - even in important cases
like writing the flash contents to a file. The results can be truncated
images that would brick the respective machine if written back as is (though
flashrom would not allow that due to a size mismatch). flashrom would not
indicate the problem in any output - so far we only check the return value
of fwrite() that is not conclusive.

This patch checks the return values of all related system calls like fclose()
unless we only read the file and are not really interested in output errors.
In the latter case the return value is casted to void to document this fact.
Additionally, this patch explicitly calls fflush() and fsync() (on regular files only)
to do the best we can to guarantee the read image reaches the disk safely
and at least inform the user if it did not work.

Corresponding to flashrom svn r1902.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
2015-12-25 21:59:45 +00:00
Ben Gardner
bcf6109a76 Add support for SST SST25WF020A, SST25WF040B, SST25WF080B
Apart from the strange ID (using Sanyo's vendor ID 0x62) the main
difference from the plain SST25WF series is that they lack op codes
0xAD (AAI Word program) and 0x52 (32K erase). The smallest version
does not support dual I/O operations either.

SST25WF080B was tested under Linux with spidev.

Corresponding to flashrom svn r1901.

Tested-by: Ben Gardner <bgardner@wabtec.com>
Signed-off-by: Ben Gardner <bgardner@wabtec.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-11-22 02:23:31 +00:00
Stefan Tauner
94d8665ea3 Add support for VIA VT8251
Seems to work on IBM SurePOS 700 and
IBM (now Toshiba) AnyPlace Kiosk Model 4838-310.

Tested-by: Jason Vannest <Jason_Vannest@abercrombie.com>
Tested-by: Rowlinson Mark <Mark.Rowlinson@uk.fujitsu.com>

Corresponding to flashrom svn r1900.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2015-11-21 23:35:47 +00:00
Stefan Tauner
839db6dccd Use nanosleep() instead of usleep() where available
Usleep() has been obsolete for quite a while.
The only target that uses it without alternative is DOS.

Corresponding to flashrom svn r1899.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-11-14 02:55:22 +00:00
Gwenhael Goavec-Merou
8cd0c73fb5 Add (implicit) support for musl libc
This is mostly achieved by fixing or refining the inclusion of header
files and replacing glibc-specific ifdefs with more generic ones.

 - <sys/io.h>: Contains iopl(2) and x86 I/O port access functions (inb, outb etc).
               Generally Linux-specific but also availble on debian/kFreeBSD.
               Provided by glibc as well as musl and uclibc.
               Include it if we are running Linux or if glibc is detected.
 - <sys/fcntl.h>: should be (and is) replaced by <fcntl.h> (without the
    			  "sys" prefix).
 - <linux/spi/spidev.h>: Does not include all necessary headers, namely
                         _IOC_SIZEBITS that is used in the definition of
                         SPI_MSGSIZE is not brought in via <linux/ioctl.h>
                         but instead we relied so far on glibc's including
                         it via <sys/ioctl.h>. Change that to explicitly
                         including <linux/ioctl.h>.
 - <endian.h>: Would also be available in musl but there is no easy way
               to detect it so we do not try yet.

Corresponding to flashrom svn r1898.

The bug report and initial patches were
Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-11-14 02:55:12 +00:00
Paul Kocialkowski
c8305e1dee Add support for 128 bytes write granularity
Some chips such as the ENE KB9012 internal flash require a write
granularity of 128 bytes.

Corresponding to flashrom svn r1897.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Nico Huber <nico.h@gmx.de>
2015-10-16 02:16:20 +00:00
Simon Glass
557eb4ff18 dediprog: Tidy up commands and remove dead nonsense code
Use names for the commands and request types instead of magic
numbers and remove some of the unnecessary unexplained arguments.
Also, cleanup the nonsense code left over from RE. Most of it can
not be explained by official documentation and was recorded with
ancient firmware/software.

Based on the following chromiumos changes:
Change-Id: I80a0dcdf40eedc89da48fb2c54cd9d9fd13e6fa1
Change-Id: If61bac2c8194b3ec30a80422d871842c66f0cd74

Corresponding to flashrom svn r1896.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: David Hendricks <dhendrix@chromium.org>
2015-07-05 16:53:22 +00:00
Urja Rannikko
0b4ffd58aa serprog: Fix FWH/LPC by implementing serprog_map
The serprog protocol does only transmit 24 bit-wide address and ignores the
top 8 bit. This is fine as long as the underlying hardware ignores the latter
anyway (which is the case for parallel chips that even lack the respective pins).
FWH/LPC chips, however, operate on a full 32-bit (LPC) or 28-bit (FWH) address
space and would fail with the fallback mapping to NULL.

Corresponding to flashrom svn r1895.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-06-29 23:24:23 +00:00
Simon Glass
25e9f40e21 dediprog: Invert the LED polarity in the code
Previously we have used low-active macros (because the hardware and
old protocol were so too) and set every single LED explicitly although we
only used a limited number of combinations. Using an enumeration for
commonly used values instead makes things easier.

Based on the following chromiumos change:
Change-Id: Ie481a583e623cdc45e3649a4db69b15570f65a7b

Corresponding to flashrom svn r1894.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: David Hendricks <dhendrix@chromium.org>
2015-06-28 13:31:19 +00:00
Urja Rannikko
0a5f6e43d1 spi25: ignore 0x00 as a manufacturer id in the generic match
Saying that manufacturer id 0x00 is an "unknown SPI chip"
just confuses people with external programmers without a
proper connection to a chip and makes them think flashrom
doesn't support the chip they're trying to use.
Also causes unnecessary -c requirement with a multiple-slot
(FWH/LPC and SPI) serprog device i was testing.

Corresponding to flashrom svn r1893.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-06-22 23:59:15 +00:00
Urja Rannikko
2a1aabaf90 Add support for Winbond W29C512A/W29EE512
Tested with a W29EE512P-70 (PLCC32, 5V)  found on an RTL8169 network card.
The ID for the chip was already in flashchips.h with the name W29C512A
and a note for "also W29EE512". The datasheets are almost identical.

Corresponding to flashrom svn r1892.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-06-20 11:53:10 +00:00
Steven Honeyman
81a8fb7c2c Add support for PMC Pm25LQ020, Pm25LQ040, Pm25LQ080, Pm25LQ016, Pm25LQ032C
Corresponding to flashrom svn r1891.

Signed-off-by: Steven Honeyman <stevenhoneyman@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-06-02 22:32:24 +00:00
Stefan Tauner
c71759d3d3 hwaccess.h: fix compilation on OSX
DirectHW provides prototypes for out[bwl] and in[bwl], but we still
need to define the respective OUT[BWL] and IN[BWL] binding macros.

Apparently this has been broken since r1864 (or January 2015).

Corresponding to flashrom svn r1890.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-05-23 23:59:23 +00:00