summaryrefslogtreecommitdiff
path: root/util/ifdtool
diff options
context:
space:
mode:
Diffstat (limited to 'util/ifdtool')
-rw-r--r--util/ifdtool/ifdtool.c106
-rw-r--r--util/ifdtool/ifdtool.h8
2 files changed, 43 insertions, 71 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index 77fbd7ab66..65ac655fe7 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -69,9 +69,13 @@ static const char *const ich_chipset_names[] = {
"8 series Wellsburg",
"9 series Wildcat Point",
"9 series Wildcat Point LP",
+ "Apollo Lake: N3xxx, J3xxx",
"Gemini Lake: N5xxx, J5xxx, N4xxx, J4xxx",
+ "Jasper Lake: N6xxx, N51xx, N45xx",
+ "Elkhart Lake: x6000 series Atom",
"100/200 series Sunrise Point",
- "300 series Cannon Point/ 400 series Ice Point",
+ "300 series Cannon Point",
+ "400 series Ice Point",
"500 series Tiger Point/ 600 series Alder Point",
"C620 series Lewisburg",
NULL
@@ -165,40 +169,16 @@ static fmsba_t *find_fmsba(char *image, int size)
return PTR_IN_RANGE(fmsba, image, size) ? fmsba : NULL;
}
-static enum ich_chipset guess_ifd_2_chipset(const fpsba_t *fpsba)
-{
- uint32_t pchstrp_22 = fpsba->pchstrp[22];
- uint32_t pchstrp_23 = fpsba->pchstrp[23];
-
- /* Offset 0x5B is the last PCH descriptor record */
- if (pchstrp_23 == 0xFFFFFFFF)
- return CHIPSET_N_J_SERIES;
-
- /* Offset 0x58 is PCH descriptor record is reserved */
- if (pchstrp_22 == 0x0)
- return CHIPSET_300_400_SERIES_CANNON_ICE_POINT;
-
- /* Offset 0x58 bit [2:0] is reserved 0x4 and 0x5a bit [7:0] is reserved 0x58 */
- if (((pchstrp_22 & 0x07) == 0x4) &&
- ((pchstrp_22 & 0xFF0000) >> 16 == 0x58))
- return CHIPSET_500_600_SERIES_TIGER_ALDER_POINT;
-
- return CHIPSET_PCH_UNKNOWN;
-}
-
/* port from flashrom */
-static enum ich_chipset guess_ich_chipset(const fdbar_t *fdb, const fpsba_t *fpsba)
+static enum ich_chipset ifd1_guess_chipset(char *image, int size)
{
+ const fdbar_t *fdb = find_fd(image, size);
+ if (!fdb)
+ exit(EXIT_FAILURE);
uint32_t iccriba = (fdb->flmap2 >> 16) & 0xff;
uint32_t msl = (fdb->flmap2 >> 8) & 0xff;
uint32_t isl = (fdb->flmap1 >> 24);
uint32_t nm = (fdb->flmap1 >> 8) & 0x7;
- int temp_chipset;
-
- /* Check for IFD2 chipset type */
- temp_chipset = guess_ifd_2_chipset(fpsba);
- if (temp_chipset != CHIPSET_PCH_UNKNOWN)
- return temp_chipset;
/* Rest for IFD1 chipset type */
if (iccriba == 0x00) {
@@ -228,6 +208,27 @@ static enum ich_chipset guess_ich_chipset(const fdbar_t *fdb, const fpsba_t *fps
}
}
+static enum ich_chipset ifd2_platform_to_chipset(const int pindex)
+{
+ switch (pindex) {
+ case PLATFORM_GLK:
+ return CHIPSET_N_J_SERIES_GEMINI_LAKE;
+ case PLATFORM_JSL:
+ return CHIPSET_N_SERIES_JASPER_LAKE;
+ case PLATFORM_EHL:
+ return CHIPSET_x6000_SERIES_ELKHART_LAKE;
+ case PLATFORM_CNL:
+ return CHIPSET_300_SERIES_CANNON_POINT;
+ case PLATFORM_TGL:
+ case PLATFORM_ADL:
+ return CHIPSET_500_600_SERIES_TIGER_ALDER_POINT;
+ case PLATFORM_ICL:
+ return CHIPSET_400_SERIES_ICE_POINT;
+ default:
+ return CHIPSET_PCH_UNKNOWN;
+ }
+}
+
/*
* Some newer platforms have re-defined the FCBA field that was used to
* distinguish IFD v1 v/s v2. Define a list of platforms that we know do not
@@ -255,50 +256,17 @@ static int is_platform_ifd_2(void)
return 0;
}
-/*
- * There is no version field in the descriptor so to determine
- * if this is a new descriptor format we check the hardcoded SPI
- * read frequency to see if it is fixed at 20MHz or 17MHz.
- */
-static int get_ifd_version_from_fcba(char *image, int size)
-{
- int read_freq;
- const fcba_t *fcba = find_fcba(image, size);
- const fdbar_t *fdb = find_fd(image, size);
- const fpsba_t *fpsba = find_fpsba(image, size);
- if (!fcba || !fdb || !fpsba)
- exit(EXIT_FAILURE);
-
- chipset = guess_ich_chipset(fdb, fpsba);
- /* TODO: port ifd_version and max_regions
- * against guess_ich_chipset()
- */
- read_freq = (fcba->flcomp >> 17) & 7;
-
- switch (read_freq) {
- case SPI_FREQUENCY_20MHZ:
- return IFD_VERSION_1;
- case SPI_FREQUENCY_17MHZ:
- case SPI_FREQUENCY_50MHZ_30MHZ:
- return IFD_VERSION_2;
- default:
- fprintf(stderr, "Unknown descriptor version: %d\n",
- read_freq);
- exit(EXIT_FAILURE);
- }
-}
-
static void check_ifd_version(char *image, int size)
{
- if (is_platform_ifd_2())
+ if (is_platform_ifd_2()) {
ifd_version = IFD_VERSION_2;
- else
- ifd_version = get_ifd_version_from_fcba(image, size);
-
- if (ifd_version == IFD_VERSION_1)
- max_regions = MAX_REGIONS_OLD;
- else
+ chipset = ifd2_platform_to_chipset(platform);
max_regions = MAX_REGIONS;
+ } else {
+ ifd_version = IFD_VERSION_1;
+ chipset = ifd1_guess_chipset(image, size);
+ max_regions = MAX_REGIONS_OLD;
+ }
}
static region_t get_region(const frba_t *frba, unsigned int region_type)
diff --git a/util/ifdtool/ifdtool.h b/util/ifdtool/ifdtool.h
index e84d605ec7..6ef2815dcb 100644
--- a/util/ifdtool/ifdtool.h
+++ b/util/ifdtool/ifdtool.h
@@ -35,9 +35,13 @@ enum ich_chipset {
CHIPSET_8_SERIES_WELLSBURG,
CHIPSET_9_SERIES_WILDCAT_POINT,
CHIPSET_9_SERIES_WILDCAT_POINT_LP,
- CHIPSET_N_J_SERIES, /* Gemini Lake: N5xxx, J5xxx, N4xxx, J4xxx */
+ CHIPSET_N_J_SERIES_APOLLO_LAKE, /* Apollo Lake: N3xxx, J3xxx */
+ CHIPSET_N_J_SERIES_GEMINI_LAKE, /* Gemini Lake: N5xxx, J5xxx, N4xxx, J4xxx */
+ CHIPSET_N_SERIES_JASPER_LAKE, /* Jasper Lake: N6xxx, N51xx, N45xx */
+ CHIPSET_x6000_SERIES_ELKHART_LAKE, /* Elkhart Lake: x6000 */
CHIPSET_100_200_SERIES_SUNRISE_POINT, /* 6th-7th gen Core i/o (LP) variants */
- CHIPSET_300_400_SERIES_CANNON_ICE_POINT, /* 8th-10th gen Core i/o (LP) variants */
+ CHIPSET_300_SERIES_CANNON_POINT, /* 8th-9th gen Core i/o (LP) variants */
+ CHIPSET_400_SERIES_ICE_POINT, /* 10th gen Core i/o (LP) variants */
CHIPSET_500_600_SERIES_TIGER_ALDER_POINT, /* 11th-12th gen Core i/o (LP)
* variants onwards */
CHIPSET_C620_SERIES_LEWISBURG,