cpu/intel/microcode: Fix get_microcode_size

Ancient microcode update files do not have a total_size field.
Add support for such platforms and return 2048 in that case.

Change-Id: I952edc12cccf24f396d940bc594d8ef97826a253
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90910
Reviewed-by: Naresh <naresh.solanki.2011@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
This commit is contained in:
Patrick Rudolph 2026-01-26 07:38:14 +01:00 committed by Matt DeVillier
commit 1e97b44e41

View file

@ -132,7 +132,12 @@ uint32_t get_microcode_rev(const void *microcode)
uint32_t get_microcode_size(const void *microcode)
{
return ((struct microcode *)microcode)->total_size;
u32 size = ((struct microcode *)microcode)->total_size;
/* Newer microcode updates include a size field, whereas older
* containers set it at 0 and are exactly 2048 bytes long */
return size ? size : 2048;
}
uint32_t get_microcode_checksum(const void *microcode)