Add a bunch of new/tested stuff and various small changes 15

Tested Mainboards:
OK:
 - Foxconn P55MX
   http://www.flashrom.org/pipermail/flashrom/2012-October/010002.html

Tested flash chips:
 - Eon EN25F64 to PR (+PR)
   http://paste.flashrom.org/view.php?id=1426
 - Macronix MX25L1005 to PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2012-October/010004.html
 - Set SST39VF512 to PREW (+W)
   http://www.flashrom.org/pipermail/flashrom/2012-September/009958.html

Tested chipsets:
 - Z77 (only reading was really tested)

Miscellaneous:
 - Fix ft2232_spi's parameter parsing.
 - Fix nicrealtek's init (always segfaulted since r1586 oops).
 - Add another T60 variant to the laptop whitelist.
 - Improve message shown when image file size does not match flash chip
 - Refine messages regarding the flash descriptor override strap according
   to the findings by Vladislav Bykov on his P55MX.
 - Fix the ID of EN25F64.
 - Demote and clarify debug message in serprog_delay().
 - Minor other cleanups.

Corresponding to flashrom svn r1613.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
diff --git a/board_enable.c b/board_enable.c
index 5dd7ae1..8f0219e 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -2407,10 +2407,11 @@
 	{0x8086, 0x7190,      0,      0,  0x8086, 0x7110,      0,      0, "^SE440BX-2$", NULL, NULL,          P3, "Intel",       "SE440BX-2",             0,   NT, intel_piix4_gpo27_lower},
 	{0x1022, 0x7468,      0,      0,  0x1022, 0x7460,      0,      0, NULL,         "iwill", "dk8_htx",   P3, "IWILL",       "DK8-HTX",               0,   OK, w83627hf_gpio24_raise_2e},
 	{0x8086, 0x27A0, 0x8086, 0x27a0,  0x8086, 0x27b8, 0x8086, 0x27b8, NULL,        "kontron", "986lcd-m", P3, "Kontron",     "986LCD-M",              0,   OK, board_kontron_986lcd_m},
+	{0x8086, 0x27a0, 0x17aa, 0x2015,  0x8086, 0x27b9, 0x17aa, 0x2009, "^ThinkPad T60", NULL, NULL,        P2, "Lenovo",      "T60",                   0,   OK, p2_whitelist_laptop},
 	{0x8086, 0x27a0, 0x17aa, 0x2017,  0x8086, 0x27b9, 0x17aa, 0x2009, "^ThinkPad T60", NULL, NULL,        P2, "Lenovo",      "T60(s)",                0,   OK, p2_whitelist_laptop},
 	{0x8086, 0x27a0, 0x17aa, 0x2017,  0x8086, 0x27b9, 0x17aa, 0x2009, "^ThinkPad X60", NULL, NULL,        P2, "Lenovo",      "X60(s)",                0,   OK, p2_whitelist_laptop},
 	{0x8086, 0x2411, 0x8086, 0x2411,  0x8086, 0x7125, 0x0e11, 0xb165, NULL,         NULL, NULL,           P3, "Mitac",       "6513WU",                0,   OK, board_mitac_6513wu},
-	{0x8086, 0x8186, 0x8086, 0x8186,  0x8086, 0x8800, 0x0000, 0x0000, "^MSC Vertriebs GmbH$", NULL, NULL, P2, "MSC",         "Q7-TCTC",               0,   OK, p2_not_a_laptop},
+	{0x8086, 0x8186, 0x8086, 0x8186,  0x8086, 0x8800,      0,      0, "^MSC Vertriebs GmbH$", NULL, NULL, P2, "MSC",         "Q7-TCTC",               0,   OK, p2_not_a_laptop},
 	{0x10DE, 0x005E, 0x1462, 0x7125,  0x10DE, 0x0052, 0x1462, 0x7125, NULL,         NULL, NULL,           P3, "MSI",         "K8N Neo4-F",            0,   OK, nvidia_mcp_gpio2_raise}, /* TODO: Should probably be K8N Neo4 Platinum, see http://www.coreboot.org/pipermail/flashrom/2010-August/004362.html. */
 	{0x8086, 0x7190,      0,      0,  0x8086, 0x7110,      0,      0, "^MS-6163 (i440BX)$", NULL, NULL,   P3, "MSI",         "MS-6163 (MS-6163 Pro)", 0,   OK, intel_piix4_gpo14_raise},
 	{0x1039, 0x0745,      0,      0,  0x1039, 0x0018,      0,      0, "^MS-6561",   NULL, NULL,           P3, "MSI",         "MS-6561 (745 Ultra)",   0,   OK, w836xx_memw_enable_2e},
diff --git a/chipset_enable.c b/chipset_enable.c
index 0873b4e..267008c 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -1406,7 +1406,7 @@
 	{0x8086, 0x1c5c, OK, "Intel", "H61",		enable_flash_pch6},
 	{0x8086, 0x1d40, OK, "Intel", "X79",		enable_flash_pch6},
 	{0x8086, 0x1d41, OK, "Intel", "X79",		enable_flash_pch6},
-	{0x8086, 0x1e44, NT, "Intel", "Z77",		enable_flash_pch7},
+	{0x8086, 0x1e44, OK, "Intel", "Z77",		enable_flash_pch7},
 	{0x8086, 0x1e46, NT, "Intel", "Z75",		enable_flash_pch7},
 	{0x8086, 0x1e47, NT, "Intel", "Q77",		enable_flash_pch7},
 	{0x8086, 0x1e48, NT, "Intel", "Q75",		enable_flash_pch7},
diff --git a/flashchips.c b/flashchips.c
index 4e09ab1..e1a0c42 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -954,7 +954,7 @@
 			}, {
 				.eraseblocks = { { 64 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
@@ -986,7 +986,7 @@
 			}, {
 				.eraseblocks = { { 128 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
@@ -1018,7 +1018,7 @@
 			}, {
 				.eraseblocks = { { 256 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
@@ -1050,7 +1050,7 @@
 			}, {
 				.eraseblocks = { { 512 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
@@ -1082,7 +1082,7 @@
 			}, {
 				.eraseblocks = { { 1024 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
@@ -1114,7 +1114,7 @@
 			}, {
 				.eraseblocks = { { 2048 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l40p,
 		.unlock		= spi_disable_blockprotect,
@@ -1153,7 +1153,7 @@
 			}, {
 				.eraseblocks = { { 4096 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25l032,
 		.unlock		= NULL, /* Two status reg bytes (read with 0x35 and 0x05) */
@@ -1192,7 +1192,7 @@
 			}, {
 				.eraseblocks = { { 4096 * 1024, 1 } },
 				.block_erase = spi_block_erase_c7,
-			}			
+			}
 		},
 		.printlock	= spi_prettyprint_status_register_amic_a25lq032,
 		.unlock		= NULL, /* Two status reg bytes (read with 0x35 and 0x05) */
@@ -3413,11 +3413,11 @@
 		.name		= "EN25F64",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
-		.model_id	= EON_EN25F32,
+		.model_id	= EON_EN25F64,
 		.total_size	= 8192,
 		.page_size	= 256,
 		.feature_bits	= FEATURE_WRSR_WREN,
-		.tested		= TEST_UNTESTED,
+		.tested		= TEST_OK_PR,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
@@ -4680,7 +4680,7 @@
 		.total_size	= 128,
 		.page_size	= 256,
 		.feature_bits	= FEATURE_WRSR_WREN,
-		.tested		= TEST_UNTESTED,
+		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
@@ -7053,7 +7053,7 @@
 		.total_size	= 64,
 		.page_size	= 4096,
 		.feature_bits	= FEATURE_EITHER_RESET,
-		.tested		= TEST_OK_PRE,
+		.tested		= TEST_OK_PREW,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */
 		.block_erasers	=
diff --git a/flashrom.c b/flashrom.c
index a887e3b..7d1ffa3 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1086,7 +1086,8 @@
 		return 1;
 	}
 	if (image_stat.st_size != size) {
-		msg_gerr("Error: Image size doesn't match\n");
+		msg_gerr("Error: Image size (%ld B) doesn't match the flash chip's size (%ld B)!\n",
+			 image_stat.st_size, size);
 		fclose(image);
 		return 1;
 	}
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 31a6c5c..c09405e 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -271,11 +271,11 @@
 			channel_count = -1;
 			break;
 		}
-	}
-	if (channel_count < 0 || strlen(arg) != 1) {
-		msg_perr("Error: Invalid channel/port/interface specified: \"%s\".\n", arg);
-		free(arg);
-		return -2;
+		if (channel_count < 0 || strlen(arg) != 1) {
+			msg_perr("Error: Invalid channel/port/interface specified: \"%s\".\n", arg);
+			free(arg);
+			return -2;
+		}
 	}
 	free(arg);
 
diff --git a/ichspi.c b/ichspi.c
index 8dd1893..fadfe62 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1675,11 +1675,9 @@
 		if (tmp2 & HSFS_FDV)
 			desc_valid = 1;
 		if (!(tmp2 & HSFS_FDOPSS) && desc_valid)
-			msg_pinfo("The Flash Descriptor Security Override "
-				  "Strap-Pin is set. Restrictions implied\n"
-				  "by the FRAP and FREG registers are NOT in "
-				  "effect. Please note that Protected\n"
-				  "Range (PR) restrictions still apply.\n");
+			msg_pinfo("The Flash Descriptor Override Strap-Pin is set. Restrictions implied by\n"
+				  "the Master Section of the flash descriptor are NOT in effect. Please note\n"
+				  "that Protected Range (PR) restrictions still apply.\n");
 		ich_init_opcodes();
 
 		if (desc_valid) {
@@ -1720,15 +1718,13 @@
 				  "yet.\n");
 			if (!ich_spi_force)
 				programmer_may_write = 0;
-			msg_pinfo("Writes have been disabled. You can enforce "
-				  "write support with the\nich_spi_force "
-				  "programmer option, but it will most likely "
-				  "harm your hardware!\nIf you force flashrom "
-				  "you will get no support if something "
-				  "breaks.\n");
+			msg_pinfo("Writes have been disabled for safety reasons. You can enforce write\n"
+				  "support with the ich_spi_force programmer option, but you will most likely\n"
+				  "harm your hardware! If you force flashrom you will get no support if\n"
+				  "something breaks. On a few mainboards it is possible to enable write\n"
+				  "access by setting a jumper (see its documentation or the board itself).\n");
 			if (ich_spi_force)
-				msg_pinfo("Continuing with write support "
-					  "because the user forced us to!\n");
+				msg_pinfo("Continuing with write support because the user forced us to!\n");
 		}
 
 		tmp = mmio_readl(ich_spibar + ICH9_REG_SSFS);
diff --git a/nicrealtek.c b/nicrealtek.c
index 779d023..92f48a8 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -60,6 +60,14 @@
 
 int nicrealtek_init(void)
 {
+	if (rget_io_perms())
+		return 1;
+
+	io_base_addr = pcidev_init(PCI_BASE_ADDRESS_0, nics_realtek);
+
+	if (register_shutdown(nicrealtek_shutdown, NULL))
+		return 1;
+
 	/* Beware, this ignores the vendor ID! */
 	switch (pcidev_dev->device_id) {
 	case 0x8139: /* RTL8139 */
@@ -74,14 +82,6 @@
 		break;
 	}
 
-	if (rget_io_perms())
-		return 1;
-
-	io_base_addr = pcidev_init(PCI_BASE_ADDRESS_0, nics_realtek);
-
-	if (register_shutdown(nicrealtek_shutdown, NULL))
-		return 1;
-
 	register_par_programmer(&par_programmer_nicrealtek, BUS_PARALLEL);
 
 	return 0;
diff --git a/print.c b/print.c
index eb99c07..bca861a 100644
--- a/print.c
+++ b/print.c
@@ -795,6 +795,7 @@
 	B("Foxconn",	"6150K8MD-8EKRSH",	OK, "http://www.foxconnchannel.com/ProductDetail.aspx?T=Motherboard&U=en-us0000157", NULL),
 	B("Foxconn",	"A6VMX",		OK, "http://www.foxconnchannel.com/ProductDetail.aspx?T=Motherboard&U=en-us0000346", NULL),
 	B("Foxconn",	"P4M800P7MA-RS2",	OK, "http://www.foxconnchannel.com/ProductDetail.aspx?T=Motherboard&U=en-us0000138", NULL),
+	B("Foxconn",	"P55MX",		OK, "http://www.foxconnchannel.com/ProductDetail.aspx?T=motherboard&U=en-us0000474", "Needs the MFG jumper to be set correctly before flashing to enable the Flash Descriptor Override Strap."),
 	B("Freetech",	"P6F91i",		OK, "http://web.archive.org/web/20010417035034/http://www.freetech.com/prod/P6F91i.html", NULL),
 	B("Foxconn",	"Q45M",			BAD, "http://www.foxconnchannel.com/ProductDetail.aspx?T=Motherboard&U=en-us0000587", "Probing works (Hardware sequencing, 4096 kB, SPI), but parts of the flash are problematic: descriptor is r/o (conforming to ICH reqs), ME is locked."),
 	B("Fujitsu-Siemens", "ESPRIMO P5915",	OK, "http://uk.ts.fujitsu.com/rl/servicesupport/techsupport/professionalpc/ESPRIMO/P/EsprimoP5915-6.htm", "Mainboard model is D2312-A2."),
diff --git a/serprog.c b/serprog.c
index b179ea4..854cb93 100644
--- a/serprog.c
+++ b/serprog.c
@@ -877,8 +877,7 @@
 	unsigned char buf[4];
 	msg_pspew("%s usecs=%d\n", __func__, usecs);
 	if (!sp_check_commandavail(S_CMD_O_DELAY)) {
-		msg_pdbg("Note: serprog_delay used, but the programmer doesn't "
-			 "support delay\n");
+		msg_pdbg2("serprog_delay used, but programmer doesn't support delays natively - emulating\n");
 		internal_delay(usecs);
 		return;
 	}