[coreboot] [flashrom] r607 - trunk

svn at coreboot.org svn at coreboot.org
Fri Jun 19 12:42:43 CEST 2009


Author: uwe
Date: 2009-06-19 12:42:43 +0200 (Fri, 19 Jun 2009)
New Revision: 607

Modified:
   trunk/flash.h
   trunk/flashrom.8
   trunk/flashrom.c
   trunk/print.c
Log:
Add a --list-supported-wiki / -z option which outputs the currently
supported flash chips (and their status, size, and type), chipsets
(plus status), mainboards (plus status), and external PCI devices
usable as programmer 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.

Signed-off-by: Uwe Hermann <uwe at hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>



Modified: trunk/flash.h
===================================================================
--- trunk/flash.h	2009-06-19 04:50:58 UTC (rev 606)
+++ trunk/flash.h	2009-06-19 10:42:43 UTC (rev 607)
@@ -248,6 +248,12 @@
 	const char *name;
 };
 
+struct board_info_url {
+	const char *vendor;
+	const char *name;
+	const char *url;
+};
+
 extern const struct board_info boards_ok[];
 extern const struct board_info boards_bad[];
 extern const struct board_info laptops_ok[];
@@ -281,6 +287,12 @@
 void print_supported_chipsets(void);
 void print_supported_boards(void);
 void print_supported_pcidevs(struct pcidev_status *devs);
+void print_supported_chips_wiki(void);
+void print_supported_boards_wiki(void);
+void print_supported_chipsets_wiki(void);
+void print_supported_pcidevs_wiki_header(void);
+void print_supported_pcidevs_wiki_footer(void);
+void print_supported_pcidevs_wiki(struct pcidev_status *devs);
 
 /* board_enable.c */
 void w836xx_ext_enter(uint16_t port);

Modified: trunk/flashrom.8
===================================================================
--- trunk/flashrom.8	2009-06-19 04:50:58 UTC (rev 606)
+++ trunk/flashrom.8	2009-06-19 10:42:43 UTC (rev 607)
@@ -2,7 +2,7 @@
 .SH NAME
 flashrom \- detect, read, write, verify and erase flash chips
 .SH SYNOPSIS
-.B flashrom \fR[\fB\-VfLhR\fR] [\fB\-E\fR|\fB\-r\fR file|\fB\-w\fR file|\fB\-v\fR file]
+.B flashrom \fR[\fB\-VfLzhR\fR] [\fB\-E\fR|\fB\-r\fR file|\fB\-w\fR file|\fB\-v\fR file]
          [\fB\-c\fR chipname] [\fB\-s\fR addr] [\fB\-e\fR addr] [\fB\-m\fR [vendor:]part]
          [\fB\-l\fR file] [\fB\-i\fR image] [\fB\-p\fR programmer] [file]
 .SH DESCRIPTION
@@ -123,6 +123,12 @@
 to test an ERASE and/or WRITE operation, so make sure you only do that
 if you have proper means to recover from failure!
 .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

Modified: trunk/flashrom.c
===================================================================
--- trunk/flashrom.c	2009-06-19 04:50:58 UTC (rev 606)
+++ trunk/flashrom.c	2009-06-19 10:42:43 UTC (rev 607)
@@ -482,9 +482,8 @@
 
 void usage(const char *name)
 {
-	printf("usage: %s [-VfLhR] [-E|-r file|-w file|-v file] [-c chipname] [-s addr]\n"
-	       "       [-e addr] [-m [vendor:]part] [-l file] [-i image] [-p programmer] [file]\n\n",
-	       name);
+	printf("usage: %s [-VfLzhR] [-E|-r file|-w file|-v file] [-c chipname] [-s addr]\n"
+              "       [-e addr] [-m [vendor:]part] [-l file] [-i image] [-p programmer] [file]\n\n", name);
 
 	printf("Please note that the command line interface for flashrom will "
 		"change before\nflashrom 1.0. Do not use flashrom in scripts "
@@ -505,12 +504,14 @@
 	     "   -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"
-	     "                                     (internal, dummy, nic3com, satasii, it87spi, ft2232spi)\n"
+	     "                                     (internal, dummy, nic3com, satasii,\n"
+	     "                                     it87spi, ft2232spi)\n"
 	     "   -h | --help:                      print this help text\n"
 	     "   -R | --version:                   print the version (release)\n"
-	     "\nYou can specify one of -E, -r, -w, -v or no operation.\n"
-	     "If no operation is specified, then all that happens"
+	     "\nYou can specify one of -E, -r, -w, -v or no operation. "
+	     "If no operation is\nspecified, then all that happens"
 	     " is that flash info is dumped.\n\n");
 	exit(1);
 }
@@ -531,7 +532,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;
+	int list_supported = 0, list_supported_wiki = 0;
 	int operation_specified = 0;
 	int ret = 0, i;
 
@@ -549,6 +550,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'},
@@ -571,7 +573,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':
@@ -647,6 +649,9 @@
 		case 'L':
 			list_supported = 1;
 			break;
+		case 'z':
+			list_supported_wiki = 1;
+			break;
 		case 'p':
 			if (strncmp(optarg, "internal", 8) == 0) {
 				programmer = PROGRAMMER_INTERNAL;
@@ -693,6 +698,18 @@
 		exit(0);
 	}
 
+	if (list_supported_wiki) {
+		printf("= Supported devices =\n");
+		print_supported_chips_wiki();
+		print_supported_chipsets_wiki();
+		print_supported_boards_wiki();
+		print_supported_pcidevs_wiki_header();
+		print_supported_pcidevs_wiki(nics_3com);
+		print_supported_pcidevs_wiki(satas_sii);
+		print_supported_pcidevs_wiki_footer();
+		exit(0);
+	}
+
 	if (read_it && write_it) {
 		printf("Error: -r and -w are mutually exclusive.\n");
 		usage(argv[0]);

Modified: trunk/print.c
===================================================================
--- trunk/print.c	2009-06-19 04:50:58 UTC (rev 606)
+++ trunk/print.c	2009-06-19 10:42:43 UTC (rev 607)
@@ -221,3 +221,340 @@
 	print_supported_boards_helper(laptops_bad,
 		"Laptops which have been verified to NOT work yet");
 }
+
+#define CHIPSET_TH "{| border=\"0\" style=\"font-size: smaller\"\n\
+|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
+! align=\"left\" | Southbridge\n! align=\"left\" | PCI IDs\n\
+! align=\"left\" | Status\n\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"
+
+#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"
+
+#define CHIP_TH "{| border=\"0\" style=\"font-size: smaller\" valign=\"top\"\n\
+|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
+! align=\"left\" | Device\n! align=\"left\" | Size / KB\n\
+! align=\"left\" | Type\n! align=\"left\" colspan=\"4\" | Status\n\n\
+|- bgcolor=\"#6699ff\"\n| colspan=\"4\" |  \n\
+| Probe\n| Read\n| Write\n| Erase\n\n"
+
+#define 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: \
+smaller\" valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
+! align=\"left\" | Device\n! align=\"left\" | PCI IDs\n\
+! align=\"left\" | Status\n\n"
+
+const struct board_info_url boards_url[] = {
+	/* Verified working boards that don't need write-enables. */
+	/* Please keep this list alphabetically ordered by vendor/board. */
+	{ "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" },
+	{ "ASUS",		"P5B-Deluxe",		"ftp://ftp.asus.com.tw/pub/ASUS/mb/socket775/P5B-Deluxe/" },
+	{ "ASUS",		"P6T Deluxe V2",	"http://www.asus.com/product.aspx?P_ID=iRlP8RG9han6saZx" },
+	{ "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" },
+	{ "GIGABYTE",		"GA-6ZMA",		"http://www.gigabyte.de/Support/Motherboard/BIOS_Model.aspx?ProductID=3289" },
+	{ "Intel",		"EP80759",		NULL },
+	{ "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" },
+	{ "MSI",		"MS-7345 (P35 Neo2-FIR)","http://www.msi.com/index.php?func=prodcpusupport&maincat_no=1&cat2_no=170&cat3_no=&prod_no=1261#menu" },
+	{ "MSI",		"MS-7168 (Orion)",	"http://support.packardbell.co.uk/uk/item/index.php?i=spec_orion&pi=platform_honeymoon_istart" },
+	{ "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" },
+	{ "Supermicro",		"H8QC8",		"http://www.supermicro.com/Aplus/motherboard/Opteron/nforce/H8QC8.cfm" },
+	{ "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",		"S2891",		NULL },
+	{ "Tyan",		"S2892",		NULL },
+	{ "Tyan",		"S2895",		NULL },
+	{ "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" },
+
+	/* Verified working boards that DO need write-enables. */
+	/* Please keep this list alphabetically ordered by vendor/board. */
+	{ "Acorp",		"6A815EPD",		NULL },
+	/* TODO: Fill in entries/URLs for the remaining boards. */
+
+	/* Verified non-working boards (for now). */
+	/* Please keep this list alphabetically ordered by vendor/board. */
+	{ "Abit",		"IS-10",		"http://www.abit.com.tw/page/en/motherboard/motherboard_detail.php?pMODEL_NAME=IS-10&fMTYPE=Socket+478" },
+	{ "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/" },
+	{ "ASUS",		"P5B",			"ftp://ftp.asus.com.tw/pub/ASUS/mb/socket775/P5B/" },
+	{ "ASUS",		"P5BV-M",		"ftp://ftp.asus.com.tw/pub/ASUS/mb/socket775/P5B-VM/" },
+	{ "Biostar",		"M6TBA",		"ftp://ftp.biostar-usa.com/manuals/M6TBA/" },
+	{ "Boser",		"HS-6637",		"http://www.boser.com.tw/manual/HS-62376637v3.4.pdf" },
+	{ "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 },
+};
+
+static int url(const char *vendor, const char *board)
+{
+	int i;
+	const struct board_info_url *b = boards_url;
+
+        for (i = 0; b[i].vendor != NULL; i++) {
+		if (!strcmp(vendor, b[i].vendor) && !strcmp(board, b[i].name))
+			return i;
+	}
+
+	return -1;
+}
+
+void print_supported_chipsets_wiki(void)
+{
+	int i, j, enablescount = 0, color = 1;
+	const struct penable *e;
+
+	for (e = chipset_enables; e->vendor_name != NULL; e++)
+		enablescount++;
+
+	printf("\n== Supported chipsets ==\n\nTotal amount of supported "
+	       "chipsets: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n| "
+	       "valign=\"top\"|\n\n%s", enablescount, CHIPSET_TH);
+
+	e = chipset_enables;
+	for (i = 0, j = 0; e[i].vendor_name != NULL; i++, j++) {
+		/* Alternate colors if the vendor changes. */
+		if (i > 0 && strcmp(e[i].vendor_name, e[i - 1].vendor_name))
+			color = !color;
+
+		printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s || %s "
+		       "|| %04x:%04x || %s\n", (color) ? "eeeeee" : "dddddd",
+		       e[i].vendor_name, e[i].device_name,
+		       e[i].vendor_id, e[i].device_id,
+		       (e[i].status == OK) ? "{{OK}}" : "?");
+
+		/* Split table in three columns. */
+		if (j >= (enablescount / 3 + 1)) {
+			printf("\n|}\n\n| valign=\"top\"|\n\n" CHIPSET_TH);
+			j = 0;
+		}
+	}
+
+	printf("\n|}\n\n|}\n");
+}
+
+static void wiki_helper(const char *heading, const char *status,
+			int cols, const struct board_info boards[])
+{
+	int i, j, k, boardcount = 0, color = 1;
+	const struct board_info *b;
+	const struct board_info_url *u = boards_url;
+
+	for (b = boards; b->vendor != NULL; b++)
+		boardcount++;
+
+	printf("\n'''%s'''\n\nTotal amount of boards: '''%d'''\n\n"
+	       "{| border=\"0\" valign=\"top\"\n| valign=\"top\"|\n\n%s",
+	       heading, boardcount, BOARD_TH);
+
+        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;
+
+		k = url(b[i].vendor, b[i].name);
+
+		printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s || %s%s %s%s ||"
+		       " {{%s}}\n", (color) ? "eeeeee" : "dddddd", b[i].vendor,
+		       (k != -1 && u[k].url) ? "[" : "",
+		       (k != -1 && u[k].url) ? u[k].url : "",
+		       b[i].name, (k != -1 && u[k].url) ? "]" : "", status);
+
+		/* Split table in 'cols' columns. */
+		if (j >= (boardcount / cols + 1)) {
+			printf("\n|}\n\n| valign=\"top\"|\n\n" BOARD_TH);
+			j = 0;
+		}
+	}
+
+	printf("\n|}\n\n|}\n");
+}
+
+static void wiki_helper2(const char *heading, int cols)
+{
+	int i, j, boardcount = 0, color = 1;
+	struct board_pciid_enable *b;
+
+	for (b = board_pciid_enables; b->vendor_name != NULL; b++)
+		boardcount++;
+
+	printf("\n'''%s'''\n\nTotal amount of boards: '''%d'''\n\n"
+	       "{| border=\"0\" valign=\"top\"\n| valign=\"top\"|\n\n%s",
+	       heading, boardcount, BOARD_TH2);
+
+	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 || %s || "
+		       "%s%s%s%s || {{OK}}\n", (color) ? "eeeeee" : "dddddd",
+		       b[i].vendor_name, b[i].board_name,
+		       (b[i].lb_vendor) ? "-m " : "—",
+		       (b[i].lb_vendor) ? b[i].lb_vendor : "",
+		       (b[i].lb_vendor) ? ":" : "",
+		       (b[i].lb_vendor) ? b[i].lb_part : "");
+
+		/* Split table in three columns. */
+		if (j >= (boardcount / cols + 1)) {
+			printf("\n|}\n\n| valign=\"top\"|\n\n" BOARD_TH2);
+			j = 0;
+		}
+	}
+
+	printf("\n|}\n\n|}\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)", 3);
+	wiki_helper("Not supported (yet)", "No", 3, boards_bad);
+}
+
+void print_supported_chips_wiki(void)
+{
+	int i = 0, c = 1, chipcount = 0;
+	struct flashchip *f, *old = NULL;
+
+	for (f = flashchips; f->name != NULL; f++)
+		chipcount++;
+
+	printf("\n== Supported chips ==\n\nTotal amount of supported "
+	       "chips: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n"
+		"| valign=\"top\"|\n\n%s", chipcount, CHIP_TH);
+
+	for (f = flashchips; f->name != NULL; f++, i++) {
+		if (!strncmp(f->name, "unknown", 7))
+			continue;
+
+		/* Alternate colors if the vendor changes. */
+		if (old != NULL && strcmp(old->vendor, f->vendor))
+			c = !c;
+
+		printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s || %s || %d "
+		       "|| %s || {{%s}} || {{%s}} || {{%s}} || {{%s}}\n",
+		       (c == 1) ? "eeeeee" : "dddddd", f->vendor, f->name,
+		       f->total_size, flashbuses_to_text(f->bustype),
+		       ((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 print_supported_pcidevs_wiki_header(void)
+{
+	printf("%s", PROGRAMMER_SECTION);
+}
+
+void print_supported_pcidevs_wiki_footer(void)
+{
+	printf("\n|}\n");
+}
+
+void print_supported_pcidevs_wiki(struct pcidev_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\" valign=\"top\"\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 == PCI_NT) ? (c) ? "?2" : "?" : "OK");
+	}
+}





More information about the coreboot mailing list