include/fmap.h: Require FMAP_SECTION_FLASH_START == 0

For simplicity we are going to impose this restriction to coreboot.
Note however that this is only a restriction for coreboot itself. The
FMAP tool itself is still a generic tool that does not require the FMAP
to start at offset 0.

Add an defacto empty fmap_config.h to our test cases, since fmap.h now
includes fmap_config.h.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: Iba04ebdcd5557664a865d2854028dd811f052249
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86770
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub "Kuba" Czapiga <czapiga@google.com>
This commit is contained in:
Maximilian Brune 2025-03-08 23:23:18 +01:00 committed by Matt DeVillier
commit 6f2a01f743
3 changed files with 21 additions and 0 deletions

View file

@ -5,9 +5,14 @@
#include <commonlib/bsd/fmap_serialized.h>
#include <commonlib/region.h>
#include <fmap_config.h>
#include <stddef.h>
#include <stdint.h>
#if FMAP_SECTION_FLASH_START != 0
#error "FMAP must always start flash address 0"
#endif
/* Locate the named area in the fmap and fill in a region device representing
* that area. The region is a sub-region of the readonly boot media. Return
* 0 on success, < 0 on error. */

View file

@ -0,0 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef FMAPTOOL_GENERATED_HEADER_H_
#define FMAPTOOL_GENERATED_HEADER_H_
/*
* This file is used for tests that include (directly as well as indirectly) fmap.h.
* Keeps the build tests from failing since fmap.h needs fmap_config.h
*/
#define FMAP_SECTION_FLASH_START 0
#endif

View file

@ -163,6 +163,7 @@ spd_cache-ddr3-test-config += CONFIG_SPD_CACHE_FMAP_NAME=\"RW_SPD_CACHE\" \
CONFIG_DIMM_MAX=4 CONFIG_DIMM_SPD_SIZE=256 \
CONFIG_BOOT_DEVICE_MEMORY_MAPPED=1
spd_cache-ddr3-test-cflags += -D__TEST_SPD_CACHE_DDR=3
spd_cache-ddr3-test-cflags += -I tests/include/tests/lib/fmap
spd_cache-ddr4-test-srcs += tests/lib/spd_cache-test.c
spd_cache-ddr4-test-srcs += tests/stubs/console.c
@ -174,6 +175,7 @@ spd_cache-ddr4-test-config += CONFIG_SPD_CACHE_FMAP_NAME=\"RW_SPD_CACHE\" \
CONFIG_DIMM_MAX=4 CONFIG_DIMM_SPD_SIZE=512 \
CONFIG_BOOT_DEVICE_MEMORY_MAPPED=1
spd_cache-ddr4-test-cflags += -D__TEST_SPD_CACHE_DDR=4
spd_cache-ddr4-test-cflags += -I tests/include/tests/lib/fmap
cbmem_stage_cache-test-srcs += tests/lib/cbmem_stage_cache-test.c
cbmem_stage_cache-test-srcs += tests/stubs/console.c
@ -201,6 +203,7 @@ cbfs-verification-no-sha512-test-config += CONFIG_COLLECT_TIMESTAMPS=0 \
CONFIG_CBFS_VERIFICATION=1 \
CONFIG_NO_CBFS_MCACHE=1 \
VB2_SUPPORT_SHA512=0
cbfs-verification-no-sha512-test-cflags += -I tests/include/tests/lib/fmap
$(call copy-test,cbfs-verification-no-sha512-test,cbfs-verification-has-sha512-test)
cbfs-verification-has-sha512-test-config += VB2_SUPPORT_SHA512=1
@ -229,6 +232,7 @@ cbfs-lookup-no-mcache-test-mocks += cbfs_get_boot_device \
cbfs-lookup-no-mcache-test-config += CONFIG_ARCH_X86=0 \
CONFIG_COLLECT_TIMESTAMPS=0 \
CONFIG_NO_CBFS_MCACHE=1
cbfs-lookup-no-mcache-test-cflags += -I tests/include/tests/lib/fmap
$(call copy-test,cbfs-lookup-no-mcache-test,cbfs-lookup-has-mcache-test)
cbfs-lookup-has-mcache-test-config += CONFIG_NO_CBFS_MCACHE=0