diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2018-06-13 15:39:57 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-06-22 09:20:22 +0000 |
commit | 9700e91b10411d5b5b5d3ff9345573557cf24c84 (patch) | |
tree | 9d9ffc7579f26129dea31b043453b5f4ff8e87c6 /util/cbfstool | |
parent | d5018a8f78b9e1f0b7d3d1be298cba9716b10c6c (diff) | |
download | coreboot-9700e91b10411d5b5b5d3ff9345573557cf24c84.tar.xz |
cbfstool/fit.c: Fix for older CPUs without total_size in mcu_header
Some older CPUs have a fixed size of 2048 bytes for microcode total size.
Change-Id: Ia50c087af41b0df14b607ce3c3b4eabc602e8738
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/27090
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/cbfstool')
-rw-r--r-- | util/cbfstool/fit.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c index e3e6c32a6f..d33cb56749 100644 --- a/util/cbfstool/fit.c +++ b/util/cbfstool/fit.c @@ -226,13 +226,18 @@ static int parse_microcode_blob(struct cbfs_image *image, mcu_header = rom_buffer_pointer(&image->buffer, current_offset); + /* Newer microcode updates include a size field, whereas older + * containers set it at 0 and are exactly 2048 bytes long */ + uint32_t total_size = mcu_header->total_size + ? mcu_header->total_size : 2048; + /* Quickly sanity check a prospective microcode update. */ - if (mcu_header->total_size < sizeof(*mcu_header)) + if (total_size < sizeof(*mcu_header)) break; /* FIXME: Should the checksum be validated? */ mcus[num_mcus].offset = current_offset; - mcus[num_mcus].size = mcu_header->total_size; + mcus[num_mcus].size = total_size; /* Proceed to next payload. */ current_offset += mcus[num_mcus].size; |