diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | src/cpu/intel/car/romstage.c | 13 | ||||
-rw-r--r-- | src/include/adainit.h | 6 | ||||
-rw-r--r-- | src/lib/Kconfig | 5 | ||||
-rw-r--r-- | src/lib/Makefile.inc | 1 | ||||
-rw-r--r-- | src/lib/gnat/Makefile.inc | 3 |
6 files changed, 31 insertions, 0 deletions
@@ -316,6 +316,9 @@ $(eval $(postinclude-hooks)) $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) # Build Kconfig .ads if necessary +ifeq ($(CONFIG_ROMSTAGE_ADA),y) +romstage-srcs += $(obj)/romstage/$(notdir $(KCONFIG_AUTOADS)) +endif ifeq ($(CONFIG_RAMSTAGE_ADA),y) ramstage-srcs += $(obj)/ramstage/$(notdir $(KCONFIG_AUTOADS)) endif diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c index c7c218b8ed..7df512dce0 100644 --- a/src/cpu/intel/car/romstage.c +++ b/src/cpu/intel/car/romstage.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <adainit.h> #include <arch/romstage.h> #include <arch/symbols.h> #include <commonlib/helpers.h> @@ -40,6 +41,18 @@ void __noreturn romstage_main(void) if (CONFIG(VBOOT_EARLY_EC_SYNC)) vboot_sync_ec(); + /* + * We can generally jump between C and Ada code back and forth + * without trouble. But since we don't have an Ada main() we + * have to do some Ada package initializations that GNAT would + * do there. This has to be done before calling any Ada code. + * + * The package initializations should not have any dependen- + * cies on C code. So we can call them here early, and don't + * have to worry at which point we can start to use Ada. + */ + romstage_adainit(); + mainboard_romstage_entry(); /* Check the stack. */ diff --git a/src/include/adainit.h b/src/include/adainit.h index 4953d4476d..041ef677ad 100644 --- a/src/include/adainit.h +++ b/src/include/adainit.h @@ -15,6 +15,12 @@ * lizations automatically. When not, we have to call it explicitly. */ +#if CONFIG(ROMSTAGE_ADA) +void romstage_adainit(void); +#else +static inline void romstage_adainit(void) {} +#endif + #if CONFIG(RAMSTAGE_ADA) void ramstage_adainit(void); #else diff --git a/src/lib/Kconfig b/src/lib/Kconfig index ae96fc61ee..d108962bac 100644 --- a/src/lib/Kconfig +++ b/src/lib/Kconfig @@ -5,6 +5,11 @@ config MISSING_BOARD_RESET implementation. This activates a stub that logs the missing board reset and halts execution. +config ROMSTAGE_ADA + bool + help + Selected by features that use Ada code in romstage. + config RAMSTAGE_ADA bool help diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 1c7bc22c1e..3e5b151b13 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -339,6 +339,7 @@ $(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL) $(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL) $(RMODTOOL) -i $< -o $@ +romstage-$(CONFIG_ROMSTAGE_ADA) += cb.ads ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads ifeq ($(CONFIG_RAMSTAGE_LIBHWBASE),y) diff --git a/src/lib/gnat/Makefile.inc b/src/lib/gnat/Makefile.inc index 065ba71404..150a715067 100644 --- a/src/lib/gnat/Makefile.inc +++ b/src/lib/gnat/Makefile.inc @@ -51,6 +51,9 @@ $(foreach arch,$(standard-archs), \ $(foreach arch,$(standard-archs), \ $(eval $(call libgnat-template,$(arch)))) +ifeq ($(CONFIG_ROMSTAGE_ADA),y) +romstage-libs += $(obj)/libgnat-$(ARCH-romstage-y)/libgnat.a +endif ifeq ($(CONFIG_RAMSTAGE_ADA),y) ramstage-libs += $(obj)/libgnat-$(ARCH-ramstage-y)/libgnat.a endif |