drivers/intel/fsp2_0: add option to compress FSP-M in cbfs
Allow the ability for chipset or mainboard to choose to compress FSP-M in cbfs using LZMA or LZ4 routines. However, only non-XIP platforms will support FSP-M compression. Since the main cbfs decompression paths are utilized add the appropriate checks for including compression algorithms under the FSP-M compression options. On picasso FSP-M (debug builds) the following savings were measured: no-compression: fspm.bin 720896 none FSP_COMPRESS_FSP_M_LZ4: fspm.bin 138379 LZ4 (720896 decompressed) -80% FSP_COMPRESS_FSP_M_LZMA: fspm.bin 98921 LZMA (720896 decompressed) -86% BUG=b:155322763,b:150746858,b:152909132 Change-Id: I5c88510c134b56a36ff1cd97a64b51ab2fea0ab0 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41450 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
@ -119,6 +119,21 @@ void fsp_handle_reset(uint32_t status)
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool fspm_env(void)
|
||||
{
|
||||
if (ENV_ROMSTAGE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool fspm_xip(void)
|
||||
{
|
||||
/* FSP-M is assumed to be loaded in romstage. */
|
||||
if (fspm_env() && CONFIG(FSP_M_XIP))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void *fsp_get_dest_and_load(struct fsp_load_descriptor *fspld, size_t size,
|
||||
const struct region_device *source_rdev,
|
||||
uint32_t compression_algo)
|
||||
@ -130,12 +145,20 @@ static void *fsp_get_dest_and_load(struct fsp_load_descriptor *fspld, size_t siz
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Don't load when executing in place. */
|
||||
if (fspm_xip())
|
||||
return dest;
|
||||
|
||||
if (cbfs_load_and_decompress(source_rdev, 0, region_device_sz(source_rdev),
|
||||
dest, size, compression_algo) != size) {
|
||||
printk(BIOS_ERR, "Failed to load FSP component.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Don't allow FSP-M relocation. */
|
||||
if (fspm_env())
|
||||
return dest;
|
||||
|
||||
if (fsp_component_relocate((uintptr_t)dest, dest, size) < 0) {
|
||||
printk(BIOS_ERR, "Unable to relocate FSP component!\n");
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user