Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Anastasia Klimchuk: Looks good to me, but someone else must approve
programmer_table: move each entry to the associated programmer source

Change-Id: I3d02bd789f0299e936eb86819b3b15b5ea2bb921
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52946
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M atahpt.c
M atapromise.c
M atavia.c
M buspirate_spi.c
M ch341a_spi.c
M dediprog.c
M developerbox_spi.c
M digilent_spi.c
M drkaiser.c
M dummyflasher.c
M ene_lpc.c
M ft2232_spi.c
M gfxnvidia.c
M internal.c
M it8212.c
M jlink_spi.c
M linux_mtd.c
M linux_spi.c
M lspcon_i2c_spi.c
M mec1308.c
M mstarddc_spi.c
M ni845x_spi.c
M nic3com.c
M nicintel.c
M nicintel_eeprom.c
M nicintel_spi.c
M nicnatsemi.c
M nicrealtek.c
M ogp_spi.c
M pickit2_spi.c
M pony_spi.c
M programmer.h
M programmer_table.c
M raiden_debug_spi.c
M rayer_spi.c
M realtek_mst_i2c_spi.c
M satamv.c
M satasii.c
M serprog.c
M stlinkv3_spi.c
M usbblaster_spi.c
41 files changed, 506 insertions(+), 617 deletions(-)

diff --git a/atahpt.c b/atahpt.c
index 327d74b..0da39e0 100644
--- a/atahpt.c
+++ b/atahpt.c
@@ -31,7 +31,7 @@

static uint32_t io_base_addr = 0;

-const struct dev_entry ata_hpt[] = {
+static const struct dev_entry ata_hpt[] = {
{0x1103, 0x0004, NT, "Highpoint", "HPT366/368/370/370A/372/372N"},
{0x1103, 0x0005, NT, "Highpoint", "HPT372A/372N"},
{0x1103, 0x0006, NT, "Highpoint", "HPT302/302N"},
@@ -64,7 +64,7 @@
.chip_writen = fallback_chip_writen,
};

-int atahpt_init(void)
+static int atahpt_init(void)
{
struct pci_dev *dev = NULL;
uint32_t reg32;
@@ -90,6 +90,16 @@
return 0;
}

+const struct programmer_entry programmer_atahpt = {
+ .name = "atahpt",
+ .type = PCI,
+ .devs.dev = ata_hpt,
+ .init = atahpt_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif
diff --git a/atapromise.c b/atapromise.c
index 4941a7c..171b22f 100644
--- a/atapromise.c
+++ b/atapromise.c
@@ -46,14 +46,14 @@
static uint8_t *atapromise_bar = NULL;
static size_t rom_size = 0;

-const struct dev_entry ata_promise[] = {
+static const struct dev_entry ata_promise[] = {
{0x105a, 0x4d38, NT, "Promise", "PDC20262 (FastTrak66/Ultra66)"},
{0x105a, 0x0d30, NT, "Promise", "PDC20265 (FastTrak100 Lite/Ultra100)"},
{0x105a, 0x4d30, OK, "Promise", "PDC20267 (FastTrak100/Ultra100)"},
{0},
};

-void *atapromise_map(const char *descr, uintptr_t phys_addr, size_t len)
+static void *atapromise_map(const char *descr, uintptr_t phys_addr, size_t len)
{
/* In case fallback_map ever returns something other than NULL. */
return NULL;
@@ -118,7 +118,7 @@
.chip_writen = fallback_chip_writen,
};

-int atapromise_init(void)
+static int atapromise_init(void)
{
struct pci_dev *dev = NULL;

@@ -162,6 +162,16 @@
return 0;
}

+const struct programmer_entry programmer_atapromise = {
+ .name = "atapromise",
+ .type = PCI,
+ .devs.dev = ata_promise,
+ .init = atapromise_init,
+ .map_flash_region = atapromise_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif
diff --git a/atavia.c b/atavia.c
index 8045e1b..f8b9738 100644
--- a/atavia.c
+++ b/atavia.c
@@ -48,7 +48,7 @@
#define ENABLE_BYTE(address) ((~(1 << ((address) & 3))) & BROM_BYTE_ENABLE_MASK)
#define BYTE_OFFSET(address) (((addr) & 3) * 8)

-const struct dev_entry ata_via[] = {
+static const struct dev_entry ata_via[] = {
{PCI_VENDOR_ID_VIA, 0x3249, DEP, "VIA", "VT6421A"},

{0},
@@ -101,7 +101,7 @@
return ready;
}

-void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len)
+static void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len)
{
return (atavia_offset != 0) ? atavia_offset : (void *)phys_addr;
}
@@ -143,7 +143,7 @@
.chip_writen = fallback_chip_writen,
};

-int atavia_init(void)
+static int atavia_init(void)
{
char *arg = extract_programmer_param("offset");
if (arg) {
@@ -188,3 +188,13 @@

return 0;
}
+
+const struct programmer_entry programmer_atavia = {
+ .name = "atavia",
+ .type = PCI,
+ .devs.dev = ata_via,
+ .init = atavia_init,
+ .map_flash_region = atavia_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/buspirate_spi.c b/buspirate_spi.c
index 96e9673..87b022f 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -302,7 +302,7 @@
*/
#define BP_DIVISOR(baud) ((4000000/(baud)) - 1)

-int buspirate_spi_init(void)
+static int buspirate_spi_init(void)
{
char *tmp;
char *dev;
@@ -659,3 +659,14 @@

return 0;
}
+
+const struct programmer_entry programmer_buspirate_spi = {
+ .name = "buspirate_spi",
+ .type = OTHER,
+ /* FIXME */
+ .devs.note = "Dangerous Prototypes Bus Pirate\n",
+ .init = buspirate_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/ch341a_spi.c b/ch341a_spi.c
index f84add4..185e582 100644
--- a/ch341a_spi.c
+++ b/ch341a_spi.c
@@ -84,7 +84,7 @@

static struct libusb_device_handle *handle = NULL;

-const struct dev_entry devs_ch341a_spi[] = {
+static const struct dev_entry devs_ch341a_spi[] = {
{0x1A86, 0x5512, OK, "Winchiphead (WCH)", "CH341A"},

{0},
@@ -323,7 +323,7 @@
*ptr++ = CH341A_CMD_UIO_STM_END;
}

-void ch341a_spi_delay(unsigned int usecs)
+static void ch341a_spi_delay(unsigned int usecs)
{
/* There is space for 28 bytes instructions of 750 ns each in the CS packet (32 - 4 for the actual CS
* instructions), thus max 21 us, but we avoid getting too near to this boundary and use
@@ -419,7 +419,7 @@
return 0;
}

-int ch341a_spi_init(void)
+static int ch341a_spi_init(void)
{
if (handle != NULL) {
msg_cerr("%s: handle already set! Please report a bug at flashrom@flashrom.org\n", __func__);
@@ -526,3 +526,13 @@
handle = NULL;
return -1;
}
+
+const struct programmer_entry programmer_ch341a_spi = {
+ .name = "ch341a_spi",
+ .type = USB,
+ .devs.dev = devs_ch341a_spi,
+ .init = ch341a_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = ch341a_spi_delay,
+};
diff --git a/dediprog.c b/dediprog.c
index a8fe19e..6a2d1f2 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -152,7 +152,7 @@
PROTOCOL_V3,
};

-const struct dev_entry devs_dediprog[] = {
+static const struct dev_entry devs_dediprog[] = {
{0x0483, 0xDADA, OK, "Dediprog", "SF100/SF200/SF600"},

{0},
@@ -1055,7 +1055,7 @@
return 0;
}

-int dediprog_init(void)
+static int dediprog_init(void)
{
char *voltage, *id_str, *device, *spispeed, *target_str;
int spispeed_idx = 1;
@@ -1279,3 +1279,13 @@

return 0;
}
+
+const struct programmer_entry programmer_dediprog = {
+ .name = "dediprog",
+ .type = USB,
+ .devs.dev = devs_dediprog,
+ .init = dediprog_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/developerbox_spi.c b/developerbox_spi.c
index e4ab6f6..5573d6f 100644
--- a/developerbox_spi.c
+++ b/developerbox_spi.c
@@ -55,7 +55,7 @@
#define CP210X_WRITE_LATCH 0x37e1
#define CP210X_READ_LATCH 0x00c2

-const struct dev_entry devs_developerbox_spi[] = {
+static const struct dev_entry devs_developerbox_spi[] = {
{0x10c4, 0xea60, OK, "Silicon Labs", "CP2102N USB to UART Bridge Controller"},
{0},
};
@@ -144,7 +144,7 @@
return 0;
}

-int developerbox_spi_init(void)
+static int developerbox_spi_init(void)
{
struct libusb_context *usb_ctx;
libusb_device_handle *cp210x_handle;
@@ -190,3 +190,13 @@
libusb_exit(usb_ctx);
return 1;
}
+
+const struct programmer_entry programmer_developerbox = {
+ .name = "developerbox",
+ .type = USB,
+ .devs.dev = devs_developerbox_spi,
+ .init = developerbox_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/digilent_spi.c b/digilent_spi.c
index ee78890..8a3699d 100644
--- a/digilent_spi.c
+++ b/digilent_spi.c
@@ -53,7 +53,7 @@
#define DIGILENT_VID 0x1443
#define DIGILENT_JTAG_PID 0x0007

-const struct dev_entry devs_digilent_spi[] = {
+static const struct dev_entry devs_digilent_spi[] = {
{ DIGILENT_VID, DIGILENT_JTAG_PID, OK, "Digilent", "Development board JTAG" },
{ 0 },
};
@@ -373,7 +373,7 @@
{ NULL, 0 },
};

-int digilent_spi_init(void)
+static int digilent_spi_init(void)
{
char *p;
uint32_t speed_hz = spispeeds[0].speed;
@@ -464,3 +464,13 @@
libusb_close(handle);
return -1;
}
+
+const struct programmer_entry programmer_digilent_spi = {
+ .name = "digilent_spi",
+ .type = USB,
+ .devs.dev = devs_digilent_spi,
+ .init = digilent_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/drkaiser.c b/drkaiser.c
index 4858b35..111bb97 100644
--- a/drkaiser.c
+++ b/drkaiser.c
@@ -29,7 +29,7 @@
/* Mask to restrict flash accesses to the 128kB memory window. */
#define DRKAISER_MEMMAP_MASK ((1 << 17) - 1)

-const struct dev_entry drkaiser_pcidev[] = {
+static const struct dev_entry drkaiser_pcidev[] = {
{0x1803, 0x5057, OK, "Dr. Kaiser", "PC-Waechter (Actel FPGA)"},

{0},
@@ -60,7 +60,7 @@
.chip_writen = fallback_chip_writen,
};

-int drkaiser_init(void)
+static int drkaiser_init(void)
{
struct pci_dev *dev = NULL;
uint32_t addr;
@@ -89,3 +89,13 @@

return 0;
}
+
+const struct programmer_entry programmer_drkaiser = {
+ .name = "drkaiser",
+ .type = PCI,
+ .devs.dev = drkaiser_pcidev,
+ .init = drkaiser_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/dummyflasher.c b/dummyflasher.c
index ba06e7c..b75cddb 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -89,14 +89,14 @@
0xFF, 0xFF, 0xFF, 0xFF, // @0x54: Macronix parameter table end
};

-void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len)
+static void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len)
{
msg_pspew("%s: Mapping %s, 0x%zx bytes at 0x%0*" PRIxPTR "\n",
__func__, descr, len, PRIxPTR_WIDTH, phys_addr);
return (void *)phys_addr;
}

-void dummy_unmap(void *virt_addr, size_t len)
+static void dummy_unmap(void *virt_addr, size_t len)
{
msg_pspew("%s: Unmapping 0x%zx bytes at %p\n", __func__, len, virt_addr);
}
@@ -943,7 +943,7 @@
return 0;
}

-int dummy_init(void)
+static int dummy_init(void)
{
struct stat image_stat;

@@ -1060,3 +1060,14 @@

return 1;
}
+
+const struct programmer_entry programmer_dummy = {
+ .name = "dummy",
+ .type = OTHER,
+ /* FIXME */
+ .devs.note = "Dummy device, does nothing and logs all accesses\n",
+ .init = dummy_init,
+ .map_flash_region = dummy_map,
+ .unmap_flash_region = dummy_unmap,
+ .delay = internal_delay,
+};
diff --git a/ene_lpc.c b/ene_lpc.c
index 04c17e3..b30eee6 100644
--- a/ene_lpc.c
+++ b/ene_lpc.c
@@ -526,7 +526,7 @@
return ret;
}

-int ene_lpc_init()
+static int ene_lpc_init()
{
uint8_t hwver, ediid, i;
ene_lpc_data_t *ctx_data = NULL;
@@ -585,4 +585,14 @@
return 1;
}

+const struct programmer_entry programmer_ene_lpc = {
+ .name = "ene_lpc",
+ .type = OTHER,
+ .devs.note = "ENE LPC interface keyboard controller\n",
+ .init = ene_lpc_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#endif /* __i386__ || __x86_64__ */
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 6072cd2..082f5ff 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -59,7 +59,7 @@
#define GOOGLE_SERVO_V2_PID0 0x5002
#define GOOGLE_SERVO_V2_PID1 0x5003

-const struct dev_entry devs_ft2232spi[] = {
+static const struct dev_entry devs_ft2232spi[] = {
{FTDI_VID, FTDI_FT2232H_PID, OK, "FTDI", "FT2232H"},
{FTDI_VID, FTDI_FT4232H_PID, OK, "FTDI", "FT4232H"},
{FTDI_VID, FTDI_FT232H_PID, OK, "FTDI", "FT232H"},
@@ -288,7 +288,7 @@
};

/* Returns 0 upon success, a negative number upon errors. */
-int ft2232_spi_init(void)
+static int ft2232_spi_init(void)
{
int ret = 0;
unsigned char buf[512];
@@ -636,4 +636,13 @@
return ret;
}

+const struct programmer_entry programmer_ft2232_spi = {
+ .name = "ft2232_spi",
+ .type = USB,
+ .devs.dev = devs_ft2232spi,
+ .init = ft2232_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
#endif
diff --git a/gfxnvidia.c b/gfxnvidia.c
index 6b1efcf..468fc6c 100644
--- a/gfxnvidia.c
+++ b/gfxnvidia.c
@@ -30,7 +30,7 @@

static uint8_t *nvidia_bar;

-const struct dev_entry gfx_nvidia[] = {
+static const struct dev_entry gfx_nvidia[] = {
{0x10de, 0x0010, NT, "NVIDIA", "Mutara V08 [NV2]" },
{0x10de, 0x0018, NT, "NVIDIA", "RIVA 128" },
{0x10de, 0x0020, NT, "NVIDIA", "RIVA TNT" },
@@ -81,7 +81,7 @@
.chip_writen = fallback_chip_writen,
};

-int gfxnvidia_init(void)
+static int gfxnvidia_init(void)
{
struct pci_dev *dev = NULL;
uint32_t reg32;
@@ -115,3 +115,13 @@

return 0;
}
+
+const struct programmer_entry programmer_gfxnvidia = {
+ .name = "gfxnvidia",
+ .type = PCI,
+ .devs.dev = gfx_nvidia,
+ .init = gfxnvidia_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/internal.c b/internal.c
index bb32435..abd4637 100644
--- a/internal.c
+++ b/internal.c
@@ -170,7 +170,7 @@
.chip_writen = fallback_chip_writen,
};

-int internal_init(void)
+static int internal_init(void)
{
int ret = 0;
int force_laptop = 0;
@@ -372,3 +372,13 @@

return ret;
}
+
+const struct programmer_entry programmer_internal = {
+ .name = "internal",
+ .type = OTHER,
+ .devs.note = NULL,
+ .init = internal_init,
+ .map_flash_region = physmap,
+ .unmap_flash_region = physunmap,
+ .delay = internal_delay,
+};
diff --git a/it8212.c b/it8212.c
index 7c66a59..620a15c 100644
--- a/it8212.c
+++ b/it8212.c
@@ -23,7 +23,7 @@

#define PCI_VENDOR_ID_ITE 0x1283

-const struct dev_entry devs_it8212[] = {
+static const struct dev_entry devs_it8212[] = {
{PCI_VENDOR_ID_ITE, 0x8212, NT, "ITE", "8212F PATA RAID"},

{0},
@@ -53,7 +53,7 @@
.chip_writen = fallback_chip_writen,
};

-int it8212_init(void)
+static int it8212_init(void)
{
if (rget_io_perms())
return 1;
@@ -78,3 +78,12 @@
register_par_master(&par_master_it8212, BUS_PARALLEL, NULL);
return 0;
}
+const struct programmer_entry programmer_it8212 = {
+ .name = "it8212",
+ .type = PCI,
+ .devs.dev = devs_it8212,
+ .init = it8212_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/jlink_spi.c b/jlink_spi.c
index 0b862cf..8b8533c 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -181,7 +181,7 @@
return 0;
}

-int jlink_spi_init(void)
+static int jlink_spi_init(void)
{
char *arg;
unsigned long speed = 0;
@@ -486,3 +486,13 @@

return 1;
}
+
+const struct programmer_entry programmer_jlink_spi = {
+ .name = "jlink_spi",
+ .type = OTHER,
+ .init = jlink_spi_init,
+ .devs.note = "SEGGER J-Link and compatible devices\n",
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/linux_mtd.c b/linux_mtd.c
index b068164..284cde4 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -295,7 +295,7 @@
return 0;
}

-static const struct opaque_master programmer_linux_mtd = {
+static const struct opaque_master linux_mtd_opaque_master = {
/* max_data_{read,write} don't have any effect for this programmer */
.max_data_read = MAX_DATA_UNSPECIFIED,
.max_data_write = MAX_DATA_UNSPECIFIED,
@@ -367,7 +367,7 @@
return 0;
}

-int linux_mtd_init(void)
+static int linux_mtd_init(void)
{
char *param;
int dev_num = 0;
@@ -422,10 +422,20 @@
goto linux_mtd_init_exit;
}

- register_opaque_master(&programmer_linux_mtd, data);
+ register_opaque_master(&linux_mtd_opaque_master, data);

ret = 0;
linux_mtd_init_exit:
free(param);
return ret;
}
+
+const struct programmer_entry programmer_linux_mtd = {
+ .name = "linux_mtd",
+ .type = OTHER,
+ .devs.note = "Device files /dev/mtd*\n",
+ .init = linux_mtd_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/linux_spi.c b/linux_spi.c
index 7d866f4..46779a0 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -165,7 +165,7 @@
return result;
}

-int linux_spi_init(void)
+static int linux_spi_init(void)
{
char *p, *endp, *dev;
uint32_t speed_hz = 2 * 1000 * 1000;
@@ -251,4 +251,14 @@
return 1;
}

+const struct programmer_entry programmer_linux_spi = {
+ .name = "linux_spi",
+ .type = OTHER,
+ .devs.note = "Device files /dev/spidev*.*\n",
+ .init = linux_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#endif // CONFIG_LINUX_SPI == 1
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 9a66b31..9f3bb9a 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -433,7 +433,7 @@
return ret;
}

-int lspcon_i2c_spi_init(void)
+static int lspcon_i2c_spi_init(void)
{
int fd = i2c_open_from_programmer_params(REGISTER_ADDRESS, 0);
if (fd < 0)
@@ -460,3 +460,13 @@

return ret;
}
+
+const struct programmer_entry programmer_lspcon_i2c_spi = {
+ .name = "lspcon_i2c_spi",
+ .type = OTHER,
+ .devs.note = "Device files /dev/i2c-*.\n",
+ .init = lspcon_i2c_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/mec1308.c b/mec1308.c
index 3923d5b..295bffb 100644
--- a/mec1308.c
+++ b/mec1308.c
@@ -419,7 +419,7 @@
return ret;
}

-int mec1308_init(void)
+static int mec1308_init(void)
{
uint16_t sio_port;
uint8_t device_id;
@@ -521,4 +521,15 @@
free(ctx_data);
return 1;
}
+
+const struct programmer_entry programmer_mec1308 = {
+ .name = "mec1308",
+ .type = OTHER,
+ .devs.note = "Microchip MEC1308 Embedded Controller.\n",
+ .init = mec1308_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#endif
diff --git a/mstarddc_spi.c b/mstarddc_spi.c
index 0f638df..a7816a4 100644
--- a/mstarddc_spi.c
+++ b/mstarddc_spi.c
@@ -150,7 +150,7 @@
};

/* Returns 0 upon success, a negative number upon errors. */
-int mstarddc_spi_init(void)
+static int mstarddc_spi_init(void)
{
int ret = 0;
int mstarddc_fd = -1;
@@ -252,4 +252,14 @@
return ret;
}

+const struct programmer_entry programmer_mstarddc_spi = {
+ .name = "mstarddc_spi",
+ .type = OTHER,
+ .devs.note = "MSTAR DDC devices addressable via /dev/i2c-* on Linux.\n",
+ .init = mstarddc_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#endif
diff --git a/ni845x_spi.c b/ni845x_spi.c
index df8ae0d..2153510 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -538,7 +538,7 @@
.write_aai = default_spi_write_aai,
};

-int ni845x_spi_init(void)
+static int ni845x_spi_init(void)
{
char *speed_str = NULL;
char *CS_str = NULL;
@@ -634,3 +634,13 @@

return 0;
}
+
+const struct programmer_entry programmer_ni845x_spi = {
+ .name = "ni845x_spi",
+ .type = OTHER, // choose other because NI-845x uses own USB implementation
+ .devs.note = "National Instruments USB-845x\n",
+ .init = ni845x_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/nic3com.c b/nic3com.c
index 6e3fc8b..14108f0 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -35,7 +35,7 @@
uint16_t id;
};

-const struct dev_entry nics_3com[] = {
+static const struct dev_entry nics_3com[] = {
/* 3C90xB */
{0x10b7, 0x9055, OK, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-TX"},
{0x10b7, 0x9001, NT, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-T4" },
@@ -101,7 +101,7 @@
return 0;
}

-int nic3com_init(void)
+static int nic3com_init(void)
{
struct pci_dev *dev = NULL;
uint32_t io_base_addr = 0;
@@ -169,6 +169,16 @@
return 1;
}

+const struct programmer_entry programmer_nic3com = {
+ .name = "nic3com",
+ .type = PCI,
+ .devs.dev = nics_3com,
+ .init = nic3com_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif
diff --git a/nicintel.c b/nicintel.c
index 3d324da..ada615e 100644
--- a/nicintel.c
+++ b/nicintel.c
@@ -23,7 +23,7 @@
static uint8_t *nicintel_bar;
static uint8_t *nicintel_control_bar;

-const struct dev_entry nics_intel[] = {
+static const struct dev_entry nics_intel[] = {
{PCI_VENDOR_ID_INTEL, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x1229, OK, "Intel", "82557/8/9/0/1 Ethernet Pro 100"},

@@ -63,7 +63,7 @@
.chip_writen = fallback_chip_writen,
};

-int nicintel_init(void)
+static int nicintel_init(void)
{
struct pci_dev *dev = NULL;
uintptr_t addr;
@@ -111,3 +111,13 @@

return 0;
}
+
+const struct programmer_entry programmer_nicintel = {
+ .name = "nicintel",
+ .type = PCI,
+ .devs.dev = nics_intel,
+ .init = nicintel_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index e170fcf..b5f2050 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -81,7 +81,7 @@
* Warning: is_i210() below makes assumptions on these PCI ids.
* It may have to be updated when this list is extended.
*/
-const struct dev_entry nics_intel_ee[] = {
+static const struct dev_entry nics_intel_ee[] = {
{PCI_VENDOR_ID_INTEL, 0x150e, OK, "Intel", "82580 Quad Gigabit Ethernet Controller (Copper)"},
{PCI_VENDOR_ID_INTEL, 0x150f, NT , "Intel", "82580 Quad Gigabit Ethernet Controller (Fiber)"},
{PCI_VENDOR_ID_INTEL, 0x1510, NT , "Intel", "82580 Quad Gigabit Ethernet Controller (Backplane)"},
@@ -447,7 +447,7 @@
return ret;
}

-int nicintel_ee_init(void)
+static int nicintel_ee_init(void)
{
if (rget_io_perms())
return 1;
@@ -501,3 +501,13 @@

return 1;
}
+
+const struct programmer_entry programmer_nicintel_eeprom = {
+ .name = "nicintel_eeprom",
+ .type = PCI,
+ .devs.dev = nics_intel_ee,
+ .init = nicintel_ee_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/nicintel_spi.c b/nicintel_spi.c
index c97471b..2f4fd10 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -79,7 +79,7 @@
uint8_t *spibar;
};

-const struct dev_entry nics_intel_spi[] = {
+static const struct dev_entry nics_intel_spi[] = {
{PCI_VENDOR_ID_INTEL, 0x105e, OK, "Intel", "82571EB Gigabit Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x1076, OK, "Intel", "82541GI Gigabit Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x107c, OK, "Intel", "82541PI Gigabit Ethernet Controller"},
@@ -259,7 +259,7 @@
return 0;
}

-int nicintel_spi_init(void)
+static int nicintel_spi_init(void)
{
struct pci_dev *dev = NULL;

@@ -308,3 +308,13 @@

return 0;
}
+
+const struct programmer_entry programmer_nicintel_spi = {
+ .name = "nicintel_spi",
+ .type = PCI,
+ .devs.dev = nics_intel_spi,
+ .init = nicintel_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/nicnatsemi.c b/nicnatsemi.c
index 56297fe..17e05c8 100644
--- a/nicnatsemi.c
+++ b/nicnatsemi.c
@@ -27,7 +27,7 @@
#define BOOT_ROM_DATA 0x54

static uint32_t io_base_addr = 0;
-const struct dev_entry nics_natsemi[] = {
+static const struct dev_entry nics_natsemi[] = {
{0x100b, 0x0020, NT, "National Semiconductor", "DP83815/DP83816"},
{0x100b, 0x0022, NT, "National Semiconductor", "DP83820"},

@@ -75,7 +75,7 @@
.chip_writen = fallback_chip_writen,
};

-int nicnatsemi_init(void)
+static int nicnatsemi_init(void)
{
struct pci_dev *dev = NULL;

@@ -102,6 +102,17 @@
return 0;
}

+
+const struct programmer_entry programmer_nicnatsemi = {
+ .name = "nicnatsemi",
+ .type = PCI,
+ .devs.dev = nics_natsemi,
+ .init = nicnatsemi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif
diff --git a/nicrealtek.c b/nicrealtek.c
index 788c088..53d3c3d 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -27,7 +27,7 @@
static uint32_t io_base_addr = 0;
static int bios_rom_addr, bios_rom_data;

-const struct dev_entry nics_realtek[] = {
+static const struct dev_entry nics_realtek[] = {
{0x10ec, 0x8139, OK, "Realtek", "RTL8139/8139C/8139C+"},
{0x10ec, 0x8169, NT, "Realtek", "RTL8169"},
{0x1113, 0x1211, OK, "SMC", "1211TX"}, /* RTL8139 clone */
@@ -90,7 +90,7 @@
return 0;
}

-int nicrealtek_init(void)
+static int nicrealtek_init(void)
{
struct pci_dev *dev = NULL;

@@ -127,6 +127,16 @@
return 0;
}

+const struct programmer_entry programmer_nicrealtek = {
+ .name = "nicrealtek",
+ .type = PCI,
+ .devs.dev = nics_realtek,
+ .init = nicrealtek_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif
diff --git a/ogp_spi.c b/ogp_spi.c
index e565f64..2e5e274 100644
--- a/ogp_spi.c
+++ b/ogp_spi.c
@@ -45,7 +45,7 @@
uint32_t reg_sck;
};

-const struct dev_entry ogp_spi[] = {
+static const struct dev_entry ogp_spi[] = {
{PCI_VENDOR_ID_OGP, 0x0000, OK, "Open Graphics Project", "Development Board OGD1"},

{0},
@@ -106,7 +106,7 @@
return 0;
}

-int ogp_spi_init(void)
+static int ogp_spi_init(void)
{
struct pci_dev *dev = NULL;
char *type;
@@ -174,3 +174,13 @@

return 0;
}
+
+const struct programmer_entry programmer_ogp_spi = {
+ .name = "ogp_spi",
+ .type = PCI,
+ .devs.dev = ogp_spi,
+ .init = ogp_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/pickit2_spi.c b/pickit2_spi.c
index 9c423b9..bec9457 100644
--- a/pickit2_spi.c
+++ b/pickit2_spi.c
@@ -46,7 +46,7 @@
#include "programmer.h"
#include "spi.h"

-const struct dev_entry devs_pickit2_spi[] = {
+static const struct dev_entry devs_pickit2_spi[] = {
{0x04D8, 0x0033, OK, "Microchip", "PICkit 2"},

{0}
@@ -388,7 +388,7 @@
return ret;
}

-int pickit2_spi_init(void)
+static int pickit2_spi_init(void)
{
uint8_t buf[CMD_LENGTH] = {
CMD_EXEC_SCRIPT,
@@ -508,3 +508,13 @@
pickit2_shutdown(pickit2_data);
return 1;
}
+
+const struct programmer_entry programmer_pickit2_spi = {
+ .name = "pickit2_spi",
+ .type = USB,
+ .devs.dev = devs_pickit2_spi,
+ .init = pickit2_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/pony_spi.c b/pony_spi.c
index 6d5db6f..6005bd4 100644
--- a/pony_spi.c
+++ b/pony_spi.c
@@ -120,7 +120,7 @@
return ret;
}

-int pony_spi_init(void)
+static int pony_spi_init(void)
{
int i, data_out;
char *arg = NULL;
@@ -250,3 +250,14 @@

return 0;
}
+
+const struct programmer_entry programmer_pony_spi = {
+ .name = "pony_spi",
+ .type = OTHER,
+ /* FIXME */
+ .devs.note = "Programmers compatible with SI-Prog, serbang or AJAWe\n",
+ .init = pony_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/programmer.h b/programmer.h
index 324b953..0dda67e 100644
--- a/programmer.h
+++ b/programmer.h
@@ -362,7 +362,7 @@
void probe_superio(void);
int register_superio(struct superio s);
extern enum chipbustype internal_buses_supported;
-int internal_init(void);
+extern const struct programmer_entry programmer_internal;
#endif

/* hwaccess.c */
@@ -400,146 +400,122 @@

/* dummyflasher.c */
#if CONFIG_DUMMY == 1
-int dummy_init(void);
-void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len);
-void dummy_unmap(void *virt_addr, size_t len);
+extern const struct programmer_entry programmer_dummy;
#endif

/* nic3com.c */
#if CONFIG_NIC3COM == 1
-int nic3com_init(void);
-extern const struct dev_entry nics_3com[];
+extern const struct programmer_entry programmer_nic3com;
#endif

/* gfxnvidia.c */
#if CONFIG_GFXNVIDIA == 1
-int gfxnvidia_init(void);
-extern const struct dev_entry gfx_nvidia[];
+extern const struct programmer_entry programmer_gfxnvidia;
#endif

/* raiden_debug_spi.c */
#if CONFIG_RAIDEN_DEBUG_SPI == 1
-int raiden_debug_spi_init(void);
-extern const struct dev_entry devs_raiden[];
+extern const struct programmer_entry programmer_raiden_debug_spi;
#endif

/* drkaiser.c */
#if CONFIG_DRKAISER == 1
-int drkaiser_init(void);
-extern const struct dev_entry drkaiser_pcidev[];
+extern const struct programmer_entry programmer_drkaiser;
#endif

/* nicrealtek.c */
#if CONFIG_NICREALTEK == 1
-int nicrealtek_init(void);
-extern const struct dev_entry nics_realtek[];
+extern const struct programmer_entry programmer_nicrealtek;
#endif

/* nicnatsemi.c */
#if CONFIG_NICNATSEMI == 1
-int nicnatsemi_init(void);
-extern const struct dev_entry nics_natsemi[];
+extern const struct programmer_entry programmer_nicnatsemi;
#endif

/* nicintel.c */
#if CONFIG_NICINTEL == 1
-int nicintel_init(void);
-extern const struct dev_entry nics_intel[];
+extern const struct programmer_entry programmer_nicintel;
#endif

/* nicintel_spi.c */
#if CONFIG_NICINTEL_SPI == 1
-int nicintel_spi_init(void);
-extern const struct dev_entry nics_intel_spi[];
+extern const struct programmer_entry programmer_nicintel_spi;
#endif

/* nicintel_eeprom.c */
#if CONFIG_NICINTEL_EEPROM == 1
-int nicintel_ee_init(void);
-extern const struct dev_entry nics_intel_ee[];
+extern const struct programmer_entry programmer_nicintel_eeprom;
#endif

/* ogp_spi.c */
#if CONFIG_OGP_SPI == 1
-int ogp_spi_init(void);
-extern const struct dev_entry ogp_spi[];
+extern const struct programmer_entry programmer_ogp_spi;
#endif

/* satamv.c */
#if CONFIG_SATAMV == 1
-int satamv_init(void);
-extern const struct dev_entry satas_mv[];
+extern const struct programmer_entry programmer_satamv;
#endif

/* satasii.c */
#if CONFIG_SATASII == 1
-int satasii_init(void);
-extern const struct dev_entry satas_sii[];
+extern const struct programmer_entry programmer_satasii;
#endif

/* atahpt.c */
#if CONFIG_ATAHPT == 1
-int atahpt_init(void);
-extern const struct dev_entry ata_hpt[];
+extern const struct programmer_entry programmer_atahpt;
#endif

/* atavia.c */
#if CONFIG_ATAVIA == 1
-int atavia_init(void);
-void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len);
-extern const struct dev_entry ata_via[];
+extern const struct programmer_entry programmer_atavia;
#endif

/* atapromise.c */
#if CONFIG_ATAPROMISE == 1
-int atapromise_init(void);
-void *atapromise_map(const char *descr, uintptr_t phys_addr, size_t len);
-extern const struct dev_entry ata_promise[];
+extern const struct programmer_entry programmer_atapromise;
#endif

/* it8212.c */
#if CONFIG_IT8212 == 1
-int it8212_init(void);
-extern const struct dev_entry devs_it8212[];
+extern const struct programmer_entry programmer_it8212;
#endif

/* ft2232_spi.c */
#if CONFIG_FT2232_SPI == 1
-int ft2232_spi_init(void);
-extern const struct dev_entry devs_ft2232spi[];
+extern const struct programmer_entry programmer_ft2232_spi;
#endif

/* usbblaster_spi.c */
#if CONFIG_USBBLASTER_SPI == 1
-int usbblaster_spi_init(void);
-extern const struct dev_entry devs_usbblasterspi[];
+extern const struct programmer_entry programmer_usbblaster_spi;
#endif

/* mstarddc_spi.c */
#if CONFIG_MSTARDDC_SPI == 1
-int mstarddc_spi_init(void);
+extern const struct programmer_entry programmer_mstarddc_spi;
#endif

/* pickit2_spi.c */
#if CONFIG_PICKIT2_SPI == 1
-int pickit2_spi_init(void);
-extern const struct dev_entry devs_pickit2_spi[];
+extern const struct programmer_entry programmer_pickit2_spi;
#endif

/* stlinkv3_spi.c */
#if CONFIG_STLINKV3_SPI == 1
-int stlinkv3_spi_init(void);
-extern const struct dev_entry devs_stlinkv3_spi[];
+extern const struct programmer_entry programmer_stlinkv3_spi;
#endif

/* rayer_spi.c */
#if CONFIG_RAYER_SPI == 1
-int rayer_spi_init(void);
+extern const struct programmer_entry programmer_rayer_spi;
#endif

/* pony_spi.c */
#if CONFIG_PONY_SPI == 1
-int pony_spi_init(void);
+extern const struct programmer_entry programmer_pony_spi;
#endif

/* bitbang_spi.c */
@@ -547,57 +523,52 @@

/* buspirate_spi.c */
#if CONFIG_BUSPIRATE_SPI == 1
-int buspirate_spi_init(void);
+extern const struct programmer_entry programmer_buspirate_spi;
#endif

/* linux_mtd.c */
#if CONFIG_LINUX_MTD == 1
-int linux_mtd_init(void);
+extern const struct programmer_entry programmer_linux_mtd;
#endif

/* linux_spi.c */
#if CONFIG_LINUX_SPI == 1
-int linux_spi_init(void);
+extern const struct programmer_entry programmer_linux_spi;
#endif

/* dediprog.c */
#if CONFIG_DEDIPROG == 1
-int dediprog_init(void);
-extern const struct dev_entry devs_dediprog[];
+extern const struct programmer_entry programmer_dediprog;
#endif

/* developerbox_spi.c */
#if CONFIG_DEVELOPERBOX_SPI == 1
-int developerbox_spi_init(void);
-extern const struct dev_entry devs_developerbox_spi[];
+extern const struct programmer_entry programmer_developerbox;
#endif

/* ch341a_spi.c */
#if CONFIG_CH341A_SPI == 1
-int ch341a_spi_init(void);
-void ch341a_spi_delay(unsigned int usecs);
-extern const struct dev_entry devs_ch341a_spi[];
+extern const struct programmer_entry programmer_ch341a_spi;
#endif

/* digilent_spi.c */
#if CONFIG_DIGILENT_SPI == 1
-int digilent_spi_init(void);
-extern const struct dev_entry devs_digilent_spi[];
+extern const struct programmer_entry programmer_digilent_spi;
#endif

/* ene_lpc.c */
#if CONFIG_ENE_LPC == 1
-int ene_lpc_init(void);
+extern const struct programmer_entry programmer_ene_lpc;
#endif

/* jlink_spi.c */
#if CONFIG_JLINK_SPI == 1
-int jlink_spi_init(void);
+extern const struct programmer_entry programmer_jlink_spi;
#endif

/* ni845x_spi.c */
#if CONFIG_NI845X_SPI == 1
-int ni845x_spi_init(void);
+extern const struct programmer_entry programmer_ni845x_spi;
#endif

/* flashrom.c */
@@ -695,7 +666,7 @@

#if CONFIG_LINUX_MTD == 1
/* trivial wrapper to avoid cluttering internal_init() with #if */
-static inline int try_mtd(void) { return linux_mtd_init(); };
+static inline int try_mtd(void) { return programmer_linux_mtd.init(); };
#else
static inline int try_mtd(void) { return 1; };
#endif
@@ -705,7 +676,7 @@

/* mec1308.c */
#if CONFIG_MEC1308 == 1
-int mec1308_init(void);
+extern const struct programmer_entry programmer_mec1308;
#endif

/* sb600spi.c */
@@ -763,9 +734,7 @@

/* serprog.c */
#if CONFIG_SERPROG == 1
-int serprog_init(void);
-void serprog_delay(unsigned int usecs);
-void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len);
+extern const struct programmer_entry programmer_serprog;
#endif

/* serial.c */
@@ -836,12 +805,12 @@

/* lspcon_i2c_spi.c */
#if CONFIG_LSPCON_I2C_SPI == 1
-int lspcon_i2c_spi_init(void);
+extern const struct programmer_entry programmer_lspcon_i2c_spi;
#endif

/* realtek_mst_i2c_spi.c */
#if CONFIG_REALTEK_MST_I2C_SPI == 1
-int realtek_mst_i2c_spi_init(void);
+extern const struct programmer_entry programmer_realtek_mst_i2c_spi;
#endif

#endif /* !__PROGRAMMER_H__ */
diff --git a/programmer_table.c b/programmer_table.c
index 5c7f0f1..e7f2c98 100644
--- a/programmer_table.c
+++ b/programmer_table.c
@@ -14,480 +14,6 @@

#include "programmer.h"

-#if CONFIG_INTERNAL == 1
-const struct programmer_entry programmer_internal = {
- .name = "internal",
- .type = OTHER,
- .devs.note = NULL,
- .init = internal_init,
- .map_flash_region = physmap,
- .unmap_flash_region = physunmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_DUMMY == 1
-const struct programmer_entry programmer_dummy = {
- .name = "dummy",
- .type = OTHER,
- /* FIXME */
- .devs.note = "Dummy device, does nothing and logs all accesses\n",
- .init = dummy_init,
- .map_flash_region = dummy_map,
- .unmap_flash_region = dummy_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_MEC1308 == 1
-const struct programmer_entry programmer_mec1308 = {
- .name = "mec1308",
- .type = OTHER,
- .devs.note = "Microchip MEC1308 Embedded Controller.\n",
- .init = mec1308_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_NIC3COM == 1
-const struct programmer_entry programmer_nic3com = {
- .name = "nic3com",
- .type = PCI,
- .devs.dev = nics_3com,
- .init = nic3com_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_NICREALTEK == 1
-const struct programmer_entry programmer_nicrealtek = {
- /* This programmer works for Realtek RTL8139 and SMC 1211. */
- .name = "nicrealtek",
- .type = PCI,
- .devs.dev = nics_realtek,
- .init = nicrealtek_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_NICNATSEMI == 1
-const struct programmer_entry programmer_nicnatsemi = {
- .name = "nicnatsemi",
- .type = PCI,
- .devs.dev = nics_natsemi,
- .init = nicnatsemi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_GFXNVIDIA == 1
-const struct programmer_entry programmer_gfxnvidia = {
- .name = "gfxnvidia",
- .type = PCI,
- .devs.dev = gfx_nvidia,
- .init = gfxnvidia_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_RAIDEN_DEBUG_SPI == 1
-const struct programmer_entry programmer_raiden_debug_spi = {
- .name = "raiden_debug_spi",
- .type = USB,
- .devs.dev = devs_raiden,
- .init = raiden_debug_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_DRKAISER == 1
-const struct programmer_entry programmer_drkaiser = {
- .name = "drkaiser",
- .type = PCI,
- .devs.dev = drkaiser_pcidev,
- .init = drkaiser_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_SATASII == 1
-const struct programmer_entry programmer_satasii = {
- .name = "satasii",
- .type = PCI,
- .devs.dev = satas_sii,
- .init = satasii_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_ATAHPT == 1
-const struct programmer_entry programmer_atahpt = {
- .name = "atahpt",
- .type = PCI,
- .devs.dev = ata_hpt,
- .init = atahpt_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_ATAVIA == 1
-const struct programmer_entry programmer_atavia = {
- .name = "atavia",
- .type = PCI,
- .devs.dev = ata_via,
- .init = atavia_init,
- .map_flash_region = atavia_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_ATAPROMISE == 1
-const struct programmer_entry programmer_atapromise = {
- .name = "atapromise",
- .type = PCI,
- .devs.dev = ata_promise,
- .init = atapromise_init,
- .map_flash_region = atapromise_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_IT8212 == 1
-const struct programmer_entry programmer_it8212 = {
- .name = "it8212",
- .type = PCI,
- .devs.dev = devs_it8212,
- .init = it8212_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_FT2232_SPI == 1
-const struct programmer_entry programmer_ft2232_spi = {
- .name = "ft2232_spi",
- .type = USB,
- .devs.dev = devs_ft2232spi,
- .init = ft2232_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_SERPROG == 1
-const struct programmer_entry programmer_serprog = {
- .name = "serprog",
- .type = OTHER,
- /* FIXME */
- .devs.note = "All programmer devices speaking the serprog protocol\n",
- .init = serprog_init,
- .map_flash_region = serprog_map,
- .unmap_flash_region = fallback_unmap,
- .delay = serprog_delay,
-};
-#endif
-
-#if CONFIG_BUSPIRATE_SPI == 1
-const struct programmer_entry programmer_buspirate_spi = {
- .name = "buspirate_spi",
- .type = OTHER,
- /* FIXME */
- .devs.note = "Dangerous Prototypes Bus Pirate\n",
- .init = buspirate_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_DEDIPROG == 1
-const struct programmer_entry programmer_dediprog = {
- .name = "dediprog",
- .type = USB,
- .devs.dev = devs_dediprog,
- .init = dediprog_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_DEVELOPERBOX_SPI == 1
-const struct programmer_entry programmer_developerbox = {
- .name = "developerbox",
- .type = USB,
- .devs.dev = devs_developerbox_spi,
- .init = developerbox_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_ENE_LPC == 1
-const struct programmer_entry programmer_ene_lpc = {
- .name = "ene_lpc",
- .type = OTHER,
- .devs.note = "ENE LPC interface keyboard controller\n",
- .init = ene_lpc_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_RAYER_SPI == 1
-const struct programmer_entry programmer_rayer_spi = {
- .name = "rayer_spi",
- .type = OTHER,
- /* FIXME */
- .devs.note = "RayeR parallel port programmer\n",
- .init = rayer_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_PONY_SPI == 1
-const struct programmer_entry programmer_pony_spi = {
- .name = "pony_spi",
- .type = OTHER,
- /* FIXME */
- .devs.note = "Programmers compatible with SI-Prog, serbang or AJAWe\n",
- .init = pony_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_NICINTEL == 1
-const struct programmer_entry programmer_nicintel = {
- .name = "nicintel",
- .type = PCI,
- .devs.dev = nics_intel,
- .init = nicintel_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_NICINTEL_SPI == 1
-const struct programmer_entry programmer_nicintel_spi = {
- .name = "nicintel_spi",
- .type = PCI,
- .devs.dev = nics_intel_spi,
- .init = nicintel_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_NICINTEL_EEPROM == 1
-const struct programmer_entry programmer_nicintel_eeprom = {
- .name = "nicintel_eeprom",
- .type = PCI,
- .devs.dev = nics_intel_ee,
- .init = nicintel_ee_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_OGP_SPI == 1
-const struct programmer_entry programmer_ogp_spi = {
- .name = "ogp_spi",
- .type = PCI,
- .devs.dev = ogp_spi,
- .init = ogp_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_SATAMV == 1
-const struct programmer_entry programmer_satamv = {
- .name = "satamv",
- .type = PCI,
- .devs.dev = satas_mv,
- .init = satamv_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_LINUX_MTD == 1
-const struct programmer_entry programmer_linux_mtd = {
- .name = "linux_mtd",
- .type = OTHER,
- .devs.note = "Device files /dev/mtd*\n",
- .init = linux_mtd_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_LINUX_SPI == 1
-const struct programmer_entry programmer_linux_spi = {
- .name = "linux_spi",
- .type = OTHER,
- .devs.note = "Device files /dev/spidev*.*\n",
- .init = linux_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_LSPCON_I2C_SPI == 1
-const struct programmer_entry programmer_lspcon_i2c_spi = {
- .name = "lspcon_i2c_spi",
- .type = OTHER,
- .devs.note = "Device files /dev/i2c-*.\n",
- .init = lspcon_i2c_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_REALTEK_MST_I2C_SPI == 1
-const struct programmer_entry programmer_realtek_mst_i2c_spi = {
- .name = "realtek_mst_i2c_spi",
- .type = OTHER,
- .devs.note = "Device files /dev/i2c-*.\n",
- .init = realtek_mst_i2c_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_USBBLASTER_SPI == 1
-const struct programmer_entry programmer_usbblaster_spi = {
- .name = "usbblaster_spi",
- .type = USB,
- .devs.dev = devs_usbblasterspi,
- .init = usbblaster_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_MSTARDDC_SPI == 1
-const struct programmer_entry programmer_mstarddc_spi = {
- .name = "mstarddc_spi",
- .type = OTHER,
- .devs.note = "MSTAR DDC devices addressable via /dev/i2c-* on Linux.\n",
- .init = mstarddc_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_PICKIT2_SPI == 1
-const struct programmer_entry programmer_pickit2_spi = {
- .name = "pickit2_spi",
- .type = USB,
- .devs.dev = devs_pickit2_spi,
- .init = pickit2_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_CH341A_SPI == 1
-const struct programmer_entry programmer_ch341a_spi = {
- .name = "ch341a_spi",
- .type = USB,
- .devs.dev = devs_ch341a_spi,
- .init = ch341a_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = ch341a_spi_delay,
-};
-#endif
-
-#if CONFIG_DIGILENT_SPI == 1
-const struct programmer_entry programmer_digilent_spi = {
- .name = "digilent_spi",
- .type = USB,
- .devs.dev = devs_digilent_spi,
- .init = digilent_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_JLINK_SPI == 1
-const struct programmer_entry programmer_jlink_spi = {
- .name = "jlink_spi",
- .type = OTHER,
- .init = jlink_spi_init,
- .devs.note = "SEGGER J-Link and compatible devices\n",
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_NI845X_SPI == 1
-const struct programmer_entry programmer_ni845x_spi = {
- .name = "ni845x_spi",
- .type = OTHER, // choose other because NI-845x uses own USB implementation
- .devs.note = "National Instruments USB-845x\n",
- .init = ni845x_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
-#if CONFIG_STLINKV3_SPI == 1
-const struct programmer_entry programmer_stlinkv3_spi = {
- .name = "stlinkv3_spi",
- .type = USB,
- .devs.dev = devs_stlinkv3_spi,
- .init = stlinkv3_spi_init,
- .map_flash_region = fallback_map,
- .unmap_flash_region = fallback_unmap,
- .delay = internal_delay,
-};
-#endif
-
const struct programmer_entry *const programmer_table[] = {

#if CONFIG_INTERNAL == 1
diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 4e177e5..92779fc 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -349,7 +349,7 @@
#include <unistd.h>

/* FIXME: Add some programmer IDs here */
-const struct dev_entry devs_raiden[] = {
+static const struct dev_entry devs_raiden[] = {
{0},
};

@@ -1454,7 +1454,7 @@
dev = usb_device_free(dev);
}

-int raiden_debug_spi_init(void)
+static int raiden_debug_spi_init(void)
{
struct usb_match match;
char *serial = extract_programmer_param("serial");
@@ -1617,3 +1617,13 @@

return 0;
}
+
+const struct programmer_entry programmer_raiden_debug_spi = {
+ .name = "raiden_debug_spi",
+ .type = USB,
+ .devs.dev = devs_raiden,
+ .init = raiden_debug_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/rayer_spi.c b/rayer_spi.c
index 915d83c..1102ff1 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -236,7 +236,7 @@
.half_period = 0,
};

-int rayer_spi_init(void)
+static int rayer_spi_init(void)
{
const struct rayer_programmer *prog = rayer_spi_types;
char *arg = NULL;
@@ -324,6 +324,17 @@
return 0;
}

+const struct programmer_entry programmer_rayer_spi = {
+ .name = "rayer_spi",
+ .type = OTHER,
+ /* FIXME */
+ .devs.note = "RayeR parallel port programmer\n",
+ .init = rayer_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 91c8aa5..22f7e7a 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -480,7 +480,7 @@
return ret;
}

-int realtek_mst_i2c_spi_init(void)
+static int realtek_mst_i2c_spi_init(void)
{
int ret = 0;
int reset = 0, enter_isp = 0;
@@ -517,3 +517,13 @@

return ret;
}
+
+const struct programmer_entry programmer_realtek_mst_i2c_spi = {
+ .name = "realtek_mst_i2c_spi",
+ .type = OTHER,
+ .devs.note = "Device files /dev/i2c-*.\n",
+ .init = realtek_mst_i2c_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/satamv.c b/satamv.c
index 30b7c34..3996a4b 100644
--- a/satamv.c
+++ b/satamv.c
@@ -25,7 +25,7 @@
static uint8_t *mv_bar;
static uint16_t mv_iobar;

-const struct dev_entry satas_mv[] = {
+static const struct dev_entry satas_mv[] = {
/* 88SX6041 and 88SX6042 are the same according to the datasheet. */
{0x11ab, 0x7042, OK, "Marvell", "88SX7042 PCI-e 4-port SATA-II"},

@@ -100,7 +100,7 @@
* 0xc08 PCI BAR2 (Flash/NVRAM) Control
* 0x1046c Flash Parameters
*/
-int satamv_init(void)
+static int satamv_init(void)
{
struct pci_dev *dev = NULL;
uintptr_t addr;
@@ -184,6 +184,16 @@
return 0;
}

+const struct programmer_entry programmer_satamv = {
+ .name = "satamv",
+ .type = PCI,
+ .devs.dev = satas_mv,
+ .init = satamv_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif
diff --git a/satasii.c b/satasii.c
index 0d22650..fe7ac15 100644
--- a/satasii.c
+++ b/satasii.c
@@ -26,7 +26,7 @@
static uint8_t *sii_bar;
static uint16_t id;

-const struct dev_entry satas_sii[] = {
+static const struct dev_entry satas_sii[] = {
{0x1095, 0x0680, OK, "Silicon Image", "PCI0680 Ultra ATA-133 Host Ctrl"},
{0x1095, 0x3112, OK, "Silicon Image", "SiI 3112 [SATALink/SATARaid] SATA Ctrl"},
{0x1095, 0x3114, OK, "Silicon Image", "SiI 3114 [SATALink/SATARaid] SATA Ctrl"},
@@ -93,7 +93,7 @@
.chip_writen = fallback_chip_writen,
};

-int satasii_init(void)
+static int satasii_init(void)
{
struct pci_dev *dev = NULL;
uint32_t addr;
@@ -133,3 +133,12 @@

return 0;
}
+const struct programmer_entry programmer_satasii = {
+ .name = "satasii",
+ .type = PCI,
+ .devs.dev = satas_sii,
+ .init = satasii_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/serprog.c b/serprog.c
index e8c0d75..e8d1f52 100644
--- a/serprog.c
+++ b/serprog.c
@@ -539,7 +539,7 @@

static enum chipbustype serprog_buses_supported = BUS_NONE;

-int serprog_init(void)
+static int serprog_init(void)
{
uint16_t iface;
unsigned char pgmname[17];
@@ -898,7 +898,7 @@
return 1;
}

-void serprog_delay(unsigned int usecs)
+static void serprog_delay(unsigned int usecs)
{
unsigned char buf[4];
msg_pspew("%s usecs=%d\n", __func__, usecs);
@@ -919,7 +919,7 @@
sp_prev_was_write = 0;
}

-void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len)
+static void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len)
{
/* Serprog transmits 24 bits only and assumes the underlying implementation handles any remaining bits
* correctly (usually setting them to one either in software (for FWH/LPC) or relying on the fact that
@@ -933,3 +933,14 @@
descr, len, PRIxPTR_WIDTH, phys_addr);
return NULL;
}
+
+const struct programmer_entry programmer_serprog = {
+ .name = "serprog",
+ .type = OTHER,
+ /* FIXME */
+ .devs.note = "All programmer devices speaking the serprog protocol\n",
+ .init = serprog_init,
+ .map_flash_region = serprog_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = serprog_delay,
+};
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c
index 8b62740..3a5aeb3 100644
--- a/stlinkv3_spi.c
+++ b/stlinkv3_spi.c
@@ -114,7 +114,7 @@

#define USB_TIMEOUT_IN_MS 5000

-const struct dev_entry devs_stlinkv3_spi[] = {
+static const struct dev_entry devs_stlinkv3_spi[] = {
{0x0483, 0x374F, OK, "STMicroelectronics", "STLINK-V3"},
{0}
};
@@ -469,7 +469,7 @@
.write_aai = default_spi_write_aai,
};

-int stlinkv3_spi_init(void)
+static int stlinkv3_spi_init(void)
{
uint16_t sck_freq_kHz = 1000; // selecting 1 MHz SCK is a good bet
char *speed_str = NULL;
@@ -549,3 +549,13 @@
libusb_exit(usb_ctx);
return ret;
}
+
+const struct programmer_entry programmer_stlinkv3_spi = {
+ .name = "stlinkv3_spi",
+ .type = USB,
+ .devs.dev = devs_stlinkv3_spi,
+ .init = stlinkv3_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
diff --git a/usbblaster_spi.c b/usbblaster_spi.c
index 5f240df..dfd98ec 100644
--- a/usbblaster_spi.c
+++ b/usbblaster_spi.c
@@ -45,7 +45,7 @@
#define ALTERA_VID 0x09fb
#define ALTERA_USBBLASTER_PID 0x6001

-const struct dev_entry devs_usbblasterspi[] = {
+static const struct dev_entry devs_usbblasterspi[] = {
{ALTERA_VID, ALTERA_USBBLASTER_PID, OK, "Altera", "USB-Blaster"},

{0}
@@ -177,7 +177,7 @@
};

/* Returns 0 upon success, a negative number upon errors. */
-int usbblaster_spi_init(void)
+static int usbblaster_spi_init(void)
{
uint8_t buf[BUF_SIZE + 1] = { 0 };
struct ftdi_context ftdic;
@@ -232,4 +232,14 @@
return 0;
}

+const struct programmer_entry programmer_usbblaster_spi = {
+ .name = "usbblaster_spi",
+ .type = USB,
+ .devs.dev = devs_usbblasterspi,
+ .init = usbblaster_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+};
+
#endif

To view, visit change 52946. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3d02bd789f0299e936eb86819b3b15b5ea2bb921
Gerrit-Change-Number: 52946
Gerrit-PatchSet: 12
Gerrit-Owner: Thomas Heijligen <src@posteo.de>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus@gmail.com>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-CC: Xiang W <wxjstz@126.com>
Gerrit-MessageType: merged