summaryrefslogtreecommitdiffstats
path: root/util/cbfstool/cbfstool.c
diff options
context:
space:
mode:
authorRizwan Qureshi <rizwan.qureshi@intel.com>2018-06-04 23:02:46 +0530
committerSubrata Banik <subrata.banik@intel.com>2018-06-26 05:59:52 +0000
commitc1072f2fc73926bbe73b507dda2e9346d39e041f (patch)
tree811ab96f0d55d6c0d8fb1d942c4d446cdacfad9d /util/cbfstool/cbfstool.c
parent1dc188fad0c6c209a0185bae6b53d5798e7cf043 (diff)
downloadcoreboot-c1072f2fc73926bbe73b507dda2e9346d39e041f.tar.gz
coreboot-c1072f2fc73926bbe73b507dda2e9346d39e041f.tar.bz2
coreboot-c1072f2fc73926bbe73b507dda2e9346d39e041f.zip
cbfstool: Update FIT entries in the second bootblock
Once a second bootblock has been added using topswap (-j) option, Update the entries in second FIT using -j option with update-fit command. Additionally add a -q option which allows to insert the address of a FMAP region (which should hold a microcode) as the first entry in the second FIT. BUG=None BRANCH=None TEST= Create ROM images with -j options and update FIT using -q option. example: ./build/util/cbfstool/cbfstool coreboot.tmp create \ -M build/fmap.fmap -r COREBOOT,FW_MAIN_A,FW_MAIN_B,RW_LEGACY build/util/cbfstool/cbfstool coreboot.tmp add \ -f build/cbfs/fallback/bootblock.bin -n bootblock -t \ bootblock -b -49152 -j 0x10000 build/util/cbfstool/cbfstool coreboot.tmp add-master-header -j 0x10000 build/util/cbfstool/cbfstool coreboot.tmp add -f build/cpu_microcode_blob.bin \ -n cpu_microcode_blob.bin -t microcode -r COREBOOT -a 16 build/util/cbfstool/cbfstool coreboot.tmp. update-fit \ -n cpu_microcode_blob.bin -x 4 -j 0x10000 -q FW_MAIN_A Also try the failure scenarion by providing invalid topswap size. Change-Id: I9a417031c279038903cdf1761a791f2da0fe8644 Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Reviewed-on: https://review.coreboot.org/26836 Reviewed-by: Subrata Banik <subrata.banik@intel.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r--util/cbfstool/cbfstool.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 0544e8f2f42a..54e2e952bbb7 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -59,6 +59,7 @@ static struct param {
const char *source_region;
const char *bootblock;
const char *ignore_section;
+ const char *ucode_region;
uint64_t u64val;
uint32_t type;
uint32_t baseaddress;
@@ -1209,8 +1210,25 @@ static int cbfs_update_fit(void)
param.headeroffset))
return 1;
+ uint32_t addr = 0;
+
+ /*
+ * get the address of provided region for first row.
+ */
+ if (param.ucode_region) {
+ struct buffer ucode;
+
+ if (partitioned_file_read_region(&ucode,
+ param.image_file, param.ucode_region))
+ addr = -convert_to_from_top_aligned(&ucode, 0);
+ else
+ return 1;
+ }
+
+
if (fit_update_table(&bootblock, &image, param.name,
- param.fit_empty_entries, convert_to_from_top_aligned))
+ param.fit_empty_entries, convert_to_from_top_aligned,
+ param.topswap_size, addr))
return 1;
// The region to be written depends on the type of image, so we write it
@@ -1300,7 +1318,7 @@ static const struct command commands[] = {
{"print", "H:r:vkh?", cbfs_print, true, false},
{"read", "r:f:vh?", cbfs_read, true, false},
{"remove", "H:r:n:vh?", cbfs_remove, true, true},
- {"update-fit", "H:r:n:x:vh?", cbfs_update_fit, true, true},
+ {"update-fit", "H:r:n:x:vh?j:q:", cbfs_update_fit, true, true},
{"write", "r:f:i:Fudvh?", cbfs_write, true, true},
{"expand", "r:h?", cbfs_expand, true, true},
{"truncate", "r:h?", cbfs_truncate, true, true},
@@ -1334,6 +1352,7 @@ static struct option long_options[] = {
{"offset", required_argument, 0, 'o' },
{"padding", required_argument, 0, 'p' },
{"page-size", required_argument, 0, 'P' },
+ {"ucode-region", required_argument, 0, 'q' },
{"size", required_argument, 0, 's' },
{"top-aligned", required_argument, 0, 'T' },
{"type", required_argument, 0, 't' },
@@ -1464,8 +1483,13 @@ static void usage(char *name)
" expand [-r fmap-region] "
"Expand CBFS to span entire region\n"
" update-fit [-r image,regions] -n MICROCODE_BLOB_NAME \\\n"
- " -x EMTPY_FIT_ENTRIES "
- "Updates the FIT table with microcode entries\n"
+ " -x EMTPY_FIT_ENTRIES \\ \n"
+ " [-j topswap-size [-q ucode-region](Intel CPUs only)] "
+ "Updates the FIT table with microcode entries.\n"
+ " "
+ " ucode-region is a region in the FMAP, its address is \n"
+ " "
+ " inserted as the first entry in the topswap FIT. \n"
"\n"
"OFFSETs:\n"
" Numbers accompanying -b, -H, and -o switches* may be provided\n"
@@ -1718,6 +1742,9 @@ int main(int argc, char **argv)
if (!is_valid_topswap())
return 1;
break;
+ case 'q':
+ param.ucode_region = optarg;
+ break;
case 'v':
verbose++;
break;