Allow to print an auto-generated hardware support list in MediaWiki markup

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.

Corresponding to flashrom svn r607.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/flashrom.c b/flashrom.c
index e1944c9..8da80b1 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -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]);