Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67840 )
Change subject: spi25: Debug flashrom crash when Write Protect is ON
......................................................................
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(a)chromium.org>
Change-Id: I81094ab5f16a85871fc9869a2e285eddbbbdec4e
Reviewed-on: https://chromium-review.googlesource.com/1535140
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator(a)appspot.gserviceaccount.com>
Tested-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Stefan Reinauer <reinauer(a)google.com>
Reviewed-by: SANTHOSH JANARDHANA HASSAN <sahassan(a)google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/40468
Reviewed-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67840
Reviewed-by: Felix Singer <felixsinger(a)posteo.net>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Nikolai Artemiev <nartemiev(a)google.com>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
---
M spi25_statusreg.c
1 file changed, 43 insertions(+), 1 deletion(-)
Approvals:
build bot (Jenkins): Verified
Felix Singer: Looks good to me, approved
Angel Pons: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
Nikolai Artemiev: Looks good to me, but someone else must approve
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index 05c7acf..de629a9 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -186,7 +186,8 @@
status = spi_read_status_register(flash);
if ((status & bp_mask) != 0) {
msg_cerr("Block protection could not be disabled!\n");
- flash->chip->printlock(flash);
+ if (flash->chip->printlock)
+ flash->chip->printlock(flash);
return 1;
}
msg_cdbg("disabled.\n");
--
To view, visit https://review.coreboot.org/c/flashrom/+/67840
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-Change-Id: I81094ab5f16a85871fc9869a2e285eddbbbdec4e
Gerrit-Change-Number: 67840
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: SANTHOSH JANARDHANA HASSAN <sahassan(a)google.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Yuji Sasaki <sasakiy(a)chromium.org>
Gerrit-MessageType: merged
Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67838 )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: pickit2_spi: Fix "dead" assignment
......................................................................
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(a)noos.fr>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34403
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67838
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Felix Singer <felixsinger(a)posteo.net>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
---
M pickit2_spi.c
1 file changed, 32 insertions(+), 1 deletion(-)
Approvals:
build bot (Jenkins): Verified
Elyes Haouas: Looks good to me, approved
Felix Singer: Looks good to me, approved
Angel Pons: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
diff --git a/pickit2_spi.c b/pickit2_spi.c
index 102fe37..bae0aa1 100644
--- a/pickit2_spi.c
+++ b/pickit2_spi.c
@@ -123,14 +123,20 @@
uint8_t command[CMD_LENGTH] = {CMD_GET_VERSION, CMD_END_OF_BUFFER};
ret = usb_interrupt_write(pickit2_handle, ENDPOINT_OUT, (char *)command, CMD_LENGTH, DFLT_TIMEOUT);
+
+ if (ret != CMD_LENGTH) {
+ msg_perr("Command Get Firmware Version failed!\n");
+ return 1;
+ }
+
ret = usb_interrupt_read(pickit2_handle, ENDPOINT_IN, (char *)command, CMD_LENGTH, DFLT_TIMEOUT);
- msg_pdbg("PICkit2 Firmware Version: %d.%d\n", (int)command[0], (int)command[1]);
if (ret != CMD_LENGTH) {
msg_perr("Command Get Firmware Version failed (%s)!\n", usb_strerror());
return 1;
}
+ msg_pdbg("PICkit2 Firmware Version: %d.%d\n", (int)command[0], (int)command[1]);
return 0;
}
--
To view, visit https://review.coreboot.org/c/flashrom/+/67838
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.0.x
Gerrit-Change-Id: I4aac5e1f3bd0604b079e1fdd9b7f09f1f4fc2d7f
Gerrit-Change-Number: 67838
Gerrit-PatchSet: 3
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Elyes Haouas <ehaouas(a)noos.fr>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67858 )
Change subject: pcidev.c: populate IDs with pci_fill_info()
......................................................................
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(a)chromium.org>
Change-Id: Ia011d4d801f8a54160e45a70b14b740e6dcc00ef
Reviewed-on: https://review.coreboot.org/c/flashrom/+/46310
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67858
Reviewed-by: Felix Singer <felixsinger(a)posteo.net>
---
M pcidev.c
1 file changed, 36 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Felix Singer: Looks good to me, approved
diff --git a/pcidev.c b/pcidev.c
index f5ad819..b0fb487 100644
--- a/pcidev.c
+++ b/pcidev.c
@@ -207,6 +207,7 @@
for (dev = pacc->devices; dev; dev = dev->next) {
if (pci_filter_match(&filter, dev)) {
+ pci_fill_info(dev, PCI_FILL_IDENT);
/* Check against list of supported devices. */
for (i = 0; devs[i].device_name != NULL; i++)
if ((dev->vendor_id == devs[i].vendor_id) &&
--
To view, visit https://review.coreboot.org/c/flashrom/+/67858
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.1.x
Gerrit-Change-Id: Ia011d4d801f8a54160e45a70b14b740e6dcc00ef
Gerrit-Change-Number: 67858
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Daniel Verkamp <dverkamp(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67856 )
Change subject: flashrom.8: add missing entry for `--flash-contents`
......................................................................
flashrom.8: add missing entry for `--flash-contents`
Change-Id: I64a8200a86329bd26a2069c5dc39430de9f8ba09
Signed-off-by: Michael Niewöhner <foss(a)mniewoehner.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/57807
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67856
Reviewed-by: Felix Singer <felixsinger(a)posteo.net>
---
M flashrom.8.tmpl
1 file changed, 22 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Felix Singer: Looks good to me, approved
diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl
index c1a228b..5192d0b 100644
--- a/flashrom.8.tmpl
+++ b/flashrom.8.tmpl
@@ -242,6 +242,13 @@
.B <imagename>
from flash layout.
.TP
+.B "\-\-flash\-contents <ref\-file>"
+The file contents of
+.BR <ref\-file>
+will be used to decide which parts of the flash need to be written. Providing
+this saves an initial read of the full flash chip. Be careful, if the provided
+data doesn't actually match the flash contents, results are undefined.
+.TP
.B "\-L, \-\-list\-supported"
List the flash chips, chipsets, mainboards, and external programmers
(including PCI, USB, parallel port, and serial port based devices)
--
To view, visit https://review.coreboot.org/c/flashrom/+/67856
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.1.x
Gerrit-Change-Id: I64a8200a86329bd26a2069c5dc39430de9f8ba09
Gerrit-Change-Number: 67856
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67855 )
Change subject: jlink_spi: Reduce transfer size
......................................................................
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(a)zapb.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/48379
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Miklós Márton <martonmiklosqdev(a)gmail.com>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67855
Reviewed-by: Felix Singer <felixsinger(a)posteo.net>
---
M jlink_spi.c
1 file changed, 20 insertions(+), 1 deletion(-)
Approvals:
build bot (Jenkins): Verified
Felix Singer: Looks good to me, approved
diff --git a/jlink_spi.c b/jlink_spi.c
index 08a9ba9..cf732b0 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -34,7 +34,7 @@
* Maximum number of bytes that can be transferred at once via the JTAG
* interface, see jaylink_jtag_io().
*/
-#define JTAG_MAX_TRANSFER_SIZE (UINT16_MAX / 8)
+#define JTAG_MAX_TRANSFER_SIZE (32768 / 8)
/*
* Default base frequency in Hz. Used when the base frequency can not be
--
To view, visit https://review.coreboot.org/c/flashrom/+/67855
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.1.x
Gerrit-Change-Id: If2c00b1524ec56740bdfe290096c3546cf375d73
Gerrit-Change-Number: 67855
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: zapb <dev(a)zapb.de>
Gerrit-MessageType: merged
Felix Singer has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67854 )
Change subject: linux_mtd: Disable buffering on the mtd device
......................................................................
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(a)chromium.org>
Change-Id: I989afd83a33013b2756a0090d6b08245613215c6
Reviewed-on: https://review.coreboot.org/c/flashrom/+/50155
Reviewed-by: Hung-Te Lin <hungte(a)chromium.org>
Reviewed-by: Patrick Rudolph <siro(a)das-labor.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67854
Reviewed-by: Nikolai Artemiev <nartemiev(a)google.com>
Reviewed-by: Felix Singer <felixsinger(a)posteo.net>
---
M linux_mtd.c
1 file changed, 53 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Felix Singer: Looks good to me, approved
Nikolai Artemiev: Looks good to me, but someone else must approve
diff --git a/linux_mtd.c b/linux_mtd.c
index ae8bef2..75dce1f 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -340,6 +340,10 @@
msg_perr("Cannot open file stream for %s\n", dev_path);
goto linux_mtd_setup_exit;
}
+ ret = setvbuf(dev_fp, NULL, _IONBF, 0);
+ if (ret)
+ msg_pwarn("Failed to set MTD device to unbuffered: %d\n", ret);
+
msg_pinfo("Opened %s successfully\n", dev_path);
ret = 0;
--
To view, visit https://review.coreboot.org/c/flashrom/+/67854
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: 1.1.x
Gerrit-Change-Id: I989afd83a33013b2756a0090d6b08245613215c6
Gerrit-Change-Number: 67854
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Douglas Anderson <dianders(a)chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Hung-Te Lin <hungte(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged