diff options
author | Jeremy Compostella <jeremy.compostella@intel.com> | 2022-12-01 15:07:51 -0700 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2022-12-17 20:51:38 +0000 |
commit | 50139d00bd5fdec1764c80fda846ecc1efcbfa5d (patch) | |
tree | e2123610aa0e33e879c0b523ca23c4474d7b9545 /src/arch/x86 | |
parent | fa83887e48f196cfa303ce6de32acf1dfec7cad9 (diff) |
lib: Hook up libhwbase in romstage
It's hidden behind the configuration option `CONFIG_ROMSTAGE_LIBHWBASE'.
This also adds some glue code to use the coreboot console for debug
output and our monotonic timer framework as timer backend.
Running Ada code in romstage and more particular libhwbase brings a few
challenges as global initialized variables are not supported in
Cache-As-Ram mode.
1. The libhwbase dynamic mmio driver implementation makes the Gnat
compiler generate some global initialized variables.
For this reason, when compiled for romstage or for romstage and
ramstage the static mmio driver is enforced (`HWBASE_STATIC_MMIO').
2. The Gnat compiler generates elaboration functions to initialize
program data at runtime. These elaboration functions are called by
the romstage_adainit() function.
The data references symbols suffixed by `_E'. Even though these
symbols, at compilation time, do not contain any data and are
filled with zeros, the Gnat compiler installs them in the .data
section.
Since these symbols are actually filled with zeros, it is safe to
install them in the .bss section.
cf. https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/elaboration_order_handling_in_gnat.html#elaboration-code
This patch requires the libhwbase
https://review.coreboot.org/c/libhwbase/+/69854 CL.
BUG=b:252792591
BRANCH=firmware-brya-14505.B
TEST=libhwbae compiles for romstage and loads successfully
Change-Id: I670249d33506e886a683e55d1589cb2bf9b16aa3
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70275
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Reviewed-by: Tarun Tuli <taruntuli@google.com>
Reviewed-by: Zhixing Ma <zhixing.ma@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/car.ld | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld index 47afd78ba2..dc075c6801 100644 --- a/src/arch/x86/car.ld +++ b/src/arch/x86/car.ld @@ -67,6 +67,12 @@ *(.bss.*) *(.sbss) *(.sbss.*) + /* '*_E' GNAT generated global variables actually are un-initialized + * (filled with zeros) variables which are initialized at + * runtime. Therefore, they can be placed in the _bss region. */ +#if CONFIG(ROMSTAGE_LIBHWBASE) + *(.data.hw__*_E) +#endif . = ALIGN(ARCH_POINTER_ALIGN_SIZE); _ebss = .; RECORD_SIZE(bss) |