Attention is currently required from: Xiang Wang, Stefan Reinauer.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49599 )
Change subject: flashrom.c: automatic generated programmer_enum.h
......................................................................
Patch Set 3:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49599/comment/b541b397_96da1b50
PS3, Line 7: flashrom.c: automatic generated programmer_enum.h
Generate programmer_enum.h automatically
--
To view, visit https://review.coreboot.org/c/flashrom/+/49599
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3f4370ccae2b64da3c4178243b192700d3d205d2
Gerrit-Change-Number: 49599
Gerrit-PatchSet: 3
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Comment-Date: Mon, 25 Jan 2021 11:26:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Xiang Wang, Stefan Reinauer.
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49599 )
Change subject: flashrom.c: automatic generated programmer_enum.h
......................................................................
Patch Set 3:
(3 comments)
File Makefile:
https://review.coreboot.org/c/flashrom/+/49599/comment/40049a83_73f3337d
PS3, Line 681: $(shell bash ./util/generator_programmer_enum.sh)
Calling bash directly is unnecessary when changing the permissions of util/generator_programmer_enum.sh to 0755.
File util/generator_programmer_enum.sh:
https://review.coreboot.org/c/flashrom/+/49599/comment/673b0b15_6ec0ac85
PS3, Line 1: #! /bin/bash
Please locate the bash binary using env: '/usr/bin/env bash'
https://review.coreboot.org/c/coreboot/+/48904https://review.coreboot.org/c/flashrom/+/49599/comment/632fd344_e9d825fd
PS3, Line 22: generator
Typo: 'this file is automatically generated by ...'
--
To view, visit https://review.coreboot.org/c/flashrom/+/49599
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3f4370ccae2b64da3c4178243b192700d3d205d2
Gerrit-Change-Number: 49599
Gerrit-PatchSet: 3
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Idwer Vollering <vidwer(a)gmail.com>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Comment-Date: Mon, 25 Jan 2021 10:09:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49823 )
Change subject: it87spi.c: Simplify param free like cros
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> This undoes what CB:46551 fixed.
Thank you for the catch, patch and history Angel!
--
To view, visit https://review.coreboot.org/c/flashrom/+/49823
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia17dfcaf758f729ae25b35d807bfbe5dc3dc5ff6
Gerrit-Change-Number: 49823
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sun, 24 Jan 2021 23:05:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/49741 )
Change subject: helpers.c: Fix undefined behavior in strndup()
......................................................................
helpers.c: Fix undefined behavior in strndup()
Using strlen() or strdup() inside strndup() is problematic: if the
input string is not null-terminated, these functions can read past the
end of the buffer, which triggers undefined behavior. Rewrite the
function to never read past the provided `maxlen` bound.
Change-Id: Id34127024085879228626fbad59af03268ec5255
Signed-off-by: Xiang Wang <merle(a)hardenedliux.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/49741
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M helpers.c
1 file changed, 9 insertions(+), 8 deletions(-)
Approvals:
build bot (Jenkins): Verified
Angel Pons: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
diff --git a/helpers.c b/helpers.c
index c83cd2c..289848d 100644
--- a/helpers.c
+++ b/helpers.c
@@ -106,15 +106,16 @@
/* strndup is a POSIX function not present in MinGW */
char *strndup(const char *src, size_t maxlen)
{
- if (strlen(src) > maxlen) {
- char *retbuf;
- if ((retbuf = malloc(1 + maxlen)) != NULL) {
- memcpy(retbuf, src, maxlen);
- retbuf[maxlen] = '\0';
- }
- return retbuf;
+ char *retbuf;
+ size_t len;
+ for (len = 0; len < maxlen; len++)
+ if (src[len] == '\0')
+ break;
+ if ((retbuf = malloc(1 + len)) != NULL) {
+ memcpy(retbuf, src, len);
+ retbuf[len] = '\0';
}
- return strdup(src);
+ return retbuf;
}
#endif
--
To view, visit https://review.coreboot.org/c/flashrom/+/49741
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id34127024085879228626fbad59af03268ec5255
Gerrit-Change-Number: 49741
Gerrit-PatchSet: 3
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-MessageType: merged
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/49637 )
Change subject: ft2232_spi.c: Generalize GPIOL pin control
......................................................................
ft2232_spi.c: Generalize GPIOL pin control
Adds a new arg "gpiol" to allow the four FT2232 GPIOL pins to be set to
any combination of high, low or high-impedance.
The existing arg "csgpiol", is intended to function as an additional
"cs" signal, allowing pins to be set high but not low. This patch
preserves the csgpiol arg for backward compatibility. In the event that
both arguments are specified, gpiol is used.
Signed-off-by: Alan Green <avg(a)google.com>
Change-Id: I1f2b3b968577e62e3c5b11bcdf4afe2de6eb84ab
Reviewed-on: https://review.coreboot.org/c/flashrom/+/49637
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Xiang Wang <merle(a)hardenedlinux.org>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
---
M ft2232_spi.c
1 file changed, 43 insertions(+), 1 deletion(-)
Approvals:
build bot (Jenkins): Verified
Xiang Wang: Looks good to me, approved
Angel Pons: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
diff --git a/ft2232_spi.c b/ft2232_spi.c
index c963a45..0d287df 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -367,7 +367,7 @@
}
free(arg);
- /* Allows setting multiple GPIOL states, for example: csgpiol=012 */
+ /* Allows setting multiple GPIOL pins to high, for example: csgpiol=012 */
arg = extract_programmer_param("csgpiol");
if (arg) {
unsigned int ngpios = strlen(arg);
@@ -388,6 +388,48 @@
}
free(arg);
+ /* Allows setting GPIOL pins high, low or input (high-z) */
+ arg = extract_programmer_param("gpiol");
+ if (arg) {
+ int ok = 0;
+ if (strlen(arg) == 4) {
+ ok = 1;
+ for (int i = 0; i < 4; i++) {
+ unsigned int pin = i + 4;
+ switch (toupper(arg[i])) {
+ case 'H':
+ cs_bits |= 1 << pin;
+ pindir |= 1 << pin;
+ break;
+ case 'L':
+ cs_bits &= ~(1 << pin);
+ pindir |= 1 << pin;
+ break;
+ case 'Z':
+ pindir &= ~(1 << pin);
+ break;
+ case 'X':
+ break;
+ default:
+ ok = 0;
+ }
+ }
+ }
+ if (!ok) {
+ msg_perr("Error: Invalid GPIOLs specified: \"%s\".\n"
+ "Valid values are 4 character strings of H, L, Z and X.\n"
+ " H - Set GPIOL output high\n"
+ " L - Set GPIOL output low\n"
+ " Z - Set GPIOL as input (high impedance)\n"
+ " X - Leave as programmer default\n"
+ "Example: gpiol=LZXH drives GPIOL 0 low, and GPIOL 3 high, sets GPIOL 1\n"
+ "to an input and leaves GPIOL 2 set according to the programmer type.\n", arg);
+ free(arg);
+ return -2;
+ }
+ }
+ free(arg);
+
msg_pdbg("Using device type %s %s ",
get_ft2232_vendorname(ft2232_vid, ft2232_type),
get_ft2232_devicename(ft2232_vid, ft2232_type));
--
To view, visit https://review.coreboot.org/c/flashrom/+/49637
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1f2b3b968577e62e3c5b11bcdf4afe2de6eb84ab
Gerrit-Change-Number: 49637
Gerrit-PatchSet: 11
Gerrit-Owner: Alan Green <avg(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/49632 )
Change subject: ft2232_spi.c: release I/Os on shutdown
......................................................................
ft2232_spi.c: release I/Os on shutdown
Reset FTDI I/O pins to high-Z (input) when shutting down. This allows
other devices to use the SPI bus without having to disconnect the
programmer.
This change will introduce a backward incompatibility in the case where
a user is relying on the state of FTDI outputs post-programming (eg. to
disallow another device from driving CS low).
However, there are likely more cases where releasing the SPI bus is the
correct thing to do.
Signed-off-by: Alan Green <avg(a)google.com>
Change-Id: I9fae55e532595752983f55fac2298f81699dbe5b
Reviewed-on: https://review.coreboot.org/c/flashrom/+/49632
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Angel Pons <th3fanbus(a)gmail.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M ft2232_spi.c
1 file changed, 25 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Angel Pons: Looks good to me, but someone else must approve
Edward O'Callaghan: Looks good to me, approved
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 65ff449..c963a45 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -159,6 +159,30 @@
return 0;
}
+static int ft2232_shutdown(void *data)
+{
+ int f;
+ struct ftdi_context *ftdic = (struct ftdi_context *) data;
+ unsigned char buf[3];
+
+ msg_pdbg("Releasing I/Os\n");
+ buf[0] = SET_BITS_LOW;
+ buf[1] = 0; /* Output byte ignored */
+ buf[2] = 0; /* Pin direction: all inputs */
+ if (send_buf(ftdic, buf, 3)) {
+ msg_perr("Unable to set pins back inputs: (%s)\n",
+ ftdi_get_error_string(ftdic));
+ }
+
+ if ((f = ftdi_usb_close(ftdic)) < 0) {
+ msg_perr("Unable to close FTDI device: %d (%s)\n", f,
+ ftdi_get_error_string(ftdic));
+ return f;
+ }
+
+ return 0;
+}
+
static int ft2232_spi_send_command(const struct flashctx *flash,
unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr,
@@ -453,6 +477,7 @@
goto ftdi_err;
}
+ register_shutdown(ft2232_shutdown, ftdic);
register_spi_master(&spi_master_ft2232);
return 0;
--
To view, visit https://review.coreboot.org/c/flashrom/+/49632
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9fae55e532595752983f55fac2298f81699dbe5b
Gerrit-Change-Number: 49632
Gerrit-PatchSet: 9
Gerrit-Owner: Alan Green <avg(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-MessageType: merged
Attention is currently required from: Stefan Reinauer.
Xiang Wang has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49741 )
Change subject: helpers.c: Fix undefined behavior in strndup()
......................................................................
Patch Set 2:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49741/comment/d9fae29e_25c98017
PS1, Line 7: helpers.c: optimize strndup
> About adding a unit-test for this function: Maybe, but it is only used for MinGW. […]
I don't know how to write effective test code
--
To view, visit https://review.coreboot.org/c/flashrom/+/49741
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id34127024085879228626fbad59af03268ec5255
Gerrit-Change-Number: 49741
Gerrit-PatchSet: 2
Gerrit-Owner: Xiang Wang <merle(a)hardenedlinux.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-CC: Shawn C <citypw(a)hardenedlinux.org>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Comment-Date: Sun, 24 Jan 2021 06:20:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Xiang Wang <merle(a)hardenedlinux.org>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment