blob: b2ac65c91e729119875eecb63908b1b0e0fafb38 [file] [log] [blame]
hailfinger0d784cd2009-09-16 12:19:03 +00001/*
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.
hailfinger0d784cd2009-09-16 12:19:03 +000016 */
17
uwef35eeec2010-06-01 10:13:17 +000018#include <stdio.h>
hailfinger0d784cd2009-09-16 12:19:03 +000019#include <string.h>
20#include <stdlib.h>
21#include <time.h>
22#include "flash.h"
23#include "flashchips.h"
hailfinger428f6852010-07-27 22:41:39 +000024#include "programmer.h"
hailfinger0d784cd2009-09-16 12:19:03 +000025
krause2eb76212011-01-17 07:50:42 +000026static const char wiki_header[] = "= Supported devices =\n\n\
hailfinger0d784cd2009-09-16 12:19:03 +000027<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
Stuart langley68cf3cc2020-03-27 15:30:36 +110028background-color:#eeeeee; text-align:left; border:1px solid #aabbcc;\">\
stefanct15068a12011-09-14 22:09:48 +000029<small>\n\
Stuart langley68cf3cc2020-03-27 15:30:36 +110030'''Last update:''' %s (generated by flashrom %s)<br />\n\
31The tables below are generated from flashrom's source by copying the output of '''flashrom -z'''.<br /><br />\n\
32A short explanation of the cells representing the support state follows:<br />\n\
33{| border=\"0\" valign=\"top\"\n\
34! style=\"text-align:left;\" |\n\
35! style=\"text-align:left;\" |\n\
36|-\n\
37|{{OK}}\n\
38| The feature was '''tested and should work''' in general unless there is a bug in flashrom or another component in \
39the system prohibits some functionality.\n\
40|-\n\
41|{{Dep}}\n\
42| '''Configuration-dependent'''. The feature was tested and should work in general but there are common \
43configurations that drastically limit flashrom's capabilities or make it completely stop working.\n\
44|-\n\
45|{{?3}}\n\
46| The feature is '''untested''' but believed to be working.\n\
47|-\n\
48|{{NA}}\n\
49| The feature is '''not applicable''' in this configuration (e.g. write operations on ROM chips).\n\
50|-\n\
51|{{No}}\n\
52| The feature is '''known to not work'''. Don't bother testing (nor reporting. Patches welcome! ;).\n\
53|}\n\
54</small></div>\n";
55
56static const char th_start[] = "| valign=\"top\"|\n\n\
57{| border=\"0\" style=\"font-size: smaller\" valign=\"top\"\n\
58|- bgcolor=\"#6699dd\"\n";
hailfinger0d784cd2009-09-16 12:19:03 +000059
hailfinger90c7d542010-05-31 15:27:27 +000060#if CONFIG_INTERNAL == 1
Stuart langley68cf3cc2020-03-27 15:30:36 +110061static const char chipset_th[] = "\
62! align=\"left\" | Vendor\n\
63! align=\"left\" | Southbridge\n\
64! align=\"center\" | PCI IDs\n\
stefanct15068a12011-09-14 22:09:48 +000065! align=\"center\" | Status\n\n";
hailfinger0d784cd2009-09-16 12:19:03 +000066
Stuart langley68cf3cc2020-03-27 15:30:36 +110067static const char board_th[] = "\
68! align=\"left\" | Vendor\n\
69! align=\"left\" | Mainboard\n\
70! align=\"left\" | Required option\n\
stefanct15068a12011-09-14 22:09:48 +000071! align=\"center\" | Status\n\n";
hailfinger0d784cd2009-09-16 12:19:03 +000072
krause2eb76212011-01-17 07:50:42 +000073static const char board_intro[] = "\
hailfinger0d784cd2009-09-16 12:19:03 +000074\n== Supported mainboards ==\n\n\
75In general, it is very likely that flashrom works out of the box even if your \
76mainboard is not listed below.\n\nThis is a list of mainboards where we have \
77verified that they either do or do not need any special initialization to \
78make flashrom work (given flashrom supports the respective chipset and flash \
79chip), or that they do not yet work at all. If they do not work, support may \
80or may not be added later.\n\n\
stefanct312d9ff2011-06-12 19:47:55 +000081Mainboards (or individual revisions) which don't appear in the list may or may \
82not work (we don't know, someone has to give it a try). Please report any \
83further verified mainboards on the [[Mailinglist|mailing list]].\n";
hailfinger74819ad2010-05-15 15:04:37 +000084#endif
hailfinger0d784cd2009-09-16 12:19:03 +000085
Stuart langley68cf3cc2020-03-27 15:30:36 +110086static const char chip_th[] = "\
stefanct15068a12011-09-14 22:09:48 +000087! align=\"left\" | Vendor\n\
88! align=\"left\" | Device\n\
89! align=\"center\" | Size [kB]\n\
90! align=\"center\" | Type\n\
91! align=\"center\" colspan=\"4\" | Status\n\
92! align=\"center\" colspan=\"2\" | Voltage [V]\n\n\
hailfinger0d784cd2009-09-16 12:19:03 +000093|- bgcolor=\"#6699ff\"\n| colspan=\"4\" | &nbsp;\n\
stefanct15068a12011-09-14 22:09:48 +000094| Probe\n| Read\n| Erase\n| Write\n\
Stuart langley68cf3cc2020-03-27 15:30:36 +110095| align=\"center\" | Min\n| align=\"center\" | Max\n\n";
hailfinger0d784cd2009-09-16 12:19:03 +000096
Stuart langley68cf3cc2020-03-27 15:30:36 +110097static const char chip_intro[] = "\
98\n== Supported flash chips ==\n\n\
99The list below contains all chips that have some kind of explicit support added to flashrom and their last \
100known test status. Newer SPI flash chips might work even without explicit support if they implement SFDP ([\
101http://www.jedec.org/standards-documents/docs/jesd216 Serial Flash Discoverable Parameters - JESD216]). \
102Flashrom will detect this automatically and inform you about it.\n\n\
103The names used below are designed to be as concise as possible and hence contain only the characters \
104describing properties that are relevant to flashrom. Irrelevant characters specify attributes flashrom can not \
105use or even detect by itself (e.g. the physical package) and have no effect on flashrom's operation. They are \
106replaced by dots ('.') functioning as wildcards (like in Regular Expressions) or are completely omitted at the \
107end of a name.\n";
108
109static const char programmer_th[] = "\
110! align=\"left\" | Programmer\n\
111! align=\"left\" | Vendor\n\
112! align=\"left\" | Device\n\
113! align=\"center\" | IDs\n\
stefanct15068a12011-09-14 22:09:48 +0000114! align=\"center\" | Status\n\n";
hailfinger0d784cd2009-09-16 12:19:03 +0000115
Stuart langley68cf3cc2020-03-27 15:30:36 +1100116/* The output of this module relies on MediaWiki templates to select special formatting styles for table cells
117 * reflecting the test status of the respective hardware. This functions returns the correct template name for
118 * the supplied enum test_state. */
119static const char *test_state_to_template(enum test_state test_state)
120{
121 switch (test_state) {
122 case OK: return "OK";
123 case BAD: return "No";
124 case NA: return "NA";
125 case DEP: return "Dep";
126 case NT:
127 default: return "?3";
128 }
129}
130
hailfinger90c7d542010-05-31 15:27:27 +0000131#if CONFIG_INTERNAL == 1
Stuart langley68cf3cc2020-03-27 15:30:36 +1100132static const char laptop_intro[] = "\n== Supported mobile devices (laptops, tablets etc.) ==\n\n\
133In general, flashing mobile devices is more difficult because they\n\n\
hailfinger0d784cd2009-09-16 12:19:03 +0000134* often use the flash chip for stuff besides the BIOS,\n\
135* often have special protection stuff which has to be handled by flashrom,\n\
136* often use flash translation circuits which need drivers in flashrom.\n\n\
137<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
138background-color:#ff6666; align:right; border:1px solid #000000;\">\n\
139'''IMPORTANT:''' At this point we recommend to '''not''' use flashrom on \
Stuart langley68cf3cc2020-03-27 15:30:36 +1100140untested mobile devices unless you have a means to recover from a flashing that goes \
hailfinger0d784cd2009-09-16 12:19:03 +0000141wrong (a working backup flash chip and/or good soldering skills).\n</div>\n";
142
uwec4c60e82010-05-24 15:28:12 +0000143static void print_supported_chipsets_wiki(int cols)
hailfinger0d784cd2009-09-16 12:19:03 +0000144{
Stuart langley68cf3cc2020-03-27 15:30:36 +1100145 int i;
146 unsigned int lines_per_col;
hailfinger0d784cd2009-09-16 12:19:03 +0000147 const struct penable *e;
Stuart langley68cf3cc2020-03-27 15:30:36 +1100148 int enablescount = 0, color = 1;
hailfinger0d784cd2009-09-16 12:19:03 +0000149
150 for (e = chipset_enables; e->vendor_name != NULL; e++)
151 enablescount++;
152
Stuart langley68cf3cc2020-03-27 15:30:36 +1100153 /* +1 to force the resulting number of columns to be < cols */
154 lines_per_col = enablescount / cols + ((enablescount%cols) > 0 ? 1 : 0);
155
156 printf("\n== Supported chipsets ==\n\nTotal amount of supported chipsets: '''%d'''\n\n"
157 "{| border=\"0\" valign=\"top\"\n", enablescount);
hailfinger0d784cd2009-09-16 12:19:03 +0000158
159 e = chipset_enables;
Stuart langley68cf3cc2020-03-27 15:30:36 +1100160 for (i = 0; e[i].vendor_name != NULL; i++) {
161 if ((i % lines_per_col) == 0)
162 printf("%s%s", th_start, chipset_th);
163
hailfinger0d784cd2009-09-16 12:19:03 +0000164 /* Alternate colors if the vendor changes. */
165 if (i > 0 && strcmp(e[i].vendor_name, e[i - 1].vendor_name))
166 color = !color;
167
uwec4c60e82010-05-24 15:28:12 +0000168 printf("|- bgcolor=\"#%s\"\n| %s || %s "
Stuart langley68cf3cc2020-03-27 15:30:36 +1100169 "|| %04x:%04x || {{%s}}\n", (color) ? "eeeeee" : "dddddd",
hailfinger0d784cd2009-09-16 12:19:03 +0000170 e[i].vendor_name, e[i].device_name,
171 e[i].vendor_id, e[i].device_id,
Stuart langley68cf3cc2020-03-27 15:30:36 +1100172 test_state_to_template(e[i].status));
hailfinger0d784cd2009-09-16 12:19:03 +0000173
Stuart langley68cf3cc2020-03-27 15:30:36 +1100174 if (((i % lines_per_col) + 1) == lines_per_col)
175 printf("\n|}\n\n");
hailfinger0d784cd2009-09-16 12:19:03 +0000176 }
177
Stuart langley68cf3cc2020-03-27 15:30:36 +1100178 /* end inner table if it did not fill the last column fully */
179 if (((i % lines_per_col)) > 0)
180 printf("\n|}\n\n");
181 printf("\n\n|}\n");
hailfinger0d784cd2009-09-16 12:19:03 +0000182}
183
Stuart langley68cf3cc2020-03-27 15:30:36 +1100184static void print_supported_boards_wiki_helper(const char *devicetype, int cols, const struct board_info boards[])
hailfinger0d784cd2009-09-16 12:19:03 +0000185{
Stuart langley68cf3cc2020-03-27 15:30:36 +1100186 int i, k;
187 unsigned int boardcount, lines_per_col;
188 unsigned int boardcount_good = 0, boardcount_bad = 0, boardcount_nt = 0;
189 int num_notes = 0, color = 1;
hailfinger0d784cd2009-09-16 12:19:03 +0000190 char *notes = calloc(1, 1);
191 char tmp[900 + 1];
hailfinger4640bdb2011-08-31 16:19:50 +0000192 const struct board_match *b = board_matches;
hailfinger0d784cd2009-09-16 12:19:03 +0000193
uwef35eeec2010-06-01 10:13:17 +0000194 for (i = 0; boards[i].vendor != NULL; i++) {
Stuart langley68cf3cc2020-03-27 15:30:36 +1100195 if (boards[i].working == OK)
uwef35eeec2010-06-01 10:13:17 +0000196 boardcount_good++;
Stuart langley68cf3cc2020-03-27 15:30:36 +1100197 else if (boards[i].working == NT)
198 boardcount_nt++;
uwef35eeec2010-06-01 10:13:17 +0000199 else
200 boardcount_bad++;
201 }
Stuart langley68cf3cc2020-03-27 15:30:36 +1100202 boardcount = boardcount_good + boardcount_nt + boardcount_bad;
hailfinger0d784cd2009-09-16 12:19:03 +0000203
Stuart langley68cf3cc2020-03-27 15:30:36 +1100204 /* +1 to force the resulting number of columns to be < cols */
205 lines_per_col = boardcount / cols + ((boardcount%cols) > 0 ? 1 : 0);
hailfinger0d784cd2009-09-16 12:19:03 +0000206
Stuart langley68cf3cc2020-03-27 15:30:36 +1100207 printf("\n\nTotal amount of known good %s: '''%d'''; "
208 "Untested (e.g. user vanished before testing new code): '''%d'''; "
209 "Not yet supported (i.e. known-bad): '''%d'''.\n\n"
210 "{| border=\"0\" valign=\"top\"\n", devicetype, boardcount_good, boardcount_nt, boardcount_bad);
211
212 for (i = 0; boards[i].vendor != NULL; i++) {
213 if ((i % lines_per_col) == 0)
214 printf("%s%s", th_start, board_th);
uwef35eeec2010-06-01 10:13:17 +0000215
hailfinger0d784cd2009-09-16 12:19:03 +0000216 /* Alternate colors if the vendor changes. */
uwef35eeec2010-06-01 10:13:17 +0000217 if (i > 0 && strcmp(boards[i].vendor, boards[i - 1].vendor))
hailfinger0d784cd2009-09-16 12:19:03 +0000218 color = !color;
219
uwef35eeec2010-06-01 10:13:17 +0000220 k = 0;
hailfingera635fff2010-06-07 11:10:43 +0000221 while ((b[k].vendor_name != NULL) &&
222 (strcmp(b[k].vendor_name, boards[i].vendor) ||
223 strcmp(b[k].board_name, boards[i].name))) {
uwef35eeec2010-06-01 10:13:17 +0000224 k++;
225 }
hailfinger0d784cd2009-09-16 12:19:03 +0000226
uwef35eeec2010-06-01 10:13:17 +0000227 printf("|- bgcolor=\"#%s\"\n| %s || %s%s %s%s || %s%s%s%s "
228 "|| {{%s}}", (color) ? "eeeeee" : "dddddd",
229 boards[i].vendor,
230 boards[i].url ? "[" : "",
231 boards[i].url ? boards[i].url : "",
232 boards[i].name,
233 boards[i].url ? "]" : "",
Stuart langley68cf3cc2020-03-27 15:30:36 +1100234 b[k].lb_vendor ? "-p internal:mainboard=" : "&mdash;",
uwef35eeec2010-06-01 10:13:17 +0000235 b[k].lb_vendor ? b[k].lb_vendor : "",
236 b[k].lb_vendor ? ":" : "",
237 b[k].lb_vendor ? b[k].lb_part : "",
Stuart langley68cf3cc2020-03-27 15:30:36 +1100238 test_state_to_template(boards[i].working));
hailfinger0d784cd2009-09-16 12:19:03 +0000239
uwef35eeec2010-06-01 10:13:17 +0000240 if (boards[i].note) {
Stuart langley68cf3cc2020-03-27 15:30:36 +1100241 num_notes++;
242 printf(" <span id=\"%s_ref%d\"><sup>[[#%s_note%d|%d]]</sup></span>\n",
243 devicetype, num_notes, devicetype, num_notes, num_notes);
244 int ret = snprintf(tmp, sizeof(tmp),
245 "<span id=\"%s_note%d\">%d. [[#%s_ref%d|&#x2191;]]</span>"
246 " <nowiki>%s</nowiki><br />\n", devicetype, num_notes, num_notes,
247 devicetype, num_notes, boards[i].note);
248 if (ret < 0 || (unsigned int)ret >= sizeof(tmp)) {
249 fprintf(stderr, "Footnote text #%d of %s truncated (ret=%d, sizeof(tmp)=%zu)\n",
250 num_notes, devicetype, ret, sizeof(tmp));
251 }
krause2eb76212011-01-17 07:50:42 +0000252 notes = strcat_realloc(notes, tmp);
hailfinger0d784cd2009-09-16 12:19:03 +0000253 } else {
254 printf("\n");
255 }
256
Stuart langley68cf3cc2020-03-27 15:30:36 +1100257 if (((i % lines_per_col) + 1) == lines_per_col)
258 printf("\n|}\n\n");
hailfinger0d784cd2009-09-16 12:19:03 +0000259 }
260
Stuart langley68cf3cc2020-03-27 15:30:36 +1100261 /* end inner table if it did not fill the last column fully */
262 if (((i % lines_per_col)) > 0)
263 printf("\n|}\n\n");
264 printf("|}\n");
hailfinger0d784cd2009-09-16 12:19:03 +0000265
266 if (num_notes > 0)
267 printf("\n<small>\n%s</small>\n", notes);
268 free(notes);
269}
270
uwec4c60e82010-05-24 15:28:12 +0000271static void print_supported_boards_wiki(void)
hailfinger0d784cd2009-09-16 12:19:03 +0000272{
273 printf("%s", board_intro);
Stuart langley68cf3cc2020-03-27 15:30:36 +1100274 print_supported_boards_wiki_helper("mainboards", 2, boards_known);
hailfinger0d784cd2009-09-16 12:19:03 +0000275
276 printf("%s", laptop_intro);
Stuart langley68cf3cc2020-03-27 15:30:36 +1100277 print_supported_boards_wiki_helper("mobile devices", 1, laptops_known);
hailfinger0d784cd2009-09-16 12:19:03 +0000278}
hailfinger74819ad2010-05-15 15:04:37 +0000279#endif
hailfinger0d784cd2009-09-16 12:19:03 +0000280
uwec4c60e82010-05-24 15:28:12 +0000281static void print_supported_chips_wiki(int cols)
hailfinger0d784cd2009-09-16 12:19:03 +0000282{
Stuart langley68cf3cc2020-03-27 15:30:36 +1100283 unsigned int lines_per_col;
stefanct588b6d22011-06-26 20:45:35 +0000284 char *s;
stefanct15068a12011-09-14 22:09:48 +0000285 char vmax[6];
286 char vmin[6];
Stuart langley68cf3cc2020-03-27 15:30:36 +1100287 const struct flashchip *f, *old = NULL;
288 int i = 0, c = 1, chipcount = 0;
hailfinger0d784cd2009-09-16 12:19:03 +0000289
stefanct8632c922011-07-26 14:33:46 +0000290 for (f = flashchips; f->name != NULL; f++) {
Stefan Tauner0fd31b62016-08-04 17:11:25 -0700291 /* Don't count generic entries. */
292 if (!strncmp(f->vendor, "Unknown", 7) ||
293 !strncmp(f->vendor, "Programmer", 10) ||
294 !strncmp(f->name, "unknown", 7))
stefanct8632c922011-07-26 14:33:46 +0000295 continue;
hailfinger0d784cd2009-09-16 12:19:03 +0000296 chipcount++;
stefanct8632c922011-07-26 14:33:46 +0000297 }
hailfinger0d784cd2009-09-16 12:19:03 +0000298
Stuart langley68cf3cc2020-03-27 15:30:36 +1100299 /* +1 to force the resulting number of columns to be < cols */
300 lines_per_col = chipcount / cols + ((chipcount%cols) > 0 ? 1 : 0);
hailfinger0d784cd2009-09-16 12:19:03 +0000301
Stuart langley68cf3cc2020-03-27 15:30:36 +1100302 printf("%s", chip_intro);
303 printf("\nTotal amount of supported chips: '''%d'''\n\n"
304 "{| border=\"0\" valign=\"top\"\n", chipcount);
305
306 for (f = flashchips; f->name != NULL; f++) {
Stefan Tauner0fd31b62016-08-04 17:11:25 -0700307 /* Don't print generic entries. */
308 if (!strncmp(f->vendor, "Unknown", 7) ||
309 !strncmp(f->vendor, "Programmer", 10) ||
310 !strncmp(f->name, "unknown", 7))
hailfinger0d784cd2009-09-16 12:19:03 +0000311 continue;
312
Stuart langley68cf3cc2020-03-27 15:30:36 +1100313 if ((i % lines_per_col) == 0)
314 printf("%s%s", th_start, chip_th);
315
hailfinger0d784cd2009-09-16 12:19:03 +0000316 /* Alternate colors if the vendor changes. */
317 if (old != NULL && strcmp(old->vendor, f->vendor))
318 c = !c;
319
Stuart langley68cf3cc2020-03-27 15:30:36 +1100320 old = f;
stefanct588b6d22011-06-26 20:45:35 +0000321 s = flashbuses_to_text(f->bustype);
stefanct15068a12011-09-14 22:09:48 +0000322 sprintf(vmin, "%0.03f", f->voltage.min / (double)1000);
323 sprintf(vmax, "%0.03f", f->voltage.max / (double)1000);
stefanct15068a12011-09-14 22:09:48 +0000324 printf("|- bgcolor=\"#%s\"\n| %s || %s || align=\"right\" | %d "
325 "|| %s || {{%s}} || {{%s}} || {{%s}} || {{%s}}"
Stuart langley68cf3cc2020-03-27 15:30:36 +1100326 "|| %s || %s\n",
hailfinger0d784cd2009-09-16 12:19:03 +0000327 (c == 1) ? "eeeeee" : "dddddd", f->vendor, f->name,
stefanct588b6d22011-06-26 20:45:35 +0000328 f->total_size, s,
Stuart langley68cf3cc2020-03-27 15:30:36 +1100329 test_state_to_template(f->tested.probe),
330 test_state_to_template(f->tested.read),
331 test_state_to_template(f->tested.erase),
332 test_state_to_template(f->tested.write),
333 f->voltage.min ? vmin : "?",
334 f->voltage.max ? vmax : "?");
stefanct588b6d22011-06-26 20:45:35 +0000335 free(s);
hailfinger0d784cd2009-09-16 12:19:03 +0000336
Stuart langley68cf3cc2020-03-27 15:30:36 +1100337 if (((i % lines_per_col) + 1) == lines_per_col)
338 printf("\n|}\n\n");
339 i++;
hailfinger0d784cd2009-09-16 12:19:03 +0000340 }
Stuart langley68cf3cc2020-03-27 15:30:36 +1100341 /* end inner table if it did not fill the last column fully */
342 if (((i % lines_per_col)) > 0)
343 printf("\n|}\n\n");
344 printf("|}\n\n");
hailfinger0d784cd2009-09-16 12:19:03 +0000345}
346
Stuart langley68cf3cc2020-03-27 15:30:36 +1100347/* Following functions are not needed when no PCI/USB programmers are compiled in,
348 * but since print_wiki code has no size constraints we include it unconditionally. */
349static int count_supported_devs_wiki(const struct dev_entry *devs)
350{
351 unsigned int count = 0;
352 unsigned int i = 0;
353 for (i = 0; devs[i].vendor_id != 0; i++)
354 count++;
355 return count;
356}
357
358static void print_supported_devs_wiki_helper(const struct programmer_entry prog)
hailfinger0d784cd2009-09-16 12:19:03 +0000359{
360 int i = 0;
361 static int c = 0;
Stuart langley68cf3cc2020-03-27 15:30:36 +1100362 const struct dev_entry *devs = prog.devs.dev;
363 const unsigned int count = count_supported_devs_wiki(devs);
hailfinger0d784cd2009-09-16 12:19:03 +0000364
365 /* Alternate colors if the vendor changes. */
366 c = !c;
367
Stuart langley68cf3cc2020-03-27 15:30:36 +1100368 for (i = 0; devs[i].vendor_id != 0; i++) {
369 printf("|- bgcolor=\"#%s\"\n", (c) ? "eeeeee" : "dddddd");
370 if (i == 0)
371 printf("| rowspan=\"%u\" | %s |", count, prog.name);
372 printf("| %s || %s || %04x:%04x || {{%s}}\n", devs[i].vendor_name, devs[i].device_name,
373 devs[i].vendor_id, devs[i].device_id, test_state_to_template(devs[i].status));
hailfinger0d784cd2009-09-16 12:19:03 +0000374 }
375}
Stuart langley68cf3cc2020-03-27 15:30:36 +1100376
377static void print_supported_devs_wiki()
378{
379 unsigned int pci_count = 0;
380 unsigned int usb_count = 0;
381 unsigned int i;
382
383 for (i = 0; i < PROGRAMMER_INVALID; i++) {
384 const struct programmer_entry prog = programmer_table[i];
385 switch (prog.type) {
386 case USB:
387 usb_count += count_supported_devs_wiki(prog.devs.dev);
388 break;
389 case PCI:
390 pci_count += count_supported_devs_wiki(prog.devs.dev);
391 break;
392 case OTHER:
393 default:
394 break;
395 }
396 }
397
398 printf("\n== PCI Devices ==\n\n"
399 "Total amount of supported PCI devices flashrom can use as a programmer: '''%d'''\n\n"
400 "{%s%s", pci_count, th_start, programmer_th);
401
402 for (i = 0; i < PROGRAMMER_INVALID; i++) {
403 const struct programmer_entry prog = programmer_table[i];
404 if (prog.type == PCI) {
405 print_supported_devs_wiki_helper(prog);
406 }
407 }
408 printf("\n|}\n\n|}\n");
409
410 printf("\n== USB Devices ==\n\n"
411 "Total amount of supported USB devices flashrom can use as a programmer: '''%d'''\n\n"
412 "{%s%s", usb_count, th_start, programmer_th);
413
414 for (i = 0; i < PROGRAMMER_INVALID; i++) {
415 const struct programmer_entry prog = programmer_table[i];
416 if (prog.type == USB) {
417 print_supported_devs_wiki_helper(prog);
418 }
419 }
420 printf("\n|}\n\n|}\n");
421
422 printf("\n== Other programmers ==\n\n"
423 "{%s", th_start);
424 printf("! align=\"left\" | Programmer\n"
425 "! align=\"left\" | Note\n\n");
426
427 for (i = 0; i < PROGRAMMER_INVALID; i++) {
428 static int c = 0;
429 const struct programmer_entry prog = programmer_table[i];
430 if (prog.type == OTHER && prog.devs.note != NULL) {
431 c = !c;
432 printf("|- bgcolor=\"#%s\"\n", (c) ? "eeeeee" : "dddddd");
433 printf("| %s || %s", prog.name, prog.devs.note);
434 }
435 }
436 printf("\n|}\n\n|}\n");
437}
hailfinger0d784cd2009-09-16 12:19:03 +0000438
hailfingera50d60e2009-11-17 09:57:34 +0000439void print_supported_wiki(void)
hailfinger0d784cd2009-09-16 12:19:03 +0000440{
441 time_t t = time(NULL);
Stuart langley68cf3cc2020-03-27 15:30:36 +1100442 char buf[sizeof("1986-02-28T12:37:42Z")];
443 strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", gmtime(&t));
hailfinger0d784cd2009-09-16 12:19:03 +0000444
Stuart langley68cf3cc2020-03-27 15:30:36 +1100445 printf(wiki_header, buf, flashrom_version);
uwec4c60e82010-05-24 15:28:12 +0000446 print_supported_chips_wiki(2);
hailfingerebad21f2010-10-08 12:40:09 +0000447#if CONFIG_INTERNAL == 1
uwec4c60e82010-05-24 15:28:12 +0000448 print_supported_chipsets_wiki(3);
hailfinger0d784cd2009-09-16 12:19:03 +0000449 print_supported_boards_wiki();
hailfinger74819ad2010-05-15 15:04:37 +0000450#endif
Stuart langley68cf3cc2020-03-27 15:30:36 +1100451 print_supported_devs_wiki();
hailfinger0d784cd2009-09-16 12:19:03 +0000452}