Attention is currently required from: Sam McNally, Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52405 )
Change subject: lspcon, realtek_mst: move i2c bus resolution from params to i2c_helper
......................................................................
Patch Set 6:
(2 comments)
File i2c_helper_linux.c:
https://review.coreboot.org/c/flashrom/+/52405/comment/3818f2ab_ddde4eb1
PS6, Line 36: {
style nit: The opening brace for functions should go on the next line
https://review.coreboot.org/c/flashrom/+/52405/comment/56b0cd2b_fc1332b4
PS6, Line 42: char *dev = malloc(sizeof(I2C_DEV_PREFIX));
This effectively undoes what CB:52415 did...
--
To view, visit https://review.coreboot.org/c/flashrom/+/52405
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ieea57b2445f3aca16c87d8f839dff131009531a0
Gerrit-Change-Number: 52405
Gerrit-PatchSet: 6
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Sam McNally <sammc(a)google.com>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Mon, 19 Apr 2021 08:53:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51487 )
Change subject: tests: Add unit test to run init/shutdown for mec1308.c
......................................................................
Patch Set 3:
(2 comments)
Patchset:
PS2:
> Please split and thanks for the patience! […]
I split this into 5 patches, and first three are ready, these ones:
https://review.coreboot.org/c/flashrom/+/52496https://review.coreboot.org/c/flashrom/+/52497https://review.coreboot.org/c/flashrom/+/52498
For the remaining two I still need to do testing and resolve comments.
This patch is now #5 out of chain of 5.
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/51487/comment/9980bbe6_31ac8f23
PS2, Line 99: : 0));
> This can get quite complex when additional tests are added. We can […]
Agree, this can happen (although I noticed for some cases it was sufficient to just return 0).
But I am very happy that now all this is contained within tests/ directory which makes it easy to experiment and change. If tests pass means tests are not broken :)
--
To view, visit https://review.coreboot.org/c/flashrom/+/51487
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3af612defe1af3850dfc1626a208d873e3a3eddc
Gerrit-Change-Number: 51487
Gerrit-PatchSet: 3
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Mon, 19 Apr 2021 06:59:49 +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
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52499 )
Change subject: hwaccess.h: Split hwaccess.h and extract hwaccess_io.h out of it
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
This needs to be tested by comparing binaries
--
To view, visit https://review.coreboot.org/c/flashrom/+/52499
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Idd04c7b36b24e9da339348a015df4f43a03744f7
Gerrit-Change-Number: 52499
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 19 Apr 2021 06:51:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/52497 )
Change subject: Add unit test to run init/shutdown for dummyflasher.c
......................................................................
Add unit test to run init/shutdown for dummyflasher.c
I plan to do this for all drivers in programmer table, one at a time. Dummy
is the first and the easiest.
After this was rebased on the top of memory checks
https://review.coreboot.org/c/flashrom/+/51243 , dummy has been discovered
to leak memory on shutdown, so I fix it here.
TEST=builds and ninja test
BUG=b:181803212
Change-Id: I3c0ef73397f00c1db7aabb5f9f00cb43525af29c
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M dummyflasher.c
A tests/init_shutdown.c
M tests/meson.build
M tests/tests.c
M tests/tests.h
5 files changed, 47 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/97/52497/1
diff --git a/dummyflasher.c b/dummyflasher.c
index 5190282..ec5060d 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -650,6 +650,7 @@
free(flashchip_contents);
}
#endif
+ free(data);
return 0;
}
diff --git a/tests/init_shutdown.c b/tests/init_shutdown.c
new file mode 100644
index 0000000..5226860
--- /dev/null
+++ b/tests/init_shutdown.c
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright 2021 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <include/test.h>
+#include <string.h>
+
+#include "programmer.h"
+
+static void run_lifecycle(void **state, enum programmer prog, const char *param)
+{
+ (void) state; /* unused */
+
+ printf("Testing programmer_init for programmer=%u ...\n", prog);
+ assert_int_equal(0, programmer_init(prog, strdup(param)));
+ printf("... programmer_init for programmer=%u successful\n", prog);
+
+ printf("Testing programmer_shutdown for programmer=%u ...\n", prog);
+ assert_int_equal(0, programmer_shutdown());
+ printf("... programmer_shutdown for programmer=%u successful\n", prog);
+}
+
+void dummy_init_and_shutdown_test_success(void **state)
+{
+ run_lifecycle(state, PROGRAMMER_DUMMY, "bus=parallel+lpc+fwh+spi");
+}
diff --git a/tests/meson.build b/tests/meson.build
index f0cb76d..815ea76 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -18,6 +18,7 @@
'helpers.c',
'flashrom.c',
'spi25.c',
+ 'init_shutdown.c',
]
mocks = [
diff --git a/tests/tests.c b/tests/tests.c
index 5be4216..1dc819e 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -68,5 +68,10 @@
};
ret |= cmocka_run_group_tests_name("spi25.c tests", spi25_tests, NULL, NULL);
+ const struct CMUnitTest init_shutdown_tests[] = {
+ cmocka_unit_test(dummy_init_and_shutdown_test_success),
+ };
+ ret |= cmocka_run_group_tests_name("init_shutdown.c tests", init_shutdown_tests, NULL, NULL);
+
return ret;
}
diff --git a/tests/tests.h b/tests/tests.h
index cb905fd..32fed0a 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -40,4 +40,7 @@
void probe_spi_at25f_test_success(void **state);
void probe_spi_st95_test_success(void **state); /* spi95.c */
+/* init_shutdown.c */
+void dummy_init_and_shutdown_test_success(void **state);
+
#endif /* TESTS_H */
--
To view, visit https://review.coreboot.org/c/flashrom/+/52497
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3c0ef73397f00c1db7aabb5f9f00cb43525af29c
Gerrit-Change-Number: 52497
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Edward O'Callaghan, Angel Pons, Anastasia Klimchuk.
Hello build bot (Jenkins), Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/51487
to look at the new patch set (#3).
Change subject: tests: Add unit test to run init/shutdown for mec1308.c
......................................................................
tests: Add unit test to run init/shutdown for mec1308.c
This patch includes mocks for io operations in hwaccess_io.h
because those are needed to test lifecycle of mec1308.c
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I3af612defe1af3850dfc1626a208d873e3a3eddc
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
A hwaccess_io_unittest.h
M meson.build
M tests/init_shutdown.c
M tests/meson.build
M tests/tests.c
M tests/tests.h
6 files changed, 107 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/87/51487/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/51487
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3af612defe1af3850dfc1626a208d873e3a3eddc
Gerrit-Change-Number: 51487
Gerrit-PatchSet: 3
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-CC: Nico Huber <nico.h(a)gmx.de>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
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
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/52469 )
Change subject: lspcon_i2c_spi.c: Rename PAGE_SIZE macro
......................................................................
lspcon_i2c_spi.c: Rename PAGE_SIZE macro
This fixes building with musl libc on alpine:i386-v3.7.
Change-Id: Ibd478f3fcd6b6803098035dbdc47f72f6ab3fa6b
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52469
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
---
M lspcon_i2c_spi.c
1 file changed, 8 insertions(+), 8 deletions(-)
Approvals:
build bot (Jenkins): Verified
Nico Huber: Looks good to me, approved
Edward O'Callaghan: Looks good to me, approved
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 7b9f1c0..7599db6 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -27,7 +27,7 @@
#define REGISTER_ADDRESS (0x94 >> 1)
#define PAGE_ADDRESS (0x9e >> 1)
-#define PAGE_SIZE 256
+#define LSPCON_PAGE_SIZE 256
#define MAX_SPI_WAIT_RETRIES 1000
#define CLT2_SPI 0x82
@@ -330,7 +330,7 @@
static int lspcon_i2c_spi_map_page(int fd, unsigned int offset)
{
int ret = 0;
- /* Page number byte, need to / PAGE_SIZE. */
+ /* Page number byte, need to / LSPCON_PAGE_SIZE. */
ret |= lspcon_i2c_spi_write_register(fd, ROMADDR_BYTE1, (offset >> 8) & 0xff);
ret |= lspcon_i2c_spi_write_register(fd, ROMADDR_BYTE2, (offset >> 16));
@@ -349,9 +349,9 @@
if (fd < 0)
return SPI_GENERIC_ERROR;
- for (i = 0; i < len; i += PAGE_SIZE) {
+ for (i = 0; i < len; i += LSPCON_PAGE_SIZE) {
ret |= lspcon_i2c_spi_map_page(fd, start + i);
- ret |= lspcon_i2c_spi_read_data(fd, PAGE_ADDRESS, buf + i, min(len - i, PAGE_SIZE));
+ ret |= lspcon_i2c_spi_read_data(fd, PAGE_ADDRESS, buf + i, min(len - i, LSPCON_PAGE_SIZE));
}
return ret;
@@ -363,8 +363,8 @@
* Using static buffer with maximum possible size,
* extra byte is needed for prefixing zero at index 0.
*/
- uint8_t write_buffer[PAGE_SIZE + 1] = { 0 };
- if (len > PAGE_SIZE)
+ uint8_t write_buffer[LSPCON_PAGE_SIZE + 1] = { 0 };
+ if (len > LSPCON_PAGE_SIZE)
return SPI_GENERIC_ERROR;
/* First byte represents the writing offset and should always be zero. */
@@ -389,9 +389,9 @@
ret |= lspcon_i2c_spi_enable_hw_write(fd);
ret |= lspcon_i2c_clt2_spi_reset(fd);
- for (unsigned int i = 0; i < len; i += PAGE_SIZE) {
+ for (unsigned int i = 0; i < len; i += LSPCON_PAGE_SIZE) {
ret |= lspcon_i2c_spi_map_page(fd, start + i);
- ret |= lspcon_i2c_spi_write_page(fd, buf + i, min(len - i, PAGE_SIZE));
+ ret |= lspcon_i2c_spi_write_page(fd, buf + i, min(len - i, LSPCON_PAGE_SIZE));
}
ret |= lspcon_i2c_spi_enable_write_protection(fd);
--
To view, visit https://review.coreboot.org/c/flashrom/+/52469
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibd478f3fcd6b6803098035dbdc47f72f6ab3fa6b
Gerrit-Change-Number: 52469
Gerrit-PatchSet: 2
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
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-MessageType: merged