coreboot-kgpe-d16/util/ifdtool
Patrick Rudolph 98ecaa4a55 ifdtool: Determine max regions from IFD
IFDv1 always has 8 regions, while IFDv2 always has 16 regions.

It's platform specific which regions are used or are reserved.
The 'SPI programming guide' as the name says is a guide only,
not a specification what the hardware actually does.
The best to do is not to rely on the guide, but detect how many
regions are present in the IFD and expose them all.

Very early IFDv2 chipsets, sometimes unofficially referred to as
IFDv1.5 platforms, only have 8 regions. To not corrupt the IFD when
operating on an IFDv1.5 detect how much space is actually present
in the IFD.

Fixes IFD corruption on Wellsburg/Lynxpoint when writing a new
flash layout.

Change-Id: I0e3f23ec580b8b8402eb1bf165e3995c8db633f1
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68780
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
2023-01-10 13:55:17 +00:00
..
.gitignore
Makefile
Makefile.inc
description.md
ifdtool.c ifdtool: Determine max regions from IFD 2023-01-10 13:55:17 +00:00
ifdtool.h