From cd259cb08a99812082f8bb2f7ecd23c031bb4e2d Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Mon, 16 May 2022 13:20:18 +0200 Subject: [PATCH] arch/x86/car.ld: Add a Kconfig param to flag AGESA brokenness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AGESA has a lot of code in the .data section (initialized data). However there is no such section in CAR stages as the code runs in XIP mode and CAR is too small to contain the data section. When the linker can not match code to a section it will just append it, which is why AGESA worked at all. Follow-up patches will attempt to fix AGESA and set Kconfig parameter to 'n'. After all AGESA sources have been fixed, this can be removed. Change-Id: I311ee17e3c0bd283692194fcee63af4449583d74 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/64387 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Kyösti Mälkki --- src/arch/x86/car.ld | 5 +++++ src/northbridge/amd/agesa/Kconfig | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld index 5a46b8b2ec..4e3383cf1e 100644 --- a/src/arch/x86/car.ld +++ b/src/arch/x86/car.ld @@ -115,8 +115,13 @@ _rom_mtrr_base = _rom_mtrr_mask; . = 0xffffff00; .illegal_globals . : { +#if CONFIG(AGESA_BROKEN_DATA_SECTION) *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data) *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data.*) +#else + *(.data) + *(.data.*) +#endif } _bogus = ASSERT((CONFIG_DCACHE_RAM_SIZE == 0) || (SIZEOF(.car.data) <= CONFIG_DCACHE_RAM_SIZE), "Cache as RAM area is too full"); diff --git a/src/northbridge/amd/agesa/Kconfig b/src/northbridge/amd/agesa/Kconfig index 6f6e3d63a9..3959284921 100644 --- a/src/northbridge/amd/agesa/Kconfig +++ b/src/northbridge/amd/agesa/Kconfig @@ -27,6 +27,13 @@ config S3_VGA_ROM_RUN source "src/northbridge/amd/agesa/*/Kconfig" +config AGESA_BROKEN_DATA_SECTION + bool + default y + help + Select this on AGESA platforms that incorrectly use the .data + section. + # TODO: Reservation for heap seems excessive config HEAP_SIZE hex