[coreboot-gerrit] Patch set updated for coreboot: util/cbfstool: Allow xip/non-xip relocation for FSP component
Furquan Shaikh (furquan@google.com)
gerrit at coreboot.org
Mon May 9 23:48:16 CEST 2016
Furquan Shaikh (furquan at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14748
-gerrit
commit 2eb92a00ecbb03475b009d66aa2cbd45e9b8a45f
Author: Furquan Shaikh <furquan at google.com>
Date: Mon May 9 11:53:34 2016 -0700
util/cbfstool: Allow xip/non-xip relocation for FSP component
Currently, convert_fsp assumes that the component is always XIP. This
is no longer true with FSP 2.0 and Apollolake platform. Thus, add the
option -y|--xip for FSP which will allow the caller to mention whether
the FSP component being added is XIP or not. Add this option to
Makefiles of current FSP drivers (fsp1_0 and fsp1_1).
Change-Id: I1e41d0902bb32afaf116bb457dd9265a5bcd8779
Signed-off-by: Furquan Shaikh <furquan at google.com>
---
src/drivers/intel/fsp1_0/Makefile.inc | 1 +
src/drivers/intel/fsp1_1/Makefile.inc | 1 +
util/cbfstool/cbfstool.c | 34 ++++++++++++++++++++++++++++------
3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/src/drivers/intel/fsp1_0/Makefile.inc b/src/drivers/intel/fsp1_0/Makefile.inc
index 4ff1068..67741a9 100644
--- a/src/drivers/intel/fsp1_0/Makefile.inc
+++ b/src/drivers/intel/fsp1_0/Makefile.inc
@@ -30,6 +30,7 @@ cbfs-files-y += fsp.bin
fsp.bin-file := $(call strip_quotes,$(CONFIG_FSP_FILE))
fsp.bin-position := $(CONFIG_FSP_LOC)
fsp.bin-type := fsp
+fsp.bin-options := --xip
endif
ifeq ($(CONFIG_ENABLE_MRC_CACHE),y)
diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc
index 3f214cb..011df67 100644
--- a/src/drivers/intel/fsp1_1/Makefile.inc
+++ b/src/drivers/intel/fsp1_1/Makefile.inc
@@ -54,6 +54,7 @@ cbfs-files-y += fsp.bin
fsp.bin-file := $(call strip_quotes,$(CONFIG_FSP_FILE))
fsp.bin-position := $(CONFIG_FSP_LOC)
fsp.bin-type := fsp
+fsp.bin-options := --xip
endif
endif
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index b1b410f..a01fc51 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -474,10 +474,28 @@ static int cbfstool_convert_fsp(struct buffer *buffer,
address = *offset;
- /* Ensure the address is a memory mapped one. */
- if (!IS_TOP_ALIGNED_ADDRESS(address))
- address = -convert_to_from_absolute_top_aligned(
- param.image_region, address);
+ /*
+ * If the FSP component is xip, then ensure that the address is a memory
+ * mapped one.
+ * If the FSP component is not xip, then use param.baseaddress that is
+ * passed in by the caller.
+ *
+ */
+ if (param.stage_xip) {
+ if (!IS_TOP_ALIGNED_ADDRESS(address))
+ 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;
+ *offset = param.baseaddress;
+ }
/* Create a copy of the buffer to attempt relocation. */
if (buffer_create(&fsp, buffer_size(buffer), "fsp"))
@@ -603,6 +621,9 @@ static int cbfs_add(void)
if (!param.baseaddress_assigned)
param.alignment = 4*1024;
convert = cbfstool_convert_fsp;
+ } else if (param.stage_xip) {
+ ERROR("cbfs add supports xip only for FSP component type\n");
+ return 1;
}
if (param.alignment) {
@@ -1030,7 +1051,7 @@ static int cbfs_compact(void)
}
static const struct command commands[] = {
- {"add", "H:r:f:n:t:c:b:a:vA:gh?", cbfs_add, true, true},
+ {"add", "H:r:f:n:t:c:b:a:yvA:gh?", cbfs_add, true, true},
{"add-flat-binary", "H:r:f:n:l:e:c:b:vA:gh?", cbfs_add_flat_binary,
true, true},
{"add-payload", "H:r:f:n:t:c:b:C:I:vA:gh?", cbfs_add_payload,
@@ -1153,7 +1174,8 @@ static void usage(char *name)
" -h Display this help message\n\n"
"COMMANDs:\n"
" add [-r image,regions] -f FILE -n NAME -t TYPE [-A hash] \\\n"
- " [-c compression] [-b base-address | -a alignment] "
+ " [-c compression] [-b base-address | -a alignment] \\\n"
+ " [-y|--xip if TYPE is FSP] "
"Add a component\n"
" add-payload [-r image,regions] -f FILE -n NAME [-A hash] \\\n"
" [-c compression] [-b base-address] \\\n"
More information about the coreboot-gerrit
mailing list