internal: Pass programmer context down into board enables

Board enables potentially need access to programmer data, e.g. to
process parameters, register masters etc.

Change-Id: I1531a6e1be9866adc5dce74c6f62bbbeae1bd274
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72527
diff --git a/board_enable.c b/board_enable.c
index dc0dda2..365e0c0 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -146,7 +146,7 @@
  * Suited for:
  *  - Nokia IP530: Intel 440BX + PIIX4 + FDC37B787
  */
-static int fdc37b787_gpio50_raise_3f0(void)
+static int fdc37b787_gpio50_raise_3f0(struct flashprog_programmer *const prog)
 {
 	return fdc37b787_gpio50_raise(0x3f0);
 }
@@ -457,7 +457,7 @@
  *  - Agami Aruma
  *  - IWILL DK8-HTX
  */
-static int w83627hf_gpio24_raise_2e(void)
+static int w83627hf_gpio24_raise_2e(struct flashprog_programmer *const prog)
 {
 	return winbond_gpio_set(0x2e, WINBOND_W83627HF_ID, 24, 1);
 }
@@ -468,7 +468,7 @@
  * Suited for:
  *  - MSI MS-6577
  */
-static int w83627hf_gpio25_raise_2e(void)
+static int w83627hf_gpio25_raise_2e(struct flashprog_programmer *const prog)
 {
 	return winbond_gpio_set(0x2e, WINBOND_W83627HF_ID, 25, 1);
 }
@@ -479,7 +479,7 @@
  * Suited for:
  *  - ASUS A8N-VM CSM: AMD Socket 939 + GeForce 6150 (C51) + MCP51
  */
-static int w83627ehf_gpio22_raise_2e(void)
+static int w83627ehf_gpio22_raise_2e(struct flashprog_programmer *const prog)
 {
 	return winbond_gpio_set(0x2e, WINBOND_W83627EHF_ID, 22, 1);
 }
@@ -490,7 +490,7 @@
  * Suited for:
  *  - MSI K8T Neo2-F V2.0
  */
-static int w83627thf_gpio44_raise_2e(void)
+static int w83627thf_gpio44_raise_2e(struct flashprog_programmer *const prog)
 {
 	return winbond_gpio_set(0x2e, WINBOND_W83627THF_ID, 44, 1);
 }
@@ -501,7 +501,7 @@
  * Suited for:
  *  - MSI K8N Neo3
  */
-static int w83627thf_gpio44_raise_4e(void)
+static int w83627thf_gpio44_raise_4e(struct flashprog_programmer *const prog)
 {
 	return winbond_gpio_set(0x4e, WINBOND_W83627THF_ID, 44, 1);
 }
@@ -557,7 +557,7 @@
  * Suited for:
  *  - Biostar M7VIQ: VIA KM266 + VT8235
  */
-static int w83697xx_memw_enable_2e(void)
+static int w83697xx_memw_enable_2e(struct flashprog_programmer *const prog)
 {
 	w83697xx_memw_enable(0x2E);
 
@@ -579,7 +579,7 @@
  *  - ASRock K7S41: SiS 741 + SiS 963 + W83697HF
  *  - ASRock K7S41GX: SiS 741GX + SiS 963L + W83697HF
  */
-static int w836xx_memw_enable_2e(void)
+static int w836xx_memw_enable_2e(struct flashprog_programmer *const prog)
 {
 	w836xx_memw_enable(0x2E);
 
@@ -590,7 +590,7 @@
  * Suited for:
  *  - Termtek TK-3370 (rev. 2.5b)
  */
-static int w836xx_memw_enable_4e(void)
+static int w836xx_memw_enable_4e(struct flashprog_programmer *const prog)
 {
 	w836xx_memw_enable(0x4E);
 
@@ -725,7 +725,7 @@
  * Suited for:
  *  - ASUS P4SC-E: SiS 651 + 962 + ITE IT8707F
  */
-static int it8707f_write_enable_2e(void)
+static int it8707f_write_enable_2e(struct flashprog_programmer *const prog)
 {
 	return it8707f_write_enable(0x2e);
 }
@@ -834,7 +834,7 @@
  * Suited for:
  *  - ASUS M2V-MX: VIA K8M890 + VT8237A + IT8716F
  */
-static int via_vt823x_gpio5_raise(void)
+static int via_vt823x_gpio5_raise(struct flashprog_programmer *const prog)
 {
 	/* On M2V-MX: GPO5 is connected to WP# and TBL#. */
 	return via_vt823x_gpio_set(5, 1);
@@ -844,7 +844,7 @@
  * Suited for:
  *  - VIA EPIA EK & N & NL
  */
-static int via_vt823x_gpio9_raise(void)
+static int via_vt823x_gpio9_raise(struct flashprog_programmer *const prog)
 {
 	return via_vt823x_gpio_set(9, 1);
 }
@@ -856,7 +856,7 @@
  * We don't need to do this for EPIA M when using coreboot, GPIO15 is never
  * lowered there.
  */
-static int via_vt823x_gpio15_raise(void)
+static int via_vt823x_gpio15_raise(struct flashprog_programmer *const prog)
 {
 	return via_vt823x_gpio_set(15, 1);
 }
@@ -868,7 +868,7 @@
  *  - MSI KT4V and KT4V-L: AMD K7 + VIA KT400 + VT8235
  *  - MSI KT4 Ultra: AMD K7 + VIA KT400 + VT8235
  */
-static int board_msi_kt4v(void)
+static int board_msi_kt4v(struct flashprog_programmer *const prog)
 {
 	int ret;
 
@@ -885,7 +885,7 @@
  * We are talking to a proprietary device on SMBus: the AS99127F which does
  * much more than the Winbond W83781D it tries to be compatible with.
  */
-static int board_asus_p3b_f(void)
+static int board_asus_p3b_f(struct flashprog_programmer *const prog)
 {
 	/*
 	 * Find where the SMBus host is. ASUS sets it to 0xE800; coreboot sets it to 0x0F00.
@@ -932,7 +932,7 @@
  * We're basically talking to some unknown device on SMBus, my guess
  * is that it is the Winbond W83781D that lives near the DIP BIOS.
  */
-static int board_asus_p5a(void)
+static int board_asus_p5a(struct flashprog_programmer *const prog)
 {
 	uint8_t tmp;
 	int i;
@@ -1006,7 +1006,7 @@
  *
  * It's not a Super I/O but it uses the same index/data port method.
  */
-static int board_hp_dl145_g3_enable(void)
+static int board_hp_dl145_g3_enable(struct flashprog_programmer *const prog)
 {
 	/* GPIO 0 reg from PM regs */
 	/* Set GPIO 2 and 5 high, connected to flash WP# and TBL# pins. */
@@ -1020,7 +1020,7 @@
  *
  * It's not a Super I/O but it uses the same index/data port method.
  */
-static int board_hp_dl165_g6_enable(void)
+static int board_hp_dl165_g6_enable(struct flashprog_programmer *const prog)
 {
 	/* Variant of DL145, with slightly different pin placement. */
 	sio_mask(0xcd6, 0x44, 0x80, 0x80); /* TBL# */
@@ -1029,7 +1029,7 @@
 	return 0;
 }
 
-static int board_ibm_x3455(void)
+static int board_ibm_x3455(struct flashprog_programmer *const prog)
 {
 	/* Raise GPIO13. */
 	sio_mask(0xcd6, 0x45, 0x20, 0x20);
@@ -1041,7 +1041,7 @@
  * Suited for:
  * - Elitegroup GeForce6100SM-M: NVIDIA MCP61 + ITE IT8726F
  */
-static int board_ecs_geforce6100sm_m(void)
+static int board_ecs_geforce6100sm_m(struct flashprog_programmer *const prog)
 {
 	struct pci_dev *dev;
 	uint32_t tmp;
@@ -1139,7 +1139,7 @@
  *  - ASUS A8N-LA (HP OEM "Nagami-GL8E"): NVIDIA MCP51
  *  - ASUS M2NBP-VM CSM: NVIDIA MCP51
  */
-static int nvidia_mcp_gpio0_raise(void)
+static int nvidia_mcp_gpio0_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x00, 1);
 }
@@ -1149,7 +1149,7 @@
  *  - abit KN8 Ultra: NVIDIA CK804
  *  - abit KN9 Ultra: NVIDIA MCP55
  */
-static int nvidia_mcp_gpio2_lower(void)
+static int nvidia_mcp_gpio2_lower(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x02, 0);
 }
@@ -1161,7 +1161,7 @@
  *  - MSI K8NGM2-L: NVIDIA MCP51
  *  - MSI K9N SLI: NVIDIA MCP55
  */
-static int nvidia_mcp_gpio2_raise(void)
+static int nvidia_mcp_gpio2_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x02, 1);
 }
@@ -1170,7 +1170,7 @@
  * Suited for:
  *  - EPoX EP-8NPA7I: Socket 754 + NVIDIA nForce4 4X
  */
-static int nvidia_mcp_gpio4_raise(void)
+static int nvidia_mcp_gpio4_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x04, 1);
 }
@@ -1187,7 +1187,7 @@
  *        b) #TBL is hardwired on that board to a pull-down. It can be
  *           overridden by connecting the two solder points next to F2.
  */
-static int nvidia_mcp_gpio5_raise(void)
+static int nvidia_mcp_gpio5_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x05, 1);
 }
@@ -1196,7 +1196,7 @@
  * Suited for:
  *  - abit NF7-S: NVIDIA CK804
  */
-static int nvidia_mcp_gpio8_raise(void)
+static int nvidia_mcp_gpio8_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x08, 1);
 }
@@ -1206,7 +1206,7 @@
  *  - GIGABYTE GA-K8NS Pro-939: Socket 939 + NVIDIA nForce3  + CK8
  *  - Probably other versions of the GA-K8NS
  */
-static int nvidia_mcp_gpio0a_raise(void)
+static int nvidia_mcp_gpio0a_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x0a, 1);
 }
@@ -1216,7 +1216,7 @@
  *  - MSI K8N Neo Platinum: Socket 754 + nForce3 Ultra + CK8
  *  - MSI K8N Neo2 Platinum: Socket 939 + nForce3 Ultra + CK8
  */
-static int nvidia_mcp_gpio0c_raise(void)
+static int nvidia_mcp_gpio0c_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x0c, 1);
 }
@@ -1225,7 +1225,7 @@
  * Suited for:
  *  - abit NF-M2 nView: Socket AM2 + NVIDIA MCP51
  */
-static int nvidia_mcp_gpio4_lower(void)
+static int nvidia_mcp_gpio4_lower(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x04, 0);
 }
@@ -1234,7 +1234,7 @@
  * Suited for:
  *  - ASUS P5ND2-SLI Deluxe: LGA775 + nForce4 SLI + MCP04
  */
-static int nvidia_mcp_gpio10_raise(void)
+static int nvidia_mcp_gpio10_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x10, 1);
 }
@@ -1243,7 +1243,7 @@
  * Suited for:
  *  - GIGABYTE GA-K8N-SLI: AMD socket 939 + NVIDIA CK804 + ITE IT8712F
  */
-static int nvidia_mcp_gpio21_raise(void)
+static int nvidia_mcp_gpio21_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x21, 0x01);
 }
@@ -1252,7 +1252,7 @@
  * Suited for:
  *  - EPoX EP-8RDA3+: Socket A + nForce2 Ultra 400 + MCP2
  */
-static int nvidia_mcp_gpio31_raise(void)
+static int nvidia_mcp_gpio31_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x31, 0x01);
 }
@@ -1262,7 +1262,7 @@
  *  - GIGABYTE GA-K8N51GMF: Socket 754 + Geforce 6100 + MCP51
  *  - GIGABYTE GA-K8N51GMF-9: Socket 939 + Geforce 6100 + MCP51
  */
-static int nvidia_mcp_gpio3b_raise(void)
+static int nvidia_mcp_gpio3b_raise(struct flashprog_programmer *const prog)
 {
 	return nvidia_mcp_gpio_set(0x3b, 1);
 }
@@ -1271,14 +1271,14 @@
  * Suited for:
  *  - Sun Ultra 40 M2: Dual Socket F (1207) + MCP55
  */
-static int board_sun_ultra_40_m2(void)
+static int board_sun_ultra_40_m2(struct flashprog_programmer *const prog)
 {
 	int ret;
 	uint8_t reg;
 	uint16_t base;
 	struct pci_dev *dev;
 
-	ret = nvidia_mcp_gpio4_lower();
+	ret = nvidia_mcp_gpio4_lower(prog);
 	if (ret)
 		return ret;
 
@@ -1303,7 +1303,7 @@
  * Suited for:
  *  - Artec Group DBE61 and DBE62
  */
-static int board_artecgroup_dbe6x(void)
+static int board_artecgroup_dbe6x(struct flashprog_programmer *const prog)
 {
 #define DBE6x_MSR_DIVIL_BALL_OPTS	0x51400015
 #define DBE6x_PRI_BOOT_LOC_SHIFT	2
@@ -1347,7 +1347,7 @@
  * Datasheet(s) used:
  *  - AMD document 43009 "AMD SB700/710/750 Register Reference Guide" rev. 1.00
  */
-static int amd_sbxxx_gpio9_raise(void)
+static int amd_sbxxx_gpio9_raise(struct flashprog_programmer *const prog)
 {
 	struct pci_dev *dev;
 	uint32_t reg;
@@ -1461,7 +1461,7 @@
  *  - ASUS OPLX-M
  *  - ASUS P2B-N
  */
-static int intel_piix4_gpo18_lower(void)
+static int intel_piix4_gpo18_lower(struct flashprog_programmer *const prog)
 {
 	return intel_piix4_gpo_set(18, 0);
 }
@@ -1470,7 +1470,7 @@
  * Suited for:
  *  - MSI MS-6163 v2 (MS-6163 Pro): Intel 440BX + PIIX4E + Winbond W83977EF
  */
-static int intel_piix4_gpo14_raise(void)
+static int intel_piix4_gpo14_raise(struct flashprog_programmer *const prog)
 {
 	return intel_piix4_gpo_set(14, 1);
 }
@@ -1479,7 +1479,7 @@
  * Suited for:
  *  - EPoX EP-BX3
  */
-static int intel_piix4_gpo22_raise(void)
+static int intel_piix4_gpo22_raise(struct flashprog_programmer *const prog)
 {
 	return intel_piix4_gpo_set(22, 1);
 }
@@ -1488,7 +1488,7 @@
  * Suited for:
  *  - abit BM6
  */
-static int intel_piix4_gpo26_lower(void)
+static int intel_piix4_gpo26_lower(struct flashprog_programmer *const prog)
 {
 	return intel_piix4_gpo_set(26, 0);
 }
@@ -1497,7 +1497,7 @@
  * Suited for:
  *  - Intel SE440BX-2
  */
-static int intel_piix4_gpo27_lower(void)
+static int intel_piix4_gpo27_lower(struct flashprog_programmer *const prog)
 {
 	return intel_piix4_gpo_set(27, 0);
 }
@@ -1506,7 +1506,7 @@
  * Suited for:
  *  - Dell OptiPlex GX1
  */
-static int intel_piix4_gpo30_lower(void)
+static int intel_piix4_gpo30_lower(struct flashprog_programmer *const prog)
 {
 	return intel_piix4_gpo_set(30, 0);
 }
@@ -1719,7 +1719,7 @@
  *  - ASUS P5LD2-VM DH
  *  - ASUS P5W DH Deluxe
  */
-static int intel_ich_gpio16_raise(void)
+static int intel_ich_gpio16_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(16, 1);
 }
@@ -1728,7 +1728,7 @@
  * Suited for:
  *  - HP Puffer2-UL8E (ASUS PTGD-LA OEM): LGA775 + 915 + ICH6
  */
-static int intel_ich_gpio18_raise(void)
+static int intel_ich_gpio18_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(18, 1);
 }
@@ -1737,7 +1737,7 @@
  * Suited for:
  *  - MSI MS-7046: LGA775 + 915P + ICH6
  */
-static int intel_ich_gpio19_raise(void)
+static int intel_ich_gpio19_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(19, 1);
 }
@@ -1747,7 +1747,7 @@
  *  - ASUS P5BV-R: LGA775 + 3200 + ICH7
  *  - AOpen i965GMt-LA: Intel Socket479 + 965GM + ICH8M
  */
-static int intel_ich_gpio20_raise(void)
+static int intel_ich_gpio20_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(20, 1);
 }
@@ -1769,7 +1769,7 @@
  *  - ASUS TUSL2-C: Intel socket370 + 815 + ICH2
  *  - Samsung Polaris 32: socket478 + 865P + ICH5
  */
-static int intel_ich_gpio21_raise(void)
+static int intel_ich_gpio21_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(21, 1);
 }
@@ -1781,7 +1781,7 @@
  *  - ASUS P4B-MX variant in HP Vectra VL420 SFF: socket478 + 845D + ICH2
  *  - TriGem Anaheim-3: socket370 + Intel 810 + ICH
  */
-static int intel_ich_gpio22_raise(void)
+static int intel_ich_gpio22_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(22, 1);
 }
@@ -1793,7 +1793,7 @@
  *    - HP Media Center m7270.fr Desktop PC as "Lithium-UL8E"
  *    - Epson Endeavor MT7700
  */
-static int intel_ich_gpio34_raise(void)
+static int intel_ich_gpio34_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(34, 1);
 }
@@ -1803,7 +1803,7 @@
  *  - AOpen i945GMx-VFX: Intel 945GM + ICH7-M used in ...
  *    - FSC ESPRIMO Q5010 (SMBIOS: D2544-B1)
  */
-static int intel_ich_gpio38_raise(void)
+static int intel_ich_gpio38_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(38, 1);
 }
@@ -1812,7 +1812,7 @@
  * Suited for:
  *  - ASUS M6Ne (laptop): socket 479M (guessed) + Intel 855PM + ICH4-M
  */
-static int intel_ich_gpio43_raise(void)
+static int intel_ich_gpio43_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(43, 1);
 }
@@ -1821,7 +1821,7 @@
  * Suited for:
  *  - HP Vectra VL400: 815 + ICH + PC87360
  */
-static int board_hp_vl400(void)
+static int board_hp_vl400(struct flashprog_programmer *const prog)
 {
 	int ret;
 	ret = intel_ich_gpio_set(25, 1);	/* Master write enable ? */
@@ -1836,7 +1836,7 @@
  * Suited for:
  *  - HP e-Vectra P2706T: 810E + ICH + PC87364
  */
-static int board_hp_p2706t(void)
+static int board_hp_p2706t(struct flashprog_programmer *const prog)
 {
 	int ret;
 	ret = pc8736x_gpio_set(PC87364_ID, 0x25, 1);
@@ -1852,7 +1852,7 @@
  *  - ASRock 775i65G: Intel LGA 775 + 865G + ICH5
  *  - MSI MS-6391 (845 Pro4): Intel Socket478 + 845 + ICH2
  */
-static int intel_ich_gpio23_raise(void)
+static int intel_ich_gpio23_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(23, 1);
 }
@@ -1862,7 +1862,7 @@
  *  - GIGABYTE GA-6IEM: Intel Socket370 + i815 + ICH2
  *  - GIGABYTE GA-8IRML: Intel Socket478 + i845 + ICH2
  */
-static int intel_ich_gpio25_raise(void)
+static int intel_ich_gpio25_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(25, 1);
 }
@@ -1871,7 +1871,7 @@
  * Suited for:
  *  - IBASE MB899: i945GM + ICH7
  */
-static int intel_ich_gpio26_raise(void)
+static int intel_ich_gpio26_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(26, 1);
 }
@@ -1884,7 +1884,7 @@
  *  - GIGABYTE GA-8PE667 Ultra 2: socket 478 + i845PE + ICH4
  *  - MSI MS-6788-40 (aka 848P Neo-V)
  */
-static int intel_ich_gpio32_raise(void)
+static int intel_ich_gpio32_raise(struct flashprog_programmer *const prog)
 {
 	return intel_ich_gpio_set(32, 1);
 }
@@ -1893,7 +1893,7 @@
  * Suited for:
  *  - AOpen i975Xa-YDG: i975X + ICH7 + W83627EHF
  */
-static int board_aopen_i975xa_ydg(void)
+static int board_aopen_i975xa_ydg(struct flashprog_programmer *const prog)
 {
 	int ret;
 
@@ -1915,7 +1915,7 @@
  * Suited for:
  *  - Acorp 6A815EPD: socket 370 + intel 815 + ICH2
  */
-static int board_acorp_6a815epd(void)
+static int board_acorp_6a815epd(struct flashprog_programmer *const prog)
 {
 	int ret;
 
@@ -1931,7 +1931,7 @@
  * Suited for:
  *  - Kontron 986LCD-M: Socket478 + 915GM + ICH7R
  */
-static int board_kontron_986lcd_m(void)
+static int board_kontron_986lcd_m(struct flashprog_programmer *const prog)
 {
 	int ret;
 
@@ -1998,7 +1998,7 @@
  *  - abit VT6X4: Pro133x + VT82C686A
  *  - abit VA6: Pro133x + VT82C686A
  */
-static int via_apollo_gpo4_lower(void)
+static int via_apollo_gpo4_lower(struct flashprog_programmer *const prog)
 {
 	return via_apollo_gpo_set(4, 0);
 }
@@ -2007,7 +2007,7 @@
  * Suited for:
  *  - Soyo SY-7VCA: Pro133A + VT82C686
  */
-static int via_apollo_gpo0_lower(void)
+static int via_apollo_gpo0_lower(struct flashprog_programmer *const prog)
 {
 	return via_apollo_gpo_set(0, 0);
 }
@@ -2020,7 +2020,7 @@
  *  - GIGABYTE GA-8SIMLFS 2.0
  *  - GIGABYTE GA-8SIMLH
  */
-static int sis_gpio0_raise_and_w836xx_memw(void)
+static int sis_gpio0_raise_and_w836xx_memw(struct flashprog_programmer *const prog)
 {
 	struct pci_dev *dev;
 	uint16_t base, temp;
@@ -2083,7 +2083,7 @@
  * Disable write protection on the Mitac 6513WU. WP# on the FWH is
  * connected to GP30 on the Super I/O, and TBL# is always high.
  */
-static int board_mitac_6513wu(void)
+static int board_mitac_6513wu(struct flashprog_programmer *const prog)
 {
 	struct pci_dev *dev;
 	uint16_t rt_port;
@@ -2116,7 +2116,7 @@
  * Suited for:
  *  - abit AV8: Socket939 + K8T800Pro + VT8237
  */
-static int board_abit_av8(void)
+static int board_abit_av8(struct flashprog_programmer *const prog)
 {
 	uint8_t val;
 
@@ -2133,7 +2133,7 @@
  *  - ASUS A7V333: VIA KT333 + VT8233A + IT8703F
  *  - ASUS A7V8X: VIA KT400 + VT8235 + IT8703F
  */
-static int it8703f_gpio51_raise(void)
+static int it8703f_gpio51_raise(struct flashprog_programmer *const prog)
 {
 	uint16_t id, base;
 	uint8_t tmp;
@@ -2262,7 +2262,7 @@
  * Suited for:
  * - ASUS A7N8X-VM/400: NVIDIA nForce2 IGP2 + IT8712F
  */
-static int it8712f_gpio12_raise(void)
+static int it8712f_gpio12_raise(struct flashprog_programmer *const prog)
 {
 	return it87_gpio_set(12, 1);
 }
@@ -2272,7 +2272,7 @@
  * - ASUS A7V600-X: VIA KT600 + VT8237 + IT8712F
  * - ASUS A7V8X-X: VIA KT400 + VT8235 + IT8712F
  */
-static int it8712f_gpio31_raise(void)
+static int it8712f_gpio31_raise(struct flashprog_programmer *const prog)
 {
 	return it87_gpio_set(32, 1);
 }
@@ -2282,7 +2282,7 @@
  * - ASUS P5N-D: NVIDIA MCP51 + IT8718F
  * - ASUS P5N-E SLI: NVIDIA MCP51 + IT8718F
  */
-static int it8718f_gpio63_raise(void)
+static int it8718f_gpio63_raise(struct flashprog_programmer *const prog)
 {
 	return it87_gpio_set(63, 1);
 }
@@ -2294,7 +2294,7 @@
  * - Intel D945GCNL
  * - MSC Q7 Tunnel Creek Module (Q7-TCTC)
  */
-static int p2_not_a_laptop(void)
+static int p2_not_a_laptop(struct flashprog_programmer *const prog)
 {
 	/* label this board as not a laptop */
 	is_laptop = 0;
@@ -2305,7 +2305,7 @@
 /*
  * Suited for all laptops, which are known to *not* have interfering embedded controllers.
  */
-static int p2_whitelist_laptop(void)
+static int p2_whitelist_laptop(struct flashprog_programmer *const prog)
 {
 	is_laptop = 1;
 	laptop_ok = true;
@@ -2719,7 +2719,7 @@
 }
 
 /* FIXME: Should this be identical to board_flash_enable? */
-static int board_handle_phase(enum board_match_phase phase)
+static int board_handle_phase(struct flashprog_programmer *const prog, enum board_match_phase phase)
 {
 	const struct board_match *board = NULL;
 
@@ -2737,20 +2737,21 @@
 		return 0;
 	}
 
-	return board->enable();
+	return board->enable(prog);
 }
 
-void board_handle_before_superio(void)
+void board_handle_before_superio(struct flashprog_programmer *const prog)
 {
-	board_handle_phase(P1);
+	board_handle_phase(prog, P1);
 }
 
-void board_handle_before_laptop(void)
+void board_handle_before_laptop(struct flashprog_programmer *const prog)
 {
-	board_handle_phase(P2);
+	board_handle_phase(prog, P2);
 }
 
-int board_flash_enable(const char *vendor, const char *model, const char *cb_vendor, const char *cb_model)
+int board_flash_enable(struct flashprog_programmer *const prog,
+		       const char *vendor, const char *model, const char *cb_vendor, const char *cb_model)
 {
 	const struct board_match *board = NULL;
 	int ret = 0;
@@ -2787,7 +2788,7 @@
 		msg_pinfo("Enabling full flash access for board \"%s %s\"... ",
 			  board->vendor_name, board->board_name);
 
-		ret = board->enable();
+		ret = board->enable(prog);
 		if (ret)
 			msg_pinfo("FAILED!\n");
 		else
diff --git a/include/programmer.h b/include/programmer.h
index 2684b08..36067a2 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -194,7 +194,7 @@
 
 	int max_rom_decode_parallel;
 	const enum test_state status;
-	int (*enable) (void); /* May be NULL. */
+	int (*enable) (struct flashprog_programmer *); /* May be NULL. */
 };
 
 extern const struct board_match board_matches[];
@@ -230,9 +230,9 @@
 uint8_t sio_read(uint16_t port, uint8_t reg);
 void sio_write(uint16_t port, uint8_t reg, uint8_t data);
 void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
-void board_handle_before_superio(void);
-void board_handle_before_laptop(void);
-int board_flash_enable(const char *vendor, const char *model, const char *cb_vendor, const char *cb_model);
+void board_handle_before_superio(struct flashprog_programmer *);
+void board_handle_before_laptop(struct flashprog_programmer *);
+int board_flash_enable(struct flashprog_programmer *, const char *vendor, const char *model, const char *cb_vendor, const char *cb_model);
 
 /* chipset_enable.c */
 int chipset_flash_enable(void);
@@ -390,7 +390,7 @@
 int sb600_probe_spi(struct pci_dev *dev);
 
 /* wbsio_spi.c */
-int wbsio_check_for_spi(void);
+int wbsio_check_for_spi(struct flashprog_programmer *);
 #endif
 
 /* opaque.c */
diff --git a/internal.c b/internal.c
index 57064a7..103cb83 100644
--- a/internal.c
+++ b/internal.c
@@ -231,7 +231,7 @@
 	dmi_init();
 
 	/* In case Super I/O probing would cause pretty explosions. */
-	board_handle_before_superio();
+	board_handle_before_superio(prog);
 
 	/* Probe for the Super I/O chip and fill global struct superio. */
 	probe_superio();
@@ -244,7 +244,7 @@
 #endif
 
 	/* Check laptop whitelist. */
-	board_handle_before_laptop();
+	board_handle_before_laptop(prog);
 
 	/*
 	 * Disable all internal buses by default if we are not sure
@@ -270,7 +270,7 @@
 	 * parallel writes on IT8705F. Also, this handles the manual chip select for Gigabyte's DualBIOS. */
 	init_superio_ite();
 
-	if (board_flash_enable(board_vendor, board_model, cb_vendor, cb_model)) {
+	if (board_flash_enable(prog, board_vendor, board_model, cb_vendor, cb_model)) {
 		msg_perr("Aborting to be safe.\n");
 		ret = 1;
 		goto internal_init_exit;
diff --git a/wbsio_spi.c b/wbsio_spi.c
index ff0083f..d4f2aac 100644
--- a/wbsio_spi.c
+++ b/wbsio_spi.c
@@ -77,7 +77,7 @@
 	.probe_opcode	= default_spi_probe_opcode,
 };
 
-int wbsio_check_for_spi(void)
+int wbsio_check_for_spi(struct flashprog_programmer *const prog)
 {
 	if (0 == (wbsio_spibase = wbsio_get_spibase(WBSIO_PORT1)))
 		if (0 == (wbsio_spibase = wbsio_get_spibase(WBSIO_PORT2)))