flashrom.git
2 years agoIncrease flashrom version number to 0.9.9. master
stefanct [Sun, 13 Mar 2016 17:46:08 +0000 (17:46 +0000)]
Increase flashrom version number to 0.9.9.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1954 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoFix fscanf format string security bug in layout.c
hailfinger [Sun, 13 Mar 2016 17:36:49 +0000 (17:36 +0000)]
Fix fscanf format string security bug in layout.c

An internal security audit of the flashrom project by
Carl-Daniel Hailfinger found a buffer overflow bug present in all
flashrom versions since the year 2005.
This bug was independently found and reported to flashrom.org by
Cosmin Gorgovan a few days ago.

A buffer on the stack and a buffer on the heap are affected by the
overflow caused by an incorrect fscanf format string.
The buffer overflow can only be triggered if the optional layout feature
is used and if the user manually specifies a specially crafted layout
file on the command line. Command line parsing and flash image handling
do not trigger the buggy code path.
Most usage of flashrom does not involve layout files.

The fix in this commit (changed fscanf format string) can be applied to
layout.c of all past flashrom versions.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1953 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoImplement serial port shutdown both for regular termination and error
hailfinger [Sun, 13 Mar 2016 16:24:09 +0000 (16:24 +0000)]
Implement serial port shutdown both for regular termination and error
condition in pony_spi.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1952 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd a bunch of new/tested stuff and various small changes 25.
stefanct [Sun, 13 Mar 2016 15:16:30 +0000 (15:16 +0000)]
Add a bunch of new/tested stuff and various small changes 25.

Tested mainboards:
OK:
 - ASRock Fatal1ty 970 Performance and P4i65G
   Reported by anonymous email message ID:
   932677687262b1300eaf14260999d9262c31@guerrillamail.com
   The latter actually had a tested board enable already.

Flash chips:
 - Eon EN25Q128 to PREW (+PREW)
   Reported by Adrian Graham
 - GigaDevice GD25VQ41B to PREW (+PREW)
   Reported by David Hendricks
 - Winbond W39V040FB to PREW (+EW)
   Reported by fjed on IRC

Miscellaneous:
 - Change PCI IDs of "MS-6577 (Xenon)" board enable.
   The previous IDs contained the on-board display adapter which is
   disabled when a dedicated graphics card is installed.
 - Add a note to the README how to overcome the clang warning if only a
   single programmer is enabled.
 - Fix some typo and manpage problems found by lintian
 - r1920 introduced some explicit calls to pkg-config instead of $(PKG_CONFIG).
   This patch corrects that.
 - Make MS-7094 (K8T Neo2-F V2.0) board enable less contestable.
   Previous PCI IDs were board-specific but ot the other of devices
   that could be disabled by the firmware or that vary among
   hardware revions. There are no good alternatives available.
   However, since we always have a DMI decoder available now, we can
   use non-board-specific devices without taking risks. Thanks to
   Uwe Hermann for reporting and testing.
 - Some other small changes to clean up whitespace and fix some warnings
   from Debian's lintian.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1951 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoFix compilation on SunOS.
stefanct [Sun, 13 Mar 2016 12:57:03 +0000 (12:57 +0000)]
Fix compilation on SunOS.

This came up when I was testing if building on SunOS still works
on the buildbot's instance of OmniOS r151014 which is based on illumos.

The fix is
 - to link against libnsl
 - a small C type fix in ich_descriptor_tool

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1950 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoSpecifying spispeed=reserved as programmer parameter resulted in
hailfinger [Sat, 12 Mar 2016 19:49:14 +0000 (19:49 +0000)]
Specifying spispeed=reserved as programmer parameter resulted in
selecting the default SPI speed instead of aborting. Rewrite the logic
to be more readable.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1949 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for GNU Hurd.
stefanct [Sun, 6 Mar 2016 22:32:16 +0000 (22:32 +0000)]
Add support for GNU Hurd.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1948 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for GD25VQ21B, GD25VQ40C, GD25VQ80C and GD25VQ16C.
stefanct [Sun, 6 Mar 2016 14:33:49 +0000 (14:33 +0000)]
Add support for GD25VQ21B, GD25VQ40C, GD25VQ80C and GD25VQ16C.

Signed-off-by: Hatim Kanchwala <hatim@hatimak.me>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1947 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoMakefile: Fix driver blacklist dependencies
hailfinger [Sun, 28 Feb 2016 22:04:51 +0000 (22:04 +0000)]
Makefile: Fix driver blacklist dependencies

Allow mstarddc_spi and pony_spi on Android.
Allow mstarddc_spi and pony_spi on architectures with unsupported raw
access.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1946 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agorayer_spi: add support for SPI Tiny Tools-compatible hardware.
stefanct [Sun, 28 Feb 2016 17:04:38 +0000 (17:04 +0000)]
rayer_spi: add support for SPI Tiny Tools-compatible hardware.

Apparently, there is at least one board of Russian origin (coined
SPI_TT LPT) that works with SPI Tiny Tools which is a closed-source
Windows GUI program somewhat similar to flashrom.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1945 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agomakefile: allow to disable all default-yes config variables with CONFIG_NOTHING=yes.
stefanct [Fri, 26 Feb 2016 23:51:21 +0000 (23:51 +0000)]
makefile: allow to disable all default-yes config variables with CONFIG_NOTHING=yes.

All credit for this should be given to Patrick Georgi (see r1869).

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1944 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoPartial architecture support for alpha hppa m68k sh s390
hailfinger [Thu, 25 Feb 2016 20:10:26 +0000 (20:10 +0000)]
Partial architecture support for alpha hppa m68k sh s390

Only hardware not needing raw access (PCI, memory, port I/O) is supported.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1943 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: use ordinary USB devs array.
stefanct [Mon, 22 Feb 2016 08:59:27 +0000 (08:59 +0000)]
dediprog: use ordinary USB devs array.

Even though there is currently only one USB device ID in the wild using our
standard way to define the devices creates nicer output for -L and -z.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1942 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agopickit2_spi: use ordinary USB devs array.
stefanct [Mon, 22 Feb 2016 08:59:15 +0000 (08:59 +0000)]
pickit2_spi: use ordinary USB devs array.

Even though there is currently only one USB device ID in the wild using our
standard way to define the devices creates nicer output for -L and -z.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1941 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoIncrease version number to 0.9.9-rc1.
stefanct [Sun, 21 Feb 2016 18:17:14 +0000 (18:17 +0000)]
Increase version number to 0.9.9-rc1.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1939 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAutomatically disable atapromise for libpayload as well.
stefanct [Sun, 21 Feb 2016 11:18:24 +0000 (11:18 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1938 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for GigaDevice GD25VQ41B and GD25Q128C.
stefanct [Sun, 21 Feb 2016 00:21:11 +0000 (00:21 +0000)]
Add support for GigaDevice GD25VQ41B and GD25Q128C.

Signed-off-by: Hatim Kanchwala <hatim@hatimak.me>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1937 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAllow global disable of all drivers requiring libusb* or libpci
Carl-Daniel Hailfinger [Sat, 20 Feb 2016 22:28:16 +0000 (22:28 +0000)]
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

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1936 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAutomatically disable atapromise on non-x86
Carl-Daniel Hailfinger [Sat, 20 Feb 2016 22:04:39 +0000 (22:04 +0000)]
Automatically disable atapromise on non-x86

We do not support PCI port I/O on non-x86 (yet).
Atapromise needs PCI port I/O.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1935 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoDo not require PCI code for RayeR SPI driver
Carl-Daniel Hailfinger [Sat, 20 Feb 2016 21:43:56 +0000 (21:43 +0000)]
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.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1934 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: tremendously improve performance on SF600 by ignoring the spec.
Stefan Tauner [Sat, 20 Feb 2016 20:53:46 +0000 (20:53 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1933 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoInclude sys/glibc-syscalls.h instead of inexistent sys/io.h on Android.
Stefan Tauner [Sat, 20 Feb 2016 20:21:58 +0000 (20:21 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1932 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoMakefile: fix overriding of make command line arguments.
Stefan Tauner [Fri, 19 Feb 2016 08:17:24 +0000 (08:17 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1931 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoFix chip size limiting in atapromise
Carl-Daniel Hailfinger [Thu, 18 Feb 2016 23:11:52 +0000 (23:11 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1930 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: port to libusb1 and use asynchronous bulk transfers for reading.
Stefan Tauner [Thu, 18 Feb 2016 21:42:49 +0000 (21:42 +0000)]
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

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1929 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: use command 0x0B (set voltage) only on older SF100s.
Stefan Tauner [Thu, 18 Feb 2016 21:42:41 +0000 (21:42 +0000)]
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

Signed-off-by: David Hendricks <dhendrix@chromium.org>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1928 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: add support for SF600.
Stefan Tauner [Thu, 18 Feb 2016 21:42:15 +0000 (21:42 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1927 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoList affected features for missing libraries
Carl-Daniel Hailfinger [Wed, 17 Feb 2016 22:25:12 +0000 (22:25 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1926 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoft2232_spi: Add support for Google Servo boards (v1 + v2).
Stefan Tauner [Sun, 14 Feb 2016 15:46:00 +0000 (15:46 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1925 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoFix compilation on non-i386 architectures on OpenBSD.
Stefan Tauner [Sun, 7 Feb 2016 03:35:04 +0000 (03:35 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1924 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for ESI ES25P40, ES25P80 and ES25P16.
stefanct [Mon, 1 Feb 2016 00:27:25 +0000 (00:27 +0000)]
Add support for ESI ES25P40, ES25P80 and ES25P16.

Signed-off-by: Hatim Kanchwala <hatim@hatimak.me>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1923 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoSeparate Am29F0xx from Am29F0xxA/B definitions.
stefanct [Sun, 31 Jan 2016 23:17:35 +0000 (23:17 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1922 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for WCH CH341A as an SPI programmer.
stefanct [Sun, 31 Jan 2016 22:10:29 +0000 (22:10 +0000)]
Add support for WCH CH341A as an SPI programmer.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1921 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd infrastructure to support libusb-1.0.
stefanct [Sun, 31 Jan 2016 22:10:14 +0000 (22:10 +0000)]
Add infrastructure to support libusb-1.0.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
git-svn-id: svn://flashrom.org/flashrom/trunk@1920 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoMakefile: print compile commands of configure steps to the build details file.
stefanct [Sun, 24 Jan 2016 22:37:10 +0000 (22:37 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1919 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: support new communication protocol, cleanup and enable by default.
stefanct [Sat, 23 Jan 2016 23:27:58 +0000 (23:27 +0000)]
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).

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1918 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd a bunch of new/tested stuff and various small changes 24.
stefanct [Sat, 23 Jan 2016 16:16:49 +0000 (16:16 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1917 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd atapromise programmer
hailfinger [Sat, 16 Jan 2016 23:45:25 +0000 (23:45 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1916 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoFix file descriptor leak in serial.c.
stefanct [Sat, 16 Jan 2016 18:50:27 +0000 (18:50 +0000)]
Fix file descriptor leak in serial.c.

Found by Coverity as "CID 1348465:  Resource leaks".

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1915 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoSet LC_ALL globally in Makefile.
stefanct [Thu, 14 Jan 2016 23:05:55 +0000 (23:05 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1914 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoPimp the manpage to create nicer hyperlinks and HTML output.
stefanct [Thu, 14 Jan 2016 22:47:55 +0000 (22:47 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1913 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for linking statically with CONFIG_STATIC=yes.
stefanct [Thu, 7 Jan 2016 18:13:07 +0000 (18:13 +0000)]
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

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1912 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoMake make errors more less flashily.
stefanct [Thu, 7 Jan 2016 17:45:59 +0000 (17:45 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1911 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agomakefile: fix exports of PKG_CONFIG_LIBDIR for pkg-config calls.
stefanct [Thu, 7 Jan 2016 09:50:26 +0000 (09:50 +0000)]
makefile: fix exports of PKG_CONFIG_LIBDIR for pkg-config calls.

The parenthesis pushed the exports into a subshell thus made them useless.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1910 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoserial: support arbitrary baud rates on Windows.
stefanct [Mon, 4 Jan 2016 05:08:40 +0000 (05:08 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1909 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoserprog: fix missing device parameter error message on Windows.
stefanct [Mon, 4 Jan 2016 03:05:23 +0000 (03:05 +0000)]
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/...".

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1908 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoserprog: allow to omit specifying a baud rate.
stefanct [Mon, 4 Jan 2016 03:05:15 +0000 (03:05 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
git-svn-id: svn://flashrom.org/flashrom/trunk@1907 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoserprog: ignore failures when setting serial port options.
stefanct [Mon, 4 Jan 2016 03:05:06 +0000 (03:05 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
git-svn-id: svn://flashrom.org/flashrom/trunk@1906 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoserprog: clear NDELAY flag only once after opening the port.
stefanct [Mon, 4 Jan 2016 03:04:36 +0000 (03:04 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
git-svn-id: svn://flashrom.org/flashrom/trunk@1905 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for libftdi1.
stefanct [Fri, 25 Dec 2015 22:42:45 +0000 (22:42 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1904 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for Sanyo LE25FU406C/LE25U40CMC.
stefanct [Fri, 25 Dec 2015 22:13:15 +0000 (22:13 +0000)]
Add support for Sanyo LE25FU406C/LE25U40CMC.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1903 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoRigorously check integrity of I/O stream data.
stefanct [Fri, 25 Dec 2015 21:59:45 +0000 (21:59 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Urja Rannikko <urjaman@gmail.com>
git-svn-id: svn://flashrom.org/flashrom/trunk@1902 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for SST SST25WF020A, SST25WF040B, SST25WF080B.
stefanct [Sun, 22 Nov 2015 02:23:31 +0000 (02:23 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1901 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for VIA VT8251.
stefanct [Sat, 21 Nov 2015 23:35:47 +0000 (23:35 +0000)]
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>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1900 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoUse nanosleep() instead of usleep() where available.
stefanct [Sat, 14 Nov 2015 02:55:22 +0000 (02:55 +0000)]
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.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1899 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd (implicit) support for musl libc.
stefanct [Sat, 14 Nov 2015 02:55:12 +0000 (02:55 +0000)]
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.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1898 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for 128 bytes write granularity.
stefanct [Fri, 16 Oct 2015 02:16:20 +0000 (02:16 +0000)]
Add support for 128 bytes write granularity.

Some chips such as the ENE KB9012 internal flash require a write
granularity of 128 bytes.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Nico Huber <nico.h@gmx.de>
git-svn-id: svn://flashrom.org/flashrom/trunk@1897 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: Tidy up commands and remove dead nonsense code.
stefanct [Sun, 5 Jul 2015 16:53:22 +0000 (16:53 +0000)]
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

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1896 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoserprog: Fix FWH/LPC by implementing serprog_map.
stefanct [Mon, 29 Jun 2015 23:24:23 +0000 (23:24 +0000)]
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.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1895 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agodediprog: Invert the LED polarity in the code.
stefanct [Sun, 28 Jun 2015 13:31:19 +0000 (13:31 +0000)]
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

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1894 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agospi25: ignore 0x00 as a manufacturer id in the generic match.
stefanct [Mon, 22 Jun 2015 23:59:15 +0000 (23:59 +0000)]
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.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1893 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for Winbond W29C512A/W29EE512.
stefanct [Sat, 20 Jun 2015 11:53:10 +0000 (11:53 +0000)]
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.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1892 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agoAdd support for PMC Pm25LQ020, Pm25LQ040, Pm25LQ080, Pm25LQ016, Pm25LQ032C.
stefanct [Tue, 2 Jun 2015 22:32:24 +0000 (22:32 +0000)]
Add support for PMC Pm25LQ020, Pm25LQ040, Pm25LQ080, Pm25LQ016, Pm25LQ032C.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1891 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

2 years agohwaccess.h: fix compilation on OSX.
stefanct [Sat, 23 May 2015 23:59:23 +0000 (23:59 +0000)]
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).

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1890 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for more GigaDevice GD25LQ chips.
stefanct [Fri, 3 Apr 2015 21:29:04 +0000 (21:29 +0000)]
Add support for more GigaDevice GD25LQ chips.

Namely GD25LQ40, GD25LQ80, GD25LQ16, GD25LQ64(B), GD25LQ128.

Signed-off-by: Roman Titov <titovroman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1889 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoIncrease flashrom version number to 0.9.8.
stefanct [Sun, 1 Mar 2015 22:05:16 +0000 (22:05 +0000)]
Increase flashrom version number to 0.9.8.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1887 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd a bunch of new/tested stuff and various small changes 23.
stefanct [Sun, 1 Mar 2015 22:04:38 +0000 (22:04 +0000)]
Add a bunch of new/tested stuff and various small changes 23.

Tested mainboards:
OK:
 - Elitegroup GF7050VT-M
   Reported by Alex
 - Fujitsu D2724-A1x (used in ESPRIMO E5625)
   Reported by Rainer Spillmann
 - Teclast X98 Air 3G
   Reported by Antonio Ospite

Flash chips:
 - Fix MX25L6405(D) definition by splitting it.
   Reported by Reggie McMurtrey
 - Add Macronix MX25L..08E family and rearrange MX25L6436E.
 - Pm49FL004 to PREW (+EW)
   Reported by Georg Sauthoff

Miscellaneous:
 - Add board enable for abit KN9 Ultra.
 - Mark ARM-USB-OCD as working OK.
 - Use "mobile devices" instead of "laptops" in output.
 - Tiny other stuff.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1886 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoFix a number of problems in mstarddc_spi.c.
stefanct [Wed, 18 Feb 2015 23:28:30 +0000 (23:28 +0000)]
Fix a number of problems in mstarddc_spi.c.

Coverity has brought up the following problems:

mstarddc_spi_send_command():
 - CID 1270702: bad comparison of malloced pointer 'cmd'.
 - CID 1270701: a NULL pointer dereference possible because of above.

Simply checking the return value of malloc in a valid way fixes both problems.

mstarddc_spi_init():
 - CID 1270699 and 1270700: Memory leak of i2c_device.

This patch revamps the function in various ways to fix these issues and some
other irritating bits.
It reduces scopes of variables where possible, pushes the code towards our
coding standards and introduces a label-based resource cleanup at the end.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Alexandre Boeglin <alex@boeglin.org>
git-svn-id: svn://flashrom.org/flashrom/trunk@1885 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoIncrease flashrom version number to 0.9.8-rc1.
stefanct [Wed, 11 Feb 2015 22:21:03 +0000 (22:21 +0000)]
Increase flashrom version number to 0.9.8-rc1.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1883 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for SPARC (maybe).
stefanct [Tue, 10 Feb 2015 08:03:10 +0000 (08:03 +0000)]
Add support for SPARC (maybe).

Was implemented by SPARC newbies, does (cross-)compile but is not run-tested.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1882 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for the Microchip PICkit2 as an SPI programmer.
stefanct [Sun, 8 Feb 2015 21:58:10 +0000 (21:58 +0000)]
Add support for the Microchip PICkit2 as an SPI programmer.

This patch was inspired by the code in AVRDude (open source Atmel AVR
programmer) to support the PICkit2 written by Doug Brown [1]. The
Dediprog code in flashrom was used as the template for this code with
some reference to the ft2232 code as well.

[1] - https://github.com/steve-m/avrdude/blob/master/pickit2.c

Signed-off-by: Justin Chevrier <jchevrier@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1881 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoRefine version check of libpci function pci_get_dev.
stefanct [Sun, 8 Feb 2015 21:58:04 +0000 (21:58 +0000)]
Refine version check of libpci function pci_get_dev.

The way more elegant check for the header fails unfortunately on CentOS 4.9
because PCI_LIB_VERSION is not defined at all although the domain parameter
is present. This patch jumps through the hoops via an additional check in the
Makefile to determine if the function accepts 5 parameters (new version) or
not (old version).

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1880 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd a bunch of new/tested stuff and various small changes 22.
stefanct [Sun, 8 Feb 2015 21:57:52 +0000 (21:57 +0000)]
Add a bunch of new/tested stuff and various small changes 22.

Tested mainboards:
OK:
 - AOpen UK79G-1394 (used in EZ18 barebones)
   Reported by Lawrence Gough
 - ASUS M4N78 SE
   Reported by Dima Veselov
 - ASUS P5LD2-VM
   Mark board enable as tested (reported by Dima Veselov)
 - GIGABYTE GA-970A-UD3P (rev. 2.0)
   Reported by trucmar on IRC
 - GIGABYTE GA-990FXA-UD3 (rev. 4.0)
   Reported by ROKO__ on IRC
 - GIGABYTE GA-H77-DS3H (rev. 1.1)
   Reported by Evgeniy Edigarev
 - GIGABYTE GA-P55-USB3 (rev. 2.0)
   Reported by Måns Thörnqvist
 - MSI MS-7817 (H81M-E33)
   Reported by Igor Kolker

Chipsets:
 - Marked Intel Bay Trail (0x0f1c) as tested OK
   Reported by Antonio Ospite
 - Refine Intel IDs
    * Add IDs for Braswell
    * Add IDs for 9 Series PCHs (e.g. H97, Z97)
    * Rename Wellsburg devices slightly

Flash chips:
 - Atmel AT25DF041A to PREW (+PREW)
   Reported by Tai-hwa Liang
 - Atmel AT26DF161 to PREW (+EW)
   Reported by Steve Shenton
 - Atmel AT45DB011D to PREW (+PREW)
   Reported by The Raven
 - Atmel AT45DB642D to PREW (+PREW)
   Reported by Mahesh Mokal
 - Eon EN25F32 to PREW (+PREW)
   Reported by Arman Khodabande
 - Eon EN25F40 to PREW (+REW)
   Reported by Jerrad Pierce
 - Eon EN25QH16 to PREW (+EW)
   Reported by Ben Johnson
 - GigaDevice GD25Q20(B) to PREW (+PREW)
   Reported by Gilles Aurejac
 - Macronix MX25U6435E/F to PR (+PR)
   Reported by Matt Taggart
 - PMC Pm25LV512(A) to PREW (+PREW)
   Reported by The Raven
 - SST SST39VF020 to PREW (+PREW)
   Reported by Urja Rannikko
 - Winbond W25Q40.V to PREW (+EW)
   Reported by Torben Nielsen
 - Add E variants of MX25Lx006 (MX25L2006E, MX25L4006E, MX25L8006E).
 - Add MX25L6465E variant.
 - There was never a MX25L12805 AFAICT.
 - Split MX25L12805 from models with the same ID but an additional 32 kB
   eraser: MX25L12835F/MX25L12845E/MX25L12865E.
 - Add a bunch of ST parallel NOR flash chip IDs.

Miscellaneous:
 - Whitelist ThinkPad X200.
 - Constify master parameter of register_master().
 - Remove FEATURE_BYTEWRITES because it was never used at all.
 - Refine hwseq messages and make them less prominent.
 - Fix the yet unused PRIxCHIPADDR format string thingy.
 - Fix copy&paste error in spi_prettyprint_status_register_bp().
   Spotted by Pablo Cases.
 - Add an additional SMBus controller revision to identify another Yangtze
   model. Thanks to Dan Christensen for reporting this issue.
 - dediprog: add missing include for stdlib.h.
   This fixes (at least) building on FreeBSD and DragonflyBSD with gcc.
 - Remove references to struct pci_filter from programmer.h.
   It is only needed in internal.c where it has a complete type. Having
   it in programmer.h provokes a warning by some old versions of gcc.
 - Tiny other stuff.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1879 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoMake strnlen() visible in old versions of glibc.
stefanct [Tue, 27 Jan 2015 18:07:50 +0000 (18:07 +0000)]
Make strnlen() visible in old versions of glibc.

strnlen() is in POSIX 2008 but was a GNU extension up to glibc 2.10
requiring to define _GNU_SOURCE. This fixes compilation on CentOS 4.9.
Also, move our implementation of strnlen() that was added to support
DJGPP to helpers.c.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1878 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoProperly include current libusb-win32 header.
stefanct [Mon, 26 Jan 2015 22:06:04 +0000 (22:06 +0000)]
Properly include current libusb-win32 header.

libusb-win32 is using a different header file name (lusb0_usb.h) for
a while. Use that on Windows builds to make clear that this is
currently the correct header to include.

Hopefully this will change soonish by migrating away from libusb-0.

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>
git-svn-id: svn://flashrom.org/flashrom/trunk@1877 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoLet pkg-config work with cross-compilers.
stefanct [Mon, 26 Jan 2015 22:03:35 +0000 (22:03 +0000)]
Let pkg-config work with cross-compilers.

In cross-compiler setups pkg-config often needs some help to
determine the correct libraries. This can be done for example by
setting PKG_CONFIG_LIBDIR to point to the directory where the
cross-compile .pc files are located. If PKG_CONFIG_LIBDIR was not
set already outside of the Makefile we set it according to LIBS_BASE
and add the respective path to the linker's rpath. This makes it
possible to easily cross-compile by only setting CC and LIBS_BASE on
the command line.

This patch also removes the explicit default for LIBS_BASE again
because it does not play well with this change and was a bad idea to
begin with.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1876 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoFix "unterminated variable reference" on ancient versions of GNU make.
stefanct [Sun, 25 Jan 2015 23:57:08 +0000 (23:57 +0000)]
Fix "unterminated variable reference" on ancient versions of GNU make.

Add a workaround for the GNU make that shipped with CentOS 4.9, which
apparently does not like semicolons in shell code (and which also
ignores info functions altogether by the way).

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1875 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoShadowing fix in nicintel_eeprom.c for ancient libpci.
stefanct [Sun, 25 Jan 2015 23:45:14 +0000 (23:45 +0000)]
Shadowing fix in nicintel_eeprom.c for ancient libpci.

Very old versions (<2.2) of pciutils had a typedef named "word" in
types.h. That does not play well with previous local variable names
of nicintel_eeprom.c.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1874 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoftdi2232_spi: revert usage of DIS_DIV_5 macro.
stefanct [Sun, 25 Jan 2015 23:42:57 +0000 (23:42 +0000)]
ftdi2232_spi: revert usage of DIS_DIV_5 macro.

In r1872 we replaced some magic values with constant macros from
ftdi.h. Among them was DIS_DIV_5 that represents the opcode that
disables the use of the 5x prescaler on newer devices. Unfortunately
this macro was only introduced with support for FT232H and hence is
not available in older versions of the library. Revert back to using
the magic constant.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1873 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoft2232_spi.c: use constants from ftdi.h instead of magic numbers.
stefanct [Sun, 25 Jan 2015 03:52:47 +0000 (03:52 +0000)]
ft2232_spi.c: use constants from ftdi.h instead of magic numbers.

Also, improve documentation of static variables cs_bits and pindir.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1872 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoFix the --mainboard parameter that controls board enables.
stefanct [Sat, 24 Jan 2015 15:16:14 +0000 (15:16 +0000)]
Fix the --mainboard parameter that controls board enables.

We refactored board_match_name()/--mainboard handling in r1577 and
apparently broke it because since then we were always comparing to
the respective coreboot values of board and vendor names instead of
the user-supplied strings.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1871 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for Eon EN25P Series.
stefanct [Sat, 24 Jan 2015 15:06:27 +0000 (15:06 +0000)]
Add support for Eon EN25P Series.

These are very similar to Eon's EN25B series but unlike those the
EN25P has uniform sectors (of 32 and 64 kB). They can not be
distinguished by RDID alone but the RES and REMS IDs are different
and hence could be detected eventually in the future. This patch
also refines tiny bits of the EN25B series.

The series includes:
 - EN25P05
 - EN25P10
 - EN25P20
 - EN25P40
 - EN25P80
 - EN25P16
 - EN25P32
 - EN25P64

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1870 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAllow to easily build all optional modules.
stefanct [Mon, 19 Jan 2015 19:52:34 +0000 (19:52 +0000)]
Allow to easily build all optional modules.

This patch adds a CONFIG_EVERYTHING flag to the Makefile
that sets all CONFIG_* flags to "yes" if they were "no".

This provides a comfortable way to ensure maximum code exposure
to tools like coverity[0] or clang's scan-build.

[0] https://scan.coverity.com/projects/1020

Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://flashrom.org/flashrom/trunk@1869 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoFix support for Macronix MX25L6495F.
stefanct [Sat, 10 Jan 2015 15:59:54 +0000 (15:59 +0000)]
Fix support for Macronix MX25L6495F.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1868 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for Macronix MX25L6495F.
stefanct [Sat, 10 Jan 2015 09:33:14 +0000 (09:33 +0000)]
Add support for Macronix MX25L6495F.

This is based on the code sent to the flashrom mailing list
by Alex Lu (alexlu6@mxic.com.tw) without sign-off.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1867 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoRefinements for DragonflyBSD.
stefanct [Sat, 10 Jan 2015 09:33:06 +0000 (09:33 +0000)]
Refinements for DragonflyBSD.

 - /usr/include/cpu/param.h defines PAGE_MASK already, hence use another
   name for the respective macro in nicintel_eeprom.c.
 - Since DragonflyBSD 3.6 DPorts is used as the default package manager.
   Therefore we should use /usr/local/ instead of /usr/pkg/ on default
   to fetch libraries.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1866 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoRemove defaults for CC and AR.
stefanct [Sat, 10 Jan 2015 09:33:00 +0000 (09:33 +0000)]
Remove defaults for CC and AR.

AR defaults to "ar" anyway in GNU make and instead of gcc it is probably a
better idea to use just cc. The latter allows to build on freebsd 10 without
overriding CC or doing symlink tricks (because it uses clang as cc, provides
multiple gcc packages but only versioned binaries without any actual "gcc"
command name in the path).

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1865 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoUnify target OS and CPU architecture checks.
stefanct [Sat, 10 Jan 2015 09:32:50 +0000 (09:32 +0000)]
Unify target OS and CPU architecture checks.

We do CPU architecture checks once for the makefile in arch.h and
once for HW access abstraction in hwaccess.c. This patch unifies
related files so that they can share the checks to improve
maintainability and reduce the chance of inconsistencies.
Furthermore, it refines some of the definitions, which
 - adds "support" for AARCH64 and PPC64,
 - adds big-endian handling on arm as well as LE handling on PPC64,
 - fixes compilation of internal.c on AARCH64 and PPC64.

Additionally, this patch continues to unify all OS checks in
flashrom by adding a new helper macro IS_WINDOWS.

The old header file for architecture checking is renamed to platform.h
to reflect its broader scope and all new macros are add in there.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1864 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAllow to easily set a global path prefix for libraries and include files.
stefanct [Sat, 10 Jan 2015 09:32:44 +0000 (09:32 +0000)]
Allow to easily set a global path prefix for libraries and include files.

Gets rid of a few DOS-specific Makefile hacks.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1863 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoRefine revision handling.
stefanct [Sat, 10 Jan 2015 09:32:07 +0000 (09:32 +0000)]
Refine revision handling.

Up to now, when compiling flashrom outside a VCS it would print two
warnings that are not very clear to the user. This patch adds a new
auxilary function to getrevision.sh and uses it in the makefile to print a
single and more meaningful message to the user while hiding the
warnings from getrevision.sh.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1862 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoFix wrong density encoding on Intel Silvermont.
stefanct [Mon, 5 Jan 2015 23:00:14 +0000 (23:00 +0000)]
Fix wrong density encoding on Intel Silvermont.

Silvermont (Bay Trail, Rangeley, Avoton) seems to still use the old
density encoding with 3 bits per chip. Documentation is unavailable
(held concealed by Intel) but thanks to the efforts of Tai-Hong
(Type) Wu the layout is clear now. This patch is based on his one
but solves the issue differently thus reducing the code complexity.

Signed-off-by: Tai-Hong Wu <thwu@lunartoday.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1861 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for the MSTAR I2C ISP protocol.
stefanct [Sat, 20 Dec 2014 20:25:19 +0000 (20:25 +0000)]
Add support for the MSTAR I2C ISP protocol.

Basically, among other chips, MSTAR manufactures SoCs that equip TV sets
and computer screens, and it seems that all of their products use the
same in-system programming protocol. Basically, they use the DDC channel
of VGA or DVI connectors, which is actually an I2C bus, to encapsulate
SPI frames (the flash chip is connected to the SoC through an SPI bus).

I wrote this patch since the screen I bought had a software bug, and the
manufacturer only released a new firmware binary, but no tool or
instructions on flashing it.

More details can be found here:
http://boeglin.org/blog/index.php?entry=Flashing-a-BenQ-Z-series-for-free(dom)

I only read code from Linux kernel archives published by Acer to figure
out the protocol (for a touchscreen controller and an NFC chip, both by
MSTAR, that share the same ISP protocol), so I don't think there are
any legal problems with it.

Compilation is currently disabled by default in the Makefile.
If in doubt, additional Makefile bugs were added by Stefan.

Signed-off-by: Alexandre Boeglin <alex@boeglin.org>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1860 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoFix handling of write protection at register space address +2.
stefanct [Sat, 20 Dec 2014 16:45:31 +0000 (16:45 +0000)]
Fix handling of write protection at register space address +2.

Since r1833 we added the offset of the virtual register in several
functions, which produced segfaults. This patch renames a few
parameters and reorganizes/fixes various parts of the
changelock_regspace2_block() function - hence the rather big diff.

Thanks to Roman Lebedev for reporting this issue and testing numerous
revisions of this patch.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1859 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for Spansion S25FL127S.
stefanct [Fri, 12 Dec 2014 00:32:03 +0000 (00:32 +0000)]
Add support for Spansion S25FL127S.

This flash chip can be configured (one time) to use 64 KiB or 256 KiB sectors.
Additionally, in the 64 KiB mode it supports 16 4 KiB sub-sectors that can be
(one time) programmed to be on the top or bottom of the device. The sub-sectors
can be erased with the 0x20 opcode but because this opcode does not work
with the remaining sectors and flashrom can not cope with that the 0x20
opcode is not supported yet.

This patch adds two definitions, one for the 64 KiB and 256 KiB configuration
respectively. The device also shares the RDID with the various S25FL128
devices so we have to increase the maximum number of successfully probed
chips to 8.

The 64 KiB mode was tested on real hardware.

Signed-off-by: Jernej Škrabec <jernej.skrabec@planet.si>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1858 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for Eon EN29LV040 and EN29LV040A.
stefanct [Sun, 7 Dec 2014 21:57:53 +0000 (21:57 +0000)]
Add support for Eon EN29LV040 and EN29LV040A.

Both use the same ID and are mostly identical.

Tested-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1857 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd support for Intel 82599 10 GbE NICs.
stefanct [Fri, 5 Dec 2014 22:56:13 +0000 (22:56 +0000)]
Add support for Intel 82599 10 GbE NICs.

The Intel 82599 series of 10 GbE controllers has a bit-banged SPI
interface that's register-compatible with the one in the 1 GbE
controllers, except the register addresses are shifted up by
0x10000, cf. Intel document 331520:
http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/82599-10-gbe-controller-datasheet.pdf

This patch was tested with a board that has the 0x10fc device and a Micron
M25P40 SPI flash chip. The PCI IDs and names for the devices are per Intel document 331521
https://www-ssl.intel.com/content/dam/www/public/us/en/documents/specification-updates/82599-10-gbe-controller-spec-update.pdf
and the PCI SIG device ID registry with small refinements.

Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1856 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoAdd board enable for GIGABYTE GA-8SIMLFS 2.0.
stefanct [Sun, 30 Nov 2014 22:31:12 +0000 (22:31 +0000)]
Add board enable for GIGABYTE GA-8SIMLFS 2.0.

This board was used/sold by Fujitsu. The board enabled was tested (sadly
with the wrong image, i.e. one of the GA-8SIMLH images directly from
GIGABYTE instead of one from Fujitsu).

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1855 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agocbtable.c: Do not unnecessarily duplicate strings.
stefanct [Sat, 1 Nov 2014 23:12:33 +0000 (23:12 +0000)]
cbtable.c: Do not unnecessarily duplicate strings.

The strdup calls were a leftover that slipped through the cleanup in
r1577.

Found-by: Valgrind 3.10.0
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1854 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agoMove strtok_r implementation verbatim to helpers.c.
stefanct [Sat, 1 Nov 2014 22:56:06 +0000 (22:56 +0000)]
Move strtok_r implementation verbatim to helpers.c.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1853 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

3 years agodmi.c: make sure we call isprint() correctly.
stefanct [Sun, 19 Oct 2014 07:54:27 +0000 (07:54 +0000)]
dmi.c: make sure we call isprint() correctly.

ISO C and POSIX require to call ctype functions with values representable
by unsigned char. We have used a char as input so far which might be
negative and hence get sign-extended.

Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
git-svn-id: svn://flashrom.org/flashrom/trunk@1852 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1