Attention is currently required from: Arthur Heymans, Peter Marheine.
Edward O'Callaghan has uploaded this change for review.
migrate register_spi_master() - wbsio_spi.c is broken
Change-Id: I0ce26d39dff4de5ec7b71e7823e0a843237fffff
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M bitbang_spi.c
M buspirate_spi.c
M ch341a_spi.c
M chipset_enable.c
M dediprog.c
M developerbox_spi.c
M digilent_spi.c
M dirtyjtag_spi.c
M dummyflasher.c
M ft2232_spi.c
M ichspi.c
M include/programmer.h
M it87spi.c
M jlink_spi.c
M linux_spi.c
M mcp6x_spi.c
M mediatek_i2c_spi.c
M mstarddc_spi.c
M ni845x_spi.c
M nicintel_spi.c
M ogp_spi.c
M parade_lspcon.c
M pickit2_spi.c
M pony_spi.c
M raiden_debug_spi.c
M rayer_spi.c
M realtek_mst_i2c_spi.c
M sb600spi.c
M serprog.c
M spi.c
M stlinkv3_spi.c
M usbblaster_spi.c
M wbsio_spi.c
33 files changed, 61 insertions(+), 50 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/83/72783/1
diff --git a/bitbang_spi.c b/bitbang_spi.c
index 7919e45..8bb7ff6 100644
--- a/bitbang_spi.c
+++ b/bitbang_spi.c
@@ -150,7 +150,8 @@
.probe_opcode = default_spi_probe_opcode,
};
-int register_spi_bitbang_master(const struct bitbang_spi_master *master, void *spi_data)
+int register_spi_bitbang_master(struct flashrom_programmer *flashprog,
+ const struct bitbang_spi_master *master, void *spi_data)
{
struct spi_master mst = spi_master_bitbang;
/* If someone forgot to initialize a bitbang function, we catch it here. */
@@ -171,7 +172,7 @@
if (spi_data)
data->spi_data = spi_data;
- register_spi_master(&mst, data);
+ register_spi_master(flashprog, &mst, data);
/* Only mess with the bus if we're sure nobody else uses it. */
bitbang_spi_request_bus(master, spi_data);
diff --git a/buspirate_spi.c b/buspirate_spi.c
index 68cea11..626e819 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -700,7 +700,7 @@
goto init_err_cleanup_exit;
}
- return register_spi_master(&spi_master_buspirate, bp_data);
+ return register_spi_master(flashprog, &spi_master_buspirate, bp_data);
init_err_cleanup_exit:
buspirate_spi_shutdown(bp_data);
diff --git a/ch341a_spi.c b/ch341a_spi.c
index c2b3943..5fe5d3e 100644
--- a/ch341a_spi.c
+++ b/ch341a_spi.c
@@ -500,7 +500,7 @@
if ((config_stream(CH341A_STM_I2C_100K) < 0) || (enable_pins(true) < 0))
goto dealloc_transfers;
- return register_spi_master(&spi_master_ch341a_spi, NULL);
+ return register_spi_master(flashprog, &spi_master_ch341a_spi, NULL);
dealloc_transfers:
for (i = 0; i < USB_IN_TRANSFERS; i++) {
diff --git a/chipset_enable.c b/chipset_enable.c
index f7e0916..899540f 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -1193,12 +1193,12 @@
return ERROR_FLASHROM_FATAL;
}
- return via_init_spi(spi0_mm_base);
+ return via_init_spi(flashprog, spi0_mm_base);
}
static int enable_flash_vt8237s_spi(struct flashrom_programmer *flashprog, const struct programmer_cfg *cfg, struct pci_dev *dev, const char *name)
{
- return via_init_spi(pci_read_long(dev, 0xbc) << 8);
+ return via_init_spi(flashprog, pci_read_long(dev, 0xbc) << 8);
}
static int enable_flash_cs5530(struct flashrom_programmer *flashprog, const struct programmer_cfg *cfg, struct pci_dev *dev, const char *name)
@@ -1671,7 +1671,7 @@
rpci_write_byte(dev, 0x8a, val);
#endif
- if (mcp6x_spi_init(want_spi))
+ if (mcp6x_spi_init(flashprog, want_spi))
ret = 1;
/* Suppress unknown laptop warning if we booted from SPI. */
diff --git a/dediprog.c b/dediprog.c
index 51529e9..9c7e7ab 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -1303,7 +1303,7 @@
if (dediprog_set_leds(LED_NONE, dp_data))
goto init_err_cleanup_exit;
- return register_spi_master(&spi_master_dediprog, dp_data);
+ return register_spi_master(flashprog, &spi_master_dediprog, dp_data);
init_err_cleanup_exit:
dediprog_shutdown(dp_data);
diff --git a/developerbox_spi.c b/developerbox_spi.c
index 0729117..ec8ab4c 100644
--- a/developerbox_spi.c
+++ b/developerbox_spi.c
@@ -176,7 +176,7 @@
goto err_exit;
}
- if (register_spi_bitbang_master(&bitbang_spi_master_cp210x, data))
+ if (register_spi_bitbang_master(flashprog, &bitbang_spi_master_cp210x, data))
return 1; /* shutdown function does the cleanup */
return 0;
diff --git a/digilent_spi.c b/digilent_spi.c
index 4545d1c..e468b1c 100644
--- a/digilent_spi.c
+++ b/digilent_spi.c
@@ -455,7 +455,7 @@
digilent_data->reset_board = reset_board;
digilent_data->handle = handle;
- return register_spi_master(&spi_master_digilent_spi, digilent_data);
+ return register_spi_master(flashprog, &spi_master_digilent_spi, digilent_data);
close_handle:
libusb_close(handle);
diff --git a/dirtyjtag_spi.c b/dirtyjtag_spi.c
index e822217..874a196 100644
--- a/dirtyjtag_spi.c
+++ b/dirtyjtag_spi.c
@@ -298,7 +298,7 @@
goto cleanup_libusb_handle;
}
- return register_spi_master(&spi_master_dirtyjtag_spi, (void*)djtag_data);
+ return register_spi_master(flashprog, &spi_master_dirtyjtag_spi, (void*)djtag_data);
cleanup_libusb_handle:
libusb_attach_kernel_driver(handle, 0);
diff --git a/dummyflasher.c b/dummyflasher.c
index bd4b94a..4ab7dbd 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -1424,7 +1424,7 @@
dummy_buses_supported & BUS_NONSPI,
data);
if (dummy_buses_supported & BUS_SPI)
- ret |= register_spi_master(&spi_master_dummyflasher, data);
+ ret |= register_spi_master(flashprog, &spi_master_dummyflasher, data);
return ret;
}
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 685963d..a216fd9 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -695,7 +695,7 @@
spi_data->pindir = pindir;
spi_data->ftdic_context = ftdic;
- return register_spi_master(&spi_master_ft2232, spi_data);
+ return register_spi_master(flashprog, &spi_master_ft2232, spi_data);
ftdi_err:
if ((f = ftdi_usb_close(&ftdic)) < 0) {
diff --git a/ichspi.c b/ichspi.c
index 877064a..cc87650 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1974,7 +1974,7 @@
.shutdown = ich_hwseq_shutdown,
};
-static int init_ich7_spi(void *spibar, enum ich_chipset ich_gen)
+static int init_ich7_spi(struct flashrom_programmer *flashprog, void *spibar, enum ich_chipset ich_gen)
{
unsigned int i;
@@ -2001,7 +2001,7 @@
}
ich_init_opcodes(ich_gen);
ich_set_bbar(0, ich_gen);
- register_spi_master(&spi_master_ich7, NULL);
+ register_spi_master(flashprog, &spi_master_ich7, NULL);
return 0;
}
@@ -2350,7 +2350,7 @@
memcpy(opaque_hwseq_data, &hwseq_data, sizeof(*opaque_hwseq_data));
register_opaque_master(flashprog, &opaque_master_ich_hwseq, opaque_hwseq_data);
} else {
- register_spi_master(&spi_master_ich9, NULL);
+ register_spi_master(flashprog, &spi_master_ich9, NULL);
}
return 0;
@@ -2365,7 +2365,7 @@
case CHIPSET_ICH7:
case CHIPSET_TUNNEL_CREEK:
case CHIPSET_CENTERTON:
- return init_ich7_spi(spibar, ich_gen);
+ return init_ich7_spi(flashprog, spibar, ich_gen);
case CHIPSET_ICH8:
default: /* Future version might behave the same */
return init_ich_default(flashprog, cfg, spibar, ich_gen);
@@ -2384,7 +2384,7 @@
.probe_opcode = ich_spi_probe_opcode,
};
-int via_init_spi(uint32_t mmio_base)
+int via_init_spi(struct flashrom_programmer *flashprog, uint32_t mmio_base)
{
int i;
@@ -2396,7 +2396,7 @@
/* Not sure if it speaks all these bus protocols. */
internal_buses_supported &= BUS_LPC | BUS_FWH;
ich_generation = CHIPSET_ICH7;
- register_spi_master(&spi_master_via, NULL);
+ register_spi_master(flashprog, &spi_master_via, NULL);
msg_pdbg("0x00: 0x%04x (SPIS)\n", mmio_readw(ich_spibar + 0));
msg_pdbg("0x02: 0x%04x (SPIC)\n", mmio_readw(ich_spibar + 2));
diff --git a/include/programmer.h b/include/programmer.h
index 4821689..777c677 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -270,8 +270,8 @@
#endif
/* bitbang_spi.c */
-int register_spi_bitbang_master(const struct bitbang_spi_master *master, void *spi_data);
-
+int register_spi_bitbang_master(struct flashrom_programmer *flashprog,
+ const struct bitbang_spi_master *master, void *spi_data);
/* flashrom.c */
struct decode_sizes {
@@ -323,7 +323,7 @@
int default_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
int default_spi_write_aai(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
bool default_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode);
-int register_spi_master(const struct spi_master *mst, void *data);
+int register_spi_master(struct flashrom_programmer *flashprog, const struct spi_master *mst, void *data);
/* The following enum is needed by ich_descriptor_tool and ich* code as well as in chipset_enable.c. */
enum ich_chipset {
@@ -363,7 +363,7 @@
/* ichspi.c */
#if CONFIG_INTERNAL == 1
int ich_init_spi(struct flashrom_programmer *, const struct programmer_cfg *cfg, void *spibar, enum ich_chipset ich_generation);
-int via_init_spi(uint32_t mmio_base);
+int via_init_spi(struct flashrom_programmer *, uint32_t mmio_base);
/* amd_imc.c */
int amd_imc_shutdown(struct pci_dev *dev);
@@ -385,8 +385,7 @@
}
/* mcp6x_spi.c */
-int mcp6x_spi_init(int want_spi);
-
+int mcp6x_spi_init(struct flashrom_programmer *, int want_spi);
/* sb600spi.c */
diff --git a/it87spi.c b/it87spi.c
index 38b03da..1f38336 100644
--- a/it87spi.c
+++ b/it87spi.c
@@ -440,7 +440,7 @@
if (internal_buses_supported & BUS_SPI)
msg_pdbg("Overriding chipset SPI with IT87 SPI.\n");
/* FIXME: Add the SPI bus or replace the other buses with it? */
- return register_spi_master(&spi_master_it87xx, data);
+ return register_spi_master(flashprog, &spi_master_it87xx, data);
}
int init_superio_ite(struct flashrom_programmer *flashprog, const struct programmer_cfg *cfg)
diff --git a/jlink_spi.c b/jlink_spi.c
index 86bdb6a..eb52478 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -515,7 +515,7 @@
if (!deassert_cs(jlink_data))
goto init_err;
- return register_spi_master(&spi_master_jlink_spi, jlink_data);
+ return register_spi_master(flashprog, &spi_master_jlink_spi, jlink_data);
init_err:
if (jaylink_devh)
diff --git a/linux_spi.c b/linux_spi.c
index 40f2532..8d93e9f 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -238,7 +238,7 @@
spi_data->fd = fd;
spi_data->max_kernel_buf_size = max_kernel_buf_size;
- return register_spi_master(&spi_master_linux, spi_data);
+ return register_spi_master(flashprog, &spi_master_linux, spi_data);
init_err:
close(fd);
diff --git a/mcp6x_spi.c b/mcp6x_spi.c
index 7869925..ac43ab3 100644
--- a/mcp6x_spi.c
+++ b/mcp6x_spi.c
@@ -115,7 +115,7 @@
return 0;
}
-int mcp6x_spi_init(int want_spi)
+int mcp6x_spi_init(struct flashrom_programmer *flashprog, int want_spi)
{
uint16_t status;
uint32_t mcp6x_spibaraddr;
@@ -183,7 +183,7 @@
free(data);
return 1;
}
- if (register_spi_bitbang_master(&bitbang_spi_master_mcp6x, data)) {
+ if (register_spi_bitbang_master(flashprog, &bitbang_spi_master_mcp6x, data)) {
/* This should never happen. */
msg_perr("MCP6X bitbang SPI master init failed!\n");
return 1;
diff --git a/mediatek_i2c_spi.c b/mediatek_i2c_spi.c
index 5f1321b..488602f 100644
--- a/mediatek_i2c_spi.c
+++ b/mediatek_i2c_spi.c
@@ -533,7 +533,7 @@
return ret;
}
- return register_spi_master(&spi_master_i2c_mediatek, port);
+ return register_spi_master(flashprog, &spi_master_i2c_mediatek, port);
}
const struct programmer_entry programmer_mediatek_i2c_spi = {
diff --git a/mstarddc_spi.c b/mstarddc_spi.c
index e94eb3b..2a18232 100644
--- a/mstarddc_spi.c
+++ b/mstarddc_spi.c
@@ -241,7 +241,7 @@
mstarddc_data->doreset = mstarddc_doreset;
// Register programmer
- register_spi_master(&spi_master_mstarddc, mstarddc_data);
+ register_spi_master(flashprog, &spi_master_mstarddc, mstarddc_data);
out:
free(i2c_device);
if (ret && (mstarddc_fd >= 0))
diff --git a/ni845x_spi.c b/ni845x_spi.c
index 0193134..f33f8cf 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -626,7 +626,7 @@
return 1;
}
- return register_spi_master(&spi_programmer_ni845x, NULL);
+ return register_spi_master(flashprog, &spi_programmer_ni845x, NULL);
}
const struct programmer_entry programmer_ni845x_spi = {
diff --git a/nicintel_spi.c b/nicintel_spi.c
index 3722379..643bb2e 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -326,7 +326,7 @@
}
}
- if (register_spi_bitbang_master(&bitbang_spi_master_nicintel, data))
+ if (register_spi_bitbang_master(flashprog, &bitbang_spi_master_nicintel, data))
return 1; /* shutdown function does cleanup */
return 0;
diff --git a/ogp_spi.c b/ogp_spi.c
index 3ea2cc6..4b9ad8d 100644
--- a/ogp_spi.c
+++ b/ogp_spi.c
@@ -167,7 +167,7 @@
return 1;
}
- if (register_spi_bitbang_master(&bitbang_spi_master_ogp, data))
+ if (register_spi_bitbang_master(flashprog, &bitbang_spi_master_ogp, data))
return 1;
return 0;
diff --git a/parade_lspcon.c b/parade_lspcon.c
index ded8453..acaf982 100644
--- a/parade_lspcon.c
+++ b/parade_lspcon.c
@@ -499,7 +499,7 @@
data->fd = fd;
- return register_spi_master(&spi_master_parade_lspcon, data);
+ return register_spi_master(flashprog, &spi_master_parade_lspcon, data);
}
const struct programmer_entry programmer_parade_lspcon = {
diff --git a/pickit2_spi.c b/pickit2_spi.c
index 10695c7..7587bbc 100644
--- a/pickit2_spi.c
+++ b/pickit2_spi.c
@@ -498,7 +498,7 @@
goto init_err_cleanup_exit;
}
- return register_spi_master(&spi_master_pickit2, pickit2_data);
+ return register_spi_master(flashprog, &spi_master_pickit2, pickit2_data);
init_err_cleanup_exit:
pickit2_shutdown(pickit2_data);
diff --git a/pony_spi.c b/pony_spi.c
index 1869d21..1e31f91 100644
--- a/pony_spi.c
+++ b/pony_spi.c
@@ -260,7 +260,7 @@
return 1;
}
- if (register_spi_bitbang_master(&bitbang_spi_master_pony, data))
+ if (register_spi_bitbang_master(flashprog, &bitbang_spi_master_pony, data))
return 1;
return 0;
diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index f604c75..397cba2 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -1644,7 +1644,7 @@
return SPI_GENERIC_ERROR;
}
- return register_spi_master(spi_config, data);
+ return register_spi_master(flashprog, spi_config, data);
}
const struct programmer_entry programmer_raiden_debug_spi = {
diff --git a/rayer_spi.c b/rayer_spi.c
index e0f37d1..0065015 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -332,7 +332,7 @@
if (pinout->preinit)
pinout->preinit(data);
- if (register_spi_bitbang_master(&bitbang_spi_master_rayer, data))
+ if (register_spi_bitbang_master(flashprog, &bitbang_spi_master_rayer, data))
return 1;
return 0;
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 6bfe536..a3b94dc 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -536,7 +536,7 @@
data->fd = fd;
data->reset = reset;
- return register_spi_master(&spi_master_i2c_realtek_mst, data);
+ return register_spi_master(flashprog, &spi_master_i2c_realtek_mst, data);
}
const struct programmer_entry programmer_realtek_mst_i2c_spi = {
diff --git a/sb600spi.c b/sb600spi.c
index 5809431..d35a8d5 100644
--- a/sb600spi.c
+++ b/sb600spi.c
@@ -811,11 +811,11 @@
/* Starting with Yangtze the SPI controller got a different interface with a much bigger buffer. */
if (amd_gen < CHIPSET_YANGTZE)
- register_spi_master(&spi_master_sb600, data);
+ register_spi_master(flashprog, &spi_master_sb600, data);
else if (amd_gen == CHIPSET_YANGTZE)
- register_spi_master(&spi_master_yangtze, data);
+ register_spi_master(flashprog, &spi_master_yangtze, data);
else
- register_spi_master(&spi_master_promontory, data);
+ register_spi_master(flashprog, &spi_master_promontory, data);
return 0;
}
diff --git a/serprog.c b/serprog.c
index 8f9e09d..e7a72e5 100644
--- a/serprog.c
+++ b/serprog.c
@@ -950,7 +950,7 @@
if (register_shutdown(serprog_shutdown, NULL))
goto init_err_cleanup_exit;
if (serprog_buses_supported & BUS_SPI)
- register_spi_master(&spi_master_serprog, NULL);
+ register_spi_master(flashprog, &spi_master_serprog, NULL);
if (serprog_buses_supported & BUS_NONSPI)
register_par_master(flashprog, &par_master_serprog, serprog_buses_supported & BUS_NONSPI, NULL);
return 0;
diff --git a/spi.c b/spi.c
index 6c2c4c4..b211647 100644
--- a/spi.c
+++ b/spi.c
@@ -141,7 +141,8 @@
return true;
}
-int register_spi_master(const struct spi_master *mst, void *data)
+int register_spi_master(struct flashrom_programmer *flashprog,
+ const struct spi_master *mst, void *data)
{
struct registered_master rmst = {0};
@@ -167,7 +168,7 @@
rmst.spi = *mst;
if (data)
rmst.spi.data = data;
- return register_master(&rmst);
+ return register_driver(flashprog, &rmst);
}
/*
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c
index 578e041..87c0a42 100644
--- a/stlinkv3_spi.c
+++ b/stlinkv3_spi.c
@@ -542,7 +542,7 @@
stlinkv3_data->usb_ctx = usb_ctx;
stlinkv3_data->handle = stlinkv3_handle;
- return register_spi_master(&spi_programmer_stlinkv3, stlinkv3_data);
+ return register_spi_master(flashprog, &spi_programmer_stlinkv3, stlinkv3_data);
init_err_exit:
if (stlinkv3_handle)
diff --git a/usbblaster_spi.c b/usbblaster_spi.c
index a64a694..beaf4a3 100644
--- a/usbblaster_spi.c
+++ b/usbblaster_spi.c
@@ -223,7 +223,7 @@
}
usbblaster_data->ftdic = ftdic;
- return register_spi_master(&spi_master_usbblaster, usbblaster_data);
+ return register_spi_master(flashprog, &spi_master_usbblaster, usbblaster_data);
}
const struct programmer_entry programmer_usbblaster_spi = {
diff --git a/wbsio_spi.c b/wbsio_spi.c
index d635a09..91c4827 100644
--- a/wbsio_spi.c
+++ b/wbsio_spi.c
@@ -217,5 +217,5 @@
}
data->spibase = wbsio_spibase;
- return register_spi_master(&spi_master_wbsio, data);
+ return register_spi_master(NULL, &spi_master_wbsio, data); /* FIXME(quasisec) */
}
To view, visit change 72783. To unsubscribe, or for help writing mail filters, visit settings.