Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
---
ft2232_spi.c | 13 -------
print.c | 15 ++++++++
print_wiki.c | 106 +++++++++++++++++++++++++++++++++++++++++++---------------
3 files changed, 94 insertions(+), 40 deletions(-)
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 122866f..ec4934e 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -435,17 +435,4 @@ static int ft2232_spi_send_command(struct flashctx *flash,
return failed ? -1 : 0;
}
-void print_supported_usbdevs(const struct usbdev_status *devs)
-{
- int i;
-
- msg_pinfo("USB devices:\n");
- for (i = 0; devs[i].vendor_name != NULL; i++) {
- msg_pinfo("%s %s [%04x:%04x]%s\n", devs[i].vendor_name,
- devs[i].device_name, devs[i].vendor_id,
- devs[i].device_id,
- (devs[i].status == NT) ? " (untested)" : "");
- }
-}
-
#endif
diff --git a/print.c b/print.c
index 1fdeac7..f0c701e 100644
--- a/print.c
+++ b/print.c
@@ -422,6 +422,21 @@ static void print_supported_boards_helper(const struct board_info *boards,
}
#endif
+#if CONFIG_FT2232_SPI == 1
+void print_supported_usbdevs(const struct usbdev_status *devs)
+{
+ int i;
+
+ msg_pinfo("USB devices:\n");
+ for (i = 0; devs[i].vendor_name != NULL; i++) {
+ msg_pinfo("%s %s [%04x:%04x]%s\n", devs[i].vendor_name,
+ devs[i].device_name, devs[i].vendor_id,
+ devs[i].device_id,
+ (devs[i].status == NT) ? " (untested)" : "");
+ }
+}
+#endif
+
void print_supported(void)
{
print_supported_chips();
diff --git a/print_wiki.c b/print_wiki.c
index 377154d..a8c9d76 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -72,10 +72,7 @@ static const char chip_th[] = "{\
| Probe\n| Read\n| Erase\n| Write\n\
| align=\"center\" | Min \n| align=\"center\" | Max\n\n";
-static const char programmer_section[] = "\
-\n== Supported programmers ==\n\nThis is a list \
-of supported PCI devices flashrom can use as programmer:\n\n{| border=\"0\" \
-valign=\"top\"\n| valign=\"top\"|\n\n{| border=\"0\" style=\"font-size: \
+static const char programmer_th[] = "{| border=\"0\" style=\"font-size: \
smaller\" valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
! align=\"left\" | Device\n! align=\"center\" | PCI IDs\n\
! align=\"center\" | Status\n\n";
@@ -126,7 +123,7 @@ static void print_supported_chipsets_wiki(int cols)
printf("\n|}\n\n|}\n");
}
-static void wiki_helper(const char *devicetype, int cols,
+static void print_supported_boards_wiki_helper(const char *devicetype, int cols,
const struct board_info boards[])
{
int i, j, k = 0, boardcount_good = 0, boardcount_bad = 0, color = 1;
@@ -199,10 +196,10 @@ static void wiki_helper(const char *devicetype, int cols,
static void print_supported_boards_wiki(void)
{
printf("%s", board_intro);
- wiki_helper("boards", 2, boards_known);
+ print_supported_boards_wiki_helper("boards", 2, boards_known);
printf("%s", laptop_intro);
- wiki_helper("laptops", 1, laptops_known);
+ print_supported_boards_wiki_helper("laptops", 1, laptops_known);
}
#endif
@@ -276,7 +273,16 @@ static void print_supported_chips_wiki(int cols)
/* Not needed for CONFIG_INTERNAL, but for all other PCI-based programmers. */
#if CONFIG_NIC3COM+CONFIG_NICREALTEK+CONFIG_NICNATSEMI+CONFIG_GFXNVIDIA+CONFIG_DRKAISER+CONFIG_SATASII+CONFIG_ATAHPT+CONFIG_NICINTEL+CONFIG_NICINTEL_SPI+CONFIG_OGP_SPI+CONFIG_SATAMV >= 1
-static void print_supported_pcidevs_wiki(const struct pcidev_status *devs)
+static int count_supported_pcidevs_wiki(const struct pcidev_status *devs)
+{
+ int i = 0;
+ unsigned int count = 0;
+ for (i = 0; devs[i].vendor_name != NULL; i++)
+ count++;
+ return count;
+}
+
+static void print_supported_pcidevs_wiki_helper(const struct pcidev_status *devs)
{
int i = 0;
static int c = 0;
@@ -294,50 +300,96 @@ static void print_supported_pcidevs_wiki(const struct pcidev_status *devs)
}
#endif
-void print_supported_wiki(void)
+static void print_supported_pcidevs_wiki()
{
- time_t t = time(NULL);
+ unsigned int pci_count = 0;
- printf(wiki_header, ctime(&t), flashrom_version);
- print_supported_chips_wiki(2);
-#if CONFIG_INTERNAL == 1
- print_supported_chipsets_wiki(3);
- print_supported_boards_wiki();
+#if CONFIG_NIC3COM == 1
+ pci_count += count_supported_pcidevs_wiki(nics_3com);
+#endif
+#if CONFIG_NICREALTEK == 1
+ pci_count += count_supported_pcidevs_wiki(nics_realtek);
+#endif
+#if CONFIG_NICNATSEMI == 1
+ pci_count += count_supported_pcidevs_wiki(nics_natsemi);
+#endif
+#if CONFIG_GFXNVIDIA == 1
+ pci_count += count_supported_pcidevs_wiki(gfx_nvidia);
+#endif
+#if CONFIG_DRKAISER == 1
+ pci_count += count_supported_pcidevs_wiki(drkaiser_pcidev);
+#endif
+#if CONFIG_SATASII == 1
+ pci_count += count_supported_pcidevs_wiki(satas_sii);
+#endif
+#if CONFIG_ATAHPT == 1
+ pci_count += count_supported_pcidevs_wiki(ata_hpt);
+#endif
+#if CONFIG_NICINTEL == 1
+ pci_count += count_supported_pcidevs_wiki(nics_intel);
+#endif
+#if CONFIG_NICINTEL_SPI == 1
+ pci_count += count_supported_pcidevs_wiki(nics_intel_spi);
+#endif
+#if CONFIG_OGP_SPI == 1
+ pci_count += count_supported_pcidevs_wiki(ogp_spi);
+#endif
+#if CONFIG_SATAMV == 1
+ pci_count += count_supported_pcidevs_wiki(satas_mv);
#endif
- printf("%s", programmer_section);
+
+ printf("\n== Supported programmers ==\n\nTotal amount of supported "
+ "PCI devices flashrom can use as programmer: '''%d'''\n\n"
+ "{| border=\"0\" valign=\"top\"\n| valign=\"top\"|\n\n",
+ pci_count);
+ printf("%s", programmer_th);
+
#if CONFIG_NIC3COM == 1
- print_supported_pcidevs_wiki(nics_3com);
+ print_supported_pcidevs_wiki_helper(nics_3com);
#endif
#if CONFIG_NICREALTEK == 1
- print_supported_pcidevs_wiki(nics_realtek);
+ print_supported_pcidevs_wiki_helper(nics_realtek);
#endif
#if CONFIG_NICNATSEMI == 1
- print_supported_pcidevs_wiki(nics_natsemi);
+ print_supported_pcidevs_wiki_helper(nics_natsemi);
#endif
#if CONFIG_GFXNVIDIA == 1
- print_supported_pcidevs_wiki(gfx_nvidia);
+ print_supported_pcidevs_wiki_helper(gfx_nvidia);
#endif
#if CONFIG_DRKAISER == 1
- print_supported_pcidevs_wiki(drkaiser_pcidev);
+ print_supported_pcidevs_wiki_helper(drkaiser_pcidev);
#endif
#if CONFIG_SATASII == 1
- print_supported_pcidevs_wiki(satas_sii);
+ print_supported_pcidevs_wiki_helper(satas_sii);
#endif
#if CONFIG_ATAHPT == 1
- print_supported_pcidevs_wiki(ata_hpt);
+ print_supported_pcidevs_wiki_helper(ata_hpt);
#endif
#if CONFIG_NICINTEL == 1
- print_supported_pcidevs_wiki(nics_intel);
+ print_supported_pcidevs_wiki_helper(nics_intel);
#endif
#if CONFIG_NICINTEL_SPI == 1
- print_supported_pcidevs_wiki(nics_intel_spi);
+ print_supported_pcidevs_wiki_helper(nics_intel_spi);
#endif
#if CONFIG_OGP_SPI == 1
- print_supported_pcidevs_wiki(ogp_spi);
+ print_supported_pcidevs_wiki_helper(ogp_spi);
#endif
#if CONFIG_SATAMV == 1
- print_supported_pcidevs_wiki(satas_mv);
+ print_supported_pcidevs_wiki_helper(satas_mv);
#endif
printf("\n|}\n");
}
+void print_supported_wiki(void)
+{
+ time_t t = time(NULL);
+
+ printf(wiki_header, ctime(&t), flashrom_version);
+ print_supported_chips_wiki(2);
+#if CONFIG_INTERNAL == 1
+ print_supported_chipsets_wiki(3);
+ print_supported_boards_wiki();
+#endif
+ print_supported_pcidevs_wiki();
+}
+
--
1.7.1