From 7e0dea6317dc74f8aba8c91d0f8e8a7237261c49 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 20 Feb 2019 18:39:22 -0800 Subject: symbols.h: Add macro to define memlayout region symbols When was first introduced, it only declared a handful of regions and we didn't expect that too many architectures and platforms would need to add their own later. However, our amount of platforms has greatly expanded since, and with them the need for more special memory regions. The amount of code duplication is starting to get unsightly, and platforms keep defining their own files that need this as well. This patch adds another macro to cut down the definition boilerplate. Unfortunately, macros cannot define other macros when they're called, so referring to region sizes as _name_size doesn't work anymore. This patch replaces the scheme with REGION_SIZE(name). Not touching the regions in the x86-specific yet since they don't follow the standard _region/_eregion naming scheme. They can be converted later if desired. Change-Id: I44727d77d1de75882c72a94f29bd7e2c27741dd8 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/c/31539 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/soc/samsung/exynos5250/alternate_cbfs.c | 4 ++-- src/soc/samsung/exynos5250/spi.c | 2 +- src/soc/samsung/exynos5420/alternate_cbfs.c | 4 ++-- src/soc/samsung/exynos5420/spi.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/soc/samsung') diff --git a/src/soc/samsung/exynos5250/alternate_cbfs.c b/src/soc/samsung/exynos5250/alternate_cbfs.c index 0687d47a5d..e7ceedb15c 100644 --- a/src/soc/samsung/exynos5250/alternate_cbfs.c +++ b/src/soc/samsung/exynos5250/alternate_cbfs.c @@ -88,7 +88,7 @@ static int sdmmc_cbfs_open(void) * figuring out the true image size from in here. Since this is mainly a * developer/debug boot mode, those shortcomings should be bearable. */ - const u32 count = _cbfs_cache_size / 512; + const u32 count = REGION_SIZE(cbfs_cache) / 512; static int first_run = 1; int (*irom_load_sdmmc)(u32 start, u32 count, void *dst) = *irom_sdmmc_read_blocks_ptr; @@ -131,7 +131,7 @@ const struct region_device *boot_device_ro(void) void boot_device_init(void) { mem_region_device_ro_init(&alternate_rdev, _cbfs_cache, - _cbfs_cache_size); + REGION_SIZE(cbfs_cache)); if (*iram_secondary_base == SECONDARY_BASE_BOOT_USB) { printk(BIOS_DEBUG, "Using Exynos alternate boot mode USB A-A\n"); diff --git a/src/soc/samsung/exynos5250/spi.c b/src/soc/samsung/exynos5250/spi.c index 9406abb302..ae67407c6d 100644 --- a/src/soc/samsung/exynos5250/spi.c +++ b/src/soc/samsung/exynos5250/spi.c @@ -179,7 +179,7 @@ void exynos_init_spi_boot_device(void) { boot_slave_regs = (void *)EXYNOS5_SPI1_BASE; - mmap_helper_device_init(&mdev, _cbfs_cache, _cbfs_cache_size); + mmap_helper_device_init(&mdev, _cbfs_cache, REGION_SIZE(cbfs_cache)); } const struct region_device *exynos_spi_boot_device(void) diff --git a/src/soc/samsung/exynos5420/alternate_cbfs.c b/src/soc/samsung/exynos5420/alternate_cbfs.c index 183c3710ef..98674ba8dc 100644 --- a/src/soc/samsung/exynos5420/alternate_cbfs.c +++ b/src/soc/samsung/exynos5420/alternate_cbfs.c @@ -92,7 +92,7 @@ static int sdmmc_cbfs_open(void) * figuring out the true image size from in here. Since this is mainly a * developer/debug boot mode, those shortcomings should be bearable. */ - const u32 count = _cbfs_cache_size / 512; + const u32 count = REGION_SIZE(cbfs_cache) / 512; static int first_run = 1; int (*irom_load_sdmmc)(u32 start, u32 count, void *dst) = *irom_sdmmc_read_blocks_ptr; @@ -138,7 +138,7 @@ const struct region_device *boot_device_ro(void) void boot_device_init(void) { mem_region_device_ro_init(&alternate_rdev, _cbfs_cache, - _cbfs_cache_size); + REGION_SIZE(cbfs_cache)); if (*iram_secondary_base == SECONDARY_BASE_BOOT_USB) { printk(BIOS_DEBUG, "Using Exynos alternate boot mode USB A-A\n"); diff --git a/src/soc/samsung/exynos5420/spi.c b/src/soc/samsung/exynos5420/spi.c index 2023b10130..3ce9457e78 100644 --- a/src/soc/samsung/exynos5420/spi.c +++ b/src/soc/samsung/exynos5420/spi.c @@ -287,7 +287,7 @@ void exynos_init_spi_boot_device(void) { boot_slave = &exynos_spi_slaves[1]; - mmap_helper_device_init(&mdev, _cbfs_cache, _cbfs_cache_size); + mmap_helper_device_init(&mdev, _cbfs_cache, REGION_SIZE(cbfs_cache)); } const struct region_device *exynos_spi_boot_device(void) -- cgit v1.2.3