Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39640 )
Change subject: Copy Verified label from coreboot
......................................................................
Patch Set 3:
This change is ready for review.
--
To view, visit https://review.coreboot.org/c/flashrom/+/39640
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: refs/meta/config
Gerrit-Change-Id: Ie77d5b461992c166c54d01ecda6fb509ad0a4407
Gerrit-Change-Number: 39640
Gerrit-PatchSet: 3
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Comment-Date: Wed, 25 Mar 2020 23:12:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Dino Li has abandoned this change. ( https://review.coreboot.org/c/flashrom/+/39818 )
Change subject: TEST-ONLY: push patch
......................................................................
Abandoned
--
To view, visit https://review.coreboot.org/c/flashrom/+/39818
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ic36635f9dbdbe8d2a652ad3516f4153cdc35dfa9
Gerrit-Change-Number: 39818
Gerrit-PatchSet: 2
Gerrit-Owner: Dino Li <Dino.Li(a)ite.com.tw>
Gerrit-MessageType: abandon
David Hendricks has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/37406 )
Change subject: dediprog: add serial argument
......................................................................
dediprog: add serial argument
A quick hack to be able to select dediprogs by USB serial argument by
just adding a @serial_number parameter to dediprog_open() and using it
in preference to @id if available (since it is more specific).
Change-Id: I9cdfbce6cf941c16bf7b7364aa4166b91369e661
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez(a)intel.com>
---
M dediprog.c
M flashrom.8.tmpl
2 files changed, 23 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/06/37406/1
diff --git a/dediprog.c b/dediprog.c
index 175e099..480cf67 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -1006,15 +1006,19 @@
/*
* Open a dediprog_handle with the USB device at the given index.
* @index index of the USB device
+ * @serial_number serial number of the USB device (id is ignored then)
* @return 0 for success, -1 for error, -2 for busy device
*/
-static int dediprog_open(int index)
+static int dediprog_open(int index, char *serial_number)
{
const uint16_t vid = devs_dediprog[0].vendor_id;
const uint16_t pid = devs_dediprog[0].device_id;
int ret;
- dediprog_handle = usb_dev_get_by_vid_pid_number(usb_ctx, vid, pid, (unsigned int) index);
+ if (serial_number)
+ dediprog_handle = usb_dev_get_by_vid_pid_serial(usb_ctx, vid, pid, serial_number);
+ else
+ dediprog_handle = usb_dev_get_by_vid_pid_number(usb_ctx, vid, pid, (unsigned int) index);
if (!dediprog_handle) {
msg_perr("Could not find a Dediprog programmer on USB.\n");
libusb_exit(usb_ctx);
@@ -1057,7 +1061,8 @@
int dediprog_init(void)
{
- char *voltage, *id_str, *device, *spispeed, *target_str;
+ char *voltage, *id_str, *device, *spispeed, *target_str,
+ *serial_number;
int spispeed_idx = 1;
int millivolt = 3500;
int id = -1; /* -1 defaults to enumeration order */
@@ -1091,6 +1096,7 @@
msg_pinfo("Setting voltage to %i mV\n", millivolt);
}
+ serial_number = extract_programmer_param("serial");
id_str = extract_programmer_param("id");
if (id_str) {
char prefix0, prefix1;
@@ -1183,9 +1189,14 @@
return 1;
}
- if (id != -1) {
+ if (serial_number) {
+ if (dediprog_open(0, serial_number)) {
+ return 1;
+ }
+ found_id = dediprog_read_id();
+ } else if (id != -1) {
for (i = 0; ; i++) {
- ret = dediprog_open(i);
+ ret = dediprog_open(i, NULL);
if (ret == -1) {
/* no dev */
libusb_exit(usb_ctx);
@@ -1218,7 +1229,7 @@
break;
}
} else {
- if (dediprog_open(usedevice)) {
+ if (dediprog_open(usedevice, NULL)) {
return 1;
}
found_id = dediprog_read_id();
@@ -1276,6 +1287,5 @@
if (register_spi_master(&spi_master_dediprog) || dediprog_set_leds(LED_NONE))
return 1;
-
return 0;
}
diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl
index 27f3846..5af1a38 100644
--- a/flashrom.8.tmpl
+++ b/flashrom.8.tmpl
@@ -928,6 +928,12 @@
.BR 0V ", " 1.8V ", " 2.5V ", " 3.5V
or the equivalent in mV.
.sp
+You can use the
+.B serial
+parameter to explicitly specify which dediprog device should be used
+based on their USB serial number::
+.sp
+.B " flashrom \-p dediprog:serial=1230A12"
An optional
.B device
parameter specifies which of multiple connected Dediprog devices should be used.
--
To view, visit https://review.coreboot.org/c/flashrom/+/37406
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9cdfbce6cf941c16bf7b7364aa4166b91369e661
Gerrit-Change-Number: 37406
Gerrit-PatchSet: 1
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-MessageType: newchange
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/39173 )
Change subject: chipset_enable.c: Mark Skylake U Premium as DEP
......................................................................
chipset_enable.c: Mark Skylake U Premium as DEP
Tested reading, writing and erasing the internal flash chip using an
Acer Aspire ES1-572 laptop with an Intel i3-6006U. However, since all
ME-enabled chipsets are marked as DEP instead of OK, this one shall
follow suit as well.
Change-Id: Ib8ee9b5e811df74d2f48bd409806c72fe862bc24
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M chipset_enable.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/73/39173/1
diff --git a/chipset_enable.c b/chipset_enable.c
index 84e4b6b..4afb0e4 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -1987,7 +1987,7 @@
{0x8086, 0x9d41, B_S, NT, "Intel", "Skylake / Kaby Lake Sample", enable_flash_pch100},
{0x8086, 0x9d43, B_S, NT, "Intel", "Skylake U Base", enable_flash_pch100},
{0x8086, 0x9d46, B_S, NT, "Intel", "Skylake Y Premium", enable_flash_pch100},
- {0x8086, 0x9d48, B_S, NT, "Intel", "Skylake U Premium", enable_flash_pch100},
+ {0x8086, 0x9d48, B_S, DEP, "Intel", "Skylake U Premium", enable_flash_pch100},
{0x8086, 0x9d4b, B_S, NT, "Intel", "Kaby Lake Y w/ iHDCP2.2 Prem.", enable_flash_pch100},
{0x8086, 0x9d4e, B_S, DEP, "Intel", "Kaby Lake U w/ iHDCP2.2 Prem.", enable_flash_pch100},
{0x8086, 0x9d50, B_S, NT, "Intel", "Kaby Lake U w/ iHDCP2.2 Base", enable_flash_pch100},
--
To view, visit https://review.coreboot.org/c/flashrom/+/39173
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib8ee9b5e811df74d2f48bd409806c72fe862bc24
Gerrit-Change-Number: 39173
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newchange
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/39312 )
Change subject: raiden_debug_spi.c: Add a delay following AP/EC flash enable
......................................................................
raiden_debug_spi.c: Add a delay following AP/EC flash enable
Add a delay following the AP and EC flash enable requests. This allows
any power rails enabled by these signals to settle and to meet the power
on to first SPI write timing requirements.
Forward ports the downstream commit:
https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/…
Change-Id: I4c1777777ee67580605c6e6f4c0c228cccc392c7
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M raiden_debug_spi.c
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/12/39312/1
diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index fa42268..6914455 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -562,6 +562,15 @@
return ret;
}
+ /*
+ * Allow for power to settle on the AP and EC flash devices.
+ * Load switches can have a 1-3 ms turn on time, and SPI flash devices
+ * can require up to 10 ms from power on to the first write.
+ */
+ if ((request_enable == RAIDEN_DEBUG_SPI_REQ_ENABLE_AP) ||
+ (request_enable == RAIDEN_DEBUG_SPI_REQ_ENABLE_EC))
+ usleep(50 * 1000);
+
register_spi_master(&spi_master_raiden_debug);
register_shutdown(shutdown, NULL);
--
To view, visit https://review.coreboot.org/c/flashrom/+/39312
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I4c1777777ee67580605c6e6f4c0c228cccc392c7
Gerrit-Change-Number: 39312
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/39311 )
Change subject: raiden_debug_spi.c: Disable retry during some error codes
......................................................................
raiden_debug_spi.c: Disable retry during some error codes
Forward ports the downstream commit:
https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/…
Change-Id: I77def28040fea8d1ecf102463180378f8612b00e
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M raiden_debug_spi.c
M usb_device.h
2 files changed, 59 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/11/39311/1
diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 1f30b6a..fa42268 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -120,6 +120,15 @@
#define GOOGLE_RAIDEN_SPI_SUBCLASS (0x51)
#define GOOGLE_RAIDEN_SPI_PROTOCOL (0x01)
+enum usb_spi_error {
+ USB_SPI_SUCCESS = 0x0000,
+ USB_SPI_TIMEOUT = 0x0001,
+ USB_SPI_BUSY = 0x0002,
+ USB_SPI_WRITE_COUNT_INVALID = 0x0003,
+ USB_SPI_READ_COUNT_INVALID = 0x0004,
+ USB_SPI_DISABLED = 0x0005,
+ USB_SPI_UNKNOWN_ERROR = 0x8000,
+};
enum raiden_debug_spi_request {
RAIDEN_DEBUG_SPI_REQ_ENABLE = 0x0000,
@@ -163,6 +172,29 @@
uint8_t data[PAYLOAD_SIZE];
} __attribute__((packed)) usb_spi_response_t;
+/*
+ * This function will return true when an error code can potentially recover
+ * if we attempt to write SPI data to the device or read from it. We know
+ * that some conditions are not recoverable in the current state so allows us
+ * to bypass the retry logic and terminate early.
+ */
+static bool retry_recovery(int error_code)
+{
+ if (error_code < 0x10000) {
+ /* Handle error codes returned from the device. */
+ if (USB_SPI_WRITE_COUNT_INVALID <= error_code &&
+ error_code <= USB_SPI_DISABLED) {
+ return false;
+ }
+ } else if (usb_device_is_libusb_error(error_code)) {
+ /* Handle error codes returned from libusb. */
+ if (error_code == LIBUSB_ERROR(LIBUSB_ERROR_NO_DEVICE)) {
+ return false;
+ }
+ }
+ return true;
+}
+
static int write_command(const struct flashctx *flash,
unsigned int write_count,
unsigned int read_count,
@@ -267,6 +299,10 @@
"Write attempt = %d\n"
"status = %d\n",
write_attempt + 1, status);
+ if (!retry_recovery(status)) {
+ /* Reattempting will not result in a recovery. */
+ return status;
+ }
programmer_delay(RETY_INTERVAL_US);
continue;
}
@@ -282,6 +318,10 @@
"Read attempt = %d\n"
"status = %d\n",
write_attempt + 1, read_attempt + 1, status);
+ if (!retry_recovery(status)) {
+ /* Reattempting will not result in a recovery. */
+ return status;
+ }
programmer_delay(RETY_INTERVAL_US);
} else {
/* We were successful at performing the SPI transfer. */
diff --git a/usb_device.h b/usb_device.h
index d379675..b2c7656 100644
--- a/usb_device.h
+++ b/usb_device.h
@@ -27,10 +27,18 @@
#include <libusb.h>
#include <stdint.h>
+#include <stdbool.h>
+
+/*
+ * The LIBUSB_ERROR macro converts a libusb failure code into an error code that
+ * flashrom recognizes. It does so without displaying an error code allowing us
+ * to compare error codes against the library enumeration values.
+ */
+#define LIBUSB_ERROR(eror_code) (0x20000 | -eror_code)
/*
* The LIBUSB macro converts a libusb failure code into an error code that
- * flashrom recognizes. It also displays additional libusb specific
+ * flashrom recognizes. It also displays additional libusb specific
* information about the failure.
*/
#define LIBUSB(expression) \
@@ -42,7 +50,7 @@
__FILE__, \
__LINE__, \
libusb_error_name(libusb_error__)); \
- libusb_error__ = 0x20000 | -libusb_error__; \
+ libusb_error__ = LIBUSB_ERROR(libusb_error__); \
} else { \
libusb_error__ = 0; \
} \
@@ -51,6 +59,15 @@
})
/*
+ * Returns true if the error code falls within the range of valid libusb
+ * error codes.
+ */
+static inline bool usb_device_is_libusb_error(int error_code)
+{
+ return (0x20000 <= error_code && error_code < 0x20064);
+}
+
+/*
* A USB match and associated value struct are used to encode the information
* about a device against which we wish to match. If the value of a
* usb_match_value has been set then a device must match that value. The name
--
To view, visit https://review.coreboot.org/c/flashrom/+/39311
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I77def28040fea8d1ecf102463180378f8612b00e
Gerrit-Change-Number: 39311
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange