summaryrefslogtreecommitdiff
path: root/src/mainboard/sifive/hifive-unleashed
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-12-30 17:30:12 -0800
committerJulius Werner <jwerner@chromium.org>2021-03-08 22:31:29 +0000
commit9b1f3cc6fb129789f1dd28160a83a1ea59dd123a (patch)
tree98347b2285d361fbcaa74892fa75a40a629d4b7f /src/mainboard/sifive/hifive-unleashed
parent11075fc80e00186cb5b488e8e0fd280cd4e97823 (diff)
cbfs: Pull handling of the CBFS_CACHE mem_pool into CBFS core
This patch pulls control of the memory pool serving allocations from the CBFS_CACHE memlayout area into cbfs.c and makes it a core part of the CBFS API. Previously, platforms would independently instantiate this as part of boot_device_ro() (mostly through cbfs_spi.c). The new cbfs_cache pool is exported as a global so these platforms can still use it to directly back rdev_mmap() on their boot device, but the cbfs_cache can now also use it to directly make allocations itself. This is used to allow transparent decompression support in cbfs_map(). Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I0d52b6a8f582a81a19fd0fd663bb89eab55a49d9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/49333 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/mainboard/sifive/hifive-unleashed')
-rw-r--r--src/mainboard/sifive/hifive-unleashed/media.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mainboard/sifive/hifive-unleashed/media.c b/src/mainboard/sifive/hifive-unleashed/media.c
index 2ff375ae29..f3dcf7f621 100644
--- a/src/mainboard/sifive/hifive-unleashed/media.c
+++ b/src/mainboard/sifive/hifive-unleashed/media.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <boot_device.h>
+#include <cbfs.h>
#include <symbols.h>
#include <device/mmio.h>
#include <soc/addressmap.h>
@@ -42,7 +43,7 @@ static const struct region_device_ops unleashed_sd_ops = {
};
static struct mmap_helper_region_device sd_mdev =
- MMAP_HELPER_REGION_INIT(&unleashed_sd_ops, 0, CONFIG_ROM_SIZE);
+ MMAP_HELPER_DEV_INIT(&unleashed_sd_ops, 0, CONFIG_ROM_SIZE, &cbfs_cache);
const struct region_device *boot_device_ro(void)
{
@@ -79,8 +80,6 @@ void boot_device_init(void)
}
if (MSEL_SPI2SD(m)) {
spi_sdcard_init(&card, 2, 0);
- mmap_helper_device_init(&sd_mdev,
- _cbfs_cache, REGION_SIZE(cbfs_cache));
return;
}
die("Wrong configuration of MSEL\n");