coreboot-kgpe-d16/src/lib
Jeremy Compostella 50139d00bd 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>
2022-12-17 20:51:38 +00:00
..
gnat Add option to use Ada code in romstage 2022-12-17 20:48:06 +00:00
Kconfig lib: Hook up libhwbase in romstage 2022-12-17 20:51:38 +00:00
Kconfig.cbfs_verification cbfs_verification: Remove dependency on VBOOT_STARTS_BEFORE_BOOTBLOCK 2022-10-26 17:19:22 +00:00
Makefile.inc lib: Hook up libhwbase in romstage 2022-12-17 20:51:38 +00:00
asan.c
b64_decode.c
bmp_logo.c
boot_device.c
bootblock.c
bootmem.c payloads,src: Replace ALIGN(x, a) by ALIGN_UP(x, a) for clarity 2022-10-13 19:14:57 +00:00
bootmode.c
bootsplash.c
cb.ads lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
cbfs.c vboot: Add VBOOT_CBFS_INTEGRATION support 2022-11-08 23:03:49 +00:00
cbfs_master_header.c
cbmem_common.c
cbmem_console.c
cbmem_stage_cache.c
compute_ip_checksum.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
coreboot_table.c lib/coreboot_table: Rename lb_fill_pcie 2022-11-04 19:17:49 +00:00
crc_byte.c
decompressor.c
delay.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
device_tree.c
dimm_info_util.c
dp_aux.c
edid.c
edid_fill_fb.c
espi_debug.c
ext_stage_cache.c
fallback_boot.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
fit.c
fit_payload.c
fmap.c
fw_config.c lib: Introduce fw_config_get_field 2022-12-17 20:43:16 +00:00
gcc.c
gcov-glue.c payloads,src: Replace ALIGN(x, a) by ALIGN_UP(x, a) for clarity 2022-10-13 19:14:57 +00:00
gcov-io.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
gcov-io.h lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
gcov-iov.h lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
gpio.c
halt.c
hardwaremain.c timer: Change timer util functions to 64-bit 2022-09-14 11:55:39 +00:00
hexdump.c
hexstrtobin.c
hw-time-timer.adb
imd.c
imd_cbmem.c cbmem_top_chipset: Change the return value to uintptr_t 2022-11-18 16:00:45 +00:00
jpeg.c
jpeg.h
libgcc.c
libgcov.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
list.c
lzma.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
lzmadecode.c lib/lzma: Build the source for decompression with flag -Ofast 2022-10-12 16:55:58 +00:00
lzmadecode.h
malloc.c lib/malloc.c: Fix log messages 2022-11-18 16:02:28 +00:00
master_header_pointer.c
memchr.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
memcmp.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
memcpy.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
memmove.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
memrange.c allocator_v4: Introduce RESOURCE_ALLOCATION_TOP_DOWN 2022-09-04 16:35:22 +00:00
memset.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
metadata_hash.c cbfs/vboot: Adapt to new vb2_digest API 2022-09-02 23:51:29 +00:00
nhlt.c
primitive_memtest.c
prog_loaders.c lib/prog_loaders.c: Clean up includes 2022-10-06 18:13:30 +00:00
prog_ops.c lib/prog_ops.c: Add <types.h> 2022-10-06 18:13:19 +00:00
program.ld arch/x86: Only use .bss from car.ld when running XIP 2022-10-20 14:43:40 +00:00
ramdetect.c
ramtest.c lib/ramtest.c: Use {read,write}32p() 2022-12-10 00:01:05 +00:00
reg_script.c
region_file.c
reset.c
rmodule.c payloads,src: Replace ALIGN(x, a) by ALIGN_UP(x, a) for clarity 2022-10-13 19:14:57 +00:00
rmodule.ld lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
romstage_handoff.c
rtc.c
selfboot.c /: Remove extra space after comma 2022-11-30 03:07:23 +00:00
spd_bin.c lib: Add LPDDR5x DRAM type 2022-11-07 02:29:23 +00:00
spd_cache.c
stack.c
string.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
thread.c timer: Change timer util functions to 64-bit 2022-09-14 11:55:39 +00:00
timer.c
timer_queue.c lib/timer_queue.c: Fix function signature 2022-09-23 17:34:30 +00:00
timestamp.c
ubsan.c
uuid.c
version.c lib: Add SPDX identifiers to files missing them 2022-08-11 17:53:29 +00:00
wrdd.c
xxhash.c lib/xxhash.c: Add new hash functions 2022-09-07 22:24:51 +00:00