summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Compostella <jeremy.compostella@intel.com>2024-03-12 17:57:13 -0700
committerJérémy Compostella <jeremy.compostella@intel.com>2024-03-26 16:12:36 +0000
commit44adf4d22f0a088b7463da2ef8f529ad172f33f7 (patch)
tree5bd28cba267d85ed188f23d94f3eaf2f55ed633d /src
parent969f04fb345506621c5d1d6eb8dff558688285b5 (diff)
drivers/intel/fsp2_0: Avoid unnecessary extra CBFS access
fsp_mrc_version() function does not need to perform a CBFS access to to get an address to the FSP-M blob as the caller, do_fsp_memory_init(), already has it loaded. In addition to make the code simpler, it avoids an unnecessary decompression of the FSP blob if `FSP_COMPRESS_FSP_M_LZ4' or `FSP_COMPRESS_FSP_M_LZMA' are set. TEST=Verified on Meteor Lake rex Change-Id: If355b5811a09a0b76acc8a297db719d54caedc54 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81256 Reviewed-by: Shuo Liu <shuo.liu@intel.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Bora Guvendik <bora.guvendik@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/intel/fsp2_0/memory_init.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c
index 27921c6b26..dc725c3561 100644
--- a/src/drivers/intel/fsp2_0/memory_init.c
+++ b/src/drivers/intel/fsp2_0/memory_init.c
@@ -259,23 +259,17 @@ struct fspm_context {
* MRC version is by reading the FSP_PRODUCDER_DATA_TABLES
* from the FSP-M binary (by parsing the FSP header).
*/
-static uint32_t fsp_mrc_version(void)
+static uint32_t fsp_mrc_version(const struct fsp_header *hdr)
{
uint32_t ver = 0;
#if CONFIG(MRC_CACHE_USING_MRC_VERSION)
- size_t fspm_blob_size;
- const char *fspm_cbfs = soc_select_fsp_m_cbfs();
- void *fspm_blob_file = cbfs_map(fspm_cbfs, &fspm_blob_size);
- if (!fspm_blob_file)
- return 0;
-
+ void *fspm_blob_file = (void *)(uintptr_t)hdr->image_base;
FSP_PRODUCER_DATA_TABLES *ft = fspm_blob_file + FSP_HDR_OFFSET;
FSP_PRODUCER_DATA_TYPE2 *table2 = &ft->FspProduceDataType2;
size_t mrc_version_size = sizeof(table2->MrcVersion);
for (size_t i = 0; i < mrc_version_size; i++) {
ver |= (table2->MrcVersion[i] << ((mrc_version_size - 1) - i) * 8);
}
- cbfs_unmap(fspm_blob_file);
#endif
return ver;
}
@@ -349,7 +343,7 @@ static void do_fsp_memory_init(const struct fspm_context *context, bool s3wake)
post_code(POSTCODE_MEM_PREINIT_PREP_START);
if (CONFIG(MRC_CACHE_USING_MRC_VERSION))
- version = fsp_mrc_version();
+ version = fsp_mrc_version(hdr);
else
version = fsp_memory_settings_version(hdr);