Attention is currently required from: Nico Huber, Thomas Heijligen.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51978 )
Change subject: test_build.sh: use sh from env
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/51978
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3897b8d980425ecbb89b238d4a766f628cf9d3e6
Gerrit-Change-Number: 51978
Gerrit-PatchSet: 1
Gerrit-Owner: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Comment-Date: Wed, 31 Mar 2021 11:38:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/51978 )
Change subject: test_build.sh: use sh from env
......................................................................
test_build.sh: use sh from env
Change-Id: I3897b8d980425ecbb89b238d4a766f628cf9d3e6
Signed-off-by: Thomas Heijligen <thomas.heijligen(a)secunet.de>
---
M test_build.sh
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/78/51978/1
diff --git a/test_build.sh b/test_build.sh
index 0e43cd3..8f11ccd 100755
--- a/test_build.sh
+++ b/test_build.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env sh
set -e
make CONFIG_EVERYTHING=yes WARNERROR=yes
--
To view, visit https://review.coreboot.org/c/flashrom/+/51978
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3897b8d980425ecbb89b238d4a766f628cf9d3e6
Gerrit-Change-Number: 51978
Gerrit-PatchSet: 1
Gerrit-Owner: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: newchange
Attention is currently required from: Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51967 )
Change subject: lspcon_i2c_spi: support a devpath option
......................................................................
Patch Set 1:
(2 comments)
File lspcon_i2c_spi.c:
https://review.coreboot.org/c/flashrom/+/51967/comment/03d827eb_6153905c
PS1, Line 436: /* TODO: remove this out of the specific SPI master implementation. */
Idea for another patch: Provide a `i2c_open_from_programmer_param` I2C helper function that returns a fd for an I2C device, using programmer params `devpath` and `bus`?
https://review.coreboot.org/c/flashrom/+/51967/comment/8e1130ba_c91c0abc
PS1, Line 486: msg_perr("%s: one of devpath or bus must be specified\n", __func__);
If both arguments are specified, `bus` is silently ignored. Should this case be treated as an error?
--
To view, visit https://review.coreboot.org/c/flashrom/+/51967
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id2adf8a307b9205ce5e5804a6c3e22f19d0c34c9
Gerrit-Change-Number: 51967
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
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-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Wed, 31 Mar 2021 09:20:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51967 )
Change subject: lspcon_i2c_spi: support a devpath option
......................................................................
Patch Set 1: Code-Review+1
(3 comments)
File i2c_helper_linux.c:
https://review.coreboot.org/c/flashrom/+/51967/comment/45504807_c0973a47
PS1, Line 46: goto err;
`goto` isn't necessary here, just return `fd`.
https://review.coreboot.org/c/flashrom/+/51967/comment/41a9c15d_338637ac
PS1, Line 54: goto err;
Same here, just return `err`.
https://review.coreboot.org/c/flashrom/+/51967/comment/a23a2a96_c0d8332c
PS1, Line 58: return ret ? ret : fd;
And return `fd` here.
--
To view, visit https://review.coreboot.org/c/flashrom/+/51967
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id2adf8a307b9205ce5e5804a6c3e22f19d0c34c9
Gerrit-Change-Number: 51967
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
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-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Wed, 31 Mar 2021 09:04:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Peter Marheine.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51967 )
Change subject: lspcon_i2c_spi: support a devpath option
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/51967
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id2adf8a307b9205ce5e5804a6c3e22f19d0c34c9
Gerrit-Change-Number: 51967
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Wed, 31 Mar 2021 03:27:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Peter Marheine has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/51967 )
Change subject: lspcon_i2c_spi: support a devpath option
......................................................................
lspcon_i2c_spi: support a devpath option
Some callers may find it easier to provide the path to an I2C device
at which to communicate with the device, rather than specify the bus
number- doing so might involve trying to parse a path to extract the
number only for flashrom to do the reverse, which is error-prone and
unnecessary.
This change adds support for a `devpath` option that is preferred,
continuing to allow `bus` and requiring one of them be specified.
TEST=Verified --flash-size outputs correct values with both
devpath=/dev/i2c-7 and bus=7, as well as noting that one is
required if neither is specified.
Signed-off-by: Peter Marheine <pmarheine(a)chromium.org>
Change-Id: Id2adf8a307b9205ce5e5804a6c3e22f19d0c34c9
---
M i2c_helper.h
M i2c_helper_linux.c
M lspcon_i2c_spi.c
3 files changed, 46 insertions(+), 23 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/67/51967/1
diff --git a/i2c_helper.h b/i2c_helper.h
index 599e08b..cab2ce6 100644
--- a/i2c_helper.h
+++ b/i2c_helper.h
@@ -72,6 +72,14 @@
int i2c_open(int bus, uint16_t addr, int force);
/**
+ * i2c_open_path: open an I2C device by device path
+ *
+ * This function behaves the same as i2c_open, but takes a filesystem
+ * path (assumed to be an I2C device file) instead of a bus number.
+ */
+int i2c_open_path(const char *path, uint16_t addr, int force);
+
+/**
* i2c_close - closes the file descriptor returned by i2c_open
*
* @fd: file descriptor to be closed.
diff --git a/i2c_helper_linux.c b/i2c_helper_linux.c
index 5c191f9..10c4547 100644
--- a/i2c_helper_linux.c
+++ b/i2c_helper_linux.c
@@ -36,14 +36,35 @@
return fd == -1 ? 0 : close(fd);
}
+int i2c_open_path(const char *path, uint16_t addr, int force)
+{
+ int ret = -1;
+ int fd = open(path, O_RDWR);
+ if (fd < 0) {
+ msg_perr("Unable to open I2C device %s: %s.\n", path, strerror(errno));
+ ret = fd;
+ goto err;
+ }
+
+ int request = force ? I2C_SLAVE_FORCE : I2C_SLAVE;
+ ret = ioctl(fd, request, addr);
+ if (ret < 0) {
+ msg_perr("Unable to set I2C slave address to 0x%02x: %s.\n", addr, strerror(errno));
+ i2c_close(fd);
+ goto err;
+ }
+
+err:
+ return ret ? ret : fd;
+}
+
+
int i2c_open(int bus, uint16_t addr, int force)
{
int ret = -1;
- int fd = -1;
/* Maximum i2c bus number is 255(3 char), +1 for null terminated string. */
int path_len = strlen(I2C_DEV_PREFIX) + 4;
- int request = force ? I2C_SLAVE_FORCE : I2C_SLAVE;
if (bus < 0 || bus > I2C_MAX_BUS) {
msg_perr("Invalid I2C bus %d.\n", bus);
@@ -63,25 +84,12 @@
goto linux_i2c_open_err;
}
- fd = open(dev, O_RDWR);
- if (fd < 0) {
- msg_perr("Unable to open I2C device %s: %s.\n", dev, strerror(errno));
- ret = fd;
- goto linux_i2c_open_err;
- }
-
- ret = ioctl(fd, request, addr);
- if (ret < 0) {
- msg_perr("Unable to set I2C slave address to 0x%02x: %s.\n", addr, strerror(errno));
- i2c_close(fd);
- goto linux_i2c_open_err;
- }
-
+ ret = i2c_open_path(dev, addr, force);
linux_i2c_open_err:
if (dev)
free(dev);
- return ret ? ret : fd;
+ return ret;
}
int i2c_read(int fd, uint16_t addr, i2c_buffer_t *buf)
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 7b9f1c0..a748f85 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -434,7 +434,7 @@
}
/* TODO: remove this out of the specific SPI master implementation. */
-static int get_bus(void)
+static int get_bus_number(void)
{
char *bus_str = extract_programmer_param("bus");
int ret = SPI_GENERIC_ERROR;
@@ -474,16 +474,23 @@
int lspcon_i2c_spi_init(void)
{
- int lspcon_i2c_spi_bus = get_bus();
- if (lspcon_i2c_spi_bus < 0)
+ int fd = -1;
+ char *device_path;
+ int bus_number;
+ if ((device_path = extract_programmer_param("devpath")) != NULL) {
+ fd = i2c_open_path(device_path, REGISTER_ADDRESS, 0);
+ free(device_path);
+ } else if ((bus_number = get_bus_number()) >= 0) {
+ fd = i2c_open(bus_number, REGISTER_ADDRESS, 0);
+ } else {
+ msg_perr("%s: one of devpath or bus must be specified\n", __func__);
return SPI_GENERIC_ERROR;
+ }
- int ret = 0;
- int fd = i2c_open(lspcon_i2c_spi_bus, REGISTER_ADDRESS, 0);
if (fd < 0)
return fd;
- ret |= lspcon_i2c_spi_reset_mpu_stop(fd);
+ int ret = lspcon_i2c_spi_reset_mpu_stop(fd);
if (ret) {
msg_perr("%s: call to reset_mpu_stop failed.\n", __func__);
return ret;
--
To view, visit https://review.coreboot.org/c/flashrom/+/51967
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id2adf8a307b9205ce5e5804a6c3e22f19d0c34c9
Gerrit-Change-Number: 51967
Gerrit-PatchSet: 1
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Nico Huber, David Hendricks, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51243 )
Change subject: Enable dynamic memory allocation checks for cmocka unit tests
......................................................................
Patch Set 7:
(4 comments)
Patchset:
PS6:
> This looks quite nice now, thank you! […]
In the initial version of this patch the role of unittest.h was that without it ninja test did not build.
My understanding of the whole situation is: with the last changes, test-build environment and real-build environment got closer to each other (closer than they have been before) and now -includes in meson.build are properly covering everything in test-build. So I feel this last patchset is more correct than the first (thanks!).
File meson.build:
https://review.coreboot.org/c/flashrom/+/51243/comment/3790dc5d_9e63b21c
PS6, Line 477: -include
> Can we have spaces after -include? That should work, I guess :)
I tried space after -include and it does not work:
cc1: fatal error: stdlib.h: No such file or directory
I checked that command line had this (as expected)
'-include stdlib.h' '-include unittest_env.h'
but it does not build.
File tests/helpers.c:
https://review.coreboot.org/c/flashrom/+/51243/comment/af981aee_5d1ef58c
PS6, Line 21: #include <stdlib.h>
> I'm not sure if we should remove this. The files under tests/ […]
I removed this one because it seems to be not needed?
Yes files in tests/ do not have command line -include
If it is indirectly included in one of the headers above, does it need to be explicitly included again?
File tests/meson.build:
https://review.coreboot.org/c/flashrom/+/51243/comment/ae37e987_3e81475c
PS6, Line 38: '-DUNIT_TEST_ENV',
> Is this still needed? Now that `unittest_env.h` is only when building […]
Yes you are right: this flag is not needed anymore in this patch. Although I may introduce it in one of the next patches (where I do lots of mocking) but here it is not needed.
--
To view, visit https://review.coreboot.org/c/flashrom/+/51243
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0c6b6b8dc17aaee28640e3fca3d1fc9f7feabf5f
Gerrit-Change-Number: 51243
Gerrit-PatchSet: 7
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Daniel Kurtz <djkurtz(a)google.com>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-CC: Victor Ding <victording(a)chromium.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Wed, 31 Mar 2021 01:47:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: David Hendricks, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk.
Hello build bot (Jenkins), Nico Huber, Daniel Kurtz, David Hendricks, Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/51243
to look at the new patch set (#7).
Change subject: Enable dynamic memory allocation checks for cmocka unit tests
......................................................................
Enable dynamic memory allocation checks for cmocka unit tests
This commit enables the feature and makes changes to existing
files and tests. I am writing more new tests with this.
Commit includes tests/flashrom.c because after enabling memory
checks the test started to fail (it used to leak memory indeed).
If you are wondering how to verify it works (because at the moment
all tests [still] pass so it’s not obvious that anything has
changed), then for example:
1) Remove free’s in flashbuses_to_text_test_success test, and it
will fail with message similar to this (line numbers from your local
source)
[ ERROR ] --- Blocks allocated...
../flashrom.c:1239: note: block 0x55f42304b640 allocated here
../flashrom.c:1239: note: block 0x55f42304b5c0 allocated here
../flashrom.c:1239: note: block 0x55f42304b3d0 allocated here
../flashrom.c:1239: note: block 0x55f42304b700 allocated here
../flashrom.c:1239: note: block 0x55f42304b780 allocated here
../flashrom.c:1239: note: block 0x55f42304bb00 allocated here
../flashrom.c:1239: note: block 0x55f42304b810 allocated here
ERROR: flashbuses_to_text_test_success leaked 7 block(s)
2) Add char *temp = malloc just before return from strcat_realloc
[ ERROR ] --- Blocks allocated...
../helpers.c:88: note: block 0x55a51307b6c0 allocated here
../helpers.c:88: note: block 0x55a51307b9e0 allocated here
ERROR: strcat_realloc_test_success leaked 2 block(s)
BUG=b:181803212
TEST=builds and ninja test
nm builddir/tests/flashrom_unit_tests.p/.._flashrom.c.o
nm builddir/tests/flashrom_unit_tests.p/flashrom.c.o
nm builddir/flashrom.p/flashrom.c.o
Change-Id: I0c6b6b8dc17aaee28640e3fca3d1fc9f7feabf5f
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M meson.build
M tests/flashrom.c
M tests/helpers.c
A unittest_env.h
4 files changed, 81 insertions(+), 12 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/43/51243/7
--
To view, visit https://review.coreboot.org/c/flashrom/+/51243
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0c6b6b8dc17aaee28640e3fca3d1fc9f7feabf5f
Gerrit-Change-Number: 51243
Gerrit-PatchSet: 7
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Daniel Kurtz <djkurtz(a)google.com>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-CC: Thomas Heijligen <src(a)posteo.de>
Gerrit-CC: Victor Ding <victording(a)chromium.org>
Gerrit-Attention: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Khem Raj, Edward O'Callaghan.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51960 )
Change subject: flashrom: Mark RISCV as non memory-mapped I/O architecture
......................................................................
Patch Set 1:
(2 comments)
Patchset:
PS1:
What's the reason for the change? I don't even understand why
the Makefile enables the programmers for the other arches w/o
port-I/O implementation.
File Makefile:
https://review.coreboot.org/c/flashrom/+/51960/comment/86a650df_d42790ca
PS1, Line 562: ifneq ($(ARCH),$(filter $(ARCH),x86 mips ppc arm sparc arc riscv))
Is this really what you want? Note the `ifneq`, it means the programmers
below would be enabled for riscv.
--
To view, visit https://review.coreboot.org/c/flashrom/+/51960
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I55c4e8529d36f0850dd56441c3fb8602c5d889fd
Gerrit-Change-Number: 51960
Gerrit-PatchSet: 1
Gerrit-Owner: Khem Raj
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Khem Raj
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Comment-Date: Tue, 30 Mar 2021 23:14:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment