diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2022-10-21 15:13:43 +0200 |
---|---|---|
committer | Lean Sheng Tan <sheng.tan@9elements.com> | 2023-02-02 13:19:11 +0000 |
commit | 16598745b8d30d6cddf7f9c59403a2a250124acc (patch) | |
tree | 6e58f057d9dbe5a60a8383e2b90410ac5274aa7e | |
parent | 794137e2a82eca7e7b2428759007155243009720 (diff) |
util/ifdtool: Add Wellsburg support
Wellsburg is IFDv2 compatible in most fields, but not in all.
It only has 8 regions and the flash master bits match the defines for
IFDv1 and thus has an "IFDv1.5" descriptor.
Add a new enum for IFDv1.5 descriptor and use them to properly operate
on this IFD.
The 'SPI programming guide' is inconsistent and mentions 6 regions
in one place, but 7 regions in another chapter. Tests showed that it
actually supports 7 regions.
Add support using the -p argument to specify Wellsburg platform.
The previous patch made sure that only 8 regions are used and that no
corruption can happen when operating in IFDv2/IFDv1.5 mode.
Tested on Intel Grangeville.
Documents used:
Intel Document Id: 516552
Intel Document Id: 565117
Change-Id: I651730b05deb512478d059174cf8615547d2fde4
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Co-developed-by: Julian Elischer <jrelis@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68657
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
-rw-r--r-- | util/ifdtool/ifdtool.c | 16 | ||||
-rw-r--r-- | util/ifdtool/ifdtool.h | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index 95bf1525e2..1ddb6b7fe1 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -258,6 +258,8 @@ static enum ich_chipset ifd2_platform_to_chipset(const int pindex) return CHIPSET_C620_SERIES_LEWISBURG; case PLATFORM_DNV: return CHIPSET_DENVERTON; + case PLATFORM_WBG: + return CHIPSET_8_SERIES_WELLSBURG; default: return CHIPSET_PCH_UNKNOWN; } @@ -285,6 +287,7 @@ static int is_platform_ifd_2(void) PLATFORM_SKLKBL, PLATFORM_IFD2, PLATFORM_MTL, + PLATFORM_WBG, }; unsigned int i; @@ -301,8 +304,11 @@ static void check_ifd_version(char *image, int size) const fdbar_t *fdb = find_fd(image, size); if (is_platform_ifd_2()) { - ifd_version = IFD_VERSION_2; chipset = ifd2_platform_to_chipset(platform); + if (chipset == CHIPSET_8_SERIES_WELLSBURG) + ifd_version = IFD_VERSION_1_5; + else + ifd_version = IFD_VERSION_2; max_regions = MIN(max_regions_from_fdbar(fdb), MAX_REGIONS); } else { ifd_version = IFD_VERSION_1; @@ -517,6 +523,7 @@ static void _decode_spi_frequency(unsigned int freq) case SPI_FREQUENCY_50MHZ_30MHZ: switch (ifd_version) { case IFD_VERSION_1: + case IFD_VERSION_1_5: printf("50MHz"); break; case IFD_VERSION_2: @@ -709,6 +716,7 @@ static void dump_fcba(const fcba_t *fcba, const fpsba_t *fpsba) printf("\n Component 1 Density: "); decode_component_density(fcba->flcomp & 7); break; + case IFD_VERSION_1_5: case IFD_VERSION_2: printf("\n Component 2 Density: "); decode_component_density((fcba->flcomp >> 4) & 0xf); @@ -1153,6 +1161,7 @@ static void set_em100_mode(const char *filename, char *image, int size) switch (ifd_version) { case IFD_VERSION_1: + case IFD_VERSION_1_5: freq = SPI_FREQUENCY_20MHZ; break; case IFD_VERSION_2: @@ -1191,6 +1200,7 @@ static void set_chipdensity(const char *filename, char *image, int size, mask = 0x7; chip2_offset = 3; break; + case IFD_VERSION_1_5: case IFD_VERSION_2: mask = 0xf; chip2_offset = 4; @@ -1318,6 +1328,7 @@ static void lock_descriptor(const char *filename, char *image, int size) } break; case PLATFORM_DNV: + case PLATFORM_WBG: /* CPU/BIOS can read descriptor and BIOS. */ fmba->flmstr1 |= (1 << REGION_DESC) << rd_shift; fmba->flmstr1 |= (1 << REGION_BIOS) << rd_shift; @@ -1756,6 +1767,7 @@ static void print_usage(const char *name) " jsl - Jasper Lake\n" " sklkbl - Sky Lake/Kaby Lake\n" " tgl - Tiger Lake\n" + " wbg - Wellsburg\n" " -S | --setpchstrap Write a PCH strap\n" " -V | --newvalue The new value to write into PCH strap specified by -S\n" " -v | --version: print the version\n" @@ -2026,6 +2038,8 @@ int main(int argc, char *argv[]) platform = PLATFORM_IFD2; } else if (!strcmp(optarg, "mtl")) { platform = PLATFORM_MTL; + } else if (!strcmp(optarg, "wbg")) { + platform = PLATFORM_WBG; } else { fprintf(stderr, "Unknown platform: %s\n", optarg); exit(EXIT_FAILURE); diff --git a/util/ifdtool/ifdtool.h b/util/ifdtool/ifdtool.h index 1ee76f1447..7379fdc907 100644 --- a/util/ifdtool/ifdtool.h +++ b/util/ifdtool/ifdtool.h @@ -7,6 +7,7 @@ enum ifd_version { IFD_VERSION_1, + IFD_VERSION_1_5, IFD_VERSION_2, }; @@ -62,6 +63,7 @@ enum platform { PLATFORM_IFD2, PLATFORM_DNV, PLATFORM_MTL, + PLATFORM_WBG }; #define LAYOUT_LINELEN 80 |