blob: db5743e7098da16f98496bfb75e06488be2d850c [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.
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
uwef35eeec2010-06-01 10:13:17 +000022#include <stdio.h>
hailfinger0d784cd2009-09-16 12:19:03 +000023#include <string.h>
24#include <stdlib.h>
25#include <time.h>
26#include "flash.h"
27#include "flashchips.h"
David Hendricks82fd8ae2010-08-04 14:34:54 -070028#include "programmer.h"
hailfinger0d784cd2009-09-16 12:19:03 +000029
David Hendricks668f29d2011-01-27 18:51:45 -080030static const char wiki_header[] = "= Supported devices =\n\n\
hailfinger0d784cd2009-09-16 12:19:03 +000031<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
32background-color:#eeeeee; align:right; border:1px solid #aabbcc;\"><small>\n\
33Please do '''not''' edit these tables in the wiki directly, they are \
34generated by pasting '''flashrom -z''' output.<br />\
35'''Last update:''' %s(generated by flashrom %s)\n</small></div>\n";
36
hailfinger90c7d542010-05-31 15:27:27 +000037#if CONFIG_INTERNAL == 1
David Hendricks668f29d2011-01-27 18:51:45 -080038static const char chipset_th[] = "{| border=\"0\" style=\"font-size: smaller\"\n\
hailfinger0d784cd2009-09-16 12:19:03 +000039|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
40! align=\"left\" | Southbridge\n! align=\"left\" | PCI IDs\n\
41! align=\"left\" | Status\n\n";
42
David Hendricks668f29d2011-01-27 18:51:45 -080043static const char board_th[] = "{| border=\"0\" style=\"font-size: smaller\" \
hailfinger0d784cd2009-09-16 12:19:03 +000044valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
uwef35eeec2010-06-01 10:13:17 +000045! align=\"left\" | Mainboard\n! align=\"left\" | Required option\n! align=\"left\" | Status\n\n";
hailfinger0d784cd2009-09-16 12:19:03 +000046
David Hendricks668f29d2011-01-27 18:51:45 -080047static const char board_intro[] = "\
hailfinger0d784cd2009-09-16 12:19:03 +000048\n== Supported mainboards ==\n\n\
49In general, it is very likely that flashrom works out of the box even if your \
50mainboard is not listed below.\n\nThis is a list of mainboards where we have \
51verified that they either do or do not need any special initialization to \
52make flashrom work (given flashrom supports the respective chipset and flash \
53chip), or that they do not yet work at all. If they do not work, support may \
54or may not be added later.\n\n\
55Mainboards which don't appear in the list may or may not work (we don't \
56know, someone has to give it a try). Please report any further verified \
57mainboards on the [[Mailinglist|mailing list]].\n";
hailfinger74819ad2010-05-15 15:04:37 +000058#endif
hailfinger0d784cd2009-09-16 12:19:03 +000059
David Hendricks668f29d2011-01-27 18:51:45 -080060static const char chip_th[] = "{| border=\"0\" style=\"font-size: smaller\" \
hailfinger0d784cd2009-09-16 12:19:03 +000061valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
62! align=\"left\" | Device\n! align=\"left\" | Size / KB\n\
63! align=\"left\" | Type\n! align=\"left\" colspan=\"4\" | Status\n\n\
64|- bgcolor=\"#6699ff\"\n| colspan=\"4\" | &nbsp;\n\
hailfingerf5fec712010-01-18 07:02:19 +000065| Probe\n| Read\n| Erase\n| Write\n\n";
hailfinger0d784cd2009-09-16 12:19:03 +000066
David Hendricks668f29d2011-01-27 18:51:45 -080067static const char programmer_section[] = "\
hailfinger0d784cd2009-09-16 12:19:03 +000068\n== Supported programmers ==\n\nThis is a list \
69of supported PCI devices flashrom can use as programmer:\n\n{| border=\"0\" \
70valign=\"top\"\n| valign=\"top\"|\n\n{| border=\"0\" style=\"font-size: \
71smaller\" valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
72! align=\"left\" | Device\n! align=\"left\" | PCI IDs\n\
73! align=\"left\" | Status\n\n";
74
hailfinger90c7d542010-05-31 15:27:27 +000075#if CONFIG_INTERNAL == 1
David Hendricks668f29d2011-01-27 18:51:45 -080076static const char laptop_intro[] = "\n== Supported laptops/notebooks ==\n\n\
hailfinger0d784cd2009-09-16 12:19:03 +000077In general, flashing laptops is more difficult because laptops\n\n\
78* often use the flash chip for stuff besides the BIOS,\n\
79* often have special protection stuff which has to be handled by flashrom,\n\
80* often use flash translation circuits which need drivers in flashrom.\n\n\
81<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
82background-color:#ff6666; align:right; border:1px solid #000000;\">\n\
83'''IMPORTANT:''' At this point we recommend to '''not''' use flashrom on \
84untested laptops unless you have a means to recover from a flashing that goes \
85wrong (a working backup flash chip and/or good soldering skills).\n</div>\n";
86
uwec4c60e82010-05-24 15:28:12 +000087static void print_supported_chipsets_wiki(int cols)
hailfinger0d784cd2009-09-16 12:19:03 +000088{
89 int i, j, enablescount = 0, color = 1;
90 const struct penable *e;
91
92 for (e = chipset_enables; e->vendor_name != NULL; e++)
93 enablescount++;
94
95 printf("\n== Supported chipsets ==\n\nTotal amount of supported "
96 "chipsets: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n| "
97 "valign=\"top\"|\n\n%s", enablescount, chipset_th);
98
99 e = chipset_enables;
100 for (i = 0, j = 0; e[i].vendor_name != NULL; i++, j++) {
101 /* Alternate colors if the vendor changes. */
102 if (i > 0 && strcmp(e[i].vendor_name, e[i - 1].vendor_name))
103 color = !color;
104
uwec4c60e82010-05-24 15:28:12 +0000105 printf("|- bgcolor=\"#%s\"\n| %s || %s "
hailfinger0d784cd2009-09-16 12:19:03 +0000106 "|| %04x:%04x || %s\n", (color) ? "eeeeee" : "dddddd",
107 e[i].vendor_name, e[i].device_name,
108 e[i].vendor_id, e[i].device_id,
uwec4c60e82010-05-24 15:28:12 +0000109 (e[i].status == OK) ? "{{OK}}" : "{{?3}}");
hailfinger0d784cd2009-09-16 12:19:03 +0000110
uwec4c60e82010-05-24 15:28:12 +0000111 /* Split table in 'cols' columns. */
112 if (j >= (enablescount / cols + 1)) {
hailfinger0d784cd2009-09-16 12:19:03 +0000113 printf("\n|}\n\n| valign=\"top\"|\n\n%s", chipset_th);
114 j = 0;
115 }
116 }
117
118 printf("\n|}\n\n|}\n");
119}
120
uwef35eeec2010-06-01 10:13:17 +0000121static void wiki_helper(const char *devicetype, int cols,
122 const struct board_info boards[])
hailfinger0d784cd2009-09-16 12:19:03 +0000123{
uwef35eeec2010-06-01 10:13:17 +0000124 int i, j, k = 0, boardcount_good = 0, boardcount_bad = 0, color = 1;
125 int num_notes = 0;
hailfinger0d784cd2009-09-16 12:19:03 +0000126 char *notes = calloc(1, 1);
127 char tmp[900 + 1];
David Hendricks82fd8ae2010-08-04 14:34:54 -0700128 const struct board_pciid_enable *b = board_pciid_enables;
hailfinger0d784cd2009-09-16 12:19:03 +0000129
uwef35eeec2010-06-01 10:13:17 +0000130 for (i = 0; boards[i].vendor != NULL; i++) {
131 if (boards[i].working)
132 boardcount_good++;
133 else
134 boardcount_bad++;
135 }
hailfinger0d784cd2009-09-16 12:19:03 +0000136
uwef35eeec2010-06-01 10:13:17 +0000137 printf("\n\nTotal amount of supported %s: '''%d'''. "
138 "Not yet supported (i.e., known-bad): '''%d'''.\n\n"
hailfinger0d784cd2009-09-16 12:19:03 +0000139 "{| border=\"0\" valign=\"top\"\n| valign=\"top\"|\n\n%s",
uwef35eeec2010-06-01 10:13:17 +0000140 devicetype, boardcount_good, boardcount_bad, board_th);
hailfinger0d784cd2009-09-16 12:19:03 +0000141
uwef35eeec2010-06-01 10:13:17 +0000142 for (i = 0, j = 0; boards[i].vendor != NULL; i++, j++) {
143
hailfinger0d784cd2009-09-16 12:19:03 +0000144 /* Alternate colors if the vendor changes. */
uwef35eeec2010-06-01 10:13:17 +0000145 if (i > 0 && strcmp(boards[i].vendor, boards[i - 1].vendor))
hailfinger0d784cd2009-09-16 12:19:03 +0000146 color = !color;
147
uwef35eeec2010-06-01 10:13:17 +0000148 k = 0;
hailfingera635fff2010-06-07 11:10:43 +0000149 while ((b[k].vendor_name != NULL) &&
150 (strcmp(b[k].vendor_name, boards[i].vendor) ||
151 strcmp(b[k].board_name, boards[i].name))) {
uwef35eeec2010-06-01 10:13:17 +0000152 k++;
153 }
hailfinger0d784cd2009-09-16 12:19:03 +0000154
uwef35eeec2010-06-01 10:13:17 +0000155 printf("|- bgcolor=\"#%s\"\n| %s || %s%s %s%s || %s%s%s%s "
156 "|| {{%s}}", (color) ? "eeeeee" : "dddddd",
157 boards[i].vendor,
158 boards[i].url ? "[" : "",
159 boards[i].url ? boards[i].url : "",
160 boards[i].name,
161 boards[i].url ? "]" : "",
162 b[k].lb_vendor ? "-m " : "&mdash;",
163 b[k].lb_vendor ? b[k].lb_vendor : "",
164 b[k].lb_vendor ? ":" : "",
165 b[k].lb_vendor ? b[k].lb_part : "",
166 (boards[i].working) ? "OK" : "No");
hailfinger0d784cd2009-09-16 12:19:03 +0000167
uwef35eeec2010-06-01 10:13:17 +0000168 if (boards[i].note) {
hailfinger0d784cd2009-09-16 12:19:03 +0000169 printf("<sup>%d</sup>\n", num_notes + 1);
David Hendricks668f29d2011-01-27 18:51:45 -0800170 snprintf(tmp, sizeof(tmp), "<sup>%d</sup> %s<br />\n",
uwef35eeec2010-06-01 10:13:17 +0000171 1 + num_notes++, boards[i].note);
David Hendricks668f29d2011-01-27 18:51:45 -0800172 notes = strcat_realloc(notes, tmp);
hailfinger0d784cd2009-09-16 12:19:03 +0000173 } else {
174 printf("\n");
175 }
176
177 /* Split table in 'cols' columns. */
uwef35eeec2010-06-01 10:13:17 +0000178 if (j >= ((boardcount_good + boardcount_bad) / cols + 1)) {
hailfinger0d784cd2009-09-16 12:19:03 +0000179 printf("\n|}\n\n| valign=\"top\"|\n\n%s", board_th);
180 j = 0;
181 }
182 }
183
184 printf("\n|}\n\n|}\n");
185
186 if (num_notes > 0)
187 printf("\n<small>\n%s</small>\n", notes);
188 free(notes);
189}
190
uwec4c60e82010-05-24 15:28:12 +0000191static void print_supported_boards_wiki(void)
hailfinger0d784cd2009-09-16 12:19:03 +0000192{
193 printf("%s", board_intro);
uwef35eeec2010-06-01 10:13:17 +0000194 wiki_helper("boards", 2, boards_known);
hailfinger0d784cd2009-09-16 12:19:03 +0000195
196 printf("%s", laptop_intro);
uwef35eeec2010-06-01 10:13:17 +0000197 wiki_helper("laptops", 1, laptops_known);
hailfinger0d784cd2009-09-16 12:19:03 +0000198}
hailfinger74819ad2010-05-15 15:04:37 +0000199#endif
hailfinger0d784cd2009-09-16 12:19:03 +0000200
uwec4c60e82010-05-24 15:28:12 +0000201static void print_supported_chips_wiki(int cols)
hailfinger0d784cd2009-09-16 12:19:03 +0000202{
203 int i = 0, c = 1, chipcount = 0;
204 struct flashchip *f, *old = NULL;
205 uint32_t t;
206
207 for (f = flashchips; f->name != NULL; f++)
208 chipcount++;
209
210 printf("\n== Supported chips ==\n\nTotal amount of supported "
211 "chips: '''%d'''\n\n{| border=\"0\" valign=\"top\"\n"
212 "| valign=\"top\"|\n\n%s", chipcount, chip_th);
213
214 for (f = flashchips; f->name != NULL; f++, i++) {
215 /* Don't print "unknown XXXX SPI chip" entries. */
216 if (!strncmp(f->name, "unknown", 7))
217 continue;
218
219 /* Alternate colors if the vendor changes. */
220 if (old != NULL && strcmp(old->vendor, f->vendor))
221 c = !c;
222
223 t = f->tested;
uwec4c60e82010-05-24 15:28:12 +0000224 printf("|- bgcolor=\"#%s\"\n| %s || %s || %d "
hailfinger0d784cd2009-09-16 12:19:03 +0000225 "|| %s || {{%s}} || {{%s}} || {{%s}} || {{%s}}\n",
226 (c == 1) ? "eeeeee" : "dddddd", f->vendor, f->name,
227 f->total_size, flashbuses_to_text(f->bustype),
228 (t & TEST_OK_PROBE) ? "OK" :
uwec4c60e82010-05-24 15:28:12 +0000229 (t & TEST_BAD_PROBE) ? "No" : "?3",
hailfinger0d784cd2009-09-16 12:19:03 +0000230 (t & TEST_OK_READ) ? "OK" :
uwec4c60e82010-05-24 15:28:12 +0000231 (t & TEST_BAD_READ) ? "No" : "?3",
hailfinger0d784cd2009-09-16 12:19:03 +0000232 (t & TEST_OK_ERASE) ? "OK" :
uwec4c60e82010-05-24 15:28:12 +0000233 (t & TEST_BAD_ERASE) ? "No" : "?3",
hailfinger0d784cd2009-09-16 12:19:03 +0000234 (t & TEST_OK_WRITE) ? "OK" :
uwec4c60e82010-05-24 15:28:12 +0000235 (t & TEST_BAD_WRITE) ? "No" : "?3");
hailfinger0d784cd2009-09-16 12:19:03 +0000236
uwec4c60e82010-05-24 15:28:12 +0000237 /* Split table into 'cols' columns. */
238 if (i >= (chipcount / cols + 1)) {
hailfinger0d784cd2009-09-16 12:19:03 +0000239 printf("\n|}\n\n| valign=\"top\"|\n\n%s", chip_th);
240 i = 0;
241 }
242
243 old = f;
244 }
245
246 printf("\n|}\n\n|}\n");
247}
248
David Hendricks82fd8ae2010-08-04 14:34:54 -0700249static void print_supported_pcidevs_wiki(const struct pcidev_status *devs)
hailfinger0d784cd2009-09-16 12:19:03 +0000250{
251 int i = 0;
252 static int c = 0;
253
254 /* Alternate colors if the vendor changes. */
255 c = !c;
256
257 for (i = 0; devs[i].vendor_name != NULL; i++) {
uwec4c60e82010-05-24 15:28:12 +0000258 printf("|- bgcolor=\"#%s\"\n| %s || %s || "
hailfinger0d784cd2009-09-16 12:19:03 +0000259 "%04x:%04x || {{%s}}\n", (c) ? "eeeeee" : "dddddd",
260 devs[i].vendor_name, devs[i].device_name,
261 devs[i].vendor_id, devs[i].device_id,
uwec4c60e82010-05-24 15:28:12 +0000262 (devs[i].status == NT) ? "?3" : "OK");
hailfinger0d784cd2009-09-16 12:19:03 +0000263 }
264}
265
hailfingera50d60e2009-11-17 09:57:34 +0000266void print_supported_wiki(void)
hailfinger0d784cd2009-09-16 12:19:03 +0000267{
268 time_t t = time(NULL);
269
270 printf(wiki_header, ctime(&t), flashrom_version);
uwec4c60e82010-05-24 15:28:12 +0000271 print_supported_chips_wiki(2);
David Hendricksc801adb2010-12-09 16:58:56 -0800272#if CONFIG_INTERNAL == 1
uwec4c60e82010-05-24 15:28:12 +0000273 print_supported_chipsets_wiki(3);
hailfinger0d784cd2009-09-16 12:19:03 +0000274 print_supported_boards_wiki();
hailfinger74819ad2010-05-15 15:04:37 +0000275#endif
hailfinger0d784cd2009-09-16 12:19:03 +0000276 printf("%s", programmer_section);
hailfinger90c7d542010-05-31 15:27:27 +0000277#if CONFIG_NIC3COM == 1
hailfinger0d784cd2009-09-16 12:19:03 +0000278 print_supported_pcidevs_wiki(nics_3com);
279#endif
hailfinger90c7d542010-05-31 15:27:27 +0000280#if CONFIG_NICREALTEK == 1
uweae6a69a2010-05-24 17:39:14 +0000281 print_supported_pcidevs_wiki(nics_realtek);
282 print_supported_pcidevs_wiki(nics_realteksmc1211);
283#endif
David Hendricks82fd8ae2010-08-04 14:34:54 -0700284#if CONFIG_NICNATSEMI == 1
285 print_supported_pcidevs_wiki(nics_natsemi);
286#endif
hailfinger90c7d542010-05-31 15:27:27 +0000287#if CONFIG_GFXNVIDIA == 1
uwe67948ad2009-10-06 20:25:48 +0000288 print_supported_pcidevs_wiki(gfx_nvidia);
289#endif
hailfinger90c7d542010-05-31 15:27:27 +0000290#if CONFIG_DRKAISER == 1
uwe01623e62009-09-25 01:31:51 +0000291 print_supported_pcidevs_wiki(drkaiser_pcidev);
hailfinger0d784cd2009-09-16 12:19:03 +0000292#endif
hailfinger90c7d542010-05-31 15:27:27 +0000293#if CONFIG_SATASII == 1
hailfinger0d784cd2009-09-16 12:19:03 +0000294 print_supported_pcidevs_wiki(satas_sii);
295#endif
hailfinger90c7d542010-05-31 15:27:27 +0000296#if CONFIG_ATAHPT == 1
uwe7e627c82010-02-21 21:17:00 +0000297 print_supported_pcidevs_wiki(ata_hpt);
298#endif
David Hendricksc801adb2010-12-09 16:58:56 -0800299#if CONFIG_NICINTEL_SPI == 1
300 print_supported_pcidevs_wiki(nics_intel_spi);
301#endif
David Hendricks668f29d2011-01-27 18:51:45 -0800302#if CONFIG_OGP_SPI == 1
303 print_supported_pcidevs_wiki(ogp_spi);
304#endif
hailfinger0d784cd2009-09-16 12:19:03 +0000305 printf("\n|}\n");
306}
307