[coreboot-gerrit] Change in coreboot[master]: cbfstool/fit.c: Fix for older CPUs without total_size in mcu_header

Patrick Georgi (Code Review) gerrit at coreboot.org
Fri Jun 22 11:20:27 CEST 2018


Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/27090 )

Change subject: cbfstool/fit.c: Fix for older CPUs without total_size in mcu_header
......................................................................

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 at aheymans.xyz>
Reviewed-on: https://review.coreboot.org/27090
Reviewed-by: Patrick Georgi <pgeorgi at google.com>
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
---
M util/cbfstool/fit.c
1 file changed, 7 insertions(+), 2 deletions(-)

Approvals:
  build bot (Jenkins): Verified
  Patrick Georgi: Looks good to me, approved



diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c
index e3e6c32..d33cb56 100644
--- a/util/cbfstool/fit.c
+++ b/util/cbfstool/fit.c
@@ -226,13 +226,18 @@
 
 		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;

-- 
To view, visit https://review.coreboot.org/27090
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia50c087af41b0df14b607ce3c3b4eabc602e8738
Gerrit-Change-Number: 27090
Gerrit-PatchSet: 3
Gerrit-Owner: Arthur Heymans <arthur at aheymans.xyz>
Gerrit-Reviewer: Patrick Georgi <pgeorgi at google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180622/2da71138/attachment.html>


More information about the coreboot-gerrit mailing list