See patch.

The code may have some potential for simplification, but it basically
works. I already used the output of the new -z option in the
http://coreboot.org/Flashrom page, please check if there are errors in
the output (or code).


Thanks, Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
Add a --list-supported-wiki / -z option which outputs the currently
supported flash chips (and their status), chipsets (plus status),
and mainboards (plus status) to stdout.

This allows for very easy pasting into the http://coreboot.org/Flashrom
page, so we can keep that page up-to-date without much hassle.

The list of boards is mostly new (known good ones which don't need
write-enable code, and known-bad ones) and also lists URLs to the
vendor's mainboard pages.
These URLs are NOT printed in -L output per default, but they are
if you use verbose mode, e.g. via -LV.
They're also used in the --list-supported-wiki output for the wiki,
of course.

Signed-off-by: Uwe Hermann <[email protected]>

Index: flashrom.8
===================================================================
--- flashrom.8	(Revision 483)
+++ flashrom.8	(Arbeitskopie)
@@ -2,7 +2,7 @@
 .SH NAME
 flashrom \- read, write, verify and erase BIOS/ROM/flash chips
 .SH SYNOPSIS
-.B flashrom \fR[\fB\-rwvEVfLhR\fR] [\fB\-c\fR chipname] [\fB\-s\fR exclude_start] [\fB\-e\fR exclude_end]
+.B flashrom \fR[\fB\-rwvEVfLzhR\fR] [\fB\-c\fR chipname] [\fB\-s\fR exclude_start] [\fB\-e\fR exclude_end]
          [\fB-m\fR [vendor:]part] [\fB-l\fR file.layout] [\fB-i\fR image_name] [file]
 .SH DESCRIPTION
 .B flashrom
@@ -123,6 +123,12 @@
 Please let us know if you can verify other boards to work or not work out
 of the box.
 .TP
+.B "\-z, \-\-list\-supported-wiki"
+Same as
+.BR \-\-list\-supported ,
+but outputs the supported hardware in MediaWiki syntax, so that it can be
+easily pasted into the wiki page at http://coreboot.org/Flashrom.
+.TP
 .B "\-p, \-\-programmer <name>"
 Specify the programmer device. Currently supported are:
 .sp
Index: flash.h
===================================================================
--- flash.h	(Revision 483)
+++ flash.h	(Arbeitskopie)
@@ -542,10 +542,12 @@
 void wbsio_mask(uint16_t index, uint8_t reg, uint8_t data, uint8_t mask);
 int board_flash_enable(const char *vendor, const char *part);
 void print_supported_boards(void);
+void print_supported_boards_wiki(void);
 
 /* chipset_enable.c */
 int chipset_flash_enable(void);
 void print_supported_chipsets(void);
+void print_supported_chipsets_wiki(void);
 
 extern unsigned long flashbase;
 
Index: chipset_enable.c
===================================================================
--- chipset_enable.c	(Revision 483)
+++ chipset_enable.c	(Arbeitskopie)
@@ -33,6 +33,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <string.h>
 #include "flash.h"
 
 unsigned long flashbase = 0;
@@ -971,6 +972,38 @@
 		       (enables[i].status == OK) ? "" : " (untested)");
 }
 
+#define CHIPSET_TH "{| border=\"0\" style=\"font-size: smaller\"\n\
+|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
+! align=\"left\" | Southbridge\n! align=\"left\" | Status\n\n"
+
+void print_supported_chipsets_wiki(void)
+{
+	int i, j, color = 1;
+
+	printf("\n== Supported chipsets ==\n\n{| border=\"0\" "
+	       "valign=\"top\"\n| valign=\"top\"|\n\n" CHIPSET_TH);
+
+	for (i = 0, j = 0; i < ARRAY_SIZE(enables); i++, j++) {
+		/* Alternate colors if the vendor changes. */
+		if (i > 0 && strcmp(enables[i].vendor_name,
+		    enables[i - 1].vendor_name))
+			color = !color;
+
+		printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s\n| %s"
+		       "\n| %s\n", (color) ? "eeeeee" : "dddddd",
+		       enables[i].vendor_name, enables[i].device_name,
+		       (enables[i].status == OK) ? "{{OK}}" : "?");
+
+		/* Split table in three columns. */
+		if (j >= (ARRAY_SIZE(enables) / 3 + 1)) {
+			printf("\n|}\n\n| valign=\"top\"|\n\n" CHIPSET_TH);
+			j = 0;
+		}
+	}
+
+	printf("\n|}\n\n|}\n");
+}
+
 int chipset_flash_enable(void)
 {
 	struct pci_dev *dev = 0;
Index: flashrom.c
===================================================================
--- flashrom.c	(Revision 483)
+++ flashrom.c	(Arbeitskopie)
@@ -301,9 +301,51 @@
 	}
 }
 
+#define CHIP_TH "{| border=\"0\" style=\"font-size: smaller\" valign=\"top\"\n\
+|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
+! align=\"left\" | Flash part\n! align=\"left\" colspan=\"4\" | Status\n\n\
+|- bgcolor=\"#6699ff\"\n| colspan=\"2\" | &nbsp;\n\
+| Probe\n| Read\n| Write\n| Erase\n\n"
+
+void print_supported_chips_wiki(void)
+{
+	int i = 0, c = 1, chipcount = 0;
+	struct flashchip *f, *old = NULL;
+
+	printf("\n== Supported chips ==\n\n{| border=\"0\" valign=\"top\"\n"
+		"| valign=\"top\"|\n\n" CHIP_TH);
+
+	for (f = flashchips; f->name != NULL; f++)
+		chipcount++;
+
+	for (f = flashchips; f->name != NULL; f++, i++) {
+		/* Alternate colors if the vendor changes. */
+		if (old != NULL && strcmp(old->vendor, f->vendor))
+			c = !c;
+
+		printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s"
+		       "\n| %s\n| {{%s}}\n| {{%s}}\n| {{%s}}\n| {{%s}}\n",
+		       (c == 1) ? "eeeeee" : "dddddd", f->vendor, f->name,
+		       ((f->tested & TEST_OK_PROBE) ? "OK" : (c) ? "?2" : "?"),
+		       ((f->tested & TEST_OK_READ)  ? "OK" : (c) ? "?2" : "?"),
+		       ((f->tested & TEST_OK_ERASE) ? "OK" : (c) ? "?2" : "?"),
+		       ((f->tested & TEST_OK_WRITE) ? "OK" : (c) ? "?2" : "?"));
+
+		/* Split table into three columns. */
+		if (i >= (chipcount / 3 + 1)) {
+			printf("\n|}\n\n| valign=\"top\"|\n\n" CHIP_TH);
+			i = 0;
+		}
+
+		old = f;
+	}
+
+	printf("\n|}\n\n|}\n");
+}
+
 void usage(const char *name)
 {
-	printf("usage: %s [-rwvEVfLhR] [-c chipname] [-s exclude_start]\n",
+	printf("usage: %s [-rwvEVfLzhR] [-c chipname] [-s exclude_start]\n",
 	       name);
 	printf("       [-e exclude_end] [-m [vendor:]part] [-l file.layout] [-i imagename] [file]\n");
 	printf("Please  note that the command line interface for flashrom will "
@@ -324,6 +366,7 @@
 	     "   -l | --layout <file.layout>:      read rom layout from file\n"
 	     "   -i | --image <name>:              only flash image name from flash layout\n"
 	     "   -L | --list-supported:            print supported devices\n"
+	     "   -z | --list-supported-wiki:       print supported devices in wiki syntax\n"
 	     "   -p | --programmer <name>:         specify the programmer device\n"
 	     "   -h | --help:                      print this help text\n"
 	     "   -R | --version:                   print the version (release)\n"
@@ -348,6 +391,7 @@
 	int option_index = 0;
 	int force = 0;
 	int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0;
+	int list_supported = 0, list_supported_wiki = 0;
 	int ret = 0, i;
 
 	static struct option long_options[] = {
@@ -364,6 +408,7 @@
 		{"layout", 1, 0, 'l'},
 		{"image", 1, 0, 'i'},
 		{"list-supported", 0, 0, 'L'},
+		{"list-supported-wiki", 0, 0, 'z'},
 		{"programmer", 1, 0, 'p'},
 		{"help", 0, 0, 'h'},
 		{"version", 0, 0, 'R'},
@@ -386,7 +431,7 @@
 	}
 
 	setbuf(stdout, NULL);
-	while ((opt = getopt_long(argc, argv, "rRwvVEfc:s:e:m:l:i:p:Lh",
+	while ((opt = getopt_long(argc, argv, "rRwvVEfc:s:e:m:l:i:p:Lzh",
 				  long_options, &option_index)) != EOF) {
 		switch (opt) {
 		case 'r':
@@ -440,11 +485,11 @@
 			find_romentry(tempstr);
 			break;
 		case 'L':
-			print_supported_chips();
-			print_supported_chipsets();
-			print_supported_boards();
-			exit(0);
+			list_supported = 1;
 			break;
+		case 'z':
+			list_supported_wiki = 1;
+			break;
 		case 'p':
 			if (strncmp(optarg, "internal", 8) == 0) {
 				programmer = PROGRAMMER_INTERNAL;
@@ -466,6 +511,21 @@
 		}
 	}
 
+	if (list_supported) {
+		print_supported_chips();
+		print_supported_chipsets();
+		print_supported_boards();
+		exit(0);
+	}
+
+	if (list_supported_wiki) {
+		printf("= Supported devices =\n");
+		print_supported_chips_wiki();
+		print_supported_chipsets_wiki();
+		print_supported_boards_wiki();
+		exit(0);
+	}
+
 	if (read_it && write_it) {
 		printf("Error: -r and -w are mutually exclusive.\n");
 		usage(argv[0]);
Index: board_enable.c
===================================================================
--- board_enable.c	(Revision 483)
+++ board_enable.c	(Arbeitskopie)
@@ -694,29 +694,236 @@
 	{     0,      0,      0,      0,       0,      0,      0,      0, NULL,         NULL,          NULL,          NULL,             NULL}, /* end marker */
 };
 
+struct board_info {
+	const char *vendor;
+	const char *name;
+	const char *url;
+};
+
+/* Please keep this list alphabetically ordered by vendor/board. */
+static const struct board_info boards_ok[] = {
+	/* Verified working boards that don't need write-enables. */
+	{ "Abit",		"AX8",			"http://www.abit.com.tw/page/en/motherboard/motherboard_detail.php?DEFTITLE=Y&fMTYPE=Socket%20939&pMODEL_NAME=AX8"; },
+	{ "Advantech",		"PCM-5820", 		"http://taiwan.advantech.com.tw/products/Model_Detail.asp?model_id=1-1TGZL8&BU=ACG&PD="; },
+	{ "ASI",		"MB-5BLMP",		"http://www.hojerteknik.com/winnet.htm"; },
+	{ "ASUS",		"A8N-E",		"http://www.asus.com.tw/products.aspx?l1=3&l2=15&l3=171&l4=0&model=455&modelmenu=2"; },
+	{ "ASUS",		"A8NE-FM/S",		"http://www.hardwareschotte.de/hardware/preise/proid_1266090/preis_ASUS+A8NE-FM"; },
+	{ "ASUS",		"A8N-SLI Premium",	"http://www.asus.com.tw/products.aspx?l1=3&l2=15&l3=148&l4=0&model=539&modelmenu=1"; },
+	{ "ASUS",		"A8V-E Deluxe",		"http://www.asus.com.tw/products.aspx?l1=3&l2=15&l3=143&l4=0&model=376&modelmenu=1"; },
+	{ "ASUS",		"M2A-VM",		"http://www.asus.com.tw/products.aspx?l1=3&l2=101&l3=496&l4=0&model=1568&modelmenu=1"; },
+	{ "ASUS",		"M2N-E",		"http://www.asus.com/products.aspx?l1=3&l2=101&l3=308&l4=0&model=1181&modelmenu=1"; },
+	{ "ASUS",		"P2B",			"http://www.motherboard.cz/mb/asus/P2B.htm"; },
+	{ "ASUS",		"P2B-F",		"http://www.motherboard.cz/mb/asus/P2B-F.htm"; },
+	{ "ASUS",		"P2B-D",		"ftp://ftp.asus.com.tw/pub/ASUS/mb/slot1/440bx/p2b-d/"; },
+	{ "ASUS",		"P2B-DS",		"ftp://ftp.asus.com.tw/pub/ASUS/mb/slot1/440bx/p2b-ds/"; },
+	{ "ASUS",		"A7V400-MX",		"http://www.asus.com.tw/products.aspx?l1=3&l2=13&l3=63&l4=0&model=228&modelmenu=1"; },
+	{ "ASUS",		"A7V8X-MX",		"http://www.asus.com.tw/products.aspx?l1=3&l2=13&l3=64&l4=0&model=229&modelmenu=1"; },
+	{ "ASUS",		"P4B266",		"http://www.ciao.co.uk/ASUS_Intel_845D_Chipset_P4B266__5409807#productdetail"; },
+	{ "ASUS",		"A8V-E SE",		"http://www.asus.com.tw/products.aspx?l1=3&l2=15&l3=143&l4=0&model=576&modelmenu=1"; },
+	{ "ASUS",		"P2L97-S",		"http://www.motherboard.cz/mb/asus/P2L97-S.htm"; },
+	{ "ASUS",		"M2A-MX",		"http://www.asus.com/products.aspx?l1=3&l2=101&l3=583&l4=0&model=1909&modelmenu=1"; },
+	{ "A-Trend",		"ATC-6220",		"http://www.motherboard.cz/mb/atrend/atc6220.htm"; },
+	{ "BCOM",		"WinNET100",		"http://www.coreboot.org/BCOM_WINNET100_Build_Tutorial"; },
+	{ "GIGABYTE",		"GA-6BXC",		"http://www.gigabyte.com.tw/Products/Motherboard/Products_Spec.aspx?ClassValue=Motherboard&ProductID=1445&ProductName=GA-6BXC"; },
+	{ "GIGABYTE",		"GA-6BXDU",		"http://www.gigabyte.com.tw/Products/Motherboard/Products_Spec.aspx?ProductID=1429"; },
+	{ "MSI",		"KT4V",			NULL },
+	{ "MSI",		"MS-7046",		NULL },
+	{ "MSI",		"MS-7065",		NULL },
+	{ "MSI",		"MS-7236 (945PL Neo3)",	"http://global.msi.com.tw/index.php?func=prodmbspec&maincat_no=1&cat2_no=&cat3_no=&prod_no=1173#menu"; },
+	{ "NEC",		"PowerMate 2000",	"http://support.necam.com/mobilesolutions/hardware/Desktops/pm2000/celeron/"; },
+	{ "PC Engines",		"Alix.1c",		"http://pcengines.ch/alix1c.htm"; },
+	{ "PC Engines",		"Alix.2c2",		"http://pcengines.ch/alix2c2.htm"; },
+	{ "PC Engines",		"Alix.2c3",		"http://pcengines.ch/alix2c3.htm"; },
+	{ "PC Engines",		"Alix.3c3",		"http://pcengines.ch/alix3c3.htm"; },
+	{ "RCA",		"RM4100",		"http://www.settoplinux.org"; },
+	{ "Sun",		"Blade x6250",		"http://www.sun.com/servers/blades/x6250/"; },
+	{ "Thomson",		"IP1000",		"http://www.settoplinux.org"; },
+	{ "T-Online",		"S-100",		"http://wiki.freifunk-hannover.de/T-Online_S_100"; },
+	{ "Tyan",		"S1846",		"http://www.tyan.com/archive/products/html/tsunamiatx.html"; },
+	{ "Tyan",		"S2498 (Tomcat K7M)",	"http://www.tyan.com/archive/products/html/tomcatk7m.html"; },
+	{ "Tyan",		"S2881",		"http://www.tyan.com/product_board_detail.aspx?pid=115"; },
+	{ "Tyan",		"S2882",		"http://www.tyan.com/product_board_detail.aspx?pid=121"; },
+	{ "Tyan",		"S2882-D",		"http://www.tyan.com/product_board_detail.aspx?pid=127"; },
+	{ "Tyan",		"S3095",		"http://www.tyan.com/product_board_detail.aspx?pid=181"; },
+	{ "Tyan",		"S5180",		"http://www.tyan.com/product_board_detail.aspx?pid=456"; },
+	{ "Tyan",		"S5191",		"http://www.tyan.com/product_board_detail.aspx?pid=343"; },
+	{ "Tyan",		"S5197",		"http://www.tyan.com/product_board_detail.aspx?pid=349"; },
+	{ "Tyan",		"S5211",		"http://www.tyan.com/product_board_detail.aspx?pid=591"; },
+	{ "Tyan",		"S5211-1U",		"http://www.tyan.com/product_board_detail.aspx?pid=593"; },
+	{ "Tyan",		"S5220",		"http://www.tyan.com/product_board_detail.aspx?pid=597"; },
+	{ "Tyan",		"S5375",		"http://www.tyan.com/product_board_detail.aspx?pid=566"; },
+	{ "Tyan",		"iS5375-1U",		"http://www.tyan.com/product_board_detail.aspx?pid=610"; },
+	{ "Tyan",		"S5376G2NR/S5376WAG2NR","http://www.tyan.com/product_board_detail.aspx?pid=605"; },
+	{ "Tyan",		"S5377",		"http://www.tyan.com/product_board_detail.aspx?pid=601"; },
+	{ "Tyan",		"S5397",		"http://www.tyan.com/product_board_detail.aspx?pid=560"; },
+	{ "VIA",		"EPIA-M",		"http://www.via.com.tw/en/products/mainboards/motherboards.jsp?motherboard_id=81"; },
+	{ "VIA",		"EPIA-MII",		"http://www.via.com.tw/en/products/mainboards/motherboards.jsp?motherboard_id=202"; },
+	{ "VIA",		"EPIA-CN",		"http://www.via.com.tw/en/products/mainboards/motherboards.jsp?motherboard_id=400"; },
+	{ "VIA",		"EPIA-LN",		"http://www.via.com.tw/en/products/mainboards/motherboards.jsp?motherboard_id=473"; },
+	{ "VIA",		"VB700X",		"http://www.via.com.tw/en/products/mainboards/motherboards.jsp?motherboard_id=490"; },
+	{ "VIA",		"NAB74X0",		"http://www.via.com.tw/en/products/mainboards/motherboards.jsp?motherboard_id=590"; },
+	{ "VIA",		"pc2500e",		"http://www.via.com.tw/en/initiatives/empowered/pc2500_mainboard/index.jsp"; },
+	{ NULL,			NULL,			0 },
+};
+
+/* Please keep this list alphabetically ordered by vendor/board. */
+static const struct board_info boards_no[] = {
+	/* Verified non-working boards (for now). */
+	{ "ASUS",		"A7N8X-E Deluxe",	"http://www.asus.com/products.aspx?l1=3&l2=13&l3=56&l4=0&model=217&modelmenu=1"; },
+	{ "ASUS",		"MEW-AM",		"ftp://ftp.asus.com.tw/pub/ASUS/mb/sock370/810/mew-am/"; },
+	{ "ASUS",		"MEW-VM",		"http://www.elhvb.com/mboards/OEM/HP/manual/ASUS%20MEW-VM.htm"; },
+	{ "ASUS",		"P3B-F",		"ftp://ftp.asus.com.tw/pub/ASUS/mb/slot1/440bx/p3b-f/"; },
+	{ "Biostar",		"M6TBA",		"ftp://ftp.biostar-usa.com/manuals/M6TBA/"; },
+	{ "FIC",		"VA-502",		"ftp://ftp.fic.com.tw/motherboard/manual/socket7/va-502/"; },
+	{ "MSI",		"MS-7260 (K9N Neo)",	"http://global.msi.com.tw/index.php?func=proddesc&prod_no=255&maincat_no=1"; },
+	{ "PCCHIPS",		"M537DMA33",		"http://motherboards.mbarron.net/models/pcchips/m537dma.htm"; },
+	{ "Soyo",		"SY-5VD",		"http://www.soyo.com/content/Downloads/163/&c=80&p=464&l=English"; },
+	{ "Sun",		"Fire x4540",		"http://www.sun.com/servers/x64/x4540/"; },
+	{ "Sun",		"Fire x4150",		"http://www.sun.com/servers/x64/x4150/"; },
+	{ "Sun",		"Fire x4200",		"http://www.sun.com/servers/entry/x4200/"; },
+	{ "Sun",		"Fire x4600",		"http://www.sun.com/servers/x64/x4600/"; },
+	{ NULL,			NULL,			0 },
+};
+
+void print_supported_boards_helper(const struct board_info *b)
+{
+	int i, j;
+
+	for (i = 0; b[i].vendor != NULL; i++) {
+		printf("%s", b[i].vendor);
+		for (j = 0; j < 25 - strlen(b[i].vendor); j++)
+			printf(" ");
+		printf("%s", b[i].name);
+		for (j = 0; j < 23 - strlen(b[i].name); j++)
+			printf(" ");
+		printf("%s\n", (verbose) ? (b[i].url) ? b[i].url : "" : "");
+	}
+}
+
 void print_supported_boards(void)
 {
-	int i;
+	int i, j;
+	struct board_pciid_enable *b = board_pciid_enables;
 
-	printf("\nSupported mainboards (this list is not exhaustive!):\n\n");
+	printf("\nSupported boards which need write-enable code:\n\n");
+	for (i = 0; b[i].vendor_name != NULL; i++) {
+		printf("%s", b[i].vendor_name);
+		for (j = 0; j < 25 - strlen(b[i].vendor_name); j++)
+			printf(" ");
+		printf("%s", b[i].board_name);
+		for (j = 0; j < 25 - strlen(b[i].board_name); j++)
+			printf(" ");
+		if (b[i].lb_vendor != NULL)
+			printf("(-m %s:%s)\n", b[i].lb_vendor, b[i].lb_part);
+		else
+			printf("(autodetected)\n");
+	}
 
-	for (i = 0; board_pciid_enables[i].vendor_name != NULL; i++) {
-		if (board_pciid_enables[i].lb_vendor != NULL) {
-			printf("%s %s (-m %s:%s)\n",
-			       board_pciid_enables[i].vendor_name,
-			       board_pciid_enables[i].board_name,
-			       board_pciid_enables[i].lb_vendor,
-			       board_pciid_enables[i].lb_part);
-		} else {
-			printf("%s %s (autodetected)\n",
-			       board_pciid_enables[i].vendor_name,
-			       board_pciid_enables[i].board_name);
+	printf("\nSupported boards which don't need write-enable code:\n\n");
+	print_supported_boards_helper(boards_ok);
+
+	printf("\nBoards which have been verified to NOT work (yet):\n\n");
+	print_supported_boards_helper(boards_no);
+
+	printf("\nSee also: http://coreboot.org/Flashrom\n";);
+}
+
+#define BOARD_TH "{| border=\"0\" style=\"font-size: smaller\" valign=\"top\"\
+\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
+! align=\"left\" | Mainboard\n! align=\"left\" | Status\n\n"
+
+#define BOARD_TH2 "{| border=\"0\" style=\"font-size: smaller\" valign=\"top\"\
+\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
+! align=\"left\" | Mainboard\n! align=\"left\" | Required option\n\
+! align=\"left\" | Status\n\n"
+
+static void wiki_helper(const char *heading, const char *status,
+			       int cols, const struct board_info boards[])
+{
+	int i, j, boardcount = 0, color = 1;
+	const struct board_info *b;
+
+	printf("\n'''%s'''\n\n{| border=\"0\" "
+	       "valign=\"top\"\n| valign=\"top\"|\n\n%s", heading, BOARD_TH);
+
+	for (b = boards; b->vendor != NULL; b++)
+		boardcount++;
+
+        for (i = 0, j = 0, b = boards; b[i].vendor != NULL; i++, j++) {
+		/* Alternate colors if the vendor changes. */
+		if (i > 0 && strcmp(b[i].vendor, b[i - 1].vendor))
+			color = !color;
+
+		printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s\n|%s%s %s%s\n|"
+		       " {{%s}}\n", (color) ? "eeeeee" : "dddddd", b[i].vendor,
+		       (b[i].url) ? " [" : "", (b[i].url) ? b[i].url : "",
+		       b[i].name, (b[i].url) ? "]" : "", status);
+
+		/* Split table in three columns. */
+		if (j >= (boardcount / cols + 1)) {
+			printf("\n|}\n\n| valign=\"top\"|\n\n" BOARD_TH);
+			j = 0;
 		}
 	}
 
-	printf("\nSee also: http://coreboot.org/Flashrom\n";);
+	printf("\n|}\n\n|}\n");
 }
 
+static void wiki_helper2(const char *heading)
+{
+	int i, j, boardcount = 0, color = 1;
+	struct board_pciid_enable *b;
+
+	printf("\n'''%s'''\n\n{| border=\"0\" "
+	       "valign=\"top\"\n| valign=\"top\"|\n\n%s", heading, BOARD_TH2);
+
+	for (b = board_pciid_enables; b->vendor_name != NULL; b++)
+		boardcount++;
+
+	b = board_pciid_enables;
+	for (i = 0, j = 0; b[i].vendor_name != NULL; i++, j++) {
+		/* Alternate colors if the vendor changes. */
+		if (i > 0 && strcmp(b[i].vendor_name, b[i - 1].vendor_name))
+			color = !color;
+
+		printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s\n| %s\n| "
+		       "%s%s%s%s\n| {{OK}}\n", (color) ? "eeeeee" : "dddddd",
+		       b[i].vendor_name, b[i].board_name,
+		       (b[i].lb_vendor) ? "-m " : "&mdash;",
+		       (b[i].lb_vendor) ? b[i].lb_vendor : "",
+		       (b[i].lb_vendor) ? ":" : "",
+		       (b[i].lb_vendor) ? b[i].lb_part : "");
+
+		/* Split table in two columns. */
+		if (j >= (boardcount / 2 + 1)) {
+			printf("\n|}\n\n| valign=\"top\"|\n\n" BOARD_TH2);
+			j = 0;
+		}
+	}
+
+	printf("\n|}\n\n|}\n");
+}
+
+#define BOARD_INTRO "\
+\n== Supported mainboards ==\n\n\
+In general, it is very likely that flashrom works out of the box even if your \
+mainboard is not listed below.\n\nThis is a list of mainboards where we have \
+verified that they either do or do not need any special initialization to \
+make flashrom work (given flashrom supports the respective chipset and flash \
+chip), or that they do not yet work at all. If they do not work, support may \
+or may not be added later.\n\n\
+Mainboards which don't appear in the list may or may not work (we don't \
+know, someone has to give it a try). Please report any further verified \
+mainboards on the [[Mailinglist|mailing list]].\n"
+
+void print_supported_boards_wiki(void)
+{
+	printf("%s", BOARD_INTRO);
+	wiki_helper("Known good (worked out of the box)", "OK", 3, boards_ok);
+	wiki_helper2("Known good (with write-enable code in flashrom)");
+	wiki_helper("Not supported (yet)", "No", 1, boards_no);
+}
+
 /**
  * Match boards on coreboot table gathered vendor and part name.
  * Require main PCI IDs to match too as extra safety.
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to