Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/23005 )
Change subject: Add Manibuilder
......................................................................
Patch Set 3: Code-Review+2
> Patch Set 3: Code-Review+2
>
> All-in-all this seems like a great step forward for build testing. I looked over the patch chain and it seems OK (nice Make-fu), but unfortunately it failed to run and I couldn't figure out why in the short amount of time I had.
>
> Some day I'd like to re-write most of the Makefile logic in Go or shell and hopefully make it easier to understand and modify, but that shouldn't block this patch.
I was able to run this on poweredgy (my Dell Poweredge R900 space heater) some time ago.
--
To view, visit https://review.coreboot.org/c/flashrom/+/23005
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I60863a5c7d70dde71486fccb66cb59b30ba4d982
Gerrit-Change-Number: 23005
Gerrit-PatchSet: 3
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Tue, 26 Nov 2019 11:11:04 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/30418 )
Change subject: manibuilder: Add list of tags used for the 1.0.x branch
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/30418
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2bc2e79729016a8f9908f316b051deeb73dc096f
Gerrit-Change-Number: 30418
Gerrit-PatchSet: 3
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Mon, 25 Nov 2019 04:02:36 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/23005 )
Change subject: Add Manibuilder
......................................................................
Patch Set 3: Code-Review+2
All-in-all this seems like a great step forward for build testing. I looked over the patch chain and it seems OK (nice Make-fu), but unfortunately it failed to run and I couldn't figure out why in the short amount of time I had.
Some day I'd like to re-write most of the Makefile logic in Go or shell and hopefully make it easier to understand and modify, but that shouldn't block this patch.
--
To view, visit https://review.coreboot.org/c/flashrom/+/23005
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I60863a5c7d70dde71486fccb66cb59b30ba4d982
Gerrit-Change-Number: 23005
Gerrit-PatchSet: 3
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Mon, 25 Nov 2019 04:02:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Ryan O'Leary has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/34160 )
Change subject: dediprog.c: Add id parameter to dediprog programmer
......................................................................
dediprog.c: Add id parameter to dediprog programmer
When multiple dediprog programmers are connected, the 'id' parameter
allows you to specify which one to use. The id is a string like SF012345
or DP012345. The value is printed on a sticker on the back of the dediprog.
This is an improvement over the 'device' parameter which is based on
enumeration order and changes when you plug/unplug devices or reboot the
machine.
To find the id without the sticker, run flashrom with the -V option.
This prints the ids as they are enumerated. Alternatively, with dpcmd,
you can use the --list-device-id and --fix-device commands to list and
write device ids respectively.
Note this only supports SF100 at the moment, but SF600 support is
possible with more work.
Change-Id: I4281213ab02131feb5d47bf66118a001cec0d219
Signed-off-by: Ryan O'Leary <ryanoleary(a)google.com>
---
M dediprog.c
1 file changed, 133 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/60/34160/1
diff --git a/dediprog.c b/dediprog.c
index 8029b64..1d10b24 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -823,6 +823,46 @@
return 0;
}
+/* Read the id from the dediprog. This should return the numeric part of the
+ * serial number found on a sticker on the back of the dediprog. Note this
+ * number is stored in writable eeprom, so it could get out of sync. Also note,
+ * this function only supports SF100 at this time, but SF600 support is not too
+ * much different.
+ * @return the id on success, -1 on failure
+ */
+static int dediprog_read_id(void)
+{
+ int ret;
+ uint8_t buf[3];
+
+ ret = libusb_control_transfer(dediprog_handle, REQTYPE_OTHER_IN,
+ 0x7, /* request */
+ 0, /* value */
+ 0xEF00, /* index */
+ buf, sizeof(buf),
+ DEFAULT_TIMEOUT);
+ if (ret != sizeof(buf)) {
+ msg_perr("Failed to read dediprog id, error %d!\n", ret);
+ return -1;
+ }
+
+ return buf[0] << 16 | buf[1] << 8 | buf[2];
+}
+
+/* Return the prefix to display in front of the id. These two characters also
+ * appear on the sticker even though they can be derived from the numerical
+ * part.
+ * @id a dediprog's id
+ * @return either "DP" or "SF"
+ */
+static const char* dediprog_id_prefix(int id) {
+ /* This is so the id matches dpcmd. */
+ if (id < 600000) {
+ return "DP";
+ }
+ return "SF";
+}
+
/*
* This command presumably sets the voltage for the SF100 itself (not the
* SPI flash). Only use this command with firmware older than V6.0.0. Newer
@@ -997,9 +1037,11 @@
int dediprog_init(void)
{
- char *voltage, *device, *spispeed, *target_str;
+ char *voltage, *id_str, *device, *spispeed, *target_str;
int spispeed_idx = 1;
int millivolt = 3500;
+ int id = -1; /* -1 defaults to enumeration order */
+ int found_id;
long usedevice = 0;
long target = FLASH_TYPE_APPLICATION_FLASH_1;
int i, ret;
@@ -1029,9 +1071,37 @@
msg_pinfo("Setting voltage to %i mV\n", millivolt);
}
+ id_str = extract_programmer_param("id");
+ if (id_str) {
+ char prefix0, prefix1;
+ const char *prefix;
+ if (sscanf(id_str, "%c%c%d", &prefix0, &prefix1, &id) != 3) {
+ msg_perr("Error: Could not parse dediprog 'id'.\n");
+ msg_perr("Expected a string like SF012345 or DP012345.\n");
+ free(id_str);
+ return 1;
+ }
+ if (id < 0 || id >= 0x1000000) {
+ msg_perr("Error: id %s is out of range!\n", id_str);
+ free(id_str);
+ return 1;
+ }
+ prefix = dediprog_id_prefix(id);
+ if (strlen(prefix) != 2 || prefix[0] != prefix0 || prefix[1] != prefix1) {
+ msg_perr("Error: %s is an invalid id!\n", id_str);
+ free(id_str);
+ return 1;
+ }
+ msg_pinfo("Will search for dediprog id %s%06d.\n", dediprog_id_prefix(id), id);
+ }
+ free(id_str);
+
device = extract_programmer_param("device");
if (device) {
char *dev_suffix;
+ if (id != -1) {
+ msg_perr("Error: Cannot use 'id' and 'device'.\n");
+ }
errno = 0;
usedevice = strtol(device, &dev_suffix, 10);
if (errno != 0 || device == dev_suffix) {
@@ -1097,25 +1167,69 @@
const uint16_t vid = devs_dediprog[0].vendor_id;
const uint16_t pid = devs_dediprog[0].device_id;
- dediprog_handle = usb_dev_get_by_vid_pid_number(usb_ctx, vid, pid, (unsigned int) usedevice);
- if (!dediprog_handle) {
- msg_perr("Could not find a Dediprog programmer on USB.\n");
- libusb_exit(usb_ctx);
- return 1;
+ for (;;) {
+ /* Notice we can only call dediprog_read_id() after
+ * libusb_set_configuration() and libusb_claim_interface(). When
+ * searching by id and either configuration or claim fails
+ * (usually the device is in use by another instance of
+ * flashrom), the device is skipped and the next device is
+ * tried.
+ */
+ dediprog_handle = usb_dev_get_by_vid_pid_number(usb_ctx, vid, pid, (unsigned int) usedevice);
+ if (!dediprog_handle) {
+ msg_perr("Could not find a Dediprog programmer on USB.\n");
+ libusb_exit(usb_ctx);
+ return 1;
+ }
+ ret = libusb_set_configuration(dediprog_handle, 1);
+ if (ret != 0) {
+ msg_perr("Could not set USB device configuration: %i %s\n",
+ ret, libusb_error_name(ret));
+ libusb_close(dediprog_handle);
+ if (id != -1) {
+ usedevice++;
+ continue;
+ }
+ libusb_exit(usb_ctx);
+ return 1;
+ }
+ ret = libusb_claim_interface(dediprog_handle, 0);
+ if (ret < 0) {
+ msg_perr("Could not claim USB device interface %i: %i %s\n",
+ 0, ret, libusb_error_name(ret));
+ libusb_close(dediprog_handle);
+ if (id != -1) {
+ usedevice++;
+ continue;
+ }
+ libusb_exit(usb_ctx);
+ return 1;
+ }
+
+ /* Read the dediprog's id. The value is only used (besides
+ * logging) when searching by id.
+ */
+ found_id = dediprog_read_id();
+ if (id != -1) {
+ if (found_id < 0) {
+ msg_perr("Could not read id.\n");
+ libusb_release_interface(dediprog_handle, 0);
+ libusb_close(dediprog_handle);
+ usedevice++;
+ continue;
+ }
+ msg_pinfo("Found dediprog id %s%06d.\n", dediprog_id_prefix(found_id), found_id);
+ if (found_id != id) {
+ libusb_release_interface(dediprog_handle, 0);
+ libusb_close(dediprog_handle);
+ usedevice++;
+ continue;
+ }
+ }
+ break;
}
- ret = libusb_set_configuration(dediprog_handle, 1);
- if (ret != 0) {
- msg_perr("Could not set USB device configuration: %i %s\n", ret, libusb_error_name(ret));
- libusb_close(dediprog_handle);
- libusb_exit(usb_ctx);
- return 1;
- }
- ret = libusb_claim_interface(dediprog_handle, 0);
- if (ret < 0) {
- msg_perr("Could not claim USB device interface %i: %i %s\n", 0, ret, libusb_error_name(ret));
- libusb_close(dediprog_handle);
- libusb_exit(usb_ctx);
- return 1;
+ if (found_id >= 0) {
+ msg_pinfo("Using dediprog id %s%06d.\n", dediprog_id_prefix(found_id), found_id);
}
if (register_shutdown(dediprog_shutdown, NULL))
--
To view, visit https://review.coreboot.org/c/flashrom/+/34160
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I4281213ab02131feb5d47bf66118a001cec0d219
Gerrit-Change-Number: 34160
Gerrit-PatchSet: 1
Gerrit-Owner: Ryan O'Leary
Gerrit-MessageType: newchange