Attention is currently required from: Mike Banon, Nico Huber, Victor Ding, Angel Pons, Anastasia Klimchuk.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56475 )
Change subject: ene_lpc: remove ENE LPC programmer
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Mike, are you able to test thi?
--
To view, visit https://review.coreboot.org/c/flashrom/+/56475
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3f40db22c42c04ce029c4defd837e05ebb550c9b
Gerrit-Change-Number: 56475
Gerrit-PatchSet: 1
Gerrit-Owner: Victor Ding <victording(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Victor Ding <victording(a)google.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Thu, 22 Jul 2021 07:46:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Nikolai Artemiev has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/56506 )
Change subject: test
......................................................................
test
Change-Id: Ib294faa1172dc31ba84890628117616b0e27419c
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
---
A x
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/06/56506/1
diff --git a/x b/x
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/x
@@ -0,0 +1 @@
+test
--
To view, visit https://review.coreboot.org/c/flashrom/+/56506
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib294faa1172dc31ba84890628117616b0e27419c
Gerrit-Change-Number: 56506
Gerrit-PatchSet: 1
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-MessageType: newchange
Attention is currently required from: Nico Huber, Angel Pons, Anastasia Klimchuk.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56501 )
Change subject: tests: Add test to erase a chip
......................................................................
Patch Set 1: Code-Review+1
(2 comments)
File tests/chip.c:
https://review.coreboot.org/c/flashrom/+/56501/comment/f894eea1_dddffc2d
PS1, Line 26: /*
: * Populate buf with the value used for erase operation, this allows to pass
: * verification checks and also emulates successful erase.
: */
: buf = memset(buf, 0xff, len);
should this memset happen instead in the block erase fn and use a singleton state here to see if that was called yet or not?
I think in this particular case of emulating a hw state a singleton global is the highly exceptional case of it being a good pattern.
https://review.coreboot.org/c/flashrom/+/56501/comment/e4ff1415_5ed59c7c
PS1, Line 42: printf("Unlock chip called\n");
The singleton state could also be queried with a counter to ensure a double unlock isn't done?
--
To view, visit https://review.coreboot.org/c/flashrom/+/56501
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6f74bfe4e02244d24d6c837cc3d551251e7b4898
Gerrit-Change-Number: 56501
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
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: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Thu, 22 Jul 2021 06:07:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
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/+/56501 )
Change subject: tests: Add test to erase a chip
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
This is my new idea, which came up recently after I spent some time looking at layout code. I plan to eventually cover do_write, do_read, do_verify (if this patch goes well).
This is a different area which has no overlap with init-shutdown tests.
Thank you for reviews!
--
To view, visit https://review.coreboot.org/c/flashrom/+/56501
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6f74bfe4e02244d24d6c837cc3d551251e7b4898
Gerrit-Change-Number: 56501
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
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: 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: Thu, 22 Jul 2021 04:49:29 +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/+/56501 )
Change subject: tests: Add test to erase a chip
......................................................................
tests: Add test to erase a chip
The test covers the code which parforms do_erase operation. It works
with fake chip and dummy programmer. Fake chip has all operations
defined, they all log and return 0. Read operation always initialises
buffer with one and the same value.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I6f74bfe4e02244d24d6c837cc3d551251e7b4898
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
A tests/chip.c
M tests/meson.build
M tests/tests.c
M tests/tests.h
4 files changed, 124 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/01/56501/1
diff --git a/tests/chip.c b/tests/chip.c
new file mode 100644
index 0000000..98758b7
--- /dev/null
+++ b/tests/chip.c
@@ -0,0 +1,115 @@
+/*
+ * 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 <stdio.h>
+#include <string.h>
+
+#include "flash.h"
+#include "programmer.h"
+
+int read_chip(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len)
+{
+ printf("Read chip called with start=0x%x, len=0x%x\n", start, len);
+ /*
+ * Populate buf with the value used for erase operation, this allows to pass
+ * verification checks and also emulates successful erase.
+ */
+ buf = memset(buf, 0xff, len);
+ return 0;
+}
+
+int write_chip(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)
+{
+ printf("Write chip called with start=0x%x, len=0x%x\n", start, len);
+ return 0;
+}
+
+int unlock_chip(struct flashctx *flash)
+{
+ printf("Unlock chip called\n");
+ return 0;
+}
+
+int block_erase_chip(struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen)
+{
+ printf("Block erase called with blockaddr=0x%x, blocklen=0x%x\n", blockaddr, blocklen);
+ return 0;
+}
+
+void erase_chip_test_success(void **state)
+{
+ (void) state; /* unused */
+
+ /* Programmer param. Test is happy with default params. */
+ char *param_dup = strdup("");
+
+ struct flashchip chip = {
+ .vendor = "aklm",
+ /*
+ * Total size less than 16 * 1024 to skip some steps
+ * in flashrom.c#prepare_flash_access.
+ */
+ .total_size = 8 * 1024,
+ .tested = TEST_OK_PREW,
+ .read = read_chip,
+ .write = write_chip,
+ .unlock = unlock_chip,
+ .block_erasers =
+ {{
+ /* All blocks within total size of the chip. */
+ .eraseblocks = { {2 * 1024, 3} },
+ .block_erase = block_erase_chip,
+ }},
+ };
+ struct flashrom_flashctx flash = {
+ .chip = &chip,
+ };
+
+ struct flashrom_layout *layout;
+
+ printf("Creating layout with one included region... ");
+ assert_int_equal(0, flashrom_layout_new(&layout));
+ /* One region which covers total size of chip. */
+ assert_int_equal(0, flashrom_layout_add_region(layout, 0x00000000, 0x00002000, "region"));
+ assert_int_equal(0, flashrom_layout_include_region(layout, "region"));
+
+ flashrom_layout_set(&flash, layout);
+ printf("done\n");
+
+ /*
+ * We need some programmer (any), and dummy is a very good one,
+ * because it doesn't need any mocking. So no extra complexity
+ * from a programmer side, and test can focus on the code which
+ * erases the chip.
+ */
+ printf("Dummyflasher initialising... ");
+ assert_int_equal(0, programmer_init(&programmer_dummy, param_dup));
+ printf("done\n");
+
+ printf("Erase chip operation started.\n");
+ assert_int_equal(0, do_erase(&flash));
+ printf("Erase chip operation done.\n");
+
+ printf("Dummyflasher shutdown... ");
+ assert_int_equal(0, programmer_shutdown());
+ printf("done\n");
+
+ printf("Releasing layout... ");
+ flashrom_layout_release(layout);
+ printf("done\n");
+
+ free(param_dup);
+}
diff --git a/tests/meson.build b/tests/meson.build
index 5776862..1bca6ec 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -20,6 +20,7 @@
'spi25.c',
'init_shutdown.c',
'layout.c',
+ 'chip.c',
]
mocks = [
diff --git a/tests/tests.c b/tests/tests.c
index 00c987c..3f77598 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -246,5 +246,10 @@
};
ret |= cmocka_run_group_tests_name("layout.c tests", layout_tests, NULL, NULL);
+ const struct CMUnitTest chip_tests[] = {
+ cmocka_unit_test(erase_chip_test_success),
+ };
+ ret |= cmocka_run_group_tests_name("chip.c tests", chip_tests, NULL, NULL);
+
return ret;
}
diff --git a/tests/tests.h b/tests/tests.h
index 14cfee0..c99b095 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -55,4 +55,7 @@
void layout_region_invalid_address_test_success(void **state);
void layout_region_invalid_range_test_success(void **state);
+/* chip.c */
+void erase_chip_test_success(void **state);
+
#endif /* TESTS_H */
--
To view, visit https://review.coreboot.org/c/flashrom/+/56501
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6f74bfe4e02244d24d6c837cc3d551251e7b4898
Gerrit-Change-Number: 56501
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Thomas Heijligen, Anastasia Klimchuk.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56469 )
Change subject: programmer_table: Remove space between address operator and variable
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/56469
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iba29b1bc3d77b8c17c51fc0552c129e6965fa308
Gerrit-Change-Number: 56469
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
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: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Thu, 22 Jul 2021 02:07:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment