summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2018-06-01 07:11:25 +0300
committerPatrick Georgi <pgeorgi@google.com>2018-06-04 08:19:44 +0000
commitb5211ef2e7da1c1b8f8bb0208e7b2f44aa859ef7 (patch)
treefcbb15c9a60e9c45e1619fa1437d2a0742076c9b
parent0863f0be89fb0117e9141a6a6b2b25daa74bc9f9 (diff)
lib/cbfs: Optimise LZMA away from romstage
If we have POSTCAR_STAGE there is no need for romstage to include LZMA decompression code. Reduces romstage by about 4 kiB on x86. Change-Id: I4c475986b2a94e5cd540c3eead433ed6c0a815ed Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/26759 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--src/lib/cbfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 87ab3877f8..9938e6abbe 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -119,8 +119,11 @@ size_t cbfs_load_and_decompress(const struct region_device *rdev, size_t offset,
return out_size;
case CBFS_COMPRESS_LZMA:
+ /* We assume here romstage and postcar are never compressed. */
if (ENV_BOOTBLOCK || ENV_VERSTAGE)
return 0;
+ if (ENV_ROMSTAGE && IS_ENABLED(CONFIG_POSTCAR_STAGE))
+ return 0;
if ((ENV_ROMSTAGE || ENV_POSTCAR)
&& !IS_ENABLED(CONFIG_COMPRESS_RAMSTAGE))
return 0;