[coreboot-gerrit] New patch to review for coreboot: util/cbfstool: allow option to honor FSP modules' linked address

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Mon May 16 22:20:34 CEST 2016


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14839

-gerrit

commit 204bdaf8029f76a88a967607c7cfd2272bb7f243
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Mon May 16 15:18:45 2016 -0500

    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 remain. i.e. don't relocate the
    FSP module and just add it to CBFS.
    
    Change-Id: I61fefd962ca9cf8aff7a4ca2bea52341ab41d67b
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 util/cbfstool/cbfstool.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 0f24af9..1f2bb72 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,13 +487,12 @@ 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;
-		}
 
-		address = param.baseaddress;
+		if (param.baseaddress_assigned == 0) {
+			INFO("Honoring pre-linked FSP module.\n");
+			do_relocation = 0;
+		} else
+			address = param.baseaddress;
 
 		/*
 		 * *offset should either be 0 or the value returned by
@@ -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;



More information about the coreboot-gerrit mailing list