From c3bb6923bdcd20f4b343ba373a7d211655d6468a Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Tue, 9 Jun 2020 21:20:27 -0700 Subject: [PATCH] util/cbfstool: Drop IS_TOP_ALIGNED_ADDRESS() check in cbfstool_convert_fsp This change drops the check for IS_TOP_ALIGNED_ADDRESS() before setting offset to 0 in cbfstool_convert_fsp(). If the user provides a baseaddress to relocate the FSP to, then the offset should be set to 0 since there is no requirement on where the file ends up in cbfs. This allows the user to relocate the FSP to an address in lower DRAM. BUG=b:155322763 Signed-off-by: Furquan Shaikh Change-Id: Ibeadbf06881f7659b2ac7d62d2152636c853fb9f Reviewed-on: https://review.coreboot.org/c/coreboot/+/42263 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel Reviewed-by: Aaron Durbin --- util/cbfstool/cbfstool.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 4ec8c904e5..decbd051f6 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -642,20 +642,17 @@ static int cbfstool_convert_fsp(struct buffer *buffer, do_relocation = 0; } else { address = param.baseaddress; - } - - /* - * *offset should either be 0 or the value returned by - * do_cbfs_locate. do_cbfs_locate should not ever return a value - * that is TOP_ALIGNED_ADDRESS. Thus, if *offset contains a top - * aligned address, set it to 0. - * - * The only requirement in this case is that the binary should - * be relocated to the base address that is requested. There is - * no requirement on where the file ends up in the cbfs. - */ - if (IS_TOP_ALIGNED_ADDRESS(*offset)) + /* + * *offset should either be 0 or the value returned by + * do_cbfs_locate. do_cbfs_locate is called only when param.baseaddress + * is not provided by user. Thus, set *offset to 0 if user provides + * a baseaddress i.e. params.baseaddress_assigned is set. The only + * requirement in this case is that the binary should be relocated to + * the base address that is requested. There is no requirement on where + * the file ends up in the cbfs. + */ *offset = 0; + } } /*