Subject: [PATCH] board_enable: add ASUS P4R8L write enable

Set SMBus register 0xa9 bit 4, following the board BIOS. Match both
PCI/subsystem IDs and the P4R8L DMI name; restore the register at shutdown.
Tested on ASUS Pundit-R / P4R8L with an SST49LF004B: program a scratch
area, erase its 4 KiB sector, and verify restoration of the whole chip.

--- a/board_enable.c
+++ b/board_enable.c
@@ -1327,6 +1327,29 @@
 	return 0;
 }
 
+/* ASUS Pundit-R / P4R8L, ATI SB200. */
+static int board_asus_p4r8l(struct board_cfg *cfg)
+{
+	struct pci_dev *dev = pcidev_find(0x1002, 0x4353);
+	uint8_t old, value;
+
+	if (!dev)
+		return -1;
+
+	/* Board-specific write enable observed in the P4R8L 1006.004 BIOS.
+	 * Its paired disable routine clears this bit. Preserve the incoming state.
+	 */
+	old = pci_read_byte(dev, 0xa9);
+	rpci_write_byte(dev, 0xa9, old | 0x10);
+	value = pci_read_byte(dev, 0xa9);
+	msg_pdbg("P4R8L SMBus 0xa9: 0x%02x -> 0x%02x\n", old, value);
+	if (!(value & 0x10)) {
+		msg_perr("P4R8L flash write enable did not latch.\n");
+		return -1;
+	}
+	return 0;
+}
+
 /*
  * Suited for:
  *  - ASUS A8AE-LE (Codename AmberineM; used in Compaq Presario 061)
@@ -2398,6 +2421,7 @@
 	{0x8086, 0x2570, 0x1043, 0x80f2,  0x8086, 0x24d3, 0x1043, 0x80a6, "^P4P800-X$", NULL, NULL,           P3, "ASUS",        "P4P800-X",              0,   OK, intel_ich_gpio21_raise},
 	{0x8086, 0x2570, 0x1043, 0x80f2,  0x8086, 0x24d3,      0,      0, "^P4P800SE$", NULL, NULL,           P3, "ASUS",        "P4P800SE",              0,   OK, intel_ich_gpio21_raise},
 	{0x8086, 0x2570, 0x1043, 0x80b2,  0x8086, 0x24c3, 0x1043, 0x8089, "^P4PE-X/TE$",NULL, NULL,           P3, "ASUS",        "P4PE-X/TE",             0,   NT, intel_ich_gpio21_raise},
+	{0x1002, 0x434c, 0x1043, 0x8108,  0x1002, 0x4353, 0x1043, 0x8108, "^P4R8L$",    NULL, NULL,           P3, "ASUS",        "P4R8L",                 0,   OK, board_asus_p4r8l},
 	{0x1039, 0x0651, 0x1043, 0x8081,  0x1039, 0x0962,      0,      0, NULL,         NULL, NULL,           P3, "ASUS",        "P4SC-E",                0,   OK, it8707f_write_enable_2e},
 	{0x8086, 0x2570, 0x1043, 0x80A5,  0x105A, 0x24D3, 0x1043, 0x80A6, NULL,         NULL, NULL,           P3, "ASUS",        "P4SD-LA",               0,   NT, intel_ich_gpio32_raise},
 	{0x1039, 0x0661, 0x1043, 0x8113,  0x1039, 0x5513, 0x1043, 0x8087, NULL,         NULL, NULL,           P3, "ASUS",        "P4S800-MX",             512, OK, w836xx_memw_enable_2e},
