Edward O'Callaghan submitted this change.

View Change



21 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved
flashrom.c: Update check_block_eraser function to use probe opcode

Update the check_block_eraser function to use probe_opcode to see if the
given block_eraser is supported by the spi master. This will help to get
a real count of usable block_erasers.

Change-Id: I6591a84ae1fe5bc1648051cc30b9393450033852
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66717
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M flashrom.c
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/flashrom.c b/flashrom.c
index 573f10b..785da6f 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -446,6 +446,18 @@
"eraseblock layout is not defined. ");
return 1;
}
+
+ if (flash->mst->buses_supported & BUS_SPI) {
+ const uint8_t *opcode = spi_get_opcode_from_erasefn(eraser.block_erase);
+ for (int i = 0; opcode[i]; i++) {
+ if (!flash->mst->spi.probe_opcode(flash, opcode[i])) {
+ if (log)
+ msg_cdbg("block erase function and layout found "
+ "but SPI master doesn't support the function. ");
+ return 1;
+ }
+ }
+ }
// TODO: Once erase functions are annotated with allowed buses, check that as well.
return 0;
}

To view, visit change 66717. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6591a84ae1fe5bc1648051cc30b9393450033852
Gerrit-Change-Number: 66717
Gerrit-PatchSet: 26
Gerrit-Owner: Aarya <aarya.chaumal@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Simon Buhrow
Gerrit-Reviewer: Thomas Heijligen <src@posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: merged