Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47991 )
Change subject: soc/intel/common/fast_spi: Add support for configuring MTRRs ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/47991/1/src/soc/intel/common/block/... File src/soc/intel/common/block/fast_spi/fast_spi.c:
https://review.coreboot.org/c/coreboot/+/47991/1/src/soc/intel/common/block/... PS1, Line 238: if (ENV_PAYLOAD_LOADER) { : mtrr_use_temp_range(ext_bios_base, ext_bios_size, type); : } else { : int mtrr = get_free_var_mtrr(); : : if (mtrr == -1) : return; : : set_var_mtrr(mtrr, ext_bios_base, ext_bios_size, type); : }
Actually, let's not add a helper function right now. […]
BTW, if you want to add the helper fast_spi_cache_ext_bios_postcar as part of this function, please feel free to do that. You will have to refactor this function such that:
static bool fast_spi_ext_bios_cache_range(uintptr_t *base, size_t size) {
if (!CONFIG(FAST_SPI_SUPPORTS_EXT_BIOS_WINDOW)) return false;
fast_spi_get_ext_bios_window(base, size);
/* Enable extended bios only if Size of Bios region is greater than 16MiB */ if (*base == 0 || *size == 0) return false;
/* Round to power of two */ alignment = 1UL << (log2_ceil(*size)); *size = ALIGN_UP(*size, alignment); *base = ALIGN_DOWN(*base, *size);
return true; }
and then use that in both fast_spi_cache_ext_bios_window and fast_spi_cache_ext_bios_postcar.
fast_spi_cache_ext_bios_window will use it for set_var_mtrr and fast_spi_cache_ext_bios_postcar will use it for postcar_frame_add_mtrr