From 1bdfc97c5413de9b7425de1ecab1b23d5e851d38 Mon Sep 17 00:00:00 2001 From: Jayvik Desai Date: Fri, 6 Mar 2026 21:15:45 +0530 Subject: [PATCH] lib/cbfs: Enable LZ4 decompression in pre-RAM stages LZ4 decompression was being incorrectly disabled in romstage when a separate romstage was used and CONFIG_COMPRESS_RAMSTAGE_LZ4 was not enabled. This occurred because ENV_RAMSTAGE_LOADER is defined as ENV_SEPARATE_ROMSTAGE in such configurations, causing cbfs_lz4_enabled() to hit the ramstage-loader check and return false. This regression was introduced by commit f12d2997fcde ("lib/cbfs: Don't include unused LZ4 code to shrink postcar stage"), which added the ramstage-loader check to avoid including the LZ4 decompressor in the postcar stage when it's not needed for the ramstage. This patch adds an explicit check for ENV_ROMSTAGE_OR_BEFORE and CONFIG_COMPRESS_PRERAM_STAGES to ensure LZ4 remains enabled in these stages regardless of the ramstage compression settings. BUG=none TEST=Verified on Quartz Change-Id: Icf5a2848ffe4c830bd462ab5dc7782afea3616e5 Signed-off-by: Jayvik Desai Reviewed-on: https://review.coreboot.org/c/coreboot/+/91581 Reviewed-by: Patrick Rudolph Reviewed-by: Kapil Porwal Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/lib/cbfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 25a29a2885..07bd3f4a28 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -131,8 +131,8 @@ static inline bool cbfs_lz4_enabled(void) if (fspm_env() && CONFIG(FSP_COMPRESS_FSP_M_LZ4)) return true; - if ((ENV_BOOTBLOCK || ENV_SEPARATE_VERSTAGE) && !CONFIG(COMPRESS_PRERAM_STAGES)) - return false; + if (ENV_ROMSTAGE_OR_BEFORE && CONFIG(COMPRESS_PRERAM_STAGES)) + return true; if (ENV_SMM) return false;