Am 25.08.2010 18:10, schrieb Jens Rottmann:
> i.e. make the mainboard the root device of the device tree - seemed plausible 
> to
> me, somehow. This compiles and boots fine, but the 'register' statement still
> doesn't have any effect, sio_gp1x_config in the mainboard's chip.h still isn't
> set - hmm, tough luck ... Why have a struct mainboard_config if it can't be
> used? Maybe it should be removed completely??
That mechanism could be fixed to work correctly again. Attached patch
should do that.


Signed-off-by: Patrick Georgi <[email protected]>
Index: util/sconfig/main.c
===================================================================
--- util/sconfig/main.c (Revision 5743)
+++ util/sconfig/main.c (Arbeitskopie)
@@ -23,7 +23,7 @@
 
 extern int linenum;
 
-struct device *head, *lastdev;
+struct device *head, *lastdev, *first;
 
 struct header headers;
 
@@ -127,6 +127,13 @@
        new_chip->type = chip;
        new_chip->chip = new_chip;
 
+       if (strncmp(path, "mainboard/", 10) == 0) {
+               new_chip->id = 0;
+               new_chip->name_underscore = "mainboard";
+               root.chip = new_chip;
+               first = new_chip;
+       }
+
        struct stat st;
        char *chip_h = malloc(strlen(path)+12);
        sprintf(chip_h, "src/%s/chip.h", path);
@@ -397,17 +404,17 @@
                printf("usage: sconfig vendor/mainboard outputdir\n");
                return 1;
        }
-       char *mainboard=argv[1];
+       char *mainboard_name=argv[1];
        char *outputdir=argv[2];
-       char *devtree=malloc(strlen(mainboard)+30);
+       char *devtree=malloc(strlen(mainboard_name)+30);
        char *outputc=malloc(strlen(outputdir)+10);
-       sprintf(devtree, "src/mainboard/%s/devicetree.cb", mainboard);
+       sprintf(devtree, "src/mainboard/%s/devicetree.cb", mainboard_name);
        sprintf(outputc, "%s/static.c", outputdir);
 
        headers.next = malloc(sizeof(struct header));
-       headers.next->name = malloc(strlen(mainboard)+12);
+       headers.next->name = malloc(strlen(mainboard_name)+12);
        headers.next->next = 0;
-       sprintf(headers.next->name, "mainboard/%s", mainboard);
+       sprintf(headers.next->name, "mainboard/%s", mainboard_name);
 
        FILE *filec = fopen(devtree, "r");
        if (!filec) {
@@ -419,6 +426,7 @@
        yyrestart(filec);
 
        lastdev = head = &root;
+       first = &mainboard;
 
        yyparse();
 
@@ -446,8 +454,12 @@
        }
        fprintf(staticc, "\n/* pass 0 */\n");
        walk_device_tree(staticc, &root, pass0, NULL);
-       fprintf(staticc, "\n/* pass 1 */\nstruct mainboard_config 
mainboard_info_0;\nstruct device **last_dev_p = &%s.next;\n", lastdev->name);
-       walk_device_tree(staticc, &root, pass1, NULL);
+       fprintf(staticc, "\n/* pass 1 */\nstruct device **last_dev_p = 
&%s.next;\n", lastdev->name);
+       if (first == &mainboard)
+               pass1(staticc, first);
+       if (root.next_sibling)
+               walk_device_tree(staticc, root.next_sibling, pass1, NULL);
+       pass1(staticc, &root);
 
        fclose(staticc);
 
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to