Mike Banon has uploaded this change for review.
[v4,5/6] Add the hidden-from-probing chips category and make KB9012 hidden
There are some chips like ENE KB9012, probing for which
could cause the other chips to misbehave. Therefore, such chips
should be "hidden" - not probed for unless the user wants
This commit introduces a new field to the "flashchip" structure:
int hidden;
Now it is possible to "hide" any chip by adding this line
.hidden = 1,
to the "struct flashchip flashchips[]" structure of a chip, like
.write = edi_chip_write,
.read = edi_chip_read,
.voltage = {2700, 3600},
.hidden = 1,
},
^^^ KB9012 has been "hidden" this way, and it will never be probed for
unless explicitly specified by its' chip name: --chip "KB9012 (EDI)"
Now, flashrom will probe for a chip only if one of these conditions is true:
1) no chip has been specified AND this chip is not "hidden"
2) this chip has been specified by -c | --chip <chipname>
Change-Id: I89a53ccaef2791a2ac32904d7ab813da7478a6f0
Signed-off-by: Mike Banon <mikebdp2@gmail.com>
---
M flash.h
M flashchips.c
M flashrom.c
3 files changed, 17 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/62/23262/1
diff --git a/flash.h b/flash.h
index a3aebc5..1c4a38c 100644
--- a/flash.h
+++ b/flash.h
@@ -190,6 +190,14 @@
enum test_state write;
} tested;
+ /*
+ * There are some chips, probing for which could cause the other chips to misbehave.
+ * Therefore, such chips should be "hidden" - not probed for unless the user wants
+ *
+ * If set to 1, do not probe for this chip unless specified by -c | --chip <chipname>
+ */
+ int hidden;
+
int (*probe) (struct flashctx *flash);
/* Delay after "enter/exit ID mode" commands in microseconds.
diff --git a/flashchips.c b/flashchips.c
index 866d8e1..7b82602 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -43,6 +43,7 @@
* .total_size = Total size in (binary) kbytes
* .page_size = Page or eraseblock(?) size in bytes
* .tested = Test status
+ * .hidden = If set to 1, do not probe unless specified
* .probe = Probe function
* .probe_timing = Probe function delay
* .block_erasers[] = Array of erase layouts and erase functions
@@ -3302,6 +3303,7 @@
.write = edi_chip_write,
.read = edi_chip_read,
.voltage = {2700, 3600},
+ .hidden = 1,
},
{
diff --git a/flashrom.c b/flashrom.c
index 361a44f..f699798 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1205,7 +1205,13 @@
char *tmp;
for (chip = flashchips + startchip; chip && chip->name; chip++) {
- if (chip_to_probe && strcmp(chip->name, chip_to_probe) != 0)
+ /*
+ * Probe for a chip only if one of these conditions is true:
+ * 1) no chip has been specified AND this chip is not "hidden"
+ * 2) this chip has been specified by -c | --chip <chipname>
+ */
+ if (!((!chip_to_probe && !chip->hidden) ||
+ (chip_to_probe && strcmp(chip->name, chip_to_probe) == 0)))
continue;
buses_common = mst->buses_supported & chip->bustype;
if (!buses_common)
To view, visit change 23262. To unsubscribe, or for help writing mail filters, visit settings.