treewide: Assume FMAP_SECTION_FLASH_START = 0

Now that we require the FMAP to start at offset 0 in the flash, we can
assume this across the entire codebase and therefore simplify it on
several ends.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: Ieb1a23f9c0ae8c0e1c91287d7eb6f7f0abbf0c2c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86771
Reviewed-by: Erik van den Bogaert <ebogaert@eltan.com>
Reviewed-by: Frans Hendriks <fhendriks@eltan.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
This commit is contained in:
Maximilian Brune 2025-03-09 00:02:00 +01:00 committed by Matt DeVillier
commit 2efe4df522
9 changed files with 6 additions and 33 deletions

View file

@ -17,11 +17,7 @@
#define CBFS_FILE_STRUCTSIZE (CBFS_FILE_OFFSET + 4)
#if FMAP_SECTION_COREBOOT_START < (0xffffffff - CONFIG_ROM_SIZE + 1)
#define COREBOOT_CBFS_START (0xffffffff - CONFIG_ROM_SIZE + 1 + FMAP_SECTION_COREBOOT_START)
#else
#define COREBOOT_CBFS_START FMAP_SECTION_COREBOOT_START
#endif
.code32
.section .init

View file

@ -14,8 +14,7 @@ struct cbfs_header header = {
* representing the CBFS region's size is added to the offset of
* the region within a larger image.
*/
.romsize = cpu_to_be32(FMAP_SECTION_COREBOOT_START + FMAP_SECTION_COREBOOT_SIZE
- FMAP_SECTION_FLASH_START),
.romsize = cpu_to_be32(FMAP_SECTION_COREBOOT_START + FMAP_SECTION_COREBOOT_SIZE),
/*
* The 4 bytes are left out for two reasons:
* 1. the cbfs master header pointer resides there
@ -25,6 +24,6 @@ struct cbfs_header header = {
*/
.bootblocksize = cpu_to_be32(4),
.align = cpu_to_be32(CBFS_ALIGNMENT),
.offset = cpu_to_be32(FMAP_SECTION_COREBOOT_START - FMAP_SECTION_FLASH_START),
.offset = cpu_to_be32(FMAP_SECTION_COREBOOT_START),
.architecture = cpu_to_be32(CBFS_ARCHITECTURE_UNKNOWN),
};

View file

@ -9,11 +9,7 @@
__attribute__((used, __section__(".header_pointer")))
#endif
#if FMAP_SECTION_COREBOOT_START < (0xffffffff - CONFIG_ROM_SIZE + 1)
#define COREBOOT_CBFS_START (0xffffffff - CONFIG_ROM_SIZE + 1 + FMAP_SECTION_COREBOOT_START)
#else
#define COREBOOT_CBFS_START FMAP_SECTION_COREBOOT_START
#endif
uint32_t header_pointer =
cpu_to_le32(COREBOOT_CBFS_START + ALIGN_UP(sizeof(struct cbfs_file)

View file

@ -45,9 +45,7 @@ $(objcbfs)/bootblock.bin: $(obj)/amdfw.rom $(obj)/fmap_config.h
amdfw_region_start=$(subst $(spc),,FMAP_SECTION_$(call regions-for-file,apu/amdfw)_START)
amdfw_offset=$(call int-subtract, \
$(CONFIG_AMD_FWM_POSITION) \
$(call int-subtract, \
$(call get_fmap_value,$(amdfw_region_start)) \
$(call get_fmap_value,FMAP_SECTION_FLASH_START)))
$(call get_fmap_value,$(amdfw_region_start)))
add_bootblock = \
$(CBFSTOOL) $(1) add -f $(2) -n apu/amdfw -t amdfw \

View file

@ -45,7 +45,6 @@ smm-y += mmap_boot.c
$(call add_intermediate, check-fmap-16mib-crossing, $(obj)/fmap_config.h)
fmap_get() { awk "/$$1/ { print \$$NF }" < $<; }; \
\
flash_offset=$$(fmap_get FMAP_SECTION_FLASH_START); \
flash_size=$$(fmap_get FMAP_SECTION_FLASH_SIZE); \
if [ $$((flash_size)) -le $$((0x1000000)) ]; then \
exit; \
@ -55,7 +54,6 @@ $(call add_intermediate, check-fmap-16mib-crossing, $(obj)/fmap_config.h)
do \
start=$$(fmap_get "FMAP_SECTION_$${x}_START"); \
size=$$(fmap_get "FMAP_SECTION_$${x}_SIZE"); \
start=$$((start-flash_offset)); \
end=$$((start+size-1)); \
if [ $$((start)) -lt $$((bios_16M_boundary)) ] && \
[ $$((end)) -ge $$((bios_16M_boundary)) ]; \

View file

@ -48,9 +48,9 @@ CPPFLAGS_common += -I$(src)/southbridge/amd/pi/hudson/include
# EC ROM should be 64K aligned.
ifeq ($(CONFIG_AMDFW_OUTSIDE_CBFS),y)
HUDSON_FWM_POSITION=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_ROM_SIZE)) 0x20000 1)
HUDSON_FWM_POSITION=0x20000
else
HUDSON_FWM_POSITION=0xfff20000
HUDSON_FWM_POSITION=0x720000
endif
ifeq ($(CONFIG_HUDSON_PSP), y)

View file

@ -184,11 +184,7 @@ static void verified_boot_check_buffer(const char *name, void *start, size_t siz
}
}
#if FMAP_SECTION_COREBOOT_START < (0xffffffff - CONFIG_ROM_SIZE + 1)
#define COREBOOT_CBFS_START (0xffffffff - CONFIG_ROM_SIZE + 1 + FMAP_SECTION_COREBOOT_START)
#else
#define COREBOOT_CBFS_START FMAP_SECTION_COREBOOT_START
#endif
void verified_boot_check_cbfsfile(const char *name, uint32_t type, uint32_t hash_index,
void **buffer, uint32_t *filesize, int32_t pcr)