diff options
-rw-r--r-- | atahpt.c | 2 | ||||
-rw-r--r-- | drkaiser.c | 2 | ||||
-rw-r--r-- | flashrom.c | 24 | ||||
-rw-r--r-- | ft2232_spi.c | 2 | ||||
-rw-r--r-- | gfxnvidia.c | 2 | ||||
-rw-r--r-- | nic3com.c | 2 | ||||
-rw-r--r-- | nicintel.c | 2 | ||||
-rw-r--r-- | nicintel_spi.c | 2 | ||||
-rw-r--r-- | nicnatsemi.c | 2 | ||||
-rw-r--r-- | nicrealtek.c | 2 | ||||
-rw-r--r-- | ogp_spi.c | 2 | ||||
-rw-r--r-- | pcidev.c | 2 | ||||
-rw-r--r-- | print.c | 31 | ||||
-rw-r--r-- | print_wiki.c | 51 | ||||
-rw-r--r-- | programmer.h | 59 | ||||
-rw-r--r-- | satamv.c | 2 | ||||
-rw-r--r-- | satasii.c | 2 |
17 files changed, 72 insertions, 119 deletions
@@ -33,7 +33,7 @@ #define PCI_VENDOR_ID_HPT 0x1103 -const struct pcidev_status ata_hpt[] = { +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"}, @@ -33,7 +33,7 @@ /* Mask to restrict flash accesses to the 128kB memory window. */ #define DRKAISER_MEMMAP_MASK ((1 << 17) - 1) -const struct pcidev_status drkaiser_pcidev[] = { +const struct dev_entry drkaiser_pcidev[] = { {0x1803, 0x5057, OK, "Dr. Kaiser", "PC-Waechter (Actel FPGA)"}, {0}, @@ -90,7 +90,7 @@ const struct programmer_entry programmer_table[] = { { .name = "nic3com", .type = PCI, - .devs.pci = nics_3com, + .devs.dev = nics_3com, .init = nic3com_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -103,7 +103,7 @@ const struct programmer_entry programmer_table[] = { /* This programmer works for Realtek RTL8139 and SMC 1211. */ .name = "nicrealtek", .type = PCI, - .devs.pci = nics_realtek, + .devs.dev = nics_realtek, .init = nicrealtek_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -115,7 +115,7 @@ const struct programmer_entry programmer_table[] = { { .name = "nicnatsemi", .type = PCI, - .devs.pci = nics_natsemi, + .devs.dev = nics_natsemi, .init = nicnatsemi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -127,7 +127,7 @@ const struct programmer_entry programmer_table[] = { { .name = "gfxnvidia", .type = PCI, - .devs.pci = gfx_nvidia, + .devs.dev = gfx_nvidia, .init = gfxnvidia_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -139,7 +139,7 @@ const struct programmer_entry programmer_table[] = { { .name = "drkaiser", .type = PCI, - .devs.pci = drkaiser_pcidev, + .devs.dev = drkaiser_pcidev, .init = drkaiser_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -151,7 +151,7 @@ const struct programmer_entry programmer_table[] = { { .name = "satasii", .type = PCI, - .devs.pci = satas_sii, + .devs.dev = satas_sii, .init = satasii_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -163,7 +163,7 @@ const struct programmer_entry programmer_table[] = { { .name = "atahpt", .type = PCI, - .devs.pci = ata_hpt, + .devs.dev = ata_hpt, .init = atahpt_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -175,7 +175,7 @@ const struct programmer_entry programmer_table[] = { { .name = "ft2232_spi", .type = USB, - .devs.usb = devs_ft2232spi, + .devs.dev = devs_ft2232spi, .init = ft2232_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -252,7 +252,7 @@ const struct programmer_entry programmer_table[] = { { .name = "nicintel", .type = PCI, - .devs.pci = nics_intel, + .devs.dev = nics_intel, .init = nicintel_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -264,7 +264,7 @@ const struct programmer_entry programmer_table[] = { { .name = "nicintel_spi", .type = PCI, - .devs.pci = nics_intel_spi, + .devs.dev = nics_intel_spi, .init = nicintel_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -276,7 +276,7 @@ const struct programmer_entry programmer_table[] = { { .name = "ogp_spi", .type = PCI, - .devs.pci = ogp_spi, + .devs.dev = ogp_spi, .init = ogp_spi_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, @@ -288,7 +288,7 @@ const struct programmer_entry programmer_table[] = { { .name = "satamv", .type = PCI, - .devs.pci = satas_mv, + .devs.dev = satas_mv, .init = satamv_init, .map_flash_region = fallback_map, .unmap_flash_region = fallback_unmap, diff --git a/ft2232_spi.c b/ft2232_spi.c index dc17d00..81be051 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -57,7 +57,7 @@ #define OLIMEX_ARM_OCD_H_PID 0x002B #define OLIMEX_ARM_TINY_H_PID 0x002A -const struct usbdev_status devs_ft2232spi[] = { +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"}, diff --git a/gfxnvidia.c b/gfxnvidia.c index 7bdbda8..624fd7c 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -34,7 +34,7 @@ uint8_t *nvidia_bar; -const struct pcidev_status gfx_nvidia[] = { +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" }, @@ -36,7 +36,7 @@ static uint32_t internal_conf; static uint16_t id; -const struct pcidev_status nics_3com[] = { +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" }, @@ -27,7 +27,7 @@ uint8_t *nicintel_bar; uint8_t *nicintel_control_bar; -const struct pcidev_status nics_intel[] = { +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"}, diff --git a/nicintel_spi.c b/nicintel_spi.c index 24d5732..325e61c 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -67,7 +67,7 @@ uint8_t *nicintel_spibar; -const struct pcidev_status nics_intel_spi[] = { +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"}, diff --git a/nicnatsemi.c b/nicnatsemi.c index fcfc613..60d8f87 100644 --- a/nicnatsemi.c +++ b/nicnatsemi.c @@ -30,7 +30,7 @@ #define BOOT_ROM_ADDR 0x50 #define BOOT_ROM_DATA 0x54 -const struct pcidev_status nics_natsemi[] = { +const struct dev_entry nics_natsemi[] = { {0x100b, 0x0020, NT, "National Semiconductor", "DP83815/DP83816"}, {0x100b, 0x0022, NT, "National Semiconductor", "DP83820"}, diff --git a/nicrealtek.c b/nicrealtek.c index 92f48a8..3c3b261 100644 --- a/nicrealtek.c +++ b/nicrealtek.c @@ -30,7 +30,7 @@ static int bios_rom_addr, bios_rom_data; -const struct pcidev_status nics_realtek[] = { +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 */ @@ -47,7 +47,7 @@ static uint32_t ogp_reg_siso; static uint32_t ogp_reg__ce; static uint32_t ogp_reg_sck; -const struct pcidev_status ogp_spi[] = { +const struct dev_entry ogp_spi[] = { {PCI_VENDOR_ID_OGP, 0x0000, OK, "Open Graphics Project", "Development Board OGD1"}, {0}, @@ -154,7 +154,7 @@ uintptr_t pcidev_readbar(struct pci_dev *dev, int bar) return (uintptr_t)addr; } -uintptr_t pcidev_init(int bar, const struct pcidev_status *devs) +uintptr_t pcidev_init(int bar, const struct dev_entry *devs) { struct pci_dev *dev; struct pci_filter filter; @@ -433,29 +433,18 @@ static void print_supported_boards_helper(const struct board_info *boards, } #endif -void print_supported_usbdevs(const struct usbdev_status *devs) +void print_supported_devs(const struct programmer_entry prog, const char *const type) { int i; - msg_pinfo("USB devices:\n"); + const struct dev_entry *const devs = prog.devs.dev; + msg_ginfo("\nSupported %s devices for the %s programmer:\n", type, prog.name); for (i = 0; devs[i].vendor_name != NULL; i++) { msg_pinfo("%s %s [%04x:%04x]%s\n", devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, devs[i].device_id, (devs[i].status == NT) ? " (untested)" : ""); } } -#if NEED_PCI == 1 -void print_supported_pcidevs(const struct pcidev_status *devs) -{ - int i; - - for (i = 0; devs[i].vendor_name != NULL; i++) { - msg_pinfo("%s %s [%04x:%04x]%s\n", devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, - devs[i].device_id, (devs[i].status == NT) ? " (untested)" : ""); - } -} -#endif - int print_supported(void) { unsigned int i; @@ -478,20 +467,18 @@ int print_supported(void) const struct programmer_entry prog = programmer_table[i]; switch (prog.type) { case USB: - msg_ginfo("\nSupported USB devices for the %s programmer:\n", prog.name); - print_supported_usbdevs(prog.devs.usb); + print_supported_devs(prog, "USB"); break; #if NEED_PCI == 1 case PCI: - msg_ginfo("\nSupported PCI devices for the %s programmer:\n", prog.name); - print_supported_pcidevs(prog.devs.pci); + print_supported_devs(prog, "PCI"); break; #endif case OTHER: - if (prog.devs.note == NULL) - break; - msg_ginfo("\nSupported devices for the %s programmer:\n", prog.name); - msg_ginfo("%s", prog.devs.note); + if (prog.devs.note != NULL) { + msg_ginfo("\nSupported devices for the %s programmer:\n", prog.name); + msg_ginfo("%s", prog.devs.note); + } break; default: msg_gerr("\n%s: %s: Uninitialized programmer type! Please report a bug at " diff --git a/print_wiki.c b/print_wiki.c index 501a2d7..4f34f29 100644 --- a/print_wiki.c +++ b/print_wiki.c @@ -77,6 +77,7 @@ static const char chip_th[] = "\ | align=\"center\" | Min \n| align=\"center\" | Max\n\n"; static const char programmer_th[] = "\ +! align=\"left\" | Programmer\n\ ! align=\"left\" | Vendor\n\ ! align=\"left\" | Device\n\ ! align=\"center\" | IDs\n\ @@ -300,51 +301,31 @@ static void print_supported_chips_wiki(int cols) /* Following functions are not needed when no PCI/USB programmers are compiled in, * but since print_wiki code has no size constraints we include it unconditionally. */ -static int count_supported_pcidevs_wiki(const struct pcidev_status *devs) +static int count_supported_devs_wiki(const struct dev_entry *devs) { unsigned int count = 0; unsigned int i = 0; - for (i = 0; devs[i].vendor_name != NULL; i++) + for (i = 0; devs[i].vendor_id != 0; i++) count++; return count; } -static void print_supported_pcidevs_wiki_helper(const struct pcidev_status *devs) +static void print_supported_devs_wiki_helper(const struct programmer_entry prog) { int i = 0; static int c = 0; + const struct dev_entry *devs = prog.devs.dev; + const unsigned int count = count_supported_devs_wiki(devs); /* Alternate colors if the vendor changes. */ c = !c; - for (i = 0; devs[i].vendor_name != NULL; i++) { - printf("|- bgcolor=\"#%s\"\n| %s || %s || %04x:%04x || {{%s}}\n", (c) ? "eeeeee" : "dddddd", - devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, devs[i].device_id, - (devs[i].status == NT) ? "?3" : "OK"); - } -} - -static int count_supported_usbdevs_wiki(const struct usbdev_status *devs) -{ - unsigned int count = 0; - unsigned int i = 0; - for (i = 0; devs[i].vendor_name != NULL; i++) - count++; - return count; -} - -static void print_supported_usbdevs_wiki_helper(const struct usbdev_status *devs) -{ - int i = 0; - static int c = 0; - - /* Alternate colors if the vendor changes. */ - c = !c; - - for (i = 0; devs[i].vendor_name != NULL; i++) { - printf("|- bgcolor=\"#%s\"\n| %s || %s || %04x:%04x || {{%s}}\n", (c) ? "eeeeee" : "dddddd", - devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, devs[i].device_id, - (devs[i].status == NT) ? "?3" : "OK"); + for (i = 0; devs[i].vendor_id != 0; i++) { + printf("|- bgcolor=\"#%s\"\n", (c) ? "eeeeee" : "dddddd"); + if (i == 0) + printf("| rowspan=\"%u\" | %s |", count, prog.name); + printf("| %s || %s || %04x:%04x || {{%s}}\n", devs[i].vendor_name, devs[i].device_name, + devs[i].vendor_id, devs[i].device_id, (devs[i].status == NT) ? "?3" : "OK"); } } @@ -358,10 +339,10 @@ static void print_supported_devs_wiki() const struct programmer_entry prog = programmer_table[i]; switch (prog.type) { case USB: - usb_count += count_supported_usbdevs_wiki(prog.devs.usb); + usb_count += count_supported_devs_wiki(prog.devs.dev); break; case PCI: - pci_count += count_supported_pcidevs_wiki(prog.devs.pci); + pci_count += count_supported_devs_wiki(prog.devs.dev); break; case OTHER: default: @@ -376,7 +357,7 @@ static void print_supported_devs_wiki() for (i = 0; i < PROGRAMMER_INVALID; i++) { const struct programmer_entry prog = programmer_table[i]; if (prog.type == PCI) { - print_supported_pcidevs_wiki_helper(prog.devs.pci); + print_supported_devs_wiki_helper(prog); } } printf("\n|}\n\n|}\n"); @@ -388,7 +369,7 @@ static void print_supported_devs_wiki() for (i = 0; i < PROGRAMMER_INVALID; i++) { const struct programmer_entry prog = programmer_table[i]; if (prog.type == USB) { - print_supported_usbdevs_wiki_helper(prog.devs.usb); + print_supported_devs_wiki_helper(prog); } } printf("\n|}\n\n|}\n"); diff --git a/programmer.h b/programmer.h index e2bb3d8..1eb0a99 100644 --- a/programmer.h +++ b/programmer.h @@ -96,12 +96,19 @@ enum programmer_type { OTHER, }; +struct dev_entry { + uint16_t vendor_id; + uint16_t device_id; + const enum test_state status; + const char *vendor_name; + const char *device_name; +}; + struct programmer_entry { const char *name; const enum programmer_type type; union { - const struct pcidev_status *const pci; - const struct usbdev_status *const usb; + const struct dev_entry *const dev; const char *const note; } devs; @@ -232,7 +239,7 @@ extern uint32_t io_base_addr; extern struct pci_access *pacc; extern struct pci_dev *pcidev_dev; uintptr_t pcidev_readbar(struct pci_dev *dev, int bar); -uintptr_t pcidev_init(int bar, const struct pcidev_status *devs); +uintptr_t pcidev_init(int bar, const struct dev_entry *devs); /* rpci_write_* are reversible writes. The original PCI config space register * contents will be restored on shutdown. */ @@ -241,27 +248,6 @@ int rpci_write_word(struct pci_dev *dev, int reg, uint16_t data); int rpci_write_long(struct pci_dev *dev, int reg, uint32_t data); #endif -/* print.c */ -#if CONFIG_NIC3COM+CONFIG_NICREALTEK+CONFIG_NICNATSEMI+CONFIG_GFXNVIDIA+CONFIG_DRKAISER+CONFIG_SATASII+CONFIG_ATAHPT+CONFIG_NICINTEL+CONFIG_NICINTEL_SPI+CONFIG_OGP_SPI+CONFIG_SATAMV >= 1 -/* Not needed for CONFIG_INTERNAL, but for all other PCI-based programmers. */ -void print_supported_pcidevs(const struct pcidev_status *devs); -#endif - -struct usbdev_status { - uint16_t vendor_id; - uint16_t device_id; - const enum test_state status; - const char *vendor_name; - const char *device_name; -}; -struct pcidev_status { - uint16_t vendor_id; - uint16_t device_id; - const enum test_state status; - const char *vendor_name; - const char *device_name; -}; - #if CONFIG_INTERNAL == 1 /* board_enable.c */ int board_parse_parameter(const char *boardstring, const char **vendor, const char **model); @@ -375,74 +361,73 @@ void dummy_unmap(void *virt_addr, size_t len); /* nic3com.c */ #if CONFIG_NIC3COM == 1 int nic3com_init(void); -extern const struct pcidev_status nics_3com[]; +extern const struct dev_entry nics_3com[]; #endif /* gfxnvidia.c */ #if CONFIG_GFXNVIDIA == 1 int gfxnvidia_init(void); -extern const struct pcidev_status gfx_nvidia[]; +extern const struct dev_entry gfx_nvidia[]; #endif /* drkaiser.c */ #if CONFIG_DRKAISER == 1 int drkaiser_init(void); -extern const struct pcidev_status drkaiser_pcidev[]; +extern const struct dev_entry drkaiser_pcidev[]; #endif /* nicrealtek.c */ #if CONFIG_NICREALTEK == 1 int nicrealtek_init(void); -extern const struct pcidev_status nics_realtek[]; +extern const struct dev_entry nics_realtek[]; #endif /* nicnatsemi.c */ #if CONFIG_NICNATSEMI == 1 int nicnatsemi_init(void); -extern const struct pcidev_status nics_natsemi[]; +extern const struct dev_entry nics_natsemi[]; #endif /* nicintel.c */ #if CONFIG_NICINTEL == 1 int nicintel_init(void); -extern const struct pcidev_status nics_intel[]; +extern const struct dev_entry nics_intel[]; #endif /* nicintel_spi.c */ #if CONFIG_NICINTEL_SPI == 1 int nicintel_spi_init(void); -extern const struct pcidev_status nics_intel_spi[]; +extern const struct dev_entry nics_intel_spi[]; #endif /* ogp_spi.c */ #if CONFIG_OGP_SPI == 1 int ogp_spi_init(void); -extern const struct pcidev_status ogp_spi[]; +extern const struct dev_entry ogp_spi[]; #endif /* satamv.c */ #if CONFIG_SATAMV == 1 int satamv_init(void); -extern const struct pcidev_status satas_mv[]; +extern const struct dev_entry satas_mv[]; #endif /* satasii.c */ #if CONFIG_SATASII == 1 int satasii_init(void); -extern const struct pcidev_status satas_sii[]; +extern const struct dev_entry satas_sii[]; #endif /* atahpt.c */ #if CONFIG_ATAHPT == 1 int atahpt_init(void); -extern const struct pcidev_status ata_hpt[]; +extern const struct dev_entry ata_hpt[]; #endif /* ft2232_spi.c */ #if CONFIG_FT2232_SPI == 1 int ft2232_spi_init(void); -extern const struct usbdev_status devs_ft2232spi[]; -void print_supported_usbdevs(const struct usbdev_status *devs); +extern const struct dev_entry devs_ft2232spi[]; #endif /* rayer_spi.c */ @@ -29,7 +29,7 @@ uint8_t *mv_bar; uint16_t mv_iobar; -const struct pcidev_status satas_mv[] = { +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"}, @@ -30,7 +30,7 @@ static uint8_t *sii_bar; static uint16_t id; -const struct pcidev_status satas_sii[] = { +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"}, |