<p>Arthur Heymans has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27090">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cbfstool/fit.c: Fix for older CPUs without total_size in mcu_header<br><br>Some older CPUs have a fixed size of 2048 bytes for microcode total size.<br><br>Change-Id: Ia50c087af41b0df14b607ce3c3b4eabc602e8738<br>Signed-off-by: Arthur Heymans <arthur@aheymans.xyz><br>---<br>M util/cbfstool/fit.c<br>1 file changed, 5 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/27090/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c</span><br><span>index e3e6c32..1684ef6 100644</span><br><span>--- a/util/cbfstool/fit.c</span><br><span>+++ b/util/cbfstool/fit.c</span><br><span>@@ -226,13 +226,14 @@</span><br><span> </span><br><span>                 mcu_header = rom_buffer_pointer(&image->buffer, current_offset);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-             /* Quickly sanity check a prospective microcode update. */</span><br><span style="color: hsl(0, 100%, 40%);">-              if (mcu_header->total_size < sizeof(*mcu_header))</span><br><span style="color: hsl(0, 100%, 40%);">-                 break;</span><br><span style="color: hsl(120, 100%, 40%);">+                /* Newer microcode updates include a size field, whereas older</span><br><span style="color: hsl(120, 100%, 40%);">+                 * containers set it at 0 and are exactly 2048 bytes long */</span><br><span style="color: hsl(120, 100%, 40%);">+          uint32_t update_size = mcu_header->total_size</span><br><span style="color: hsl(120, 100%, 40%);">+                      ? mcu_header->total_size : 2048;</span><br><span> </span><br><span>              /* FIXME: Should the checksum be validated? */</span><br><span>               mcus[num_mcus].offset = current_offset;</span><br><span style="color: hsl(0, 100%, 40%);">-         mcus[num_mcus].size = mcu_header->total_size;</span><br><span style="color: hsl(120, 100%, 40%);">+              mcus[num_mcus].size = update_size;</span><br><span> </span><br><span>               /* Proceed to next payload. */</span><br><span>               current_offset += mcus[num_mcus].size;</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27090">change 27090</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/27090"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia50c087af41b0df14b607ce3c3b4eabc602e8738 </div>
<div style="display:none"> Gerrit-Change-Number: 27090 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz> </div>