programmer_table: move each entry to the associated programmer source
Change-Id: I3d02bd789f0299e936eb86819b3b15b5ea2bb921
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/52946
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71373
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/atahpt.c b/atahpt.c
index dae0222..a064deb 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"},
@@ -54,7 +54,7 @@
.chip_writen = fallback_chip_writen,
};
-int atahpt_init(void)
+static int atahpt_init(void)
{
struct pci_dev *dev = NULL;
uint32_t reg32;
@@ -94,6 +94,16 @@
return INB(io_base_addr + BIOS_ROM_DATA);
}
+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 ab34a1e..747a7fb 100644
--- a/atapromise.c
+++ b/atapromise.c
@@ -46,7 +46,7 @@
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)"},
@@ -67,7 +67,7 @@
.chip_writen = fallback_chip_writen,
};
-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;
@@ -106,7 +106,7 @@
}
}
-int atapromise_init(void)
+static int atapromise_init(void)
{
struct pci_dev *dev = NULL;
@@ -165,6 +165,16 @@
return pci_mmio_readb(atapromise_bar + (addr & ADDR_MASK));
}
+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 b407a30..529f02f 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},
@@ -114,12 +114,12 @@
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;
}
-int atavia_init(void)
+static int atavia_init(void)
{
char *arg = extract_programmer_param("offset");
if (arg) {
@@ -190,3 +190,13 @@
msg_pspew("%s: 0x%02x from 0x%*" PRIxPTR ".\n", __func__, val, PRIxPTR_WIDTH, addr);
return val;
}
+
+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 fdfc0e4..901acdd 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -214,7 +214,7 @@
*/
#define BP_DIVISOR(baud) ((4000000/(baud)) - 1)
-int buspirate_spi_init(void)
+static int buspirate_spi_init(void)
{
char *tmp;
char *dev;
@@ -664,3 +664,14 @@
return ret;
}
+
+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 84cc3fe..b22d9a2 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 d6654f4..aa1923b 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 4ff2fb6..a14f695 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},
};
@@ -136,7 +136,7 @@
return 0;
}
-int developerbox_spi_init(void)
+static int developerbox_spi_init(void)
{
libusb_init(&usb_ctx);
if (!usb_ctx) {
@@ -167,3 +167,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 0f7a9da..7431671 100644
--- a/digilent_spi.c
+++ b/digilent_spi.c
@@ -51,7 +51,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 },
};
@@ -368,7 +368,7 @@
{ NULL, 0 },
};
-int digilent_spi_init(void)
+static int digilent_spi_init(void)
{
char *p;
uint32_t speed_hz = spispeeds[0].speed;
@@ -454,3 +454,13 @@
handle = NULL;
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 ac49df3..0c0655d 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},
@@ -52,7 +52,7 @@
.chip_writen = fallback_chip_writen,
};
-int drkaiser_init(void)
+static int drkaiser_init(void)
{
struct pci_dev *dev = NULL;
uint32_t addr;
@@ -93,3 +93,13 @@
{
return pci_mmio_readb(drkaiser_bar + (addr & DRKAISER_MEMMAP_MASK));
}
+
+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 e947f00..ae39c48 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -361,7 +361,7 @@
return 0;
}
-int dummy_init(void)
+static int dummy_init(void)
{
struct stat image_stat;
@@ -434,14 +434,14 @@
return 0;
}
-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);
}
@@ -889,3 +889,14 @@
return spi_write_chunked(flash, buf, start, len,
spi_write_256_chunksize);
}
+
+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/ft2232_spi.c b/ft2232_spi.c
index 4289e14..51f14b1 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"},
@@ -193,7 +193,7 @@
};
/* Returns 0 upon success, a negative number upon errors. */
-int ft2232_spi_init(void)
+static int ft2232_spi_init(void)
{
int ret;
unsigned char buf[512];
@@ -587,4 +587,13 @@
return failed ? -1 : 0;
}
+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 d8ea4d6..9c91ae5 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" },
@@ -73,7 +73,7 @@
.chip_writen = fallback_chip_writen,
};
-int gfxnvidia_init(void)
+static int gfxnvidia_init(void)
{
struct pci_dev *dev = NULL;
uint32_t reg32;
@@ -119,3 +119,13 @@
{
return pci_mmio_readb(nvidia_bar + (addr & GFXNVIDIA_MEMMAP_MASK));
}
+
+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 f1048d9..2b25dbf 100644
--- a/internal.c
+++ b/internal.c
@@ -148,7 +148,7 @@
enum chipbustype internal_buses_supported = BUS_NONE;
-int internal_init(void)
+static int internal_init(void)
{
int ret = 0;
int force_laptop = 0;
@@ -395,3 +395,13 @@
mmio_readn((void *)addr, buf, len);
return;
}
+
+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 ac53a6f..8953e34 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},
@@ -45,7 +45,7 @@
.chip_writen = fallback_chip_writen,
};
-int it8212_init(void)
+static int it8212_init(void)
{
if (rget_io_perms())
return 1;
@@ -80,3 +80,13 @@
{
return pci_mmio_readb(it8212_bar + (addr & IT8212_MEMMAP_MASK));
}
+
+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 369c645..8a1b36c 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -174,7 +174,7 @@
return 0;
}
-int jlink_spi_init(void)
+static int jlink_spi_init(void)
{
char *arg;
unsigned long speed = 0;
@@ -452,3 +452,13 @@
return 0;
}
+
+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 998f37a..9499f26 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -291,7 +291,7 @@
return 0;
}
-static 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,
@@ -362,7 +362,7 @@
return 0;
}
-int linux_mtd_init(void)
+static int linux_mtd_init(void)
{
char *param;
int dev_num = 0;
@@ -405,10 +405,20 @@
if (register_shutdown(linux_mtd_shutdown, NULL))
goto linux_mtd_init_exit;
- register_opaque_master(&programmer_linux_mtd);
+ register_opaque_master(&linux_mtd_opaque_master);
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 1ef8f2b..b0a2801 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -69,7 +69,7 @@
.write_aai = default_spi_write_aai,
};
-int linux_spi_init(void)
+static int linux_spi_init(void)
{
char *p, *endp, *dev;
uint32_t speed_hz = 2 * 1000 * 1000;
@@ -234,4 +234,14 @@
return spi_write_chunked(flash, buf, start, len, max_kernel_buf_size - 5);
}
+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/mstarddc_spi.c b/mstarddc_spi.c
index 48d6204..248dba6 100644
--- a/mstarddc_spi.c
+++ b/mstarddc_spi.c
@@ -68,7 +68,7 @@
}
/* Returns 0 upon success, a negative number upon errors. */
-int mstarddc_spi_init(void)
+static int mstarddc_spi_init(void)
{
int ret = 0;
@@ -229,4 +229,14 @@
.write_aai = default_spi_write_aai,
};
+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 7b2bea3..92184ff 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -640,3 +640,13 @@
.write_256 = default_spi_write_256,
.write_aai = default_spi_write_aai,
};
+
+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 b7b967a..94442df 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -33,7 +33,7 @@
static uint32_t internal_conf;
static 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" },
@@ -81,7 +81,7 @@
return 0;
}
-int nic3com_init(void)
+static int nic3com_init(void)
{
struct pci_dev *dev = NULL;
@@ -139,6 +139,16 @@
return INB(io_base_addr + BIOS_ROM_DATA);
}
+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 4672890..30f9dd0 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"},
@@ -55,7 +55,7 @@
.chip_writen = fallback_chip_writen,
};
-int nicintel_init(void)
+static int nicintel_init(void)
{
struct pci_dev *dev = NULL;
uintptr_t addr;
@@ -115,3 +115,13 @@
{
return pci_mmio_readb(nicintel_bar + (addr & NICINTEL_MEMMAP_MASK));
}
+
+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 f95107f..c986dac 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 1173ef7..76b53fa 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -77,7 +77,7 @@
static uint8_t *nicintel_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"},
@@ -241,7 +241,7 @@
return 0;
}
-int nicintel_spi_init(void)
+static int nicintel_spi_init(void)
{
struct pci_dev *dev = NULL;
@@ -278,3 +278,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 085768d..c134edb 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"},
@@ -49,7 +49,7 @@
.chip_writen = fallback_chip_writen,
};
-int nicnatsemi_init(void)
+static int nicnatsemi_init(void)
{
struct pci_dev *dev = NULL;
@@ -106,6 +106,16 @@
return INB(io_base_addr + BOOT_ROM_DATA);
}
+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 5454b63..858108e 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 */
@@ -54,7 +54,7 @@
return 0;
}
-int nicrealtek_init(void)
+static int nicrealtek_init(void)
{
struct pci_dev *dev = NULL;
@@ -129,6 +129,16 @@
return val;
}
+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 e603edb..ba32f27 100644
--- a/ogp_spi.c
+++ b/ogp_spi.c
@@ -43,7 +43,7 @@
static uint32_t ogp_reg__ce;
static uint32_t ogp_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},
@@ -92,7 +92,7 @@
.half_period = 0,
};
-int ogp_spi_init(void)
+static int ogp_spi_init(void)
{
struct pci_dev *dev = NULL;
char *type;
@@ -140,3 +140,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 0bc17af..0e189a9 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}
@@ -378,7 +378,7 @@
return ret;
}
-int pickit2_spi_init(void)
+static int pickit2_spi_init(void)
{
uint8_t buf[CMD_LENGTH] = {
CMD_EXEC_SCRIPT,
@@ -489,3 +489,13 @@
return 0;
}
+
+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 ed9d326..d0fcb81 100644
--- a/pony_spi.c
+++ b/pony_spi.c
@@ -110,7 +110,7 @@
return ret;
}
-int pony_spi_init(void)
+static int pony_spi_init(void)
{
int i, data_out;
char *arg = NULL;
@@ -229,3 +229,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 50ec930..af7d500 100644
--- a/programmer.h
+++ b/programmer.h
@@ -347,7 +347,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 */
@@ -385,140 +385,117 @@
/* 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
/* 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 */
@@ -526,52 +503,47 @@
/* 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
/* 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 */
@@ -668,7 +640,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
@@ -731,9 +703,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 */
diff --git a/programmer_table.c b/programmer_table.c
index 18e007c..e7fd075 100644
--- a/programmer_table.c
+++ b/programmer_table.c
@@ -14,420 +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_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_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_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_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/rayer_spi.c b/rayer_spi.c
index 8e869e6..4705097 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -164,7 +164,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;
@@ -280,6 +280,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/satamv.c b/satamv.c
index 31265ea..0b667f8 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"},
@@ -69,7 +69,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;
@@ -188,6 +188,16 @@
return satamv_indirect_chip_readb(addr);
}
+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 8a0938d..0f782f9 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"},
@@ -64,7 +64,7 @@
return ctrl_reg;
}
-int satasii_init(void)
+static int satasii_init(void)
{
struct pci_dev *dev = NULL;
uint32_t addr;
@@ -135,3 +135,13 @@
return (pci_mmio_readl(sii_bar + 4)) & 0xff;
}
+
+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 8adf541..fdcc194 100644
--- a/serprog.c
+++ b/serprog.c
@@ -329,7 +329,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];
@@ -877,7 +877,7 @@
sp_do_read_n(&(buf[addrm-addr]), addrm, lenm); // FIXME: return error
}
-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);
@@ -931,7 +931,7 @@
return ret;
}
-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
@@ -945,3 +945,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 d09b0d5..65cb35c 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}
};
@@ -444,7 +444,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;
@@ -512,3 +512,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 8059840..5659535 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}
@@ -74,7 +74,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 };
@@ -214,4 +214,14 @@
.write_aai = default_spi_write_aai,
};
+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