Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de> |
| 5 | * Copyright (C) 2009 Carl-Daniel Hailfinger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 22 | #include <stdio.h> |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 23 | #include <string.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <time.h> |
| 26 | #include "flash.h" |
| 27 | #include "flashchips.h" |
Carl-Daniel Hailfinger | 5b997c3 | 2010-07-27 22:41:39 +0000 | [diff] [blame] | 28 | #include "programmer.h" |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 29 | |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 30 | static const char wiki_header[] = "= Supported devices =\n\n\ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 31 | <div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \ |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 32 | background-color:#eeeeee; text-align:right; border:1px solid #aabbcc;\">\ |
| 33 | <small>\n\ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 34 | Please do '''not''' edit these tables in the wiki directly, they are \ |
| 35 | generated by pasting '''flashrom -z''' output.<br />\ |
| 36 | '''Last update:''' %s(generated by flashrom %s)\n</small></div>\n"; |
| 37 | |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 38 | #if CONFIG_INTERNAL == 1 |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 39 | static const char chipset_th[] = "{| border=\"0\" style=\"font-size: smaller\"\n\ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 40 | |- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\ |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 41 | ! align=\"left\" | Southbridge\n! align=\"center\" | PCI IDs\n\ |
| 42 | ! align=\"center\" | Status\n\n"; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 43 | |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 44 | static const char board_th[] = "{| border=\"0\" style=\"font-size: smaller\" \ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 45 | valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\ |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 46 | ! align=\"left\" | Mainboard\n! align=\"left\" | Required option\n\ |
| 47 | ! align=\"center\" | Status\n\n"; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 48 | |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 49 | static const char board_intro[] = "\ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 50 | \n== Supported mainboards ==\n\n\ |
| 51 | In general, it is very likely that flashrom works out of the box even if your \ |
| 52 | mainboard is not listed below.\n\nThis is a list of mainboards where we have \ |
| 53 | verified that they either do or do not need any special initialization to \ |
| 54 | make flashrom work (given flashrom supports the respective chipset and flash \ |
| 55 | chip), or that they do not yet work at all. If they do not work, support may \ |
| 56 | or may not be added later.\n\n\ |
Stefan Tauner | d06d941 | 2011-06-12 19:47:55 +0000 | [diff] [blame] | 57 | Mainboards (or individual revisions) which don't appear in the list may or may \ |
| 58 | not work (we don't know, someone has to give it a try). Please report any \ |
| 59 | further verified mainboards on the [[Mailinglist|mailing list]].\n"; |
Carl-Daniel Hailfinger | 8841d3e | 2010-05-15 15:04:37 +0000 | [diff] [blame] | 60 | #endif |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 61 | |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 62 | static const char chip_th[] = "{\ |
| 63 | | border=\"0\" style=\"font-size: smaller\" valign=\"top\"\n\ |
| 64 | |- bgcolor=\"#6699dd\"\n\ |
| 65 | ! align=\"left\" | Vendor\n\ |
| 66 | ! align=\"left\" | Device\n\ |
| 67 | ! align=\"center\" | Size [kB]\n\ |
| 68 | ! align=\"center\" | Type\n\ |
| 69 | ! align=\"center\" colspan=\"4\" | Status\n\ |
| 70 | ! align=\"center\" colspan=\"2\" | Voltage [V]\n\n\ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 71 | |- bgcolor=\"#6699ff\"\n| colspan=\"4\" | \n\ |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 72 | | Probe\n| Read\n| Erase\n| Write\n\ |
Paul Menzel | 018d482 | 2011-10-21 12:33:07 +0000 | [diff] [blame] | 73 | | align=\"center\" | Min \n| align=\"center\" | Max\n\n"; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 74 | |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 75 | static const char programmer_section[] = "\ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 76 | \n== Supported programmers ==\n\nThis is a list \ |
| 77 | of supported PCI devices flashrom can use as programmer:\n\n{| border=\"0\" \ |
| 78 | valign=\"top\"\n| valign=\"top\"|\n\n{| border=\"0\" style=\"font-size: \ |
| 79 | smaller\" valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\ |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 80 | ! align=\"left\" | Device\n! align=\"center\" | PCI IDs\n\ |
| 81 | ! align=\"center\" | Status\n\n"; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 82 | |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 83 | #if CONFIG_INTERNAL == 1 |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 84 | static const char laptop_intro[] = "\n== Supported laptops/notebooks ==\n\n\ |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 85 | In general, flashing laptops is more difficult because laptops\n\n\ |
| 86 | * often use the flash chip for stuff besides the BIOS,\n\ |
| 87 | * often have special protection stuff which has to be handled by flashrom,\n\ |
| 88 | * often use flash translation circuits which need drivers in flashrom.\n\n\ |
| 89 | <div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \ |
| 90 | background-color:#ff6666; align:right; border:1px solid #000000;\">\n\ |
| 91 | '''IMPORTANT:''' At this point we recommend to '''not''' use flashrom on \ |
| 92 | untested laptops unless you have a means to recover from a flashing that goes \ |
| 93 | wrong (a working backup flash chip and/or good soldering skills).\n</div>\n"; |
| 94 | |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 95 | static void print_supported_chipsets_wiki(int cols) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 96 | { |
| 97 | int i, j, enablescount = 0, color = 1; |
| 98 | const struct penable *e; |
| 99 | |
| 100 | for (e = chipset_enables; e->vendor_name != NULL; e++) |
| 101 | enablescount++; |
| 102 | |
| 103 | printf("\n== Supported chipsets ==\n\nTotal amount of supported " |
| 104 | "chipsets: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n| " |
| 105 | "valign=\"top\"|\n\n%s", enablescount, chipset_th); |
| 106 | |
| 107 | e = chipset_enables; |
| 108 | for (i = 0, j = 0; e[i].vendor_name != NULL; i++, j++) { |
| 109 | /* Alternate colors if the vendor changes. */ |
| 110 | if (i > 0 && strcmp(e[i].vendor_name, e[i - 1].vendor_name)) |
| 111 | color = !color; |
| 112 | |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 113 | printf("|- bgcolor=\"#%s\"\n| %s || %s " |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 114 | "|| %04x:%04x || %s\n", (color) ? "eeeeee" : "dddddd", |
| 115 | e[i].vendor_name, e[i].device_name, |
| 116 | e[i].vendor_id, e[i].device_id, |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 117 | (e[i].status == OK) ? "{{OK}}" : "{{?3}}"); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 118 | |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 119 | /* Split table in 'cols' columns. */ |
| 120 | if (j >= (enablescount / cols + 1)) { |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 121 | printf("\n|}\n\n| valign=\"top\"|\n\n%s", chipset_th); |
| 122 | j = 0; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | printf("\n|}\n\n|}\n"); |
| 127 | } |
| 128 | |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 129 | static void wiki_helper(const char *devicetype, int cols, |
| 130 | const struct board_info boards[]) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 131 | { |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame^] | 132 | int i, j, k; |
| 133 | unsigned int boardcount_good = 0, boardcount_bad = 0, boardcount_nt = 0; |
| 134 | int num_notes = 0, color = 1; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 135 | char *notes = calloc(1, 1); |
| 136 | char tmp[900 + 1]; |
Carl-Daniel Hailfinger | 97d5b12 | 2011-08-31 16:19:50 +0000 | [diff] [blame] | 137 | const struct board_match *b = board_matches; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 138 | |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 139 | for (i = 0; boards[i].vendor != NULL; i++) { |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame^] | 140 | if (boards[i].working == OK) |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 141 | boardcount_good++; |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame^] | 142 | else if (boards[i].working == NT) |
| 143 | boardcount_nt++; |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 144 | else |
| 145 | boardcount_bad++; |
| 146 | } |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 147 | |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame^] | 148 | printf("\n\nTotal amount of known good boards %s: '''%d'''; " |
| 149 | "Untested (e.g. user vanished before testing new code): '''%d'''; " |
| 150 | "Not yet supported (i.e. known-bad): '''%d'''.\n\n" |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 151 | "{| border=\"0\" valign=\"top\"\n| valign=\"top\"|\n\n%s", |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame^] | 152 | devicetype, boardcount_good, boardcount_nt, boardcount_bad, board_th); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 153 | |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 154 | for (i = 0, j = 0; boards[i].vendor != NULL; i++, j++) { |
| 155 | |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 156 | /* Alternate colors if the vendor changes. */ |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 157 | if (i > 0 && strcmp(boards[i].vendor, boards[i - 1].vendor)) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 158 | color = !color; |
| 159 | |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 160 | k = 0; |
Carl-Daniel Hailfinger | 4146ced | 2010-06-07 11:10:43 +0000 | [diff] [blame] | 161 | while ((b[k].vendor_name != NULL) && |
| 162 | (strcmp(b[k].vendor_name, boards[i].vendor) || |
| 163 | strcmp(b[k].board_name, boards[i].name))) { |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 164 | k++; |
| 165 | } |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 166 | |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 167 | printf("|- bgcolor=\"#%s\"\n| %s || %s%s %s%s || %s%s%s%s " |
| 168 | "|| {{%s}}", (color) ? "eeeeee" : "dddddd", |
| 169 | boards[i].vendor, |
| 170 | boards[i].url ? "[" : "", |
| 171 | boards[i].url ? boards[i].url : "", |
| 172 | boards[i].name, |
| 173 | boards[i].url ? "]" : "", |
Carl-Daniel Hailfinger | 2d927fb | 2012-01-04 00:48:27 +0000 | [diff] [blame] | 174 | b[k].lb_vendor ? "-p internal:mainboard=" : "—", |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 175 | b[k].lb_vendor ? b[k].lb_vendor : "", |
| 176 | b[k].lb_vendor ? ":" : "", |
| 177 | b[k].lb_vendor ? b[k].lb_part : "", |
Stefan Tauner | 2c20b28 | 2012-07-28 19:35:26 +0000 | [diff] [blame^] | 178 | (boards[i].working == OK) ? "OK" : |
| 179 | (boards[i].working == NT) ? "?3" : "No"); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 180 | |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 181 | if (boards[i].note) { |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 182 | printf("<sup>%d</sup>\n", num_notes + 1); |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 183 | snprintf(tmp, sizeof(tmp), "<sup>%d</sup> %s<br />\n", |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 184 | 1 + num_notes++, boards[i].note); |
Mathias Krause | a60faab | 2011-01-17 07:50:42 +0000 | [diff] [blame] | 185 | notes = strcat_realloc(notes, tmp); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 186 | } else { |
| 187 | printf("\n"); |
| 188 | } |
| 189 | |
| 190 | /* Split table in 'cols' columns. */ |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 191 | if (j >= ((boardcount_good + boardcount_bad) / cols + 1)) { |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 192 | printf("\n|}\n\n| valign=\"top\"|\n\n%s", board_th); |
| 193 | j = 0; |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | printf("\n|}\n\n|}\n"); |
| 198 | |
| 199 | if (num_notes > 0) |
| 200 | printf("\n<small>\n%s</small>\n", notes); |
| 201 | free(notes); |
| 202 | } |
| 203 | |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 204 | static void print_supported_boards_wiki(void) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 205 | { |
| 206 | printf("%s", board_intro); |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 207 | wiki_helper("boards", 2, boards_known); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 208 | |
| 209 | printf("%s", laptop_intro); |
Peter Lemenkov | 4adf8a6 | 2010-06-01 10:13:17 +0000 | [diff] [blame] | 210 | wiki_helper("laptops", 1, laptops_known); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 211 | } |
Carl-Daniel Hailfinger | 8841d3e | 2010-05-15 15:04:37 +0000 | [diff] [blame] | 212 | #endif |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 213 | |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 214 | static void print_supported_chips_wiki(int cols) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 215 | { |
| 216 | int i = 0, c = 1, chipcount = 0; |
Carl-Daniel Hailfinger | 4c82318 | 2011-05-04 00:39:50 +0000 | [diff] [blame] | 217 | const struct flashchip *f, *old = NULL; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 218 | uint32_t t; |
Stefan Tauner | 0015549 | 2011-06-26 20:45:35 +0000 | [diff] [blame] | 219 | char *s; |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 220 | char vmax[6]; |
| 221 | char vmin[6]; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 222 | |
Stefan Tauner | 93f7023 | 2011-07-26 14:33:46 +0000 | [diff] [blame] | 223 | for (f = flashchips; f->name != NULL; f++) { |
Stefan Tauner | 035492a | 2012-02-03 22:32:09 +0000 | [diff] [blame] | 224 | /* Don't count generic entries. */ |
| 225 | if (!strncmp(f->vendor, "Unknown", 7) || |
| 226 | !strncmp(f->vendor, "Programmer", 10) || |
| 227 | !strncmp(f->name, "unknown", 7)) |
Stefan Tauner | 4c5665f | 2012-02-17 20:03:37 +0000 | [diff] [blame] | 228 | continue; |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 229 | chipcount++; |
Stefan Tauner | 93f7023 | 2011-07-26 14:33:46 +0000 | [diff] [blame] | 230 | } |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 231 | |
| 232 | printf("\n== Supported chips ==\n\nTotal amount of supported " |
| 233 | "chips: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n" |
| 234 | "| valign=\"top\"|\n\n%s", chipcount, chip_th); |
| 235 | |
| 236 | for (f = flashchips; f->name != NULL; f++, i++) { |
Stefan Tauner | 035492a | 2012-02-03 22:32:09 +0000 | [diff] [blame] | 237 | /* Don't print generic entries. */ |
| 238 | if (!strncmp(f->vendor, "Unknown", 7) || |
| 239 | !strncmp(f->vendor, "Programmer", 10) || |
| 240 | !strncmp(f->name, "unknown", 7)) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 241 | continue; |
| 242 | |
| 243 | /* Alternate colors if the vendor changes. */ |
| 244 | if (old != NULL && strcmp(old->vendor, f->vendor)) |
| 245 | c = !c; |
| 246 | |
| 247 | t = f->tested; |
Stefan Tauner | 0015549 | 2011-06-26 20:45:35 +0000 | [diff] [blame] | 248 | s = flashbuses_to_text(f->bustype); |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 249 | sprintf(vmin, "%0.03f", f->voltage.min / (double)1000); |
| 250 | sprintf(vmax, "%0.03f", f->voltage.max / (double)1000); |
| 251 | /* '{{%s}}' is used in combination with 'OK', 'No' and '?3' to |
| 252 | * select special formatting templates for the bg color. */ |
| 253 | printf("|- bgcolor=\"#%s\"\n| %s || %s || align=\"right\" | %d " |
| 254 | "|| %s || {{%s}} || {{%s}} || {{%s}} || {{%s}}" |
| 255 | "|| %s || %s \n", |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 256 | (c == 1) ? "eeeeee" : "dddddd", f->vendor, f->name, |
Stefan Tauner | 0015549 | 2011-06-26 20:45:35 +0000 | [diff] [blame] | 257 | f->total_size, s, |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 258 | (t & TEST_OK_PROBE) ? "OK" : |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 259 | (t & TEST_BAD_PROBE) ? "No" : "?3", |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 260 | (t & TEST_OK_READ) ? "OK" : |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 261 | (t & TEST_BAD_READ) ? "No" : "?3", |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 262 | (t & TEST_OK_ERASE) ? "OK" : |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 263 | (t & TEST_BAD_ERASE) ? "No" : "?3", |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 264 | (t & TEST_OK_WRITE) ? "OK" : |
Stefan Tauner | f74a7b9 | 2011-09-14 22:09:48 +0000 | [diff] [blame] | 265 | (t & TEST_BAD_WRITE) ? "No" : "?3", |
| 266 | f->voltage.min ? vmin : "N/A", |
| 267 | f->voltage.min ? vmax : "N/A"); |
Stefan Tauner | 0015549 | 2011-06-26 20:45:35 +0000 | [diff] [blame] | 268 | free(s); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 269 | |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 270 | /* Split table into 'cols' columns. */ |
| 271 | if (i >= (chipcount / cols + 1)) { |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 272 | printf("\n|}\n\n| valign=\"top\"|\n\n%s", chip_th); |
| 273 | i = 0; |
| 274 | } |
| 275 | |
| 276 | old = f; |
| 277 | } |
| 278 | |
| 279 | printf("\n|}\n\n|}\n"); |
| 280 | } |
| 281 | |
Carl-Daniel Hailfinger | d953558 | 2011-03-08 00:09:11 +0000 | [diff] [blame] | 282 | /* Not needed for CONFIG_INTERNAL, but for all other PCI-based programmers. */ |
Carl-Daniel Hailfinger | b713d2e | 2011-05-08 00:24:18 +0000 | [diff] [blame] | 283 | #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 |
Carl-Daniel Hailfinger | ad3cc55 | 2010-07-03 11:02:10 +0000 | [diff] [blame] | 284 | static void print_supported_pcidevs_wiki(const struct pcidev_status *devs) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 285 | { |
| 286 | int i = 0; |
| 287 | static int c = 0; |
| 288 | |
| 289 | /* Alternate colors if the vendor changes. */ |
| 290 | c = !c; |
| 291 | |
| 292 | for (i = 0; devs[i].vendor_name != NULL; i++) { |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 293 | printf("|- bgcolor=\"#%s\"\n| %s || %s || " |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 294 | "%04x:%04x || {{%s}}\n", (c) ? "eeeeee" : "dddddd", |
| 295 | devs[i].vendor_name, devs[i].device_name, |
| 296 | devs[i].vendor_id, devs[i].device_id, |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 297 | (devs[i].status == NT) ? "?3" : "OK"); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 298 | } |
| 299 | } |
Carl-Daniel Hailfinger | d953558 | 2011-03-08 00:09:11 +0000 | [diff] [blame] | 300 | #endif |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 301 | |
Carl-Daniel Hailfinger | f529205 | 2009-11-17 09:57:34 +0000 | [diff] [blame] | 302 | void print_supported_wiki(void) |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 303 | { |
| 304 | time_t t = time(NULL); |
| 305 | |
| 306 | printf(wiki_header, ctime(&t), flashrom_version); |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 307 | print_supported_chips_wiki(2); |
Carl-Daniel Hailfinger | 9e3a6c4 | 2010-10-08 12:40:09 +0000 | [diff] [blame] | 308 | #if CONFIG_INTERNAL == 1 |
Uwe Hermann | a6d9c4b | 2010-05-24 15:28:12 +0000 | [diff] [blame] | 309 | print_supported_chipsets_wiki(3); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 310 | print_supported_boards_wiki(); |
Carl-Daniel Hailfinger | 8841d3e | 2010-05-15 15:04:37 +0000 | [diff] [blame] | 311 | #endif |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 312 | printf("%s", programmer_section); |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 313 | #if CONFIG_NIC3COM == 1 |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 314 | print_supported_pcidevs_wiki(nics_3com); |
| 315 | #endif |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 316 | #if CONFIG_NICREALTEK == 1 |
Uwe Hermann | 829ed84 | 2010-05-24 17:39:14 +0000 | [diff] [blame] | 317 | print_supported_pcidevs_wiki(nics_realtek); |
Uwe Hermann | 829ed84 | 2010-05-24 17:39:14 +0000 | [diff] [blame] | 318 | #endif |
Andrew Morgan | 74a828a | 2010-07-21 15:12:07 +0000 | [diff] [blame] | 319 | #if CONFIG_NICNATSEMI == 1 |
| 320 | print_supported_pcidevs_wiki(nics_natsemi); |
| 321 | #endif |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 322 | #if CONFIG_GFXNVIDIA == 1 |
Uwe Hermann | 2b5cb51 | 2009-10-06 20:25:48 +0000 | [diff] [blame] | 323 | print_supported_pcidevs_wiki(gfx_nvidia); |
| 324 | #endif |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 325 | #if CONFIG_DRKAISER == 1 |
Uwe Hermann | 07c54c8 | 2009-09-25 01:31:51 +0000 | [diff] [blame] | 326 | print_supported_pcidevs_wiki(drkaiser_pcidev); |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 327 | #endif |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 328 | #if CONFIG_SATASII == 1 |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 329 | print_supported_pcidevs_wiki(satas_sii); |
| 330 | #endif |
Carl-Daniel Hailfinger | 7112772 | 2010-05-31 15:27:27 +0000 | [diff] [blame] | 331 | #if CONFIG_ATAHPT == 1 |
Uwe Hermann | ddd5c9e | 2010-02-21 21:17:00 +0000 | [diff] [blame] | 332 | print_supported_pcidevs_wiki(ata_hpt); |
| 333 | #endif |
Carl-Daniel Hailfinger | b713d2e | 2011-05-08 00:24:18 +0000 | [diff] [blame] | 334 | #if CONFIG_NICINTEL == 1 |
| 335 | print_supported_pcidevs_wiki(nics_intel); |
| 336 | #endif |
Idwer Vollering | 004f4b7 | 2010-09-03 18:21:21 +0000 | [diff] [blame] | 337 | #if CONFIG_NICINTEL_SPI == 1 |
| 338 | print_supported_pcidevs_wiki(nics_intel_spi); |
| 339 | #endif |
Mark Marshall | 90021f2 | 2010-12-03 14:48:11 +0000 | [diff] [blame] | 340 | #if CONFIG_OGP_SPI == 1 |
| 341 | print_supported_pcidevs_wiki(ogp_spi); |
| 342 | #endif |
Carl-Daniel Hailfinger | 9a1105c | 2011-02-04 21:37:59 +0000 | [diff] [blame] | 343 | #if CONFIG_SATAMV == 1 |
| 344 | print_supported_pcidevs_wiki(satas_mv); |
| 345 | #endif |
Carl-Daniel Hailfinger | 9c8476b | 2009-09-16 12:19:03 +0000 | [diff] [blame] | 346 | printf("\n|}\n"); |
| 347 | } |
| 348 | |