blob: 6ef2815dcb4025ebe81410cbbdc27cc51d7fb838 [file] [log] [blame]
Patrick Georgiea063cb2020-05-08 19:28:13 +02001/* ifdtool - dump Intel Firmware Descriptor information */
Patrick Georgi7333a112020-05-08 20:48:04 +02002/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer1c795ad12011-10-14 12:49:41 -07003
4#include <stdint.h>
Bill XIEb3e15a22017-09-07 18:34:50 +08005#include <stdbool.h>
Duncan Laurie1f7fd722015-06-22 11:14:48 -07006#define IFDTOOL_VERSION "1.2"
7
8enum ifd_version {
9 IFD_VERSION_1,
10 IFD_VERSION_2,
11};
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070012
Bill XIEb3e15a22017-09-07 18:34:50 +080013/* port from flashrom */
14enum ich_chipset {
15 CHIPSET_ICH_UNKNOWN,
16 CHIPSET_ICH,
17 CHIPSET_ICH2345,
18 CHIPSET_ICH6,
19 CHIPSET_POULSBO, /* SCH U* */
20 CHIPSET_TUNNEL_CREEK, /* Atom E6xx */
21 CHIPSET_CENTERTON, /* Atom S1220 S1240 S1260 */
22 CHIPSET_ICH7,
23 CHIPSET_ICH8,
24 CHIPSET_ICH9,
25 CHIPSET_ICH10,
Subrata Banik89db2252020-08-26 14:49:17 +053026 CHIPSET_PCH_UNKNOWN,
Bill XIEb3e15a22017-09-07 18:34:50 +080027 CHIPSET_5_SERIES_IBEX_PEAK,
28 CHIPSET_6_SERIES_COUGAR_POINT,
29 CHIPSET_7_SERIES_PANTHER_POINT,
30 CHIPSET_8_SERIES_LYNX_POINT,
31 CHIPSET_BAYTRAIL, /* Actually all with Silvermont architecture:
32 * Bay Trail, Avoton/Rangeley
33 */
34 CHIPSET_8_SERIES_LYNX_POINT_LP,
35 CHIPSET_8_SERIES_WELLSBURG,
36 CHIPSET_9_SERIES_WILDCAT_POINT,
37 CHIPSET_9_SERIES_WILDCAT_POINT_LP,
Subrata Banik8c082e52021-06-10 23:02:29 +053038 CHIPSET_N_J_SERIES_APOLLO_LAKE, /* Apollo Lake: N3xxx, J3xxx */
39 CHIPSET_N_J_SERIES_GEMINI_LAKE, /* Gemini Lake: N5xxx, J5xxx, N4xxx, J4xxx */
40 CHIPSET_N_SERIES_JASPER_LAKE, /* Jasper Lake: N6xxx, N51xx, N45xx */
41 CHIPSET_x6000_SERIES_ELKHART_LAKE, /* Elkhart Lake: x6000 */
Subrata Banik89db2252020-08-26 14:49:17 +053042 CHIPSET_100_200_SERIES_SUNRISE_POINT, /* 6th-7th gen Core i/o (LP) variants */
Subrata Banik8c082e52021-06-10 23:02:29 +053043 CHIPSET_300_SERIES_CANNON_POINT, /* 8th-9th gen Core i/o (LP) variants */
44 CHIPSET_400_SERIES_ICE_POINT, /* 10th gen Core i/o (LP) variants */
Subrata Banika5f47812020-09-29 11:43:01 +053045 CHIPSET_500_600_SERIES_TIGER_ALDER_POINT, /* 11th-12th gen Core i/o (LP)
46 * variants onwards */
Bill XIEb3e15a22017-09-07 18:34:50 +080047 CHIPSET_C620_SERIES_LEWISBURG,
48};
49
Andrey Petrov96ecb772016-10-31 19:31:54 -070050enum platform {
Furquan Shaikhc0257dd2018-05-02 23:29:04 -070051 PLATFORM_APL,
52 PLATFORM_CNL,
Lean Sheng Tan0faba3c2021-06-09 07:52:24 -070053 PLATFORM_EHL,
Furquan Shaikhc0257dd2018-05-02 23:29:04 -070054 PLATFORM_GLK,
Aamir Bohra1018be22018-06-29 15:08:50 +053055 PLATFORM_ICL,
rkanabard64b0462019-08-30 11:40:08 +053056 PLATFORM_JSL,
Furquan Shaikh088b6e82018-03-21 10:42:37 -070057 PLATFORM_SKLKBL,
Ravi Sarawadi7d9d63b2019-10-22 13:45:36 -070058 PLATFORM_TGL,
Subrata Banik46f80732020-03-14 15:01:42 +053059 PLATFORM_ADL,
Andrey Petrov96ecb772016-10-31 19:31:54 -070060};
61
Chris Douglass03ce0142014-02-26 13:30:13 -050062#define LAYOUT_LINELEN 80
63
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070064enum spi_frequency {
65 SPI_FREQUENCY_20MHZ = 0,
66 SPI_FREQUENCY_33MHZ = 1,
Duncan Laurie1f7fd722015-06-22 11:14:48 -070067 SPI_FREQUENCY_48MHZ = 2,
68 SPI_FREQUENCY_50MHZ_30MHZ = 4,
69 SPI_FREQUENCY_17MHZ = 6,
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070070};
71
Subrata Banikd16ef4d2020-08-26 15:53:00 +053072enum spi_frequency_500_series {
73 SPI_FREQUENCY_100MHZ = 0,
74 SPI_FREQUENCY_50MHZ = 1,
75 SPI_FREQUENCY_500SERIES_33MHZ = 3,
76 SPI_FREQUENCY_25MHZ = 4,
77 SPI_FREQUENCY_14MHZ = 6,
78};
79
Subrata Banike5d39922020-08-26 16:01:42 +053080enum espi_frequency {
81 ESPI_FREQUENCY_20MHZ = 0,
82 ESPI_FREQUENCY_24MHZ = 1,
83 ESPI_FREQUENCY_30MHZ = 2,
84 ESPI_FREQUENCY_48MHZ = 3,
85 ESPI_FREQUENCY_60MHZ = 4,
86 ESPI_FREQUENCY_17MHZ = 6,
87};
88
89enum espi_frequency_500_series {
90 ESPI_FREQUENCY_500SERIES_20MHZ = 0,
91 ESPI_FREQUENCY_500SERIES_24MHZ = 1,
92 ESPI_FREQUENCY_500SERIES_25MHZ = 2,
93 ESPI_FREQUENCY_500SERIES_48MHZ = 3,
94 ESPI_FREQUENCY_500SERIES_60MHZ = 4,
95};
96
Stefan Reinauer1b1309f2012-05-11 15:53:43 -070097enum component_density {
98 COMPONENT_DENSITY_512KB = 0,
99 COMPONENT_DENSITY_1MB = 1,
100 COMPONENT_DENSITY_2MB = 2,
101 COMPONENT_DENSITY_4MB = 3,
102 COMPONENT_DENSITY_8MB = 4,
103 COMPONENT_DENSITY_16MB = 5,
Duncan Laurie1f7fd722015-06-22 11:14:48 -0700104 COMPONENT_DENSITY_32MB = 6,
105 COMPONENT_DENSITY_64MB = 7,
106 COMPONENT_DENSITY_UNUSED = 0xf
Stefan Reinauer1b1309f2012-05-11 15:53:43 -0700107};
108
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700109// flash descriptor
110typedef struct {
111 uint32_t flvalsig;
112 uint32_t flmap0;
113 uint32_t flmap1;
114 uint32_t flmap2;
Subrata Banikbd2da5a2020-08-26 15:43:51 +0530115 uint32_t flmap3; // Exist for 500 series onwards
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700116} __attribute__((packed)) fdbar_t;
117
118// regions
Duncan Laurie1f7fd722015-06-22 11:14:48 -0700119#define MAX_REGIONS 9
120#define MAX_REGIONS_OLD 5
Bill XIE4651d452017-09-12 11:54:48 +0800121
Duncan Laurie7775d672019-06-06 13:39:26 -0700122enum flash_regions {
123 REGION_DESC,
124 REGION_BIOS,
125 REGION_ME,
126 REGION_GBE,
127 REGION_PDR,
128 REGION_EC = 8,
129};
130
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700131typedef struct {
Bill XIE4651d452017-09-12 11:54:48 +0800132 uint32_t flreg[MAX_REGIONS];
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700133} __attribute__((packed)) frba_t;
134
135// component section
136typedef struct {
137 uint32_t flcomp;
138 uint32_t flill;
139 uint32_t flpb;
140} __attribute__((packed)) fcba_t;
141
142// pch strap
Patrick Rudolph802cbee2020-05-25 12:18:11 +0200143#define MAX_PCHSTRP 1024
Bill XIE4651d452017-09-12 11:54:48 +0800144
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700145typedef struct {
Bill XIE4651d452017-09-12 11:54:48 +0800146 uint32_t pchstrp[MAX_PCHSTRP];
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700147} __attribute__((packed)) fpsba_t;
148
Shawn Nematbakhshd2cb1182015-09-10 19:07:13 -0700149/*
150 * WR / RD bits start at different locations within the flmstr regs, but
151 * otherwise have identical meaning.
152 */
153#define FLMSTR_WR_SHIFT_V1 24
154#define FLMSTR_WR_SHIFT_V2 20
155#define FLMSTR_RD_SHIFT_V1 16
156#define FLMSTR_RD_SHIFT_V2 8
157
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700158// master
159typedef struct {
160 uint32_t flmstr1;
161 uint32_t flmstr2;
162 uint32_t flmstr3;
Duncan Laurie1f7fd722015-06-22 11:14:48 -0700163 uint32_t flmstr4;
164 uint32_t flmstr5;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700165} __attribute__((packed)) fmba_t;
166
167// processor strap
168typedef struct {
169 uint32_t data[8];
170} __attribute__((packed)) fmsba_t;
171
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700172// ME VSCC
173typedef struct {
174 uint32_t jid;
175 uint32_t vscc;
176} vscc_t;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700177
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700178typedef struct {
179 // Actual number of entries specified in vtl
Stefan Tauner0d226142018-08-05 18:56:53 +0200180 /* FIXME: Rationale for the limit of 8.
181 * AFAICT it's 127, cf. flashrom's ich_descriptors_tool). */
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700182 vscc_t entry[8];
183} vtba_t;
184
185typedef struct {
186 int base, limit, size;
187} region_t;
Chris Douglass03ce0142014-02-26 13:30:13 -0500188
189struct region_name {
Bill XIEfa5f9942017-09-12 11:22:29 +0800190 const char *pretty;
191 const char *terse;
Bill XIE1bf65062017-09-12 11:31:37 +0800192 const char *filename;
Mathew Kingc7ddc992019-08-08 14:59:25 -0600193 const char *fmapname;
Chris Douglass03ce0142014-02-26 13:30:13 -0500194};