List all boards which are

 - Supported out of the box (no flash enables required)

 - Verifiably not yet working (unknown flash enable)

Also, move some structs to flash.h in preparation for later wiki
output support.

Corresponding to flashrom svn r523.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/board_enable.c b/board_enable.c
index 90c23bc..ec41511 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -661,30 +661,6 @@
  * When a board is identified through its coreboot ids (in both cases), the
  * main pci ids are still required to match, as a safeguard.
  */
-struct board_pciid_enable {
-	/* Any device, but make it sensible, like the ISA bridge. */
-	uint16_t first_vendor;
-	uint16_t first_device;
-	uint16_t first_card_vendor;
-	uint16_t first_card_device;
-
-	/* Any device, but make it sensible, like
-	 * the host bridge. May be NULL.
-	 */
-	uint16_t second_vendor;
-	uint16_t second_device;
-	uint16_t second_card_vendor;
-	uint16_t second_card_device;
-
-	/* The vendor / part name from the coreboot table. */
-	const char *lb_vendor;
-	const char *lb_part;
-
-	const char *vendor_name;
-	const char *board_name;
-
-	int (*enable) (const char *name);
-};
 
 /* Please keep this list alphabetically ordered by vendor/board name. */
 struct board_pciid_enable board_pciid_enables[] = {
@@ -725,27 +701,132 @@
 	{     0,      0,      0,      0,       0,      0,      0,      0, NULL,         NULL,          NULL,          NULL,             NULL}, /* end marker */
 };
 
+/* Please keep this list alphabetically ordered by vendor/board. */
+const struct board_info boards_ok[] = {
+	/* Verified working boards that don't need write-enables. */
+	{ "Abit",		"AX8", },
+	{ "Advantech",		"PCM-5820", },
+	{ "ASI",		"MB-5BLMP", },
+	{ "ASUS",		"A8N-E", },
+	{ "ASUS",		"A8NE-FM/S", },
+	{ "ASUS",		"A8N-SLI Premium", },
+	{ "ASUS",		"A8V-E Deluxe", },
+	{ "ASUS",		"M2A-VM", },
+	{ "ASUS",		"M2N-E", },
+	{ "ASUS",		"P2B", },
+	{ "ASUS",		"P2B-F", },
+	{ "ASUS",		"P2B-D", },
+	{ "ASUS",		"P2B-DS", },
+	{ "ASUS",		"A7V400-MX", },
+	{ "ASUS",		"A7V8X-MX", },
+	{ "ASUS",		"P4B266", },
+	{ "ASUS",		"A8V-E SE", },
+	{ "ASUS",		"P2L97-S", },
+	{ "ASUS",		"M2A-MX", },
+	{ "A-Trend",		"ATC-6220", },
+	{ "BCOM",		"WinNET100", },
+	{ "GIGABYTE",		"GA-6BXC", },
+	{ "GIGABYTE",		"GA-6BXDU", },
+	{ "MSI",		"KT4V", },
+	{ "MSI",		"MS-7046", },
+	{ "MSI",		"MS-7065", },
+	{ "MSI",		"MS-7236 (945PL Neo3)", },
+	{ "NEC",		"PowerMate 2000", },
+	{ "PC Engines",		"Alix.1c", },
+	{ "PC Engines",		"Alix.2c2", },
+	{ "PC Engines",		"Alix.2c3", },
+	{ "PC Engines",		"Alix.3c3", },
+	{ "RCA",		"RM4100", },
+	{ "Sun",		"Blade x6250", },
+	{ "Thomson",		"IP1000", },
+	{ "T-Online",		"S-100", },
+	{ "Tyan",		"S1846", },
+	{ "Tyan",		"S2498 (Tomcat K7M)", },
+	{ "Tyan",		"S2881", },
+	{ "Tyan",		"S2882", },
+	{ "Tyan",		"S2882-D", },
+	{ "Tyan",		"S3095", },
+	{ "Tyan",		"S5180", },
+	{ "Tyan",		"S5191", },
+	{ "Tyan",		"S5197", },
+	{ "Tyan",		"S5211", },
+	{ "Tyan",		"S5211-1U", },
+	{ "Tyan",		"S5220", },
+	{ "Tyan",		"S5375", },
+	{ "Tyan",		"iS5375-1U", },
+	{ "Tyan",		"S5376G2NR/S5376}WAG2NR", },
+	{ "Tyan",		"S5377", },
+	{ "Tyan",		"S5397", },
+	{ "VIA",		"EPIA-M", },
+	{ "VIA",		"EPIA-MII", },
+	{ "VIA",		"EPIA-CN", },
+	{ "VIA",		"EPIA-LN", },
+	{ "VIA",		"VB700X", },
+	{ "VIA",		"NAB74X0", },
+	{ "VIA",		"pc2500e", },
+
+	{},
+};
+
+/* Please keep this list alphabetically ordered by vendor/board. */
+const struct board_info boards_bad[] = {
+	/* Verified non-working boards (for now). */
+	{ "ASUS",		"A7N8X-E Deluxe", },
+	{ "ASUS",		"MEW-AM", },
+	{ "ASUS",		"MEW-VM", },
+	{ "ASUS",		"P3B-F", },
+	{ "Biostar",		"M6TBA", },
+	{ "FIC",		"VA-502", },
+	{ "MSI",		"MS-7260 (K9N Neo)", },
+	{ "PCCHIPS",		"M537DMA33", },
+	{ "Soyo",		"SY-5VD", },
+	{ "Sun",		"Fire x4540", },
+	{ "Sun",		"Fire x4150", },
+	{ "Sun",		"Fire x4200", },
+	{ "Sun",		"Fire x4600", },
+
+	{},
+};
+
+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("\n");
+	}
+}
+
 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");
-
-	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 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");
 	}
 
-	printf("\nSee also: http://coreboot.org/Flashrom\n");
+	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_bad);
 }
 
 /**
diff --git a/chipset_enable.c b/chipset_enable.c
index 97229ce..d9e82ec 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -924,20 +924,11 @@
 	return 0;
 }
 
-typedef struct penable {
-	uint16_t vendor_id;
-	uint16_t device_id;
-	int status;
-	const char *vendor_name;
-	const char *device_name;
-	int (*doit) (struct pci_dev *dev, const char *name);
-} FLASH_ENABLE;
-
 #define OK 0
 #define NT 1	/* Not tested */
 
 /* Please keep this list alphabetically sorted by vendor/device. */
-static const FLASH_ENABLE enables[] = {
+const struct penable chipset_enables[] = {
 	{0x10B9, 0x1533, OK, "ALi", "M1533",		enable_flash_ali_m1533},
 	{0x1022, 0x7440, OK, "AMD", "AMD-768",		enable_flash_amd8111},
 	{0x1022, 0x7468, OK, "AMD", "AMD8111",		enable_flash_amd8111},
@@ -1014,6 +1005,8 @@
 	{0x1106, 0x3372, OK, "VIA", "VT8237S",		enable_flash_vt8237s_spi},
 	{0x1106, 0x0586, OK, "VIA", "VT82C586A/B",	enable_flash_amd8111},
 	{0x1106, 0x0686, NT, "VIA", "VT82C686A/B",	enable_flash_amd8111},
+
+	{},
 };
 
 void print_supported_chipsets(void)
@@ -1022,11 +1015,13 @@
 
 	printf("\nSupported chipsets:\n\n");
 
-	for (i = 0; i < ARRAY_SIZE(enables); i++)
-		printf("%s %s [%04x:%04x]%s\n", enables[i].vendor_name,
-		       enables[i].device_name, enables[i].vendor_id,
-		       enables[i].device_id,
-		       (enables[i].status == OK) ? "" : " (untested)");
+	for (i = 0; chipset_enables[i].vendor_name != NULL; i++) {
+		printf("%s %s [%04x:%04x]%s\n", chipset_enables[i].vendor_name,
+		       chipset_enables[i].device_name,
+		       chipset_enables[i].vendor_id,
+		       chipset_enables[i].device_id,
+		       (chipset_enables[i].status == OK) ? "" : " (untested)");
+	}
 }
 
 int chipset_flash_enable(void)
@@ -1036,17 +1031,20 @@
 	int i;
 
 	/* Now let's try to find the chipset we have... */
-	for (i = 0; i < ARRAY_SIZE(enables); i++) {
-		dev = pci_dev_find(enables[i].vendor_id, enables[i].device_id);
+	for (i = 0; chipset_enables[i].vendor_name != NULL; i++) {
+		dev = pci_dev_find(chipset_enables[i].vendor_id,
+				   chipset_enables[i].device_id);
 		if (dev)
 			break;
 	}
 
 	if (dev) {
 		printf("Found chipset \"%s %s\", enabling flash write... ",
-		       enables[i].vendor_name, enables[i].device_name);
+		       chipset_enables[i].vendor_name,
+		       chipset_enables[i].device_name);
 
-		ret = enables[i].doit(dev, enables[i].device_name);
+		ret = chipset_enables[i].doit(dev,
+					      chipset_enables[i].device_name);
 		if (ret)
 			printf("FAILED!\n");
 		else
diff --git a/flash.h b/flash.h
index 671f1a1..f6bdab0 100644
--- a/flash.h
+++ b/flash.h
@@ -168,6 +168,52 @@
 
 extern struct flashchip flashchips[];
 
+struct penable {
+	uint16_t vendor_id;
+	uint16_t device_id;
+	int status;
+	const char *vendor_name;
+	const char *device_name;
+	int (*doit) (struct pci_dev *dev, const char *name);
+};
+
+extern const struct penable chipset_enables[];
+
+struct board_pciid_enable {
+	/* Any device, but make it sensible, like the ISA bridge. */
+	uint16_t first_vendor;
+	uint16_t first_device;
+	uint16_t first_card_vendor;
+	uint16_t first_card_device;
+
+	/* Any device, but make it sensible, like
+	 * the host bridge. May be NULL.
+	 */
+	uint16_t second_vendor;
+	uint16_t second_device;
+	uint16_t second_card_vendor;
+	uint16_t second_card_device;
+
+	/* The vendor / part name from the coreboot table. */
+	const char *lb_vendor;
+	const char *lb_part;
+
+	const char *vendor_name;
+	const char *board_name;
+
+	int (*enable) (const char *name);
+};
+
+extern struct board_pciid_enable board_pciid_enables[];
+
+struct board_info {
+	const char *vendor;
+	const char *name;
+};
+
+extern const struct board_info boards_ok[];
+extern const struct board_info boards_bad[];
+
 /*
  * Please keep this list sorted alphabetically by manufacturer. The first
  * entry of each section should be the manufacturer ID, followed by the
diff --git a/flashrom.c b/flashrom.c
index cd16d71..925b05b 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -399,6 +399,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 ret = 0, i;
 
 	static struct option long_options[] = {
@@ -491,13 +492,7 @@
 			find_romentry(tempstr);
 			break;
 		case 'L':
-			print_supported_chips();
-			print_supported_chipsets();
-			print_supported_boards();
-			printf("\nSupported PCI devices flashrom can use "
-			       "as programmer:\n\n");
-			print_supported_pcidevs(nics_3com);
-			exit(0);
+			list_supported = 1;
 			break;
 		case 'p':
 			if (strncmp(optarg, "internal", 8) == 0) {
@@ -524,6 +519,16 @@
 		}
 	}
 
+	if (list_supported) {
+		print_supported_chips();
+		print_supported_chipsets();
+		print_supported_boards();
+		printf("\nSupported PCI devices flashrom can use "
+		       "as programmer:\n\n");
+		print_supported_pcidevs(nics_3com);
+		exit(0);
+	}
+
 	if (read_it && write_it) {
 		printf("Error: -r and -w are mutually exclusive.\n");
 		usage(argv[0]);