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,
|
|
|
|
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_ICH,
|
|
|
|
CHIPSET_ICH2345,
|
|
|
|
CHIPSET_ICH6,
|
|
|
|
CHIPSET_POULSBO, /* SCH U* */
|
|
|
|
CHIPSET_TUNNEL_CREEK, /* Atom E6xx */
|
|
|
|
CHIPSET_CENTERTON, /* Atom S1220 S1240 S1260 */
|
|
|
|
CHIPSET_ICH7,
|
|
|
|
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,
|
2020-08-26 11:19:17 +02:00
|
|
|
CHIPSET_N_J_SERIES, /* Gemini Lake: N5xxx, J5xxx, N4xxx, J4xxx */
|
|
|
|
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 */
|
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,
|
|
|
|
};
|
|
|
|
|
2016-11-01 03:31:54 +01:00
|
|
|
enum platform {
|
2018-05-03 08:29:04 +02:00
|
|
|
PLATFORM_APL,
|
|
|
|
PLATFORM_CNL,
|
|
|
|
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,
|
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
|
|
|
|
typedef struct {
|
|
|
|
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
|
2011-10-14 21:49:41 +02:00
|
|
|
} __attribute__((packed)) fdbar_t;
|
|
|
|
|
|
|
|
// regions
|
2015-06-22 20:14:48 +02:00
|
|
|
#define MAX_REGIONS 9
|
|
|
|
#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,
|
|
|
|
REGION_EC = 8,
|
|
|
|
};
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
typedef struct {
|
2017-09-12 05:54:48 +02:00
|
|
|
uint32_t flreg[MAX_REGIONS];
|
2011-10-14 21:49:41 +02:00
|
|
|
} __attribute__((packed)) frba_t;
|
|
|
|
|
|
|
|
// component section
|
|
|
|
typedef struct {
|
|
|
|
uint32_t flcomp;
|
|
|
|
uint32_t flill;
|
|
|
|
uint32_t flpb;
|
|
|
|
} __attribute__((packed)) fcba_t;
|
|
|
|
|
|
|
|
// pch strap
|
2020-05-25 12:18:11 +02:00
|
|
|
#define MAX_PCHSTRP 1024
|
2017-09-12 05:54:48 +02:00
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
typedef struct {
|
2017-09-12 05:54:48 +02:00
|
|
|
uint32_t pchstrp[MAX_PCHSTRP];
|
2011-10-14 21:49:41 +02:00
|
|
|
} __attribute__((packed)) fpsba_t;
|
|
|
|
|
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
|
|
|
|
typedef struct {
|
|
|
|
uint32_t flmstr1;
|
|
|
|
uint32_t flmstr2;
|
|
|
|
uint32_t flmstr3;
|
2015-06-22 20:14:48 +02:00
|
|
|
uint32_t flmstr4;
|
|
|
|
uint32_t flmstr5;
|
2011-10-14 21:49:41 +02:00
|
|
|
} __attribute__((packed)) fmba_t;
|
|
|
|
|
|
|
|
// processor strap
|
|
|
|
typedef struct {
|
|
|
|
uint32_t data[8];
|
|
|
|
} __attribute__((packed)) fmsba_t;
|
|
|
|
|
2012-09-27 21:42:15 +02:00
|
|
|
// ME VSCC
|
|
|
|
typedef struct {
|
|
|
|
uint32_t jid;
|
|
|
|
uint32_t vscc;
|
|
|
|
} vscc_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
// 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). */
|
2012-09-27 21:42:15 +02:00
|
|
|
vscc_t entry[8];
|
|
|
|
} vtba_t;
|
2011-10-14 21:49:41 +02:00
|
|
|
|
2012-09-27 21:42:15 +02:00
|
|
|
typedef struct {
|
|
|
|
int base, limit, size;
|
|
|
|
} region_t;
|
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
|
|
|
};
|