Author: uwe
Date: 2009-06-20 03:21:38 +0200 (Sat, 20 Jun 2009)
New Revision: 615

Modified:
   trunk/Makefile
   trunk/flash.h
   trunk/flashrom.c
   trunk/print.c
Log:
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.

Signed-off-by: Uwe Hermann <[email protected]>
Acked-by: Uwe Hermann <[email protected]>



Modified: trunk/Makefile
===================================================================
--- trunk/Makefile      2009-06-19 19:00:48 UTC (rev 614)
+++ trunk/Makefile      2009-06-20 01:21:38 UTC (rev 615)
@@ -74,7 +74,7 @@
        $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURE_CFLAGS) -c -o $@ $< $(SVNDEF)
 
 %.o: %.c .features
-       $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURE_CFLAGS) -c $< -o $@
+       $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURE_CFLAGS) -c $< -o $@ $(SVNDEF)
 
 clean:
        rm -f $(PROGRAM) *.o

Modified: trunk/flash.h
===================================================================
--- trunk/flash.h       2009-06-19 19:00:48 UTC (rev 614)
+++ trunk/flash.h       2009-06-20 01:21:38 UTC (rev 615)
@@ -248,12 +248,6 @@
        const char *name;
 };
 
-struct board_info_url {
-       const char *vendor;
-       const char *name;
-       const char *url;
-};
-
 extern const struct board_info boards_ok[];
 extern const struct board_info boards_bad[];
 extern const struct board_info laptops_ok[];
@@ -287,12 +281,7 @@
 void print_supported_chipsets(void);
 void print_supported_boards(void);
 void print_supported_pcidevs(struct pcidev_status *devs);
-void print_supported_chips_wiki(void);
-void print_supported_boards_wiki(void);
-void print_supported_chipsets_wiki(void);
-void print_supported_pcidevs_wiki_header(void);
-void print_supported_pcidevs_wiki_footer(void);
-void print_supported_pcidevs_wiki(struct pcidev_status *devs);
+void print_wiki_tables(void);
 
 /* board_enable.c */
 void w836xx_ext_enter(uint16_t port);

Modified: trunk/flashrom.c
===================================================================
--- trunk/flashrom.c    2009-06-19 19:00:48 UTC (rev 614)
+++ trunk/flashrom.c    2009-06-20 01:21:38 UTC (rev 615)
@@ -681,14 +681,7 @@
        }
 
        if (list_supported_wiki) {
-               printf("= Supported devices =\n");
-               print_supported_chips_wiki();
-               print_supported_chipsets_wiki();
-               print_supported_boards_wiki();
-               print_supported_pcidevs_wiki_header();
-               print_supported_pcidevs_wiki(nics_3com);
-               print_supported_pcidevs_wiki(satas_sii);
-               print_supported_pcidevs_wiki_footer();
+               print_wiki_tables();
                exit(0);
        }
 

Modified: trunk/print.c
===================================================================
--- trunk/print.c       2009-06-19 19:00:48 UTC (rev 614)
+++ trunk/print.c       2009-06-20 01:21:38 UTC (rev 615)
@@ -21,9 +21,22 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <time.h>
 #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 @@
                "Laptops which have been verified to NOT work yet");
 }
 
+const char *wiki_header = "= Supported devices =\n\n\
+<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
+background-color:#eeeeee; align:right; border:1px solid #aabbcc;\"><small>\n\
+Please do '''not''' edit these tables in the wiki directly, they are \
+semi-automatically generated by pasting '''flashrom -z''' output.<br />\
+'''Last update:''' %s(generated by flashrom %s)\n</small></div>\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 @@
 ! 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\
+<div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
+background-color:#ff9f9f; align:right; border:1px solid #aabbcc;\">\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</div>\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 @@
        { "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 @@
        { "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 @@
        { "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 @@
        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 @@
 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 @@
                        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("<sup>%d</sup>\n", num_notes + 1);
+                       snprintf((char *)&tmp, 900, "<sup>%d</sup> %s<br />\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 @@
        }
 
        printf("\n|}\n\n|}\n");
+
+       if (num_notes > 0)
+               printf("\n<small>\n%s</small>\n", notes);
+       free(notes);
 }
 
 static void wiki_helper2(const char *heading, int cols)
@@ -543,6 +625,10 @@
        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 @@
        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 @@
                       (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");
+}
+


-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to