Kyösti Mälkki ([email protected]) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/473

-gerrit

commit a576674b90767c48a54f89f6ab6da7964d751483
Author: Kyösti Mälkki <[email protected]>
Date:   Thu Feb 23 14:17:53 2012 +0200

    Auto-generate bootblock initialisation
    
    Add toolchain rule to create bootblock_devices.h file with function
    
      static void bootblock_mainboard_init(void);
    
    This calls the bootblock_xx_init() functions for all the chips listed
    in mainboard/x/y/devtree.cb, in the order the chips are listed.
    
    To create mainboard-specific override, one can copy the generated file
    as mainboard/x/y/bootblock.c, make necessary changes there and select
    HAS_MAINBOARD_BOOTBLOCK in the board Kconfig.
    
    NOTE: A follow-up patch is required to actually use the generated
    file instead of separate CONFIG_BOOTBLOCK_xx_INIT entries.
    
    Change-Id: Ib1d101cdd68993530c9c7a653ac000a01de52ac2
    Signed-off-by: Kyösti Mälkki <[email protected]>
---
 src/arch/x86/Kconfig                    |  3 +++
 src/arch/x86/Makefile.inc               |  5 +++++
 src/mainboard/hp/dl165_g6_fam10/Kconfig |  1 +
 util/sconfig/main.c                     | 16 +++++++++-------
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 5a79516..0d58403 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -70,6 +70,9 @@ config PC80_SYSTEM
        bool
        default y
 
+config HAS_MAINBOARD_BOOTBLOCK
+       def_bool n
+
 config BOOTBLOCK_MAINBOARD_INIT
        string
 
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index abc71de..6ac1fc9 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -326,6 +326,11 @@ $(objgenerated)/bootblock.inc: 
$(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOC
                $< > $(objgenerated)/bootblock.inc.d
        $(ROMCC) -c -S $(bootblock_romccflags) $(ROMCCFLAGS) -I. $(INCLUDES) $< 
-o $@
 
+$(objgenerated)/bootblock_devices.h: 
$(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(objutil)/sconfig/sconfig
+       @printf "    SCONFIG    $(subst $(src)/,,$(<)) (bootblock)\n"
+       mkdir -p $(dir $@)
+       $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(dir $@) -b $(notdir $@)
+
 $(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o 
$(objgenerated)/bootblock.ld
        @printf "    LINK       $(subst $(obj)/,,$(@))\n"
 ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
diff --git a/src/mainboard/hp/dl165_g6_fam10/Kconfig 
b/src/mainboard/hp/dl165_g6_fam10/Kconfig
index 43c4243..21353b7 100644
--- a/src/mainboard/hp/dl165_g6_fam10/Kconfig
+++ b/src/mainboard/hp/dl165_g6_fam10/Kconfig
@@ -15,6 +15,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
        select HAVE_BUS_CONFIG
        select HAVE_PIRQ_TABLE
        select HAVE_MP_TABLE
+       select HAS_MAINBOARD_BOOTBLOCK
        select LIFT_BSP_APIC_ID
        select BOARD_ROMSIZE_KB_1024
        select RAMINIT_SYSINFO
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 43b083e..cdf54bc 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -544,7 +544,7 @@ static void usage(void)
 {
        printf("usage: sconfig vendor/mainboard outputdir [-{s|b|k} 
outputfile]\n");
        printf("\t-s file\tcreate ramstage static device map\n");
-       printf("\t-b file\tcreate bootblock init_mainboard()\n");
+       printf("\t-b file\tcreate bootblock initialisation\n");
        printf("\t-k file\tcreate Kconfig devicetree section\n");
        printf("Defaults to \"-s static.c\" if no {s|b|k} specified.\n");
        exit (1);
@@ -662,25 +662,27 @@ int main(int argc, char** argv) {
                h = &headers;
                while (h->next) {
                        h = h->next;
+                       if (!h->chiph_exists)
+                               continue;
                        fprintf(autogen, "#include \"%s/bootblock.c\"\n", 
h->name);
                }
 
                fprintf(autogen, "\n#if CONFIG_HAS_MAINBOARD_BOOTBLOCK\n");
                fprintf(autogen, "#include \"mainboard/%s/bootblock.c\"\n", 
mainboard);
                fprintf(autogen, "#else\n");
-               fprintf(autogen, "static unsigned long init_mainboard(int 
bsp_cpu)\n{\n");
-               fprintf(autogen, "\tif (! bsp_cpu) return 0;\n");
+               fprintf(autogen, "static void 
bootblock_mainboard_init(void)\n{\n");
                h = &headers;
                while (h->next) {
                        h = h->next;
-                       char * buf = translate_name(h->name, UNSLASH);
+                       if (!h->chiph_exists)
+                               continue;
+                       char * buf = translate_name(h->name, SPLIT_1ST);
                        if (buf) {
-                               fprintf(autogen, "\tinit_%s();\n", buf);
+                               fprintf(autogen, "\tbootblock_%s_init();\n", 
buf);
                                free(buf);
                        }
                }
-
-               fprintf(autogen, "\treturn 0;\n}\n");
+               fprintf(autogen, "}\n");
                fprintf(autogen, "#endif\n");
 
        } else if (scan_mode == KCONFIG_MODE) {

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

Reply via email to