diff options
author | Julius Werner <jwerner@chromium.org> | 2019-02-20 18:39:22 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2019-02-22 06:44:02 +0000 |
commit | 7e0dea6317dc74f8aba8c91d0f8e8a7237261c49 (patch) | |
tree | c9f476b75f0f9fcfe84aeb00b396723b3bcf7f5b /src/drivers | |
parent | 314b5c370b4655bc701985ddf1d1d478067e7baa (diff) |
symbols.h: Add macro to define memlayout region symbols
When <symbols.h> 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 <soc/symbols.h> 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 <arch/symbols.h> 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 <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/31539
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/intel/fsp2_0/memory_init.c | 2 | ||||
-rw-r--r-- | src/drivers/spi/cbfs_spi.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index bb64cd5fef..1eeede586d 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -398,7 +398,7 @@ void fsp_memory_init(bool s3wake) memranges_init_empty(&memmap, &freeranges[0], ARRAY_SIZE(freeranges)); memranges_insert(&memmap, (uintptr_t)_car_region_start, _car_relocatable_data_end - _car_region_start, 0); - memranges_insert(&memmap, (uintptr_t)_program, _program_size, 0); + memranges_insert(&memmap, (uintptr_t)_program, REGION_SIZE(program), 0); if (!IS_ENABLED(CONFIG_FSP_M_XIP)) status = load_fspm_mem(&hdr, &file_data, &memmap); diff --git a/src/drivers/spi/cbfs_spi.c b/src/drivers/spi/cbfs_spi.c index 3e5f2af889..e311752dee 100644 --- a/src/drivers/spi/cbfs_spi.c +++ b/src/drivers/spi/cbfs_spi.c @@ -105,7 +105,7 @@ static void switch_to_postram_cache(int unused) boot_device_init(); if (_preram_cbfs_cache != _postram_cbfs_cache) mmap_helper_device_init(&mdev, _postram_cbfs_cache, - _postram_cbfs_cache_size); + REGION_SIZE(postram_cbfs_cache)); } ROMSTAGE_CBMEM_INIT_HOOK(switch_to_postram_cache); @@ -122,7 +122,7 @@ void boot_device_init(void) spi_flash_init_done = true; - mmap_helper_device_init(&mdev, _cbfs_cache, _cbfs_cache_size); + mmap_helper_device_init(&mdev, _cbfs_cache, REGION_SIZE(cbfs_cache)); } /* Return the CBFS boot device. */ |