From a2d05012e863252abe52c241fec74e6932008b53 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sat, 20 Jun 2009 01:21:38 +0000 Subject: Various wiki output changes - Move board_info_url struct to print.c, doesn't have to be global. - Simplify flashrom.c a bit by moving stuff to print.c. Eliminate two now-useless mini-functions in print.c. - Add a note that the wiki page contents are semi-automatically generated. - Mention date of last wiki page update as well as the flashrom revision that was used to generate the wiki output. - Also generate list of supported laptops in -z output now. - Add some more board URLs. - Add a boards_notes[] table to allow for arbitrary footnotes/comments for each board in the table. All notes will automatically be turned into wiki footnotes with correct numbers and will appear at the end of the respective table. Corresponding to flashrom svn r615. Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann --- print.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 111 insertions(+), 20 deletions(-) (limited to 'print.c') diff --git a/print.c b/print.c index 53883c32f..c1247833a 100644 --- a/print.c +++ b/print.c @@ -21,9 +21,22 @@ #include #include +#include #include "flash.h" #include "flashchips.h" +struct board_info_url { + const char *vendor; + const char *name; + const char *url; +}; + +struct board_info_notes { + const char *vendor; + const char *name; + const char *note; +}; + /* * Return a string corresponding to the bustype parameter. * Memory is obtained with malloc() and can be freed with free(). @@ -222,6 +235,13 @@ void print_supported_boards(void) "Laptops which have been verified to NOT work yet"); } +const char *wiki_header = "= Supported devices =\n\n\ +
\n\ +Please do '''not''' edit these tables in the wiki directly, they are \ +semi-automatically generated by pasting '''flashrom -z''' output.
\ +'''Last update:''' %s(generated by flashrom %s)\n
\n"; + const char *chipset_th = "{| border=\"0\" style=\"font-size: smaller\"\n\ |- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\ ! align=\"left\" | Southbridge\n! align=\"left\" | PCI IDs\n\ @@ -263,9 +283,20 @@ smaller\" valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\ ! align=\"left\" | Device\n! align=\"left\" | PCI IDs\n\ ! align=\"left\" | Status\n\n"; +const char *laptop_intro = "\n== Supported laptops/notebooks ==\n\n\ +In general, flashing laptops is more difficult because laptops\n\n\ +* often use the flash chip for stuff besides the BIOS,\n\ +* often have special protection stuff which has to be handled by flashrom,\n\ +* often use flash translation circuits which need drivers in flashrom.\n\n\ +
\n\ +'''IMPORTANT:''' At this point we recommend to '''not''' use flashrom on \ +untested laptops unless you have a means to recover from a flashing that goes \ +wrong (a working backup flash chip and/or good soldering skills).\n
\n"; + +/* Please keep these lists alphabetically ordered by vendor/board. */ const struct board_info_url boards_url[] = { /* Verified working boards that don't need write-enables. */ - /* Please keep this list alphabetically ordered by vendor/board. */ { "Abit", "AX8", "http://www.abit.com.tw/page/en/motherboard/motherboard_detail.php?DEFTITLE=Y&fMTYPE=Socket%20939&pMODEL_NAME=AX8" }, { "Advantech", "PCM-5820", "http://taiwan.advantech.com.tw/products/Model_Detail.asp?model_id=1-1TGZL8&BU=ACG&PD=" }, { "ASI", "MB-5BLMP", "http://www.hojerteknik.com/winnet.htm" }, @@ -342,7 +373,6 @@ const struct board_info_url boards_url[] = { { "VIA", "VB700X", "http://www.via.com.tw/en/products/mainboards/motherboards.jsp?motherboard_id=490" }, /* Verified working boards that DO need write-enables. */ - /* Please keep this list alphabetically ordered by vendor/board. */ { "Acorp", "6A815EPD", NULL }, { "agami", "Aruma", NULL }, { "Albatron", "PM266A", NULL }, @@ -380,7 +410,6 @@ const struct board_info_url boards_url[] = { { "VIA", "PC3500G", NULL }, /* Verified non-working boards (for now). */ - /* Please keep this list alphabetically ordered by vendor/board. */ { "Abit", "IS-10", "http://www.abit.com.tw/page/en/motherboard/motherboard_detail.php?pMODEL_NAME=IS-10&fMTYPE=Socket+478" }, { "ASUS", "M3N78 Pro", NULL }, { "ASUS", "MEW-AM", "ftp://ftp.asus.com.tw/pub/ASUS/mb/sock370/810/mew-am/" }, @@ -404,19 +433,43 @@ const struct board_info_url boards_url[] = { { "Sun", "Fire x4600", "http://www.sun.com/servers/x64/x4600/" }, /* Verified working laptops. */ - /* Please keep this list alphabetically ordered by vendor/board. */ - { "Lenovo", "3000 V100 TF05Cxx", NULL }, + { "Lenovo", "3000 V100 TF05Cxx", "http://www5.pc.ibm.com/europe/products.nsf/products?openagent&brand=Lenovo3000Notebook&series=Lenovo+3000+V+Series#viewallmodelstop" }, /* Verified non-working laptops (for now). */ - /* Please keep this list alphabetically ordered by vendor/board. */ { "Acer", "Aspire One", NULL }, - { "Dell", "Latitude CPi A366XT", NULL }, - { "IBM/Lenovo", "Thinkpad T40p", NULL }, + { "Dell", "Latitude CPi A366XT", "http://www.coreboot.org/Dell_Latitude_CPi_A366XT" }, + { "IBM/Lenovo", "Thinkpad T40p", "http://www.thinkwiki.org/wiki/Category:T40p" }, { "IBM/Lenovo", "240", NULL }, { NULL, NULL, 0 }, }; +/* Please keep these lists alphabetically ordered by vendor/board. */ +const struct board_info_notes boards_notes[] = { + /* Verified working boards that don't need write-enables. */ + { "ASI", "MB-5BLMP", "Used in the IGEL WinNET III thin client." }, + { "ASUS", "A8V-E SE", "See http://www.coreboot.org/pipermail/coreboot/2007-October/026496.html." }, + { "ASUS", "M2A-VM", "See http://www.coreboot.org/pipermail/coreboot/2007-September/025281.html." }, + { "BCOM", "WinNET100", "Used in the IGEL-316 thin client." }, + + /* Verified working boards that DO need write-enables. */ + { "Acer", "Aspire One", "See http://www.coreboot.org/pipermail/coreboot/2009-May/048041.html." }, + + /* Verified non-working boards (for now). */ + { "MSI", "MS-6178", "Immediately powers off if you try to hot-plug the chip. However, this does '''not''' happen if you use coreboot." }, + { "MSI", "MS-7260 (K9N Neo)", "Interestingly flashrom does not work when the vendor BIOS is booted, but it ''does'' work flawlessly when the machine is booted with coreboot." }, + + /* Verified working laptops. */ + /* None which need comments, yet... */ + + /* Verified non-working laptops (for now). */ + { "Acer", "Aspire One", "http://www.coreboot.org/pipermail/coreboot/2009-May/048041.html" }, + { "Dell", "Latitude CPi A366XT", "The laptop immediately powers off if you try to hot-swap the chip. It's not yet tested if write/erase would work on this laptop." }, + { "IBM/Lenovo", "Thinkpad T40p", "Seems to (partially) work at first, but one block/sector cannot be written which then leaves you with a bricked laptop. Maybe this can be investigated and fixed in software later." }, + + { NULL, NULL, 0 }, +}; + static int url(const char *vendor, const char *board) { int i; @@ -430,6 +483,19 @@ static int url(const char *vendor, const char *board) return -1; } +static int note(const char *vendor, const char *board) +{ + int i; + const struct board_info_notes *n = boards_notes; + + for (i = 0; n[i].vendor != NULL; i++) { + if (!strcmp(vendor, n[i].vendor) && !strcmp(board, n[i].name)) + return i; + } + + return -1; +} + void print_supported_chipsets_wiki(void) { int i, j, enablescount = 0, color = 1; @@ -467,9 +533,11 @@ void print_supported_chipsets_wiki(void) static void wiki_helper(const char *heading, const char *status, int cols, const struct board_info boards[]) { - int i, j, k, boardcount = 0, color = 1; + int i, j, k, c, boardcount = 0, color = 1, num_notes = 0; const struct board_info *b; const struct board_info_url *u = boards_url; + char *notes = calloc(1, 1); + char tmp[900 + 1]; for (b = boards; b->vendor != NULL; b++) boardcount++; @@ -484,13 +552,23 @@ static void wiki_helper(const char *heading, const char *status, color = !color; k = url(b[i].vendor, b[i].name); + c = note(b[i].vendor, b[i].name); printf("|- bgcolor=\"#%s\" valign=\"top\"\n| %s || %s%s %s%s ||" - " {{%s}}\n", (color) ? "eeeeee" : "dddddd", b[i].vendor, + " {{%s}}", (color) ? "eeeeee" : "dddddd", b[i].vendor, (k != -1 && u[k].url) ? "[" : "", (k != -1 && u[k].url) ? u[k].url : "", b[i].name, (k != -1 && u[k].url) ? "]" : "", status); + if (c != -1) { + printf("%d\n", num_notes + 1); + snprintf((char *)&tmp, 900, "%d %s
\n", + 1 + num_notes++, boards_notes[c].note); + notes = strcat_realloc(notes, (char *)&tmp); + } else { + printf("\n"); + } + /* Split table in 'cols' columns. */ if (j >= (boardcount / cols + 1)) { printf("\n|}\n\n| valign=\"top\"|\n\n%s", board_th); @@ -499,6 +577,10 @@ static void wiki_helper(const char *heading, const char *status, } printf("\n|}\n\n|}\n"); + + if (num_notes > 0) + printf("\n\n%s\n", notes); + free(notes); } static void wiki_helper2(const char *heading, int cols) @@ -543,6 +625,10 @@ void print_supported_boards_wiki(void) wiki_helper("Known good (worked out of the box)", "OK", 3, boards_ok); wiki_helper2("Known good (with write-enable code in flashrom)", 3); wiki_helper("Not supported (yet)", "No", 3, boards_bad); + + printf("%s", laptop_intro); + wiki_helper("Known good (worked out of the box)", "OK", 1, laptops_ok); + wiki_helper("Not supported (yet)", "No", 1, laptops_bad); } void print_supported_chips_wiki(void) @@ -586,16 +672,6 @@ void print_supported_chips_wiki(void) printf("\n|}\n\n|}\n"); } -void print_supported_pcidevs_wiki_header(void) -{ - printf("%s", programmer_section); -} - -void print_supported_pcidevs_wiki_footer(void) -{ - printf("\n|}\n"); -} - void print_supported_pcidevs_wiki(struct pcidev_status *devs) { int i = 0; @@ -612,3 +688,18 @@ void print_supported_pcidevs_wiki(struct pcidev_status *devs) (devs[i].status == PCI_NT) ? (c) ? "?2" : "?" : "OK"); } } + +void print_wiki_tables(void) +{ + time_t t = time(NULL); + + printf(wiki_header, ctime(&t), FLASHROM_VERSION); + print_supported_chips_wiki(); + print_supported_chipsets_wiki(); + print_supported_boards_wiki(); + printf("%s", programmer_section); + print_supported_pcidevs_wiki(nics_3com); + print_supported_pcidevs_wiki(satas_sii); + printf("\n|}\n"); +} + -- cgit v1.2.3