2020-05-08 19:28:13 +02:00
|
|
|
/* ifdtool - dump Intel Firmware Descriptor information */
|
util/: Replace GPLv2 boiler plate with SPDX header
Used commands:
perl -i -p0e 's|\/\*[\s*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-only */|' $(cat filelist)
perl -i -p0e 's|This[\s*]*program[\s*]*is[\s*]*free[\s*]*software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*either[\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License,[\s*]*or[\s*]*.at[\s*]*your[\s*]*option.*[\s*]*any[\s*]*later[\s*]*version.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-or-later */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*This[\s*#]*program[\s*#]*is[\s*#]*free[\s*#]*software[;:,][\s*#]*you[\s*#]*can[\s*#]*redistribute[\s*#]*it[\s*#]*and/or[\s*#]*modify[\s*#]*it[\s*#]*under[\s*#]*the[\s*#]*terms[\s*#]*of[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*as[\s*#]*published[\s*#]*by[\s*#]*the[\s*#]*Free[\s*#]*Software[\s*#]*Foundation[;:,][\s*#]*either[\s*#]*version[\s*#]*3[\s*#]*of[\s*#]*the[\s*#]*License[;:,][\s*#]*or[\s*#]*.at[\s*#]*your[\s*#]*option.*[\s*#]*any[\s*#]*later[\s*#]*version.[\s*#]*This[\s*#]*program[\s*#]*is[\s*#]*distributed[\s*#]*in[\s*#]*the[\s*#]*hope[\s*#]*that[\s*#]*it[\s*#]*will[\s*#]*be[\s*#]*useful[;:,][\s*#]*but[\s*#]*WITHOUT[\s*#]*ANY[\s*#]*WARRANTY[;:,][\s*#]*without[\s*#]*even[\s*#]*the[\s*#]*implied[\s*#]*warranty[\s*#]*of[\s*#]*MERCHANTABILITY[\s*#]*or[\s*#]*FITNESS[\s*#]*FOR[\s*#]*A[\s*#]*PARTICULAR[\s*#]*PURPOSE.[\s*#]*See[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*for[\s*#]*more[\s*#]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-3.0-or-later */|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w]*.*is free software[:;][\#\s]*you[\#\s]*can[\#\s]*redistribute[\#\s]*it[\#\s]*and\/or[\#\s]*modify[\#\s]*it[\s\#]*under[\s \#]*the[\s\#]*terms[\s\#]*of[\s\#]*the[\s\#]*GNU[\s\#]*General[\s\#]*Public[\s\#]*License[\s\#]*as[\s\#]*published[\s\#]*by[\s\#]*the[\s\#]*Free[\s\#]*Software[\s\#]*Foundation[;,][\s\#]*version[\s\#]*2[\s\#]*of[\s\#]*the[\s\#]*License.*[\s\#]*This[\s\#]*program[\s\#]*is[\s\#]*distributed[\s\#]*in[\s\#]*the[\s\#]*hope[\s\#]*that[\s\#]*it[\s\#]*will[\#\s]*be[\#\s]*useful,[\#\s]*but[\#\s]*WITHOUT[\#\s]*ANY[\#\s]*WARRANTY;[\#\s]*without[\#\s]*even[\#\s]*the[\#\s]*implied[\#\s]*warranty[\#\s]*of[\#\s]*MERCHANTABILITY[\#\s]*or[\#\s]*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.[\#\s]*See[\#\s]*the[\#\s]*GNU[\#\s]*General[\#\s]*Public[\#\s]*License[\#\s]*for[\#\s]*more[\#\s]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
Change-Id: I1008a63b804f355a916221ac994701d7584f60ff
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-08 20:48:04 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2011-10-14 21:49:41 +02:00
|
|
|
|
|
|
|
#include <stdint.h>
|
2017-09-07 12:34:50 +02:00
|
|
|
#include <stdbool.h>
|
2015-06-22 20:14:48 +02:00
|
|
|
#define IFDTOOL_VERSION "1.2"
|
|
|
|
|
|
|
|
enum ifd_version {
|
|
|
|
IFD_VERSION_1,
|
2022-10-21 15:13:43 +02:00
|
|
|
IFD_VERSION_1_5,
|
2015-06-22 20:14:48 +02:00
|
|
|
IFD_VERSION_2,
|
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
2017-09-07 12:34:50 +02:00
|
|
|
/* port from flashrom */
|
|
|
|
enum ich_chipset {
|
|
|
|
CHIPSET_ICH_UNKNOWN,
|
|
|
|
CHIPSET_ICH8,
|
|
|
|
CHIPSET_ICH9,
|
|
|
|
CHIPSET_ICH10,
|
2020-08-26 11:19:17 +02:00
|
|
|
CHIPSET_PCH_UNKNOWN,
|
2017-09-07 12:34:50 +02:00
|
|
|
CHIPSET_5_SERIES_IBEX_PEAK,
|
|
|
|
CHIPSET_6_SERIES_COUGAR_POINT,
|
|
|
|
CHIPSET_7_SERIES_PANTHER_POINT,
|
|
|
|
CHIPSET_8_SERIES_LYNX_POINT,
|
|
|
|
CHIPSET_BAYTRAIL, /* Actually all with Silvermont architecture:
|
|
|
|
* Bay Trail, Avoton/Rangeley
|
|
|
|
*/
|
|
|
|
CHIPSET_8_SERIES_LYNX_POINT_LP,
|
|
|
|
CHIPSET_8_SERIES_WELLSBURG,
|
|
|
|
CHIPSET_9_SERIES_WILDCAT_POINT,
|
|
|
|
CHIPSET_9_SERIES_WILDCAT_POINT_LP,
|
2021-06-10 19:32:29 +02:00
|
|
|
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 */
|
2020-08-26 11:19:17 +02:00
|
|
|
CHIPSET_100_200_SERIES_SUNRISE_POINT, /* 6th-7th gen Core i/o (LP) variants */
|
2021-06-10 19:32:29 +02:00
|
|
|
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 */
|
2020-09-29 08:13:01 +02:00
|
|
|
CHIPSET_500_600_SERIES_TIGER_ALDER_POINT, /* 11th-12th gen Core i/o (LP)
|
|
|
|
* variants onwards */
|
2017-09-07 12:34:50 +02:00
|
|
|
CHIPSET_C620_SERIES_LEWISBURG,
|
2022-01-06 06:52:30 +01:00
|
|
|
CHIPSET_DENVERTON,
|
2017-09-07 12:34:50 +02:00
|
|
|
};
|
|
|
|
|
2016-11-01 03:31:54 +01:00
|
|
|
enum platform {
|
2018-05-03 08:29:04 +02:00
|
|
|
PLATFORM_APL,
|
|
|
|
PLATFORM_CNL,
|
2021-06-22 05:26:46 +02:00
|
|
|
PLATFORM_LBG,
|
2021-06-09 16:52:24 +02:00
|
|
|
PLATFORM_EHL,
|
2018-05-03 08:29:04 +02:00
|
|
|
PLATFORM_GLK,
|
2018-06-29 11:38:50 +02:00
|
|
|
PLATFORM_ICL,
|
2019-08-30 08:10:08 +02:00
|
|
|
PLATFORM_JSL,
|
2018-03-21 18:42:37 +01:00
|
|
|
PLATFORM_SKLKBL,
|
2019-10-22 22:45:36 +02:00
|
|
|
PLATFORM_TGL,
|
2020-03-14 10:31:42 +01:00
|
|
|
PLATFORM_ADL,
|
2022-02-03 00:19:05 +01:00
|
|
|
PLATFORM_IFD2,
|
2022-01-06 06:52:30 +01:00
|
|
|
PLATFORM_DNV,
|
2022-01-20 14:21:21 +01:00
|
|
|
PLATFORM_MTL,
|
2022-10-21 15:13:43 +02:00
|
|
|
PLATFORM_WBG
|
2016-11-01 03:31:54 +01:00
|
|
|
};
|
|
|
|
|
2014-02-26 19:30:13 +01:00
|
|
|
#define LAYOUT_LINELEN 80
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
enum spi_frequency {
|
|
|
|
SPI_FREQUENCY_20MHZ = 0,
|
|
|
|
SPI_FREQUENCY_33MHZ = 1,
|
2015-06-22 20:14:48 +02:00
|
|
|
SPI_FREQUENCY_48MHZ = 2,
|
|
|
|
SPI_FREQUENCY_50MHZ_30MHZ = 4,
|
|
|
|
SPI_FREQUENCY_17MHZ = 6,
|
2011-10-14 21:49:41 +02:00
|
|
|
};
|
|
|
|
|
2020-08-26 12:23:00 +02:00
|
|
|
enum spi_frequency_500_series {
|
|
|
|
SPI_FREQUENCY_100MHZ = 0,
|
|
|
|
SPI_FREQUENCY_50MHZ = 1,
|
|
|
|
SPI_FREQUENCY_500SERIES_33MHZ = 3,
|
|
|
|
SPI_FREQUENCY_25MHZ = 4,
|
|
|
|
SPI_FREQUENCY_14MHZ = 6,
|
|
|
|
};
|
|
|
|
|
2020-08-26 12:31:42 +02:00
|
|
|
enum espi_frequency {
|
|
|
|
ESPI_FREQUENCY_20MHZ = 0,
|
|
|
|
ESPI_FREQUENCY_24MHZ = 1,
|
|
|
|
ESPI_FREQUENCY_30MHZ = 2,
|
|
|
|
ESPI_FREQUENCY_48MHZ = 3,
|
|
|
|
ESPI_FREQUENCY_60MHZ = 4,
|
|
|
|
ESPI_FREQUENCY_17MHZ = 6,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum espi_frequency_500_series {
|
|
|
|
ESPI_FREQUENCY_500SERIES_20MHZ = 0,
|
|
|
|
ESPI_FREQUENCY_500SERIES_24MHZ = 1,
|
|
|
|
ESPI_FREQUENCY_500SERIES_25MHZ = 2,
|
|
|
|
ESPI_FREQUENCY_500SERIES_48MHZ = 3,
|
|
|
|
ESPI_FREQUENCY_500SERIES_60MHZ = 4,
|
|
|
|
};
|
|
|
|
|
2012-05-12 00:53:43 +02:00
|
|
|
enum component_density {
|
|
|
|
COMPONENT_DENSITY_512KB = 0,
|
|
|
|
COMPONENT_DENSITY_1MB = 1,
|
|
|
|
COMPONENT_DENSITY_2MB = 2,
|
|
|
|
COMPONENT_DENSITY_4MB = 3,
|
|
|
|
COMPONENT_DENSITY_8MB = 4,
|
|
|
|
COMPONENT_DENSITY_16MB = 5,
|
2015-06-22 20:14:48 +02:00
|
|
|
COMPONENT_DENSITY_32MB = 6,
|
|
|
|
COMPONENT_DENSITY_64MB = 7,
|
|
|
|
COMPONENT_DENSITY_UNUSED = 0xf
|
2012-05-12 00:53:43 +02:00
|
|
|
};
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
// flash descriptor
|
2023-03-05 04:34:40 +01:00
|
|
|
struct __packed fdbar {
|
2011-10-14 21:49:41 +02:00
|
|
|
uint32_t flvalsig;
|
|
|
|
uint32_t flmap0;
|
|
|
|
uint32_t flmap1;
|
|
|
|
uint32_t flmap2;
|
2020-08-26 12:13:51 +02:00
|
|
|
uint32_t flmap3; // Exist for 500 series onwards
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
|
|
|
// regions
|
2022-01-06 05:51:40 +01:00
|
|
|
#define MAX_REGIONS 16
|
2015-06-22 20:14:48 +02:00
|
|
|
#define MAX_REGIONS_OLD 5
|
2017-09-12 05:54:48 +02:00
|
|
|
|
2019-06-06 22:39:26 +02:00
|
|
|
enum flash_regions {
|
|
|
|
REGION_DESC,
|
|
|
|
REGION_BIOS,
|
|
|
|
REGION_ME,
|
|
|
|
REGION_GBE,
|
|
|
|
REGION_PDR,
|
2022-01-06 05:51:40 +01:00
|
|
|
REGION_DEV_EXP1,
|
|
|
|
REGION_BIOS2,
|
2019-06-06 22:39:26 +02:00
|
|
|
REGION_EC = 8,
|
2022-01-06 05:51:40 +01:00
|
|
|
REGION_DEV_EXP2,
|
|
|
|
REGION_IE,
|
|
|
|
REGION_10GB_0,
|
|
|
|
REGION_10GB_1,
|
|
|
|
REGION_PTT = 15,
|
2019-06-06 22:39:26 +02:00
|
|
|
};
|
|
|
|
|
2023-03-05 04:34:40 +01:00
|
|
|
struct __packed frba {
|
2017-09-12 05:54:48 +02:00
|
|
|
uint32_t flreg[MAX_REGIONS];
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
|
|
|
// component section
|
2023-03-05 04:34:40 +01:00
|
|
|
struct __packed fcba {
|
2011-10-14 21:49:41 +02:00
|
|
|
uint32_t flcomp;
|
|
|
|
uint32_t flill;
|
|
|
|
uint32_t flpb;
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
|
|
|
// pch strap
|
2020-05-25 12:18:11 +02:00
|
|
|
#define MAX_PCHSTRP 1024
|
2017-09-12 05:54:48 +02:00
|
|
|
|
2023-03-05 04:34:40 +01:00
|
|
|
struct __packed fpsba {
|
2017-09-12 05:54:48 +02:00
|
|
|
uint32_t pchstrp[MAX_PCHSTRP];
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
2015-09-11 04:07:13 +02:00
|
|
|
/*
|
|
|
|
* WR / RD bits start at different locations within the flmstr regs, but
|
|
|
|
* otherwise have identical meaning.
|
|
|
|
*/
|
|
|
|
#define FLMSTR_WR_SHIFT_V1 24
|
|
|
|
#define FLMSTR_WR_SHIFT_V2 20
|
|
|
|
#define FLMSTR_RD_SHIFT_V1 16
|
|
|
|
#define FLMSTR_RD_SHIFT_V2 8
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
// master
|
2023-03-05 04:34:40 +01:00
|
|
|
struct __packed fmba {
|
2011-10-14 21:49:41 +02:00
|
|
|
uint32_t flmstr1;
|
|
|
|
uint32_t flmstr2;
|
|
|
|
uint32_t flmstr3;
|
2015-06-22 20:14:48 +02:00
|
|
|
uint32_t flmstr4;
|
|
|
|
uint32_t flmstr5;
|
2022-01-06 06:52:30 +01:00
|
|
|
uint32_t flmstr6;
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
|
|
|
// processor strap
|
2023-03-05 04:34:40 +01:00
|
|
|
struct __packed fmsba {
|
2011-10-14 21:49:41 +02:00
|
|
|
uint32_t data[8];
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
2012-09-27 21:42:15 +02:00
|
|
|
// ME VSCC
|
2023-03-05 04:34:40 +01:00
|
|
|
struct vscc {
|
2012-09-27 21:42:15 +02:00
|
|
|
uint32_t jid;
|
|
|
|
uint32_t vscc;
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2012-09-27 21:42:15 +02:00
|
|
|
|
2023-03-05 04:34:40 +01:00
|
|
|
struct vtba {
|
2012-09-27 21:42:15 +02:00
|
|
|
// Actual number of entries specified in vtl
|
2018-08-05 18:56:53 +02:00
|
|
|
/* FIXME: Rationale for the limit of 8.
|
|
|
|
* AFAICT it's 127, cf. flashrom's ich_descriptors_tool). */
|
2023-03-05 04:34:40 +01:00
|
|
|
struct vscc entry[8];
|
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
2023-03-05 04:34:40 +01:00
|
|
|
struct region {
|
2023-03-05 20:55:32 +01:00
|
|
|
int base, limit, size, type;
|
2023-03-05 04:34:40 +01:00
|
|
|
};
|
2014-02-26 19:30:13 +01:00
|
|
|
|
|
|
|
struct region_name {
|
2017-09-12 05:22:29 +02:00
|
|
|
const char *pretty;
|
|
|
|
const char *terse;
|
2017-09-12 05:31:37 +02:00
|
|
|
const char *filename;
|
2019-08-08 22:59:25 +02:00
|
|
|
const char *fmapname;
|
2014-02-26 19:30:13 +01:00
|
|
|
};
|