diff --git a/src/include/fmap.h b/src/include/fmap.h index 761e742f56..fc49dbdf5e 100644 --- a/src/include/fmap.h +++ b/src/include/fmap.h @@ -5,9 +5,14 @@ #include #include +#include #include #include +#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. */ diff --git a/tests/include/tests/lib/fmap_config.h b/tests/include/tests/lib/fmap_config.h new file mode 100644 index 0000000000..5b3540020b --- /dev/null +++ b/tests/include/tests/lib/fmap_config.h @@ -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 diff --git a/tests/lib/Makefile.mk b/tests/lib/Makefile.mk index 1a96c7d620..31603cdf03 100644 --- a/tests/lib/Makefile.mk +++ b/tests/lib/Makefile.mk @@ -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