From 493ec92eb3c379c127754dd2459563c21d9d6ed9 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 16 May 2016 15:18:45 -0500 Subject: util/cbfstool: allow option to honor FSP modules' linked address If '-b' isn't passed when adding an FSP file type to CBFS allow the currently linked address to be used. i.e. don't relocate the FSP module and just add it to CBFS. Change-Id: I61fefd962ca9cf8aff7a4ca2bea52341ab41d67b Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/14839 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- util/cbfstool/cbfstool.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'util/cbfstool/cbfstool.c') diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 0f24af99c9..7b30ce94f7 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -471,6 +471,7 @@ static int cbfstool_convert_fsp(struct buffer *buffer, { uint32_t address; struct buffer fsp; + int do_relocation = 1; address = *offset; @@ -486,14 +487,13 @@ static int cbfstool_convert_fsp(struct buffer *buffer, address = -convert_to_from_absolute_top_aligned( param.image_region, address); } else { - if ((param.baseaddress_assigned == 0) || - (param.baseaddress == 0)) { - ERROR("Invalid baseaddress for non-XIP FSP.\n"); - return 1; + if (param.baseaddress_assigned == 0) { + INFO("Honoring pre-linked FSP module.\n"); + do_relocation = 0; + } else { + address = param.baseaddress; } - 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 @@ -508,6 +508,13 @@ static int cbfstool_convert_fsp(struct buffer *buffer, *offset = 0; } + /* + * Nothing left to do if relocation is not being attempted. Just add + * the file. + */ + if (!do_relocation) + return cbfstool_convert_raw(buffer, offset, header); + /* Create a copy of the buffer to attempt relocation. */ if (buffer_create(&fsp, buffer_size(buffer), "fsp")) return -1; -- cgit v1.2.3