Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47659 )
Change subject: fast spi multiple bios region windows ......................................................................
fast spi multiple bios region windows
Change-Id: I1b564aed9809cf14b40a3b8e907622266fc782e2 Signed-off-by: Furquan Shaikh furquan@google.com --- M src/soc/intel/common/block/fast_spi/Kconfig M src/soc/intel/common/block/fast_spi/Makefile.inc A src/soc/intel/common/block/fast_spi/mmap_boot.c M src/soc/intel/tigerlake/Kconfig 4 files changed, 76 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/47659/1
diff --git a/src/soc/intel/common/block/fast_spi/Kconfig b/src/soc/intel/common/block/fast_spi/Kconfig index 9369272..8724ca4 100644 --- a/src/soc/intel/common/block/fast_spi/Kconfig +++ b/src/soc/intel/common/block/fast_spi/Kconfig @@ -11,3 +11,13 @@ default y help Disable the write status SPI opcode in Intel Fast SPI block. + +config FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS + bool + depends on SOC_INTEL_COMMON_BLOCK_FAST_SPI + help + SoC has support for multiple BIOS region windows. + +config X86_TOP4G_BOOTMEDIA_MAP + bool + default n if FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS diff --git a/src/soc/intel/common/block/fast_spi/Makefile.inc b/src/soc/intel/common/block/fast_spi/Makefile.inc index e5b50aa..aa69b72 100644 --- a/src/soc/intel/common/block/fast_spi/Makefile.inc +++ b/src/soc/intel/common/block/fast_spi/Makefile.inc @@ -19,3 +19,10 @@ endif
CPPFLAGS_common += -I$(src)/soc/intel/common/block/fast_spi + +bootblock-$(CONFIG_FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS) += mmap_boot.c +romstage-$(CONFIG_FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS) += mmap_boot.c +verstage-$(CONFIG_FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS) += mmap_boot.c +ramstage-$(CONFIG_FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS) += mmap_boot.c +postcar-$(CONFIG_FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS) += mmap_boot.c +smm-$(CONFIG_FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS) += mmap_boot.c \ No newline at end of file diff --git a/src/soc/intel/common/block/fast_spi/mmap_boot.c b/src/soc/intel/common/block/fast_spi/mmap_boot.c new file mode 100644 index 0000000..4bc8531 --- /dev/null +++ b/src/soc/intel/common/block/fast_spi/mmap_boot.c @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <boot_device.h> +#include <commonlib/region.h> +#include <console/console.h> +#include <fmap.h> +#include <intelblocks/fast_spi.h> + +static size_t bios_size; + +static struct xlate_region_device real_dev; +static struct mem_region_device shadow_devs[2]; +static struct xlate_window real_dev_windows[2]; + +static void bios_mmap_init(void) +{ + size_t size, start; + uintptr_t std_window_base; + size_t std_window_size; + uintptr_t ext_window_base; + size_t ext_window_size; + size_t window_count = 0; + + if (bios_size != 0) + return; + + start = fast_spi_get_bios_region(&size); + + std_window_size = MIN(16 * MiB, size); + std_window_base = 4ULL * GiB - std_window_size; + + mem_region_device_ro_init(&shadow_devs[0], (void *)std_window_base, std_window_size); + real_dev_windows[0].access_dev = &shadow_devs[0].rdev; + real_dev_windows[0].sub_region.offset = start + size - std_window_size; + real_dev_windows[0].sub_region.size = std_window_size; + window_count++; + + ext_window_size = size - std_window_size; + ext_window_base = 0xF8000000; + + if (ext_window_size) { + mem_region_device_ro_init(&shadow_devs[1], (void *)ext_window_base, ext_window_size); + real_dev_windows[1].access_dev = &shadow_devs[1].rdev; + real_dev_windows[1].sub_region.offset = start; + real_dev_windows[1].sub_region.size = ext_window_size; + window_count++; + } + + xlate_region_device_ro_init(&real_dev, window_count, real_dev_windows, CONFIG_ROM_SIZE); + bios_size = size; +} + +const struct region_device *boot_device_ro(void) +{ + bios_mmap_init(); + + return &real_dev.rdev; +} diff --git a/src/soc/intel/tigerlake/Kconfig b/src/soc/intel/tigerlake/Kconfig index 507f871..5a338bd 100644 --- a/src/soc/intel/tigerlake/Kconfig +++ b/src/soc/intel/tigerlake/Kconfig @@ -15,6 +15,7 @@ select CPU_INTEL_FIRMWARE_INTERFACE_TABLE select CPU_SUPPORTS_PM_TIMER_EMULATION select DRIVERS_USB_ACPI + select FAST_SPI_SUPPORTS_MULTIPLE_BIOS_WINDOWS select FSP_COMPRESS_FSP_S_LZ4 select FSP_M_XIP select FSP_STATUS_GLOBAL_RESET_REQUIRED_3