1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 07:23:43 +02:00

List the size (in KB) and type of supported flash chips in 'flashrom -L'

Also, list how many chips/chipsets/boards we support in 'flashrom -L'.

Corresponding to flashrom svn r599.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
Uwe Hermann 2009-06-16 23:15:10 +00:00
parent 05dfbe67d6
commit 4e587905ae
3 changed files with 60 additions and 22 deletions

View File

@ -829,7 +829,10 @@ const struct board_info boards_bad[] = {
void print_supported_boards_helper(const struct board_info *b) void print_supported_boards_helper(const struct board_info *b)
{ {
int i, j; int i, j, boardcount = 0;
for (i = 0; b[i].vendor != NULL; i++)
boardcount++;
for (i = 0; b[i].vendor != NULL; i++) { for (i = 0; b[i].vendor != NULL; i++) {
printf("%s", b[i].vendor); printf("%s", b[i].vendor);
@ -844,11 +847,15 @@ void print_supported_boards_helper(const struct board_info *b)
void print_supported_boards(void) void print_supported_boards(void)
{ {
int i, j; int i, j, boardcount = 0;
struct board_pciid_enable *b = board_pciid_enables; struct board_pciid_enable *b = board_pciid_enables;
printf("\nSupported boards which need write-enable code:\n\nVendor: " for (i = 0; b[i].vendor_name != NULL; i++)
" Board: Required option:\n\n"); boardcount++;
printf("\nSupported boards which need write-enable code (total: %d):"
"\n\nVendor: Board: "
"Required option:\n\n", boardcount);
for (i = 0; b[i].vendor_name != NULL; i++) { for (i = 0; b[i].vendor_name != NULL; i++) {
printf("%s", b[i].vendor_name); printf("%s", b[i].vendor_name);
@ -863,10 +870,16 @@ void print_supported_boards(void)
printf("(none, board is autodetected)\n"); printf("(none, board is autodetected)\n");
} }
printf("\nSupported boards which don't need write-enable code:\n\n"); for (i = 0, boardcount = 0; boards_ok[i].vendor != NULL; i++)
boardcount++;
printf("\nSupported boards which don't need write-enable code "
"(total: %d):\n\n", boardcount);
print_supported_boards_helper(boards_ok); print_supported_boards_helper(boards_ok);
printf("\nBoards which have been verified to NOT work (yet):\n\n"); for (i = 0, boardcount = 0; boards_bad[i].vendor != NULL; i++)
boardcount++;
printf("\nBoards which have been verified to NOT work yet "
"(total: %d):\n\n", boardcount);
print_supported_boards_helper(boards_bad); print_supported_boards_helper(boards_bad);
} }

View File

@ -1037,11 +1037,14 @@ const struct penable chipset_enables[] = {
void print_supported_chipsets(void) void print_supported_chipsets(void)
{ {
int i, j; int i, j, chipsetcount = 0;
const struct penable *c = chipset_enables; const struct penable *c = chipset_enables;
printf("\nSupported chipsets:\n\nVendor: Chipset:" for (i = 0; c[i].vendor_name != NULL; i++)
" PCI IDs:\n\n"); chipsetcount++;
printf("\nSupported chipsets (total: %d):\n\nVendor: "
"Chipset: PCI IDs:\n\n", chipsetcount);
for (i = 0; c[i].vendor_name != NULL; i++) { for (i = 0; c[i].vendor_name != NULL; i++) {
printf("%s", c[i].vendor_name); printf("%s", c[i].vendor_name);

View File

@ -516,9 +516,22 @@ int erase_flash(struct flashchip *flash)
#endif #endif
#define POS_PRINT(x) do { pos += strlen(x); printf(x); } while (0) #define POS_PRINT(x) do { pos += strlen(x); printf(x); } while (0)
static int digits(int n)
{
int i;
if (!n)
return 1;
for (i = 0; n; ++i)
n /= 10;
return i;
}
void print_supported_chips(void) void print_supported_chips(void)
{ {
int okcol = 0, pos = 0, i; int okcol = 0, pos = 0, i, chipcount = 0;
struct flashchip *f; struct flashchip *f;
for (f = flashchips; f->name != NULL; f++) { for (f = flashchips; f->name != NULL; f++) {
@ -528,13 +541,18 @@ void print_supported_chips(void)
} }
okcol = (okcol + 7) & ~7; okcol = (okcol + 7) & ~7;
printf("Supported flash chips:\n\n"); for (f = flashchips; f->name != NULL; f++)
chipcount++;
printf("\nSupported flash chips (total: %d):\n\n", chipcount);
POS_PRINT("Vendor: Device:"); POS_PRINT("Vendor: Device:");
while (pos < okcol) { while (pos < okcol) {
printf("\t"); printf("\t");
pos += 8 - (pos % 8); pos += 8 - (pos % 8);
} }
printf("Tested OK operations:\tKnown BAD operations:\n\n");
printf("Tested OK:\tKnown BAD: Size/KB: Type:\n\n");
printf("(P = PROBE, R = READ, E = ERASE, W = WRITE)\n\n");
for (f = flashchips; f->name != NULL; f++) { for (f = flashchips; f->name != NULL; f++) {
/* Don't print "unknown XXXX SPI chip" entries. */ /* Don't print "unknown XXXX SPI chip" entries. */
@ -553,29 +571,33 @@ void print_supported_chips(void)
} }
if ((f->tested & TEST_OK_MASK)) { if ((f->tested & TEST_OK_MASK)) {
if ((f->tested & TEST_OK_PROBE)) if ((f->tested & TEST_OK_PROBE))
POS_PRINT("PROBE "); POS_PRINT("P ");
if ((f->tested & TEST_OK_READ)) if ((f->tested & TEST_OK_READ))
POS_PRINT("READ "); POS_PRINT("R ");
if ((f->tested & TEST_OK_ERASE)) if ((f->tested & TEST_OK_ERASE))
POS_PRINT("ERASE "); POS_PRINT("E ");
if ((f->tested & TEST_OK_WRITE)) if ((f->tested & TEST_OK_WRITE))
POS_PRINT("WRITE"); POS_PRINT("W ");
} }
while (pos < okcol + 24) { while (pos < okcol + 9) {
printf("\t"); printf("\t");
pos += 8 - (pos % 8); pos += 8 - (pos % 8);
} }
if ((f->tested & TEST_BAD_MASK)) { if ((f->tested & TEST_BAD_MASK)) {
if ((f->tested & TEST_BAD_PROBE)) if ((f->tested & TEST_BAD_PROBE))
printf("PROBE "); printf("P ");
if ((f->tested & TEST_BAD_READ)) if ((f->tested & TEST_BAD_READ))
printf("READ "); printf("R ");
if ((f->tested & TEST_BAD_ERASE)) if ((f->tested & TEST_BAD_ERASE))
printf("ERASE "); printf("E ");
if ((f->tested & TEST_BAD_WRITE)) if ((f->tested & TEST_BAD_WRITE))
printf("WRITE"); printf("W ");
} }
printf("\n");
printf("\t %d", f->total_size);
for (i = 0; i < 10 - digits(f->total_size); i++)
printf(" ");
printf("%s\n", flashbuses_to_text(f->bustype));
} }
} }