summaryrefslogtreecommitdiffstats
path: root/print_wiki.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-12-27 18:40:36 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-12-27 18:40:36 +0000
commit4b24a2d70b79f3288370fd5b4f472bdf218f16e8 (patch)
treeb4ba0971a1d5ff2f8e1693ae66b33e8c8cda1843 /print_wiki.c
parentaf358d6af23b21f93f6e27278e76eec21a3d148f (diff)
downloadast2050-flashrom-4b24a2d70b79f3288370fd5b4f472bdf218f16e8.zip
ast2050-flashrom-4b24a2d70b79f3288370fd5b4f472bdf218f16e8.tar.gz
Unify usbdev_status and pcidev_status into dev_entry
Once upon a time usbdev_status was created for the ft2232 programmer. Its IDs are semantically different to pcidev_status because they indicate USB instead of PCI IDs, but apart from that both data structures are equal. This change makes life easier for everything involved in handling and printing the status of devices that is noted in those structures by combining them into dev_entry. It is still possible to distinguish between PCI and USB devices indirectly by using the struct programmer's type field. Also, add a programmer column to the PCI and USB devices lists. Corresponding to flashrom svn r1632. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'print_wiki.c')
-rw-r--r--print_wiki.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/print_wiki.c b/print_wiki.c
index 501a2d7..4f34f29 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -77,6 +77,7 @@ static const char chip_th[] = "\
| align=\"center\" | Min \n| align=\"center\" | Max\n\n";
static const char programmer_th[] = "\
+! align=\"left\" | Programmer\n\
! align=\"left\" | Vendor\n\
! align=\"left\" | Device\n\
! align=\"center\" | IDs\n\
@@ -300,51 +301,31 @@ static void print_supported_chips_wiki(int cols)
/* Following functions are not needed when no PCI/USB programmers are compiled in,
* but since print_wiki code has no size constraints we include it unconditionally. */
-static int count_supported_pcidevs_wiki(const struct pcidev_status *devs)
+static int count_supported_devs_wiki(const struct dev_entry *devs)
{
unsigned int count = 0;
unsigned int i = 0;
- for (i = 0; devs[i].vendor_name != NULL; i++)
+ for (i = 0; devs[i].vendor_id != 0; i++)
count++;
return count;
}
-static void print_supported_pcidevs_wiki_helper(const struct pcidev_status *devs)
+static void print_supported_devs_wiki_helper(const struct programmer_entry prog)
{
int i = 0;
static int c = 0;
+ const struct dev_entry *devs = prog.devs.dev;
+ const unsigned int count = count_supported_devs_wiki(devs);
/* Alternate colors if the vendor changes. */
c = !c;
- for (i = 0; devs[i].vendor_name != NULL; i++) {
- printf("|- bgcolor=\"#%s\"\n| %s || %s || %04x:%04x || {{%s}}\n", (c) ? "eeeeee" : "dddddd",
- devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, devs[i].device_id,
- (devs[i].status == NT) ? "?3" : "OK");
- }
-}
-
-static int count_supported_usbdevs_wiki(const struct usbdev_status *devs)
-{
- unsigned int count = 0;
- unsigned int i = 0;
- for (i = 0; devs[i].vendor_name != NULL; i++)
- count++;
- return count;
-}
-
-static void print_supported_usbdevs_wiki_helper(const struct usbdev_status *devs)
-{
- int i = 0;
- static int c = 0;
-
- /* Alternate colors if the vendor changes. */
- c = !c;
-
- for (i = 0; devs[i].vendor_name != NULL; i++) {
- printf("|- bgcolor=\"#%s\"\n| %s || %s || %04x:%04x || {{%s}}\n", (c) ? "eeeeee" : "dddddd",
- devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, devs[i].device_id,
- (devs[i].status == NT) ? "?3" : "OK");
+ for (i = 0; devs[i].vendor_id != 0; i++) {
+ printf("|- bgcolor=\"#%s\"\n", (c) ? "eeeeee" : "dddddd");
+ if (i == 0)
+ printf("| rowspan=\"%u\" | %s |", count, prog.name);
+ printf("| %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) ? "?3" : "OK");
}
}
@@ -358,10 +339,10 @@ static void print_supported_devs_wiki()
const struct programmer_entry prog = programmer_table[i];
switch (prog.type) {
case USB:
- usb_count += count_supported_usbdevs_wiki(prog.devs.usb);
+ usb_count += count_supported_devs_wiki(prog.devs.dev);
break;
case PCI:
- pci_count += count_supported_pcidevs_wiki(prog.devs.pci);
+ pci_count += count_supported_devs_wiki(prog.devs.dev);
break;
case OTHER:
default:
@@ -376,7 +357,7 @@ static void print_supported_devs_wiki()
for (i = 0; i < PROGRAMMER_INVALID; i++) {
const struct programmer_entry prog = programmer_table[i];
if (prog.type == PCI) {
- print_supported_pcidevs_wiki_helper(prog.devs.pci);
+ print_supported_devs_wiki_helper(prog);
}
}
printf("\n|}\n\n|}\n");
@@ -388,7 +369,7 @@ static void print_supported_devs_wiki()
for (i = 0; i < PROGRAMMER_INVALID; i++) {
const struct programmer_entry prog = programmer_table[i];
if (prog.type == USB) {
- print_supported_usbdevs_wiki_helper(prog.devs.usb);
+ print_supported_devs_wiki_helper(prog);
}
}
printf("\n|}\n\n|}\n");
OpenPOWER on IntegriCloud