1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

1911 Commits

Author SHA1 Message Date
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
Roman Titov
95edc89a94 Add support for more GigaDevice GD25LQ chips
Namely GD25LQ40, GD25LQ80, GD25LQ16, GD25LQ64(B), GD25LQ128.

Corresponding to flashrom svn r1889.

Signed-off-by: Roman Titov <titovroman@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-04-03 21:29:04 +00:00
Stefan Tauner
f4651f612b Increase flashrom version number to 0.9.8
Corresponding to flashrom svn r1887.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
v0.9.8
2015-03-01 22:05:16 +00:00
Stefan Tauner
74dc73f690 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.

Corresponding to flashrom svn r1886.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-03-01 22:04:38 +00:00
Stefan Tauner
adadca66f2 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.

Corresponding to flashrom svn r1885.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Alexandre Boeglin <alex@boeglin.org>
2015-02-18 23:28:30 +00:00
Stefan Tauner
400b3adc8a Increase flashrom version number to 0.9.8-rc1
Corresponding to flashrom svn r1883.

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>
v0.9.8-rc1
2015-02-11 22:21:03 +00:00
Stefan Tauner
fb2d77cbaf Add support for SPARC (maybe)
Was implemented by SPARC newbies, does (cross-)compile but is not run-tested.

Corresponding to flashrom svn r1882.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2015-02-10 08:03:10 +00:00
Justin Chevrier
66e554bc88 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

Corresponding to flashrom svn r1881.

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>
2015-02-08 21:58:10 +00:00
Stefan Tauner
5673450316 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).

Corresponding to flashrom svn r1880.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-02-08 21:58:04 +00:00
Stefan Tauner
5c316f9549 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.

Corresponding to flashrom svn r1879.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-02-08 21:57:52 +00:00
Stefan Tauner
dc62793184 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.

Corresponding to flashrom svn r1878.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2015-01-27 18:07:50 +00:00
Stefan Tauner
0cbd8c2558 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.

Corresponding to flashrom svn r1877.

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>
2015-01-26 22:06:04 +00:00
Stefan Tauner
e37735a994 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.

Corresponding to flashrom svn r1876.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2015-01-26 22:03:35 +00:00
Stefan Tauner
5d1ad35275 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).

Corresponding to flashrom svn r1875.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-25 23:57:08 +00:00
Stefan Tauner
3e6b7bb948 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.

Corresponding to flashrom svn r1874.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-25 23:45:14 +00:00
Stefan Tauner
05151b6dcb 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.

Corresponding to flashrom svn r1873.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-25 23:42:57 +00:00
Antony Pavlov
b4dd40c5da ft2232_spi.c: use constants from ftdi.h instead of magic numbers
Also, improve documentation of static variables cs_bits and pindir.

Corresponding to flashrom svn r1872.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-25 03:52:47 +00:00
Stefan Tauner
57f276f208 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.

Corresponding to flashrom svn r1871.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-24 15:16:14 +00:00
Stefan Tauner
b175af5cb7 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

Corresponding to flashrom svn r1870.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-24 15:06:27 +00:00
Patrick Georgi
ced7ab66cf 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

Corresponding to flashrom svn r1869.

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>
2015-01-19 19:52:34 +00:00
Stefan Tauner
a4617f7aed Fix support for Macronix MX25L6495F
Corresponding to flashrom svn r1868.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-10 15:59:54 +00:00
Stefan Tauner
40bc96fca2 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.

Corresponding to flashrom svn r1867.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-10 09:33:14 +00:00
Stefan Tauner
8d21ff1d63 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.

Corresponding to flashrom svn r1866.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-10 09:33:06 +00:00
Stefan Tauner
4c32af8999 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).

Corresponding to flashrom svn r1865.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-10 09:33:00 +00:00
Stefan Tauner
b0eee9b8d6 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.

Corresponding to flashrom svn r1864.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-10 09:32:50 +00:00
Stefan Tauner
be62d3fc07 Allow to easily set a global path prefix for libraries and include files
Gets rid of a few DOS-specific Makefile hacks.

Corresponding to flashrom svn r1863.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-10 09:32:44 +00:00
Stefan Tauner
d5ff845545 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.

Corresponding to flashrom svn r1862.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2015-01-10 09:32:07 +00:00
Tai-Hong Wu
60dead4aee 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.

Corresponding to flashrom svn r1861.

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>
2015-01-05 23:00:14 +00:00
Alexandre Boeglin
80e6471588 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.

Corresponding to flashrom svn r1860.

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>
2014-12-20 20:25:19 +00:00
Stefan Tauner
5859ced80f 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.

Corresponding to flashrom svn r1859.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2014-12-20 16:45:31 +00:00
Jernej Škrabec
e814a9b6e8 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.

Corresponding to flashrom svn r1858.

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>
2014-12-12 00:32:03 +00:00
Denis 'GNUtoo' Carikli
b5f9d5c402 Add support for Eon EN29LV040 and EN29LV040A
Both use the same ID and are mostly identical.

Corresponding to flashrom svn r1857.

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>
2014-12-07 21:57:53 +00:00
Ed Swierk
33180dfb39 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.

Corresponding to flashrom svn r1856.

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>
2014-12-05 22:56:13 +00:00
Stefan Tauner
7fbbbb80d2 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).

Corresponding to flashrom svn r1855.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2014-11-30 22:31:12 +00:00
Paul Menzel
592d99c98f 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

Corresponding to flashrom svn r1854.

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2014-11-01 23:12:33 +00:00
Stefan Tauner
b41d847d72 Move strtok_r implementation verbatim to helpers.c
Corresponding to flashrom svn r1853.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2014-11-01 22:56:06 +00:00
Stefan Tauner
ff9e6c32c3 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.

Corresponding to flashrom svn r1852.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2014-10-19 07:54:27 +00:00