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 <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/14839
Tested-by: build bot (Jenkins)
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aaron Durbin 2016-05-16 15:18:45 -05:00
parent 15843bdad0
commit 493ec92eb3
1 changed files with 13 additions and 6 deletions

View File

@ -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;