Make mainboard_ops and mainboard.c file optional

This provides weak empty declaration for mainboard_ops.
The struct chip_operations is not defined for __PRE_RAM__ so
the declaration is also moved upwards in the output.

Change-Id: I101f0b8b9f0a55fb51a7c6475d53cc588c84026d
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/1931
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Kyösti Mälkki 2012-11-15 07:05:43 +02:00 committed by Patrick Georgi
parent 95efb565b6
commit e773c92ef4
2 changed files with 2 additions and 3 deletions

View File

@ -228,7 +228,7 @@ endif
# Things that appear in every board # Things that appear in every board
romstage-srcs += $(objgenerated)/crt0.s romstage-srcs += $(objgenerated)/crt0.s
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
ifeq ($(CONFIG_GENERATE_MP_TABLE),y) ifeq ($(CONFIG_GENERATE_MP_TABLE),y)
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),) ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),)
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c

View File

@ -637,6 +637,7 @@ int main(int argc, char** argv) {
fprintf(autogen, "#include \"%s/chip.h\"\n", h->name); fprintf(autogen, "#include \"%s/chip.h\"\n", h->name);
} }
fprintf(autogen, "\n#ifndef __PRE_RAM__\n"); fprintf(autogen, "\n#ifndef __PRE_RAM__\n");
fprintf(autogen, "__attribute__((weak)) struct chip_operations mainboard_ops = {};\n");
h = &headers; h = &headers;
while (h->next) { while (h->next) {
h = h->next; h = h->next;
@ -653,8 +654,6 @@ int main(int argc, char** argv) {
"ROMSTAGE_CONST struct device * ROMSTAGE_CONST last_dev = &%s;\n", lastdev->name); "ROMSTAGE_CONST struct device * ROMSTAGE_CONST last_dev = &%s;\n", lastdev->name);
#ifdef MAINBOARDS_HAVE_CHIP_H #ifdef MAINBOARDS_HAVE_CHIP_H
fprintf(autogen, "static ROMSTAGE_CONST struct mainboard_config ROMSTAGE_CONST mainboard_info_0;\n"); fprintf(autogen, "static ROMSTAGE_CONST struct mainboard_config ROMSTAGE_CONST mainboard_info_0;\n");
#else
fprintf(autogen, "extern struct chip_operations mainboard_ops;\n");
#endif #endif
walk_device_tree(autogen, &root, pass1, NULL); walk_device_tree(autogen, &root, pass1, NULL);