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

2210 Commits

Author SHA1 Message Date
Subrata Banik
431a88dcbe ichspi: Unify timeouts across all SPI operations to 30s
Note: This patch was backported from the master branch and it was
modified so that it can be applied on the 1.1.x branch.

`ich_hwseq_wait_for_cycle_complete()` drops taking `timeout` as argument
in favor of a fixed timeout of `30 seconds` for any given SPI operation
as recommended by the SPI programming guide.

Document: Alder Lake-P Client Platform SPI Programming Guide
          Rev 1.30 (supporting document for multi-master accessing the
                    SPI Flash device.)

Refer to below section to understand the problem in more detail and SPI
operation timeout recommendation from Intel in multi-master
scenarios.

On Intel Chipsets that support multi-mastering access of the SPI flash
may run into a timeout failure when the operation initiated from a
single master just follows the SPI operational timeout recommendation
as per the vendor datasheet (example: winbond spiflash W25Q256JV-DTR
specification, table 9.7).

In the multi-master SPI accessing scenario using hardware sequencing
operation, it's impossible to know the actual status of the SPI bus
prior to individual master starting the operation (SPI Cycle In Progress
a.k.a SCIP bit represents the status of SPI operation on individual
master).

Thus, any SPI operation triggered in multi-master environment might need
to account a worst case scenario where the most time consuming operation
might have occupied the SPI bus from a master and an operation initiated
by another master just timed out.

Here is the timeout calculation for any hardware sequencing operation:
  Worst Case Operational Delay =
        (Maximum Time consumed by a SPI operation + Any marginal
	                 adjustment)

  Timeout Recommendation for Hardware Sequencing Operation =
        ((Worst Case Operational Delay) * (#No. Of SPI Master - 1) +
                        Current Operational latency)

Assume, on Intel platform with 6 SPI master like, Host CPU, CSE, EC,
GbE and other reserved etc, hence, the Timeout Calculation for SPI
erase Operation would look like as below:

  Maximum Time consumed by a SPI Operation =  5 seconds

  Worst Case Operational Delay = 5 seconds

  Timeout Recommendation for Hardware Seq Operation =
             5 seconds * (6 - 1) + 5 seconds = 30 seconds

BUG=b:223630977
TEST=Able to perform read/write/erase operation on PCH 600 series
chipset (board name: Brya).

Original-Signed-off-by: Subrata Banik <subratabanik@google.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/62867
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Change-Id: Ifa910dea794175d8ee2ad277549e5a0d69cba45b
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/68690
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
v1.1.1 v1.1.1-rc1
2022-10-30 09:43:30 +00:00
Felix Singer
919277fc68 Makefile: Fix dependencies for developerbox_spi
Note: This patch was backported from the master branch and it was
modified so that it can be applied on the 1.1.x branch.

The developerbox_spi programmer depends on bitbang SPI support. Thus,
fix that.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: Ic0fe589ffdccede0fbf6360c2bebe58a36654f10
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66096
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/68011
2022-10-06 01:01:01 +00:00
Angel Pons
e8c548c850 Replace freenode references
The flashrom project no longer uses freenode. To avoid having outdated
man pages in the future, the contact methods are now listed in the wiki.

Change-Id: I75e8f43c50dc4c3feede0250334a877cdaac8103
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56031
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/68061
2022-10-06 01:00:22 +00:00
Angel Pons
4b62efdccf print_wiki.c: Update mailing list reference
Change-Id: I5c67b5b3be2f306132d8565539bbf10477222026
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56030
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/68060
2022-10-06 01:00:19 +00:00
Nico Huber
d6a50cb8c7 pcidev: Always fetch ident info
As discovered earlier[1], the `vendor_id` and `device_id` fields are not
always automatically set. However, we use these fields throughout flash-
rom. To not lose track when we actually fetched them, let's always call
pci_fill_info(PCI_FILL_IDENT) before returning a `pci_dev` handle.

[1] Commit ca2e3bce0 (pcidev.c: populate IDs with pci_fill_info())

Backported to older versions where pcidev handling was much more
scattered.

Signed-off-by: Nico Huber <nico.h@gmx.de>
Change-Id: Iae2511178bec44343cbe902722fdca9eda036059
Ticket: https://ticket.coreboot.org/issues/367
Reviewed-on: https://review.coreboot.org/c/flashrom/+/64573
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67859
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:03:28 +00:00
Daniel Verkamp
bb83de61d1 pcidev.c: populate IDs with pci_fill_info()
With pciutils 3.7.0, flashrom is unable to match any PCI devices by
vendor/device ID because the vendor_id and device_id fields of struct
pci_dev are not filled in.

Call pci_fill_info() to request these identifiers before trying to match
them against the supported device list.

The pciutils ChangeLog for 3.7.0 mentions that the documentation and
back-end behavior for pci_fill_info() was updated; it seems that a call
to pci_fill_info() was always intended to be required, but some backends
(such as the sysfs one used on Linux) would fill the identifier fields
even when not requested by the user.  The pci_fill_info() function and
the PCI_FILL_IDENT flag have been available for all versions of pciutils
since at least 2.0 from 1999, so it should be safe to add without any
version checks.

With this change, reading/writing a nicintel_spi boot ROM is successful.

Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Change-Id: Ia011d4d801f8a54160e45a70b14b740e6dcc00ef
Reviewed-on: https://review.coreboot.org/c/flashrom/+/46310
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67858
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:03:23 +00:00
Nikolai Artemiev
cae8c73956 linux_mtd: check ioctl() return value properly
Make the linux_mtd driver treat any negative return value from the
MEMERASE ioctl as an error. Previously it only treated -1 as an error.

BUG=b:213561594,b:210973586,b:182223106
BRANCH=none
TEST=builds

Change-Id: I40cfbdee2ab608fbe6c17d9cac6ec53ff224d9a4
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/60996
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67857
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:03:18 +00:00
Michael Niewöhner
48a629e59d flashrom.8: add missing entry for --flash-contents
Change-Id: I64a8200a86329bd26a2069c5dc39430de9f8ba09
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/57807
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67856
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:02:58 +00:00
Marc Schink
da00f265cb jlink_spi: Reduce transfer size
The maximum transfer size is too large for some devices and
results in an USB timeout.

Change-Id: If2c00b1524ec56740bdfe290096c3546cf375d73
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/48379
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Miklós Márton <martonmiklosqdev@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67855
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:02:52 +00:00
Douglas Anderson
5096333a67 linux_mtd: Disable buffering on the mtd device
We open the device node for the MTD device with this:
  dev_fp = fopen(dev_path, "r+")

In C fopen() is allowed to provide _buffered_ access to the file.
That means that the standard library is allowed to read ahead and/or
return cached data.  That's really not what we want for something like
this.  Let's turn it off.

This fixes a problem where flashrom would sometimes fail to "verify"
that it erased the flash.  The error message would look something like
this:

Erasing and writing flash chip... FAILED at 0x0000e220! Expected=0xff, Found=0xe9, failed byte count from 0x0000e200-0x0000e2ff: 0xdc
 failed byte count from 0x0000e000-0x0000efff: 0xffffffff
 ERASE_FAILED
FAILED!
Uh oh. Erase/write failed. Checking if anything changed.

After the failure I could read the flash device with a new invocation
of flashrom and I would see that, indeed, the erase had worked.

Tracing in the kernel showed that when the failure happened we saw a
pattern that looked like this:
* Read 0x0b00 bytes starting at 0x0000d000
* Read 0x1000 bytes starting at 0x0000db00
* Erase 0x1000 bytes starting at 0x0000e000

...and then there was _not_ a read after the erase.  It can be assumed
that, since userspace had already read 0xdb00 - 0xeaff that it was
looking at old buffered data after the erase.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Change-Id: I989afd83a33013b2756a0090d6b08245613215c6
Reviewed-on: https://review.coreboot.org/c/flashrom/+/50155
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67854
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:02:45 +00:00
Edward O'Callaghan
464edef34f chipset_enable.c: Validate physmap() return rcrb value
Validate the physical mapping in enable_flash_silvermont().

Change-Id: Icc5a799a06b3f310d9a191fa5eb99b255b20d79d
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/48225
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sam McNally <sammc@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67853
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:02:20 +00:00
Edward O'Callaghan
326dc91ceb chipset_enable.c: check return value from rphysmap() call
Port from the ChromiumOS fork of flashrom.

Change-Id: I8075fe5f80ac0da5280d2f0de6829ed3a2496476
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/46444
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sam McNally <sammc@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67852
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:02:06 +00:00
Angel Pons
ebaf0d423a it87spi.c: Prevent use-after-free bug
The memory for the `param` string is aliased by `dualbiosindex_suffix`.
Moreover, `errno` could have been modified by the call to `free()`.
Therefore, only free the former when there are no more uses of either.

Change-Id: I79f18f6077c77c0cbb8bfa431e17f9b079f11c95
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/46551
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67851
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:01:57 +00:00
Yuji Sasaki
3265bb2427 spi25: Debug flashrom crash when Write Protect is ON
When hardware write protect is applied, flashrom crashed and
generate coredump. spi_disable_blockprotect_generic() calls
flash->chip->printlock() method when disable was failed,
but this method is optional, can be NULL depends on type of
flashrom chip. NULL pointer check before call is added to
avoid crash.

BRANCH=none
BUG=b:129083894
TEST=Run on Mistral P2
(On CR50 console, run "wp disable")
flashrom --wp-range 0 0x400000
flashrom --wp-enable
(On CR50 console, run "wp enable")
flashrom -r /tmp/test.bin
Verify "Block protection could not be disabled!" is shown,
but flash read completes.
Signed-off-by: Yuji Sasaki <sasakiy@chromium.org>

Change-Id: I81094ab5f16a85871fc9869a2e285eddbbbdec4e
Reviewed-on: https://chromium-review.googlesource.com/1535140
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: SANTHOSH JANARDHANA HASSAN <sahassan@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/40468
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67850
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:01:51 +00:00
Jacob Garber
d43c299ca8 dummyflasher: Add error check for file read
Print an error message and return if the read from emu_persistent_image
fails.

Change-Id: Icd1a72f9171e547f2081ba4bc53834a17ef7fcab
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1403912
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34845
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67849
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:01:44 +00:00
Jacob Garber
ee65a0357e linux_spi: Use fgets() to read buffer size
Since fread() returns the number of bytes read, this currently will only
check for errors if it returns 0 (i.e. the file was empty). However, it
is possible for fread() to encounter an error after reading a few bytes,
which this doesn't catch. Fix this by using fgets() instead, which will
return NULL if EOF or an error is encountered, and is simpler anyway.

Change-Id: I4f37c70e97149b87c6344e63a57d11ddde7638c4
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1403824
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34848
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67848
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:01:37 +00:00
Jacob Creedon
06a344f8aa flashchips: Fix N25Q512 bulk erase
The N25Q is a stacked device, so it requires 0xC4 to perform a die
erase.

Signed-off-by: Jacob Creedon <jcreedon@google.com>
Change-Id: Ib408fbe5633abd8b657e3907142b997e88b33f84
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34489
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67847
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-09-29 17:01:32 +00:00
Elyes HAOUAS
3789ce9b63 pickit2_spi: Fix "dead" assignment
We never read the first 'ret'. Let's check the first 'ret'
and exit if it failed.

Also, print the version only when the command succeeded.

Backported to libusb-v0 version (checking for CMD_LENGTH
instead of 0 return value).

Found-by: scan-build 7.0.1-8
Change-Id: I4aac5e1f3bd0604b079e1fdd9b7f09f1f4fc2d7f
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34403
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67846
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-29 17:01:26 +00:00
Nico Huber
4f6aa94f00 dmi: Correctly check for ERROR_PTR
For the physmap*() functions, NULL is considered valid return value.
Fixes a segmentation fault when DMI tables can't be mapped.

Tested on intel/eblake board with broken coreboot.

Change-Id: Ic403c2940c2b91acbd113f0acfa3ce9ef6c6bb6c
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62613
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-03-07 16:44:51 +00:00
Jacob Garber
8c3de01548 tree: Make internal variables static
All these variables are only used in the files they are defined in, so
they can be made static.

(Backported as it untangles aliased global objects.)

Change-Id: I1e55138adef540e9d3a2237aa5b289cb338c0608
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33747
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62612
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-03-07 16:44:36 +00:00
Patrick Georgi
9d7d8006e2 test_build.sh: Move build test procedure to repository
Instead of hard coding the test procedure on qa.coreboot.org, allow
running a script in the repo instead. The server is already adapted
to do that, so once there's a test_build.sh file in the toplevel
directory, it's run in place of the default operation.

The content of this change mirrors the default operation exactly so
should serve as a good starting point.

The script is executed in an encapsulate[0] context with the workspace,
/tmp and $HOME/.ccache writable, everything else read-only and
network disabled.

It should return 0 on success, anything else on failure, as is normal
for UNIX processes.

[0] https://review.coreboot.org/cgit/encapsulate.git

(Backported minus the Meson support)

Change-Id: I37a8e925d1b283c3b8f87cb3d0f1ed8920f2cf95
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/46894
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62617
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: Nico Huber <nico.h@gmx.de>
2022-03-07 16:44:24 +00:00
Nico Huber
930660027d libflashrom: Add CPP guard to fix big-endian builds
Calm a compiler warning on big-endian builds about the unused static
flashrom_layout_parse_fmap(). The guard is ugly but gets the job done.
We should forbid endian-specific code in the future, I guess.

Change-Id: Id3f4a57e027f88cc469ed50312adddcc8af71a63
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33297
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
v1.1
2019-06-09 11:53:34 +00:00
Nico Huber
ac3772c7b5 Makefile: Also blacklist J-Link SPI for DOS
libjaylink will probably never be available.

Change-Id: Ie9222f82e16fe4c76fe7dd0f9aac7de6a862ab98
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33296
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Marc Schink <flashrom-dev@marcschink.de>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2019-06-08 20:46:21 +00:00
Nico Huber
9c78142964 Makefile: Blacklist Digilent SPI (using USB) for DOS
Change-Id: I9a7dd5a2afcd12dd247e1f5534db61b79d77525e
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33295
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2019-06-08 20:45:28 +00:00
Patrick Rudolph
620ceb0e8f usbdev: Only match requested USB devices
Don't use a device that has the same vendor ID, but a different
than requested product ID.

Fixes broken dediprog detection with TOMU in use.

Change-Id: I08c1c363ce2d6603e46efecc61d3910e02314fca
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/32892
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
v1.1-rc2
2019-06-03 12:01:40 +00:00
Nico Huber
dc5af547df dediprog: Disable 4BA completely
This is an interim solution. We'll have to enable 4BA step-by-step for
each dediprog protocol version.

Change-Id: I08efcbb09ab3499ef6902a698e9ce3d6232237c4
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/30386
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
v1.1-rc1
2019-04-02 16:55:43 +00:00
Nico Huber
3d7b1e3b5c Fix verification with sparse layouts
The full verification step was not accounting for sparse layouts.
Instead of the old contents, combine_image_by_layout() implicitly
assumed the new contents for unspecified regions.

Change-Id: I44e0cea621f2a3d4dc70fa7e93c52ed95e54014a
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/30370
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
2019-04-02 16:42:53 +00:00
Elyes HAOUAS
0cacb11c62 Remove trailing whitespace
Change-Id: I1ff9418bcf150558ce7c97fafa3a68e5fa59f11e
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/31227
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2019-03-04 15:46:25 +00:00
Arthur Heymans
1cf369fb59 layout.c: Remove unused variable
Change-Id: I0c0c085999a12987376d75825fcf43e788a55a4b
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/31243
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2019-03-04 15:45:13 +00:00
Nico Huber
ae24b8bfd3 layout: Add missing stdbool.h include
Change-Id: I9a413d491038b29c832011a738f3b49e029dcf6f
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/31013
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2019-03-04 15:34:31 +00:00
Nico Huber
6e61e0cf9c Fix erasing of unaligned regions
The erase (-E) feature is somehow a brute force method, but still, if we
are given a region to erase, we should make sure to restore surrounding
data if the erase block expands beyond the region.

It shares a lot of code with the write path. Though, experiments with
common functions have shown that it would make the whole function even
harder to read. Maybe we could add some abstraction if we ever need
similar code on a third path.

Change-Id: I5fc35310f0b090f218cd1d660e27fb39dd05c3c5
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/31068
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2019-03-04 15:01:59 +00:00
Richard Hughes
db7482bb72 Fix several -Wno-implicit-fallthrough warnings
GCC is picky about the comment being where the break should go.

Change-Id: I05db2fb34025fefe2c6ddd1274c8e45b7cc5a4b6
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/30406
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2019-02-11 23:50:12 +00:00
Richard Hughes
e2cbb12f22 Fix one more -Wmissing-field-initializers warning
Fixes:

    ichspi.c: In function ‘ich_init_spi’:
    ichspi.c:1707:9: warning: missing initializer for field ‘component’

Change-Id: Iee5728167963fece24822ad2e3ab7bd9d444b42c
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/31224
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2019-02-03 19:08:37 +00:00
Richard Hughes
84b453e4d4 Fix a trivial calloc warning
Change-Id: Id457c15555a6ca6333474601f92982446afa40ab
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/31223
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2019-02-03 19:08:33 +00:00
Richard Hughes
df49058227 Fix several -Wno-missing-field-initializers warnings
Change-Id: Ib4487d4c1a38fa8471fa1f9034604412e9d14cf7
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/30405
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2019-02-03 18:44:16 +00:00
Richard Hughes
93e1625f9f Fix several -Wold-style-declaration warnings
Change-Id: Iffe5e652779a13ee7f64696fb5df4a781fe9a632
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/30404
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2019-02-03 18:31:45 +00:00
Richard Hughes
d82be7b2be buspirate_spi: Fix a missing error check during _init()
Change-Id: I17c6737853bf311b3f7aa9bfb10b54ce19e95ecc
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/30407
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2019-01-05 16:26:01 +00:00
Richard Hughes
6eca76123c Fix a tiny memory leak in the CLI tool
Change-Id: Iec696cb15dcf437f08e1e4f2a5a1faa0df6fd081
Signed-off-by: Richard Hughes <richard@hughsie.com>
Reviewed-on: https://review.coreboot.org/c/30408
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2019-01-05 16:25:49 +00:00
Marc Schink
3578ec6a3d Add initial J-Link SPI programmer
Tested with SEGGER J-Link EDU, Flasher ARM and flash chip W25Q16.V.

Change-Id: Ie03a054a75457ec9e1cab36ea124bb53b10e8d7e
Signed-off-by: Marc Schink <flashrom-dev@marcschink.de>
Reviewed-on: https://review.coreboot.org/c/28087
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2019-01-05 16:25:04 +00:00
Nico Huber
9cecc7e25d linux_spi: Hardcode default spispeed of 2MHz
Leaving the `linux_spi` driver's unknown default is almost never what we
want and resulted in many support requests since Raspbian switched to a
default that is too high for most applications.

Change-Id: I9361b7c1a1ab8900a619b06e1dae14cd87eb56c2
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/30368
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2018-12-22 23:03:57 +00:00
Tristan Corrick
099c8b2d5f chipset_enable.c: Mark Intel C224 as DEP
Tested on a Supermicro X10SLM+-F. The flash chip has been read, written,
and erased many times without issue. Most boards with this chipset will
have the ME region locked, hence the selection of DEP.

Change-Id: I25126b94e691289a7b29dd81d5c864854a4e0245
Signed-off-by: Tristan Corrick <tristan@corrick.kiwi>
Reviewed-on: https://review.coreboot.org/c/30361
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2018-12-22 13:07:34 +00:00
Nico Huber
e7cbfae69e libflashrom.h: Add missing includes
<stddef.h> for `size_t` and <sys/types.h> for `off_t`.

Change-Id: Ifc84dfe2a06633321d0abd364bdea1216925a779
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/30153
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2018-12-21 13:37:03 +00:00
Nico Huber
ba72e91ec1 fmap: Fix length calculation in error message
Change-Id: Ie0f448970de6a7829f304448e0835eaeb7d103a3
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/30152
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2018-12-21 13:36:56 +00:00
Nico Huber
bbaa1719b1 dediprog: Fix small, unaligned reads
This never was a use case until now but the `--fmap` code makes it
obvious: Unaligned reads that were smaller than the `chunksize` here,
were extended without considering the length of the buffer read into.

With that fixed we run into the next problem: dediprog_spi_bulk_read()
shouldn't report an error when an empty read is unaligned.

Change-Id: Ie12b62499ebfdb467d5126c00d327c76077ddead
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/30051
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2018-12-06 15:47:35 +00:00
Angel Pons
7fb508dc13 chipset_enable.c: Mark Intel PM55 as DEP
Tested reading, writing and erasing the internal flash chip using an HP
Pavilion dv6-2125ef laptop with an Intel PM55 chipset. However, since
all ME-enabled chipsets are marked as DEP instead of OK, this one shall
follow suit as well.

Change-Id: I667ea970be11a35b480e0e7c69a1fdf9afa08762
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/29437
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-11-03 11:33:25 +00:00
Angel Pons
f2cd32570e flashchips: Add Sanyo LE25FU206/A and LE25FU106B
As per user `The_Raven Raven` on the mailing list. Since the added
values had some inconsistencies, the chips are marked as untested.

Change-Id: I6c26aafdca232110986334e85297d73d513600dc
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/28813
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-11-01 16:37:32 +00:00
Tristan Corrick
c4e9fd0abc chipset_enable.c: Mark Intel H81 as DEP
Tested on an ASRock H81M-HDS. The flash chip has been read, written, and
erased many times without issue. Most boards with this chipset will have
the ME region locked, hence the selection of DEP.

Change-Id: I30aae956b2851c741e59403f5e49b80b5ba7c5e4
Signed-off-by: Tristan Corrick <tristan@corrick.kiwi>
Reviewed-on: https://review.coreboot.org/29391
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-11-01 11:06:07 +00:00
David Hendricks
61818dc098 flashchips: Add IS25LP256 and IS25WP256
Tested IS25LP256 using Raspberry Pi and Dediprog SF600 programmers.
Tested IS25WP256 using Dediprog SF600.

Change-Id: Idf7a224abcde5f7935d9ef88309f78207de60a7a
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/29306
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-10-30 09:39:15 +00:00
David Hendricks
4987679d73 flashchips: Add W25Q256JV support
Similar to W25Q256FV, but it supports the native 4BA page program
instruction (12h). Note that the variant with QE enabled by default
shares the device ID of the W25Q256FV.

Tested using a Raspberry Pi.

Change-Id: I76d7362777d364594d2a733d7e478741b0bef7c4
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/29305
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2018-10-29 22:50:49 +00:00
Nico Huber
3a41e2a27e dmi: Remove nonsense guard; Makefile handles it
Change-Id: If4216be1f9ed308e4580c36d0356480e637ffc82
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/28715
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2018-10-23 21:15:53 +00:00