summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-04-16 16:48:32 -0700
committerJulius Werner <jwerner@chromium.org>2021-04-21 02:06:26 +0000
commitc893197352acc9b53c1beef5082cbc0271f63688 (patch)
treeb975712387bd54bd0101a736adbb2a6fe5b824bb /src/soc
parentb03e497ef16e9e38ba9220d31131a6bfdef35390 (diff)
commonlib/region: Turn addrspace_32bit into a more official API
We had the addrspace_32bit rdev in prog_loaders.c for a while to help represent memory ranges as an rdev, and we've found it useful for a couple of things that have nothing to do with program loading. This patch moves the concept straight into commonlib/region.c so it is no longer anchored in such a weird place, and easier to use in unit tests. Also expand the concept to the whole address space (there's no real need to restrict it to 32 bits in 64-bit environments) and introduce an rdev_chain_mem() helper function to make it a bit easier to use. Replace some direct uses of struct mem_region_device with this new API where it seems to make sense. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ie4c763b77f77d227768556a9528681d771a08dca Reviewed-on: https://review.coreboot.org/c/coreboot/+/52533 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/apollolake/mmap_boot.c9
-rw-r--r--src/soc/samsung/exynos5250/alternate_cbfs.c7
-rw-r--r--src/soc/samsung/exynos5420/alternate_cbfs.c5
3 files changed, 7 insertions, 14 deletions
diff --git a/src/soc/intel/apollolake/mmap_boot.c b/src/soc/intel/apollolake/mmap_boot.c
index 23c819e3a0..6e0800cd65 100644
--- a/src/soc/intel/apollolake/mmap_boot.c
+++ b/src/soc/intel/apollolake/mmap_boot.c
@@ -42,7 +42,7 @@
static size_t bios_size;
-static struct mem_region_device shadow_dev;
+static struct region_device shadow_dev;
static struct xlate_region_device real_dev;
static struct xlate_window real_dev_window;
@@ -67,10 +67,9 @@ static void bios_mmap_init(void)
*/
bios_mapped_size = size - 256 * KiB;
- mem_region_device_ro_init(&shadow_dev, (void *)base,
- bios_mapped_size);
+ rdev_chain_mem(&shadow_dev, (void *)base, bios_mapped_size);
- xlate_window_init(&real_dev_window, &shadow_dev.rdev, start, bios_mapped_size);
+ xlate_window_init(&real_dev_window, &shadow_dev, start, bios_mapped_size);
xlate_region_device_ro_init(&real_dev, 1, &real_dev_window, CONFIG_ROM_SIZE);
bios_size = size;
@@ -98,7 +97,7 @@ uint32_t spi_flash_get_mmap_windows(struct flash_mmap_window *table)
bios_mmap_init();
table->flash_base = region_offset(&real_dev_window.sub_region);
- table->host_base = (uintptr_t)rdev_mmap_full(&shadow_dev.rdev);
+ table->host_base = (uintptr_t)rdev_mmap_full(&shadow_dev);
table->size = region_sz(&real_dev_window.sub_region);
return 1;
diff --git a/src/soc/samsung/exynos5250/alternate_cbfs.c b/src/soc/samsung/exynos5250/alternate_cbfs.c
index a4ae71aafc..a540c3cadf 100644
--- a/src/soc/samsung/exynos5250/alternate_cbfs.c
+++ b/src/soc/samsung/exynos5250/alternate_cbfs.c
@@ -92,8 +92,8 @@ static int sdmmc_cbfs_open(void)
return 0;
}
-static struct mem_region_device alternate_rdev =
- MEM_REGION_DEV_RO_INIT(NULL, 0);
+const static struct mem_region_device alternate_rdev =
+ MEM_REGION_DEV_RO_INIT(_cbfs_cache, REGION_SIZE(cbfs_cache));
const struct region_device *boot_device_ro(void)
{
@@ -114,9 +114,6 @@ const struct region_device *boot_device_ro(void)
void boot_device_init(void)
{
- mem_region_device_ro_init(&alternate_rdev, _cbfs_cache,
- REGION_SIZE(cbfs_cache));
-
if (*iram_secondary_base == SECONDARY_BASE_BOOT_USB) {
printk(BIOS_DEBUG, "Using Exynos alternate boot mode USB A-A\n");
usb_cbfs_open();
diff --git a/src/soc/samsung/exynos5420/alternate_cbfs.c b/src/soc/samsung/exynos5420/alternate_cbfs.c
index 0eb8c08604..99f14a13f2 100644
--- a/src/soc/samsung/exynos5420/alternate_cbfs.c
+++ b/src/soc/samsung/exynos5420/alternate_cbfs.c
@@ -100,7 +100,7 @@ static int sdmmc_cbfs_open(void)
}
static struct mem_region_device alternate_rdev =
- MEM_REGION_DEV_RO_INIT(NULL, 0);
+ MEM_REGION_DEV_RO_INIT(_cbfs_cache, REGION_SIZE(cbfs_cache));
const struct region_device *boot_device_ro(void)
{
@@ -121,9 +121,6 @@ const struct region_device *boot_device_ro(void)
void boot_device_init(void)
{
- mem_region_device_ro_init(&alternate_rdev, _cbfs_cache,
- REGION_SIZE(cbfs_cache));
-
if (*iram_secondary_base == SECONDARY_BASE_BOOT_USB) {
printk(BIOS_DEBUG, "Using Exynos alternate boot mode USB A-A\n");
usb_cbfs_open();