#107: flashrom: Display test status in -L chip listing

#107: flashrom: Display test status in -L chip listing ---------------------------------+------------------------------------------ Reporter: stuge | Owner: somebody Type: enhancement | Status: new Priority: minor | Milestone: flashrom v1.0 Component: flashrom | Version: Keywords: testing | Dependencies: Patchstatus: there is no patch | ---------------------------------+------------------------------------------ -- Ticket URL: <http://tracker.coreboot.org/trac/coreboot/ticket/107> coreboot <http://www.coreboot.org/>

#107: flashrom: Display test status in -L chip listing ----------------------------+----------------------------------------------- Reporter: stuge | Owner: somebody Type: enhancement | Status: new Priority: minor | Milestone: flashrom v1.0 Component: flashrom | Version: Resolution: | Keywords: testing Dependencies: | Patchstatus: there is no patch ----------------------------+----------------------------------------------- Comment(by stuge): Can also include adding wiki-usable output. -- Ticket URL: <http://tracker.coreboot.org/trac/coreboot/ticket/107#comment:1> coreboot <http://www.coreboot.org/>

#107: flashrom: Display test status in -L chip listing ----------------------------+----------------------------------------------- Reporter: stuge | Owner: somebody Type: enhancement | Status: new Priority: minor | Milestone: flashrom v1.0 Component: flashrom | Version: Resolution: | Keywords: testing Dependencies: | Patchstatus: there is no patch ----------------------------+----------------------------------------------- Comment(by hailfinger): Good idea. I'd consider this to be optional, though. -- Ticket URL: <http://tracker.coreboot.org/trac/coreboot/ticket/107#comment:2> coreboot <http://www.coreboot.org/>

#107: flashrom: Display test status in -L chip listing ----------------------------------+----------------------------------------- Reporter: stuge | Owner: stuge Type: enhancement | Status: assigned Priority: minor | Milestone: flashrom v1.0 Component: flashrom | Version: Keywords: testing | Dependencies: Patchstatus: patch needs review | ----------------------------------+----------------------------------------- Changes (by stuge): * owner: somebody => stuge * status: new => assigned * patchstatus: there is no patch => patch needs review -- Ticket URL: <http://tracker.coreboot.org/trac/coreboot/ticket/107#comment:3> coreboot <http://www.coreboot.org/>

On Fri, Dec 05, 2008 at 04:19:49AM -0000, coreboot wrote:
#107: flashrom: Display test status in -L chip listing ----------------------------------+----------------------------------------- Reporter: stuge | Owner: stuge Type: enhancement | Status: assigned Priority: minor | Milestone: flashrom v1.0 Component: flashrom | Version: Keywords: testing | Dependencies: Patchstatus: patch needs review | ----------------------------------+----------------------------------------- Changes (by stuge):
* owner: somebody => stuge * status: new => assigned * patchstatus: there is no patch => patch needs review
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>
With the small change below this is Acked-by: Uwe Hermann <uwe@hermann-uwe.de> The output looks nice, patch compiles and works fine. Please post patches to the list though, trac doesn't automatically forward them to the list -> harder and more annoying to review, IMO.
Index: flashrom.c =================================================================== --- flashrom.c (revision 3797) +++ flashrom.c (working copy) @@ -205,14 +205,61 @@ return 0; }
+#define MAX(a,b) ((a)>(b)?(a):(b)) ^ ^^ ^^ ^^ lots of missing spaces here
+#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)) + POS_PRINT("PROBE "); + if ((f->tested & TEST_BAD_READ)) + POS_PRINT("READ "); + if ((f->tested & TEST_BAD_ERASE)) + POS_PRINT("ERASE "); + if ((f->tested & TEST_BAD_WRITE)) + POS_PRINT("WRITE"); + } + printf("\n"); + } }
void usage(const char *name)
Uwe. -- http://www.hermann-uwe.de | http://www.holsham-traders.de http://www.crazy-hacks.org | http://www.unmaintained-free-software.org

Uwe Hermann wrote:
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Thanks, r3803.
Please post patches to the list though, trac doesn't automatically forward them to the list -> harder and more annoying to review, IMO.
Hm yea understand. //Peter

#107: flashrom: Display test status in -L chip listing ----------------------------+----------------------------------------------- Reporter: stuge | Owner: stuge Type: enhancement | Status: closed Priority: minor | Milestone: flashrom v1.0 Component: flashrom | Version: Resolution: fixed | Keywords: testing Dependencies: | Patchstatus: patch has been committed ----------------------------+----------------------------------------------- Changes (by stuge): * status: assigned => closed * patchstatus: patch needs review => patch has been committed * resolution: => fixed Comment: r3803 -- Ticket URL: <http://tracker.coreboot.org/trac/coreboot/ticket/107#comment:4> coreboot <http://www.coreboot.org/>
participants (3)
-
coreboot
-
Peter Stuge
-
Uwe Hermann