treewide: Move check-ramstage-overlap variables

Moves the variables to more appropriate locations to save some lines and
make it more readable. For x86 it now also adds the intermediate, but
since x86 doesn't define any regions (e.g. ramstage) to check against,
the intermediate is effectively skipped.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I28371ae3416040243f238271ba45238ceccfcf0b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90816
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Maximilian Brune 2025-11-29 04:41:24 +01:00 committed by Matt DeVillier
commit 7158a1746c
6 changed files with 21 additions and 23 deletions

View file

@ -1447,11 +1447,6 @@ bootsplash$(BOOTSPLASH_SUFFIX)-file := $(call strip_quotes,$(CONFIG_BOOTSPLASH_F
bootsplash$(BOOTSPLASH_SUFFIX)-type := bootsplash
endif
# Ensure that no payload segment overlaps with memory regions used by ramstage
# (not for x86 since it can relocate itself in that case)
ifneq ($(CONFIG_ARCH_X86),y)
check-ramstage-overlap-regions := ramstage
check-ramstage-overlap-files :=
ifneq ($(CONFIG_PAYLOAD_NONE),y)
check-ramstage-overlap-files += $(CONFIG_CBFS_PREFIX)/payload
endif
@ -1464,6 +1459,15 @@ ramstage-symbol-addr-cmd = $(OBJDUMP_ramstage) -t $(objcbfs)/ramstage.elf | \
sed -n '/ $(1)$$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' | \
uniq
# Ensures that no segments from files in check-ramstage-overlap-files overlap memory regions
# used by ramstage. By default the segments of the payload are checked against the ramstage
# segments, but there may be other executables in RAM (e.g. BL31, OPENSBI). So Architecture
# Makefiles may add relevant executables to `check-ramstage-overlap-files`. Architecture
# Makefiles need to initialize `check-ramstage-overlap-regions` to use this check.
# For example:
# Common regions to add are `ramstage`, `stack` or `postram_cbfs_cache`. Which means that the
# ramstage segments `ramstage`, `stack`, `postram_cbfs_cache` are checked to make sure they
# don't overlap with the segments of check-ramstage-overlap-files (e.g. payload).
$(call add_intermediate, check-ramstage-overlaps)
programs=$$($(foreach file,$(check-ramstage-overlap-files), \
$(call cbfs-get-segments-cmd,$(file)) ; )) ; \
@ -1489,5 +1493,3 @@ $(call add_intermediate, check-ramstage-overlaps)
done ; \
pstart= ; pend= ; \
done
endif

View file

@ -4,10 +4,6 @@
# ARM specific options
###############################################################################
ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM),y)
check-ramstage-overlap-regions += postram_cbfs_cache stack ttb
endif
ifeq ($(CONFIG_ARCH_ARM),y)
subdirs-y += libgcc/
subdirs-y += armv4/ armv7/
@ -99,6 +95,8 @@ endif # CONFIG_ARCH_ROMSTAGE_ARM
ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM),y)
check-ramstage-overlap-regions += postram_cbfs_cache stack ttb ramstage
ramstage-y += stages.c
ramstage-y += div0.c
ramstage-y += eabi_compat.c

View file

@ -6,14 +6,6 @@
subdirs-y += armv8/
################################################################################
# ARM specific options
################################################################################
ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM64),y)
check-ramstage-overlap-regions += postram_cbfs_cache stack ttb
endif
################################################################################
# bootblock
################################################################################
@ -106,6 +98,8 @@ endif # CONFIG_ARCH_ROMSTAGE_ARM64
ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM64),y)
check-ramstage-overlap-regions += postram_cbfs_cache stack ttb ramstage
ramstage-y += div0.c
ramstage-y += eabi_compat.c
ramstage-y += boot.c

View file

@ -65,6 +65,8 @@ endif
################################################################################
ifeq ($(CONFIG_ARCH_RAMSTAGE_PPC64),y)
check-ramstage-overlap-regions += ramstage
ramstage-y += stages.c
ramstage-y += arch_timer.c
ramstage-y += boot.c

View file

@ -5,10 +5,6 @@
################################################################################
ifeq ($(CONFIG_ARCH_RISCV),y)
ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
check-ramstage-overlap-regions += stack
endif
riscv_flags = -I$(src)/arch/riscv/
ifeq ($(CONFIG_ARCH_RISCV_RV64),y)
@ -134,6 +130,8 @@ endif #CONFIG_ARCH_ROMSTAGE_RISCV
################################################################################
ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
check-ramstage-overlap-regions += stack ramstage
ramstage-y =
ramstage-y += ramstage.S
ramstage-y += tables.c

View file

@ -224,6 +224,10 @@ $(CONFIG_CBFS_PREFIX)/postcar-compression := none
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y)
# not adding a check-ramstage-overlap-regions here because x86 ramstage can automatically
# relocate itself to a free area (its build as a rmodule). Therefore no ramstage segments can
# overlap with other executables in RAM.
ramstage-y += acpi.c
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c
ramstage-$(CONFIG_ACPI_BERT) += acpi_bert_storage.c