1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 23:43:42 +02:00

2676 Commits

Author SHA1 Message Date
Edward O'Callaghan
d3b6acffe4 Add writeprotect support infrastructure
The following just lays out the structure for write protect
manipulation of SPI flash chips in Flashrom. We later follow
up with adding support for each manufacturer group.

BUG=b:153800563
BRANCH=none
TEST=builds

Change-Id: Id93b5a1cb2da476fa8a7dde41d7b963024117474
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/40325
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-09-28 06:32:22 +00:00
Matt DeVillier
b1f858f65b Add support for Comet Lake-U/400-series PCH
Add enum CHIPSET_400_SERIES_COMET_POINT and treat it identically
to CHIPSET_300_SERIES_CANNON_POINT.

Add PCI IDs for Comet Lake, CML-U Premium and classify as CHIPSET_400_SERIES_COMET_POINT.

Test: read/write unlocked CML-U board

Change-Id: I43b4ad1eecfed16fec59863e46d4e997fbe45f1b
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44420
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by:  Felix Singer <felixsinger@posteo.net>
2020-09-24 10:47:28 +00:00
Edward O'Callaghan
cb9f3cd0a7 dummyflasher.c: Upstream ChromiumOS 'freq' param feature
This allows the dummyflasher to emulate a bus/chip frequency
by passing a delay parameter.

BUG=b:140394053
BRANCH=none
TEST=builds and ran with freq passed,
```
   └──╼ dd if=/dev/urandom of=/tmp/bar bs=2K count=1
   1+0 records in
   1+0 records out
   2048 bytes (2.0 kB, 2.0 KiB) copied, 0.000583308 s, 3.5 MB/s

   └──╼ ./flashrom -p dummy:image=/tmp/foo,bus=spi,freq=100Hz,size=2048,emulate=VARIABLE_SIZE -w /tmp/bar
   flashrom v1.2-105-g702c58a-dirty on Linux 5.7.10-1rodete2-amd64 (x86_64)
   flashrom is free software, get the source code at https://flashrom.org

   Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
   Found Generic flash chip "Variable Size SPI chip" (2 kB, SPI) on dummy.
   Reading old flash chip contents... done.
   Erasing and writing flash chip... Erase/write done.
   Verifying flash... VERIFIED.
```

Change-Id: I1c2702b9e0cae860f5f03114e307707d4d3219af
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/45461
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sam McNally <sammc@google.com>
2020-09-22 13:06:10 +00:00
Nikolai Artemiev
702c58a321 tests: Update licence headers
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Change-Id: Ia964279ace569b4b93f4e2919c1c228a9b621745
Reviewed-on: https://review.coreboot.org/c/flashrom/+/45438
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-09-17 00:48:04 +00:00
Patrick Georgi
0bb86017ad tests: Clear ID cache before trying to fetch chip ID a second time
Without that, the code never calls into spi_send_command (because
everything's known already) and so the expected return values are
never returned.

Change-Id: Iba6a56774ce5b51e0f7072b4600a9479cdabf8c7
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/45431
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-09-16 09:40:12 +00:00
Lachlan Bishop
3b8fe0f8e9 dummyflasher.c: Factor out global state
Moves global state into spi_master data.

BUGS=b:140394053

Change-Id: I972b085875f1277d9ff33326669d2676a3bcd3aa
Signed-off-by: Lachlan Bishop <lxb@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/45230
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-09-14 00:45:50 +00:00
Jonathan Zhang
95d822e342 allow 0x34 as ICCRIBA for CHIPSET_C620_SERIES_LEWISBURG
Intel C621A Lewisburg PCH belongs to C620 series, it has 0x34 as ICCRIBA.

Fix guess_ich_chipset_from_content() accordingly.

Print status info of read_ich_descriptors_from_dump() to facilitate
debugging upon failure.

TESTED=run flashrom successfully from OCP Yosemite V3 DeltaLake server.

Change-Id: I363aaccfb90e0a127c0f0bb0072e9e85c210b669
Signed-off-by: Jonathan Zhang <jonzhang@fb.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44621
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-09-10 04:43:30 +00:00
Namyoon Woo
79da18f869 support 4-byte address format for VARIABLE_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIABLE_SIZE
dummy flash device, so that it can emulate an flash size larger than
16 MBytes.
- assigned a feature bits FEATURE_4BA to VARIABLE_SIZE flash config.
- added codes handling two commands, JEDEC_READ_4BA and
JEDEC_BYTE_PROGRAM_4BA.
- changed blockeraser to use Chip-Erase command so that it can be
free from flash address byte format.

TEST=ran the command line below:
$ flashrom -p dummy:image=${TMP_FILE},size=33554432, \
emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f

$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \
emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f

$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \
emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f

Signed-off-by: Namyoon Woo <namyoon@google.com>
Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44881
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-09-07 00:54:16 +00:00
Namyoon Woo
84fc9e889d dummyflasher.c: Only write back emulated image if modified
When the image is not modified, there is no point in writing it back.
In fact we may not have file permissions to do so.

Signed-off-by: Namyoon Woo <namyoon@google.com>
Change-Id: I3bf2d7edb28a9a1e5406b67a88a0ee6e07db83e3
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44907
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-09-07 00:53:38 +00:00
Namyoon Woo
3149822cd4 support variable-size SPI chip for dummy programmer
This is designed for firmware updater to pack firmware image
preserving some specific partitions in any size.

BUG=none
TEST=ran the command line below:
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \
emulate=VARIABLE_SIZE -w ${IMG} -V -f

$ flashrom -p dummy:image=${TMP_FILE},size=auto, \
emulate=VARIABLE_SIZE -w ${IMG} -V -f

Signed-off-by: Namyoon Woo <namyoon@google.com>
Change-Id: Iff266e151459561b126ecfd1c47420b385be1db2
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44879
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-09-07 00:52:34 +00:00
Jacob Garber
0e787b2e79 chipset_enable: Mark Intel Q77 as DEP
Tested reading and writing internal flash on Dell Optiplex 9010 SFF.

Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Change-Id: I4717959be1b79aa986f1276589d01ce7475bda8f
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44910
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2020-08-29 10:10:04 +00:00
Jonathan Zhang
f33f1a1179 add PCI IDs for additional c620 series PCH chips
Add PCI IDs for C621A, C627A and C629A.

Change-Id: I636becd9f08bdf604c6af81ce396049655353b04
Signed-off-by: Jonathan Zhang <jonzhang@fb.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44620
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-08-27 20:30:09 +00:00
Edward O'Callaghan
3b12945835 spi: Allow cached ID bytes to be cleared
This does two things:
1. Removes the static variables from various ID functions and moves
   them to a single struct.
2. Adds a function to clear the struct.

The idea of the original caching mechanism introduced years ago was
simply to speed up probe_flash() by not issuing the same read ID
commands dozens or hundreds of times for a single chip.

That implementation assumed that we would only call probe_flash()
once. However, there are cases when we want to call probe_flash()
multiple times, for example, if using an external programmer and
using different voltages (for probing the chip).

This patch is extremely similar to the original works of:
 `commit 57b7524b1448189d3630d6c4735e60dbbdf14d51`.
 Author: David Hendricks <dhendrix@chromium.org>
&&
 `commit 7f7c711ee1a41649607f81f1533e5135fc1361fc`.
 Author: David Hendricks <dhendrix@chromium.org>

BUG=b:15656443
BRANCH=none
TEST=none

Change-Id: I879cb08dbe66db9ab0c3b8a7f93b04fe1c5980f4
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41399
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2020-08-26 08:35:28 +00:00
Edward O'Callaghan
a2dc4f7faf spi25.c: Factor out rdid_get_ids() and compare_id()
This is in preparation for implementing a cache for the
probe results of RDID and REMS (3&4-byte variant) commands.
The intention is to make probing of SPI rom's slightly
faster, a few 10's of ms dependant upon the spi master used.

BUG=b:15656443
BRANCH=none
TEST=builds

Change-Id: I1556e97a7c70425069e3d1dc0d5daf0aeec4e7bf
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41398
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2020-08-26 08:34:01 +00:00
Luka Kovacic
8f18e811e5 chipset_enable.c: Add support for Intel C620 Series Chipset SPI Controller
Support for the Intel C620 Series Chipset SPI Controller (rev 04) is added
to enable SPI flash access on the following platform:

- Intel Xeon D-2187NT

Support for this controller was shortly tested on the platform above.
The flash is recognized, some regions of the flash are locked.

Signed-off-by: Luka Kovacic <luka.kovacic@sartura.hr>
Tested-by: Jakov Petrina <jakov.petrina@sartura.hr>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Change-Id: If39d9bb1acd4029f802a44a2940dd23f66ba09b1
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44162
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-08-25 17:58:37 +00:00
Pyry Kontio
da6b3b70cb Makefile: Fix building on AArch64 NixOS
The parsing of the output of archtest.c produced an unexpected
value on AArch64 NixOS. For example, the make variable ARCH was set to:

```
bit outside of fd_set selected
arm
```

This made the arch and OS checks fail.

This commit simplifies the parsing, making it more robust.

The C files archtest.c, endiantest.c and os.h used to set the
TARGET_OS, ARCH and ENDIAN variables, respectively, output
the result of the test as the final line, so just extracting
the final line and removing double quoting is enough.

This commit also fixes a bug with debug_shell lacking escaping
single quotes, which prevented using the single quote in the
debug_shell calls. It used to work by accident before this fix;
the line in the call happened to contain a balanced pair of double
quotes and lacked other characters that needed escaping, which
didn't break the debug_shell, but this was accidental and very
brittle.

Signed-off-by: Pyry Kontio <pyry.kontio@drasa.eu>
Change-Id: Iaa4477a71e758cf9ecad2c22f3b77bc6508a3510
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43140
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-08-24 10:36:52 +00:00
Victor Ding
821e44cb4d Add MEC1308 EC programmer
Initial support of Microchip MEC1308 Embedded Controller.

BUG=b:156144893
BRANCH=none

Signed-off-by: Victor Ding <victording@google.com>
Change-Id: I2d51b4bdc0b38b6e488e71b9e774eb6232a2069e
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44541
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-08-20 11:11:35 +00:00
Victor Ding
436b4155b1 Add ENE LPC programmer
Initial support of ENE LPC interface keyboard controller.

BUG=b:156140422
BRANCH=none

Signed-off-by: Victor Ding <victording@google.com>
Change-Id: I970afd8c1bd92c159c60e09f22e2f18c0433729d
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44580
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-08-20 10:10:22 +00:00
David Hendricks
22cd31674d flashchips: Add W25Q256JW_DTR
W25Q256JW currently has two variants, the W25Q256JW with device
ID 0x6019 added in commit be4682d and the W25Q256JW_DTR (aka
W25Q256JW-IM) with device ID 0x8019 added by this patch.

Winbond W25Q256-series chips have a few device IDs:
0x4019: W25Q256FV
0x6019: W25Q256JW
0x7019: W25Q256JV
0x8019: W25Q256JW_DTR

Hence we need to be more specific with naming than usual to avoid a
false positive with wildcards.

Change-Id: I50a6de2c915f9201c458378fcc49130ead73d8c4
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42386
Reviewed-by: Simon Buhrow
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-08-19 05:12:38 +00:00
Steve Markgraf
f82dd300e3 flashchips: Add support for Macronix MX25L5121E
Tested with ch341a_spi.

Change-Id: I881e2cda938083ba271b2ee0c457d2bbd8e1a766
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43416
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-08-04 22:26:08 +00:00
Richard Hughes
f88174f4fd meson: Do not compile with -DSTANDALONE
This enables the -o option which is used to collect logs for debugging.

Change-Id: If6c12c682ba72cd519e30f1f8c96552322ff75e3
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42230
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2020-08-04 22:20:27 +00:00
Nikolai Artemiev
9e440caa83 ft2232_spi.c: align with Chrome OS flashrom
Brings over various changes:
- Use DIS_DIV_5 constant
- Update some comments
- Wrap long lines

Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Change-Id: I24c20e9b5d7e661d0180699bbd0d1447f6bf816f
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42796
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-08-04 22:09:40 +00:00
Miklós Márton
47143bc9a5 stlinkv3_spi.c: Improve printed messages
Add missing line ends, and add a note about the first version of the
updater which contains the necessary V3 bridge feature.

Change-Id: Ib45efa37b192489bdfe26f1f0fd1d81035a08c70
Signed-off-by: Miklós Márton <martonmiklosqdev@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43900
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-08-04 13:15:28 +00:00
Jacob Appelbaum
f4eeefd8ab Add support for Winbond W25X05CL
This commit adds support for the Winbond W25X05CL SPI flash chip.  The
Winbond W25X05CL is a 512Kib (64 KiB) SPI flash chip with 4KiB sectors.
I have tested this patch with a Bus Pirate (v3b) and an in-circuit W25X05CL
flash chip using a test clip. Reading, erasing, and writing all function
as expected.

Change-Id: I19c33c7da374f0263f30577a10a0f0f1afa4febc
Signed-off-by: Jacob Appelbaum <jacob@appelbaum.net>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43573
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-26 09:16:20 +00:00
Rosen Penev
e410164d11 meson: fix compilation under uClibc-ng
fileno requires _POSIX_C_SOURCE to only be defined.

nanosleep requires _POSIX_C_SOURCE to be defined to 199309L.

strndup requires _POSIX_C_SOURCE to be defined to 200809L.

Change-Id: Idb80937bb78e173eb03f2a0c0cdd8925fcd7bfa1
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43599
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-21 04:55:01 +00:00
David Hendricks
0c65b5048d endiantest: Fix #if expression
Without this, `gcc -E endiantest.c` can fail and return the incorrect
endiannes as well as exiting with non-zero. Here is the actual error
shown in the output:

endiantest.c:2:31: error: #if with no expression
 #if __FLASHROM_LITTLE_ENDIAN__

I was able to reproduce this using gcc-6.3.0 and clang-4.0.1, but
newer compilers didn't have this issue.

Change-Id: Iba2febd861471ec821a494336e800c2564984332
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43598
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-21 04:46:24 +00:00
Mary Ruthven
c66d5f8cb3 raiden_debug_spi: add param for a custom reset setup
GSC firmware asserts EC_RST_L before programming the AP with
raiden_debug:target=AP.Some Chromium devices don't power the AP flash
 when the EC is in reset. These boards can't flash the AP with the
current CCD behavior. This change adds a custom_rst raiden_debug param
to tell Cr50 not to assert EC_RST_L or touch any reset signals while
flashing the AP. Users will need to configure the reset signals before
running the flashrom command.

BUG=b:154885210
BRANCH=none
TEST=manual

	flashrom -p raiden_debug:target=EC -r ec.bin

	flashrom -p raiden_debug:target=AP -r ap.bin

	flashrom -p raiden_debug:target=AP,custom_rst=true -r ap.bin

	flashrom -p raiden_debug:target=AP,custom_rst=inv -r ap.bin

	flashrom -p raiden_debug -r base.bin

Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Change-Id: I2da26469120c5304bc129b5578fcb7ca805fc1d1
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43527
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-21 01:48:16 +00:00
Mary Ruthven
caf56e7ac9 raiden_debug_spi: add missing USB_SPI requests
Add the missing USB_SPI requests from platform/cr50

BUG=none
BRANCH=none
TEST=none

Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Change-Id: I49c0c28566ed36af6fa03e23a878d19462c55f70
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43525
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Brian Nemec <bnemec@google.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-07-21 01:47:45 +00:00
Brian J. Nemec
2cb1f333c8 raiden_debug_spi.c: Add support for USB SPI protocol V2
Add support for the USB SPI V2 protocol and its documentation.
The protocol version number uses the bInterfaceProtocol field in
USB to identify which device to use, this enables us to support
both V1 and V2 with the same host.

The USB SPI V2 protocol adds the ability to perform multi-packet
USB SPI transfers. This results in fewer USB messages exchanged,
larger SPI transfers, and faster flashing speeds.

BUG=b:139058552
BRANCH=none
TEST=Manual testing of ServoMicro and Flashrom when performing
    reads, writes, and verification of the EC firmware on Nami
    with a USB SPI V1 protocol device
TEST=Manual testing of ServoMicro and Flashrom when performing
    reads, writes, and verification of the EC firmware on Nami
    with a USB SPI V2 protocol device
TEST=Builds

Signed-off-by: Brian J. Nemec <bnemec@chromium.com>
Change-Id: Ie356c63b521c0cc11a4946ffac128ec7139f0bec
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41533
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-21 00:41:12 +00:00
Brian J. Nemec
a7b526d92b raiden_debug_spi.c: Add protocol based configuration to init
Add a configuration stage to the initialization. This enables
us to dynamically set the maximum SPI write and read limits
based on the device we are connected to and switch the command
function. These changes will enable us to have larger SPI
transfers in protocol V2 and separate out the logic flow used
for the different protocols.

BUG=b:139058552
BRANCH=none
TEST=Manual testing of ServoMicro and Flashrom when performing
    reads, writes, and verification of the EC firmware on Nami.
TEST=Builds

Signed-off-by: Brian J. Nemec <bnemec@chromium.com>
Change-Id: Id404af14e55fa0884e29f28880206aaad4deba66
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41532
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-21 00:39:35 +00:00
Brian J. Nemec
7ac57c77be raiden_debug_spi.c: Add USB context states and helper functions
Add context states to handle the USB packets, these allow us to
simplify the process of loading data from the transmit buffer
into a USB packets' data section and from a USB packet to it's
receive buffers. These will also keep track of the size of the USB
packet allowing a simpler interface to transmit them.

Helper functions have been added to help with copying data between
the transmit and receive context states to and from the USB packets.

BUG=b:139058552
BRANCH=none
TEST=Manual testing of ServoMicro and Flashrom when performing
    reads, writes, and verification of the EC firmware on Nami.
TEST=Builds

Signed-off-by: Brian J. Nemec <bnemec@chromium.com>
Change-Id: Id7b598b39923b4b8c1b6905e5d5c5a2be4078f96
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43550
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-07-20 23:51:03 +00:00
Brian J. Nemec
ce80d18973 raiden_debug_spi.c: Add transfer context states
Add context states to handle the read and write buffers as transmit
and receive states. These are used to keep track of the number of
bytes transmitted and received allowing future support of multi-packet
messages in the v2 protocol and easier integration with a unified USB
packet context.

BUG=b:139058552
BRANCH=none
TEST=Manual testing of ServoMicro and Flashrom when performing
    reads, writes, and verification of the EC firmware on Nami.
TEST=Builds

Signed-off-by: Brian J. Nemec <bnemec@chromium.com>
Change-Id: Ic6eea82ffc604ec56278f7aaa0deafe0cf75973c
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41608
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-20 04:49:20 +00:00
Brian J. Nemec
7a88780e92 raiden_debug_spi.c: Clean up the USB SPI protocol
Perform some clean up the USB SPI protocol 1 prior to adding
protocol 2 to improve consistency and correct minor issues.

* Minor clean up the comments descriptor for the protocol.
  This adds the location of another relevant file, corrects the
  omission of one of the protocol modes, makes the direction
  of the packets explicit, and minor formatting changes.

* Fix typos in constants associated with the retry mechanism.

* Clean declarations to match the EC code formats.

* Updates the error message formatting so protocol V1 closely
  matches the V2 protocol for consistency.

* Minor changes to the structure, moving validation of the
  arguments earlier in the transfer. Overall to keep V1 and
  V2 closer aligned and reduce future changes in the V1 code.

BUG=b:139058552
BRANCH=none
TEST=Builds

Signed-off-by: Brian J. Nemec <bnemec@chromium.com>
Change-Id: I17e62dabee2724eecf8d5a1a7827f06f0c7514df
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41597
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-20 04:48:10 +00:00
Brian J. Nemec
bd9b4b6d8d raiden_debug_spi.c: Rename Protocol V1 specific fields
Rename the structures from the USB SPI which are specific
to the V1 protocol.

BUG=b:139058552
BRANCH=none
TEST=Builds

Signed-off-by: Brian J. Nemec <bnemec@chromium.com>
Change-Id: I70b43af50d872d850dae287d99bcd768107a1cad
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41596
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-07-20 04:47:13 +00:00
Edward O'Callaghan
75cb187b48 ichspi.c: Make ich_init_spi() parameteric on spibar
The ich_init_spi() function takes spibar as a parameter
and sets the global ich_spibar with it but then uses the
global symbol instead of using the parameter directly.

Change-Id: Id809c33d8a4074acbee8e1cd8e3b7b00ce0cb3ec
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43506
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-16 22:30:08 +00:00
Edward O'Callaghan
68ba2ad6e0 ichspi.c: Make pprinters parametric on ich_generation
Make the two prettyprint functions pure by taking the
ich_generation value as a function parameter over a global
variable:

 * prettyprint_ich9_reg_hsfs()
 * prettyprint_ich9_reg_hsfc()

Change-Id: I5d4fb012c6b9b843ac30c1fe2ea6fe754c545a43
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43501
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-16 22:28:25 +00:00
Edward O'Callaghan
4c9b416379 ichspi.c: Make ich_set_bbar() parameteric on ich_generation
Work towards dropping ich_generation global usage and make
the ich_set_bbar() function pure.

Change-Id: I6da6dccb413cbafa2fbaca213574f22c7a258139
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43500
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-16 22:26:20 +00:00
Edward O'Callaghan
556fe8d53d ichspi.c: Make ich_init_opcodes() parameteric on ich_generation
Work towards dropping ich_generation global usage and make
the ich_init_opcodes() function pure.

Change-Id: I68cc078cc8bc1c772f52ca3e5e12559991180210
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43499
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-16 22:26:03 +00:00
Edward O'Callaghan
2ffc1e485b ichspi.c: Make ich_init_spi() parametric on ich_generation
Work towards dropping ich_generation global usage and make
the ich_init_spi() function more pure.

Change-Id: I5293e7ae6f20a2299577172655c2926861091f5a
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43498
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-16 22:25:42 +00:00
Richard Hughes
7aea04f709 Install the man file when using meson as a buildsystem
This fixes a regression with the Fedora package.

Change-Id: I881bd5002a842072ce9dadea033c51a2668f9e7c
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/38939
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-15 12:27:40 +00:00
Jan Samek
62027c8e37 chipset_enable: add PCI ID for APL-I (Broxton)
Change-Id: I48dba541b5893551f47f3d5ed422eb1dc36f5324
Signed-off-by: Jan Samek <jan.samek@siemens.com>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42805
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-10 15:12:12 +00:00
David Hendricks
174a0c1b40 serial: Fix file read/write error handling for Windows
File read/write semantics are different between POSIX and Windows. In
particular Windows file read/write functions return a boolean type to
indicate success or failure, while the POSIX equivalents return a
signed integer indicating number of bytes read if successful or -1 if
not.

This attempts to correct some error handling paths for Windows and
avoid invalid comparisons that were causing compilation issues.

Reported on https://github.com/flashrom/flashrom/issues/149

Change-Id: Ib179d51ede2dbd38f54f3641bfe90340a6a87e31
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43051
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-07 14:02:02 +00:00
David Hendricks
9b6fb745c2 dediprog: Correct REQTYPE_OTHER_OUT macro
It's not used anywhere, but it should be correct if we continue to
keep it in.

Change-Id: I8a6941c2906dda2c5aac5e0af3364fd2ac5773f3
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42763
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-06-24 19:25:34 +00:00
David Hendricks
17d463718d tree: Remove unneeded semicolons after loops
Trivial cleanup

Change-Id: Id93a019a39b765c70b1a4eaeb25d9b582c3e4141
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42742
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-06-24 19:24:57 +00:00
David Hendricks
3c720597c3 mysteries_intel: Add a section for software vs hardware sequencing
This attempts to explain software sequencing, hardware sequencing,
and the "Opaque flash chip".

Change-Id: I2445e926aad96060f26d0bc55dd7642c1a404296
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42485
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-06-20 20:11:09 +00:00
Edward O'Callaghan
76d2445d39 tests/spi25.c: Add unit-test coverage of spi95.c
Add spi95.c unit-tests to spi25.c to avoid some clutter.

BUG=b:157280555
BRANCH=none
TEST=builds

Change-Id: I6de59451b82131b58114b268ff6dd0b18cd5952b
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41656
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-06-17 11:08:30 +00:00
Edward O'Callaghan
3cc70c25f9 tests/: Add helper.c unit tests
BUG=b:157280555
BRANCH=none
TEST=builds

Change-Id: If4a1fe7c499f51bb9d7cd48ef26caf9dfae3c1fa
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41655
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-06-17 11:08:06 +00:00
Edward O'Callaghan
629b8f06ec tests/: Add flashrom.c unit tests
BUG=b:157280555
BRANCH=none
TEST=builds

Change-Id: I2d9213f98c6c9639f2417466ba4895117e8d600a
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41646
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-06-17 11:07:35 +00:00
el-coderon
be4682dc44 flashchips: Add W25Q256.W
Nicklas Lennert wrote me via the flashrom mailing list that
he successfully ran read, write and verify cmd.

Signed-off-by: Simon Buhrow <simon.buhrow@posteo.de>
Change-Id: I3608945a38b5ed42b8b2b9b2b388cdea97141d7b
Reviewed-on: https://review.coreboot.org/c/flashrom/+/40855
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2020-06-16 17:05:47 +00:00
Edward O'Callaghan
41f48c75a2 tests/: Add spi25.c unit tests
BUG=b:157280555
BRANCH=none
TEST=builds

Change-Id: I47112952835ce2c4c773a9d90379ff8ceefaaf9a
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41645
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2020-06-16 02:25:17 +00:00