summaryrefslogtreecommitdiff
path: root/util/flashrom
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2008-12-06 01:37:09 +0000
committerPeter Stuge <peter@stuge.se>2008-12-06 01:37:09 +0000
commitbaada5efaf7d53dc738b5fa2cefed1293ac45173 (patch)
tree33b0db1857d2a81b2f2546cb4172a35c4c56ff73 /util/flashrom
parentce00f1d12c5d992c979e97e926e4e1e521122494 (diff)
flashrom: Display test status in -L chip listing
Looks like this: Supported flash chips: Tested OK operations: Known BAD operations: AMD Am29F002(N)BB AMD Am29F002(N)BT PROBE READ ERASE WRITE AMD Am29F016D AMD Am29F040B PROBE READ ERASE WRITE AMD Am29LV040B Atmel AT45CS1282 READ Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3803 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom')
-rw-r--r--util/flashrom/flashrom.c55
1 files changed, 51 insertions, 4 deletions
diff --git a/util/flashrom/flashrom.c b/util/flashrom/flashrom.c
index de3fab53cf..623ce7f05d 100644
--- a/util/flashrom/flashrom.c
+++ b/util/flashrom/flashrom.c
@@ -205,14 +205,61 @@ int verify_flash(struct flashchip *flash, uint8_t *buf)
return 0;
}
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define POS_PRINT(x) do { pos += strlen(x); printf(x); } while (0)
+
void print_supported_chips(void)
{
- int i;
+ int okcol = 0, pos = 0;
+ struct flashchip *f;
- printf("Supported ROM chips:\n\n");
+ for (f = flashchips; f->name != NULL; f++) {
+ if (GENERIC_DEVICE_ID == f->model_id)
+ continue;
+ okcol = MAX(okcol, strlen(f->vendor) + 1 + strlen(f->name));
+ }
+ okcol = (okcol + 7) & ~7;
- for (i = 0; flashchips[i].name != NULL; i++)
- printf("%s %s\n", flashchips[i].vendor, flashchips[i].name);
+ POS_PRINT("Supported flash chips:");
+ while (pos < okcol) {
+ printf("\t");
+ pos += 8 - (pos % 8);
+ }
+ printf("Tested OK operations:\tKnown BAD operations:\n\n");
+
+ for (f = flashchips; f->name != NULL; f++) {
+ printf("%s %s", f->vendor, f->name);
+ pos = strlen(f->vendor) + 1 + strlen(f->name);
+ while (pos < okcol) {
+ printf("\t");
+ pos += 8 - (pos % 8);
+ }
+ if ((f->tested & TEST_OK_MASK)) {
+ if ((f->tested & TEST_OK_PROBE))
+ POS_PRINT("PROBE ");
+ if ((f->tested & TEST_OK_READ))
+ POS_PRINT("READ ");
+ if ((f->tested & TEST_OK_ERASE))
+ POS_PRINT("ERASE ");
+ if ((f->tested & TEST_OK_WRITE))
+ POS_PRINT("WRITE");
+ }
+ while (pos < okcol + 24) {
+ printf("\t");
+ pos += 8 - (pos % 8);
+ }
+ if ((f->tested & TEST_BAD_MASK)) {
+ if ((f->tested & TEST_BAD_PROBE))
+ printf("PROBE ");
+ if ((f->tested & TEST_BAD_READ))
+ printf("READ ");
+ if ((f->tested & TEST_BAD_ERASE))
+ printf("ERASE ");
+ if ((f->tested & TEST_BAD_WRITE))
+ printf("WRITE");
+ }
+ printf("\n");
+ }
}
void usage(const char *name)