mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-11-04 15:10:39 +01:00 
			
		
		
		
	ichspi: Add support for C740 PCH
Clean commit 51e1d0e4b7
'Add support for Intel Emmitsburg PCH' which broke
CHIPSET_5_SERIES_IBEX_PEAK detection and which assumes C740 is the same
as C620, while its more a close relative to Intel's H570 PCH.
Based on Intel SPI Programming Guide #619386.
Test: Run on Intel ArcherCity CRB with Intel's C741 PCH
      using the 'internal' programmer.
Test: Run on BMC and accessed the SPI flash chip over
      'linux_mtd' programmer.
Change-Id: I80eebc0fcc14de9df823aceaee77870ad136f94a
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/78186
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Anastasia Klimchuk
					
				
			
			
				
	
			
			
			
						parent
						
							95424a2b97
						
					
				
				
					commit
					1dd7c88f41
				
			@@ -601,6 +601,7 @@ static enum chipbustype enable_flash_ich_report_gcs(
 | 
			
		||||
		break;
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -712,6 +713,7 @@ static enum chipbustype enable_flash_ich_report_gcs(
 | 
			
		||||
		break;
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
	case CHIPSET_600_SERIES_ALDER_POINT:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_METEOR_LAKE:
 | 
			
		||||
		boot_straps = boot_straps_pch500;
 | 
			
		||||
		break;
 | 
			
		||||
@@ -987,6 +989,11 @@ static int enable_flash_c620(const struct programmer_cfg *cfg, struct pci_dev *c
 | 
			
		||||
	return enable_flash_pch100_or_c620(cfg, dev, name, 0x1f, 5, CHIPSET_C620_SERIES_LEWISBURG);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int enable_flash_c740(const struct programmer_cfg *cfg, struct pci_dev *const dev, const char *const name)
 | 
			
		||||
{
 | 
			
		||||
	return enable_flash_pch100_or_c620(cfg, dev, name, 0x1f, 5, CHIPSET_C740_SERIES_EMMITSBURG);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int enable_flash_pch300(const struct programmer_cfg *cfg, struct pci_dev *const dev, const char *const name)
 | 
			
		||||
{
 | 
			
		||||
	return enable_flash_pch100_or_c620(cfg, dev, name, 0x1f, 5, CHIPSET_300_SERIES_CANNON_POINT);
 | 
			
		||||
@@ -2123,7 +2130,7 @@ const struct penable chipset_enables[] = {
 | 
			
		||||
	{0x8086, 0xa247, B_S,    NT,  "Intel", "C620 Series Chipset Supersku",	enable_flash_c620},
 | 
			
		||||
	{0x8086, 0xa248, B_S,    NT,  "Intel", "C620 Series Chipset Supersku",	enable_flash_c620},
 | 
			
		||||
	{0x8086, 0xa249, B_S,    NT,  "Intel", "C620 Series Chipset Supersku",	enable_flash_c620},
 | 
			
		||||
	{0x8086, 0x1bca, B_S,    NT,  "Intel", "Emmitsburg Chipset SKU",	enable_flash_c620},
 | 
			
		||||
	{0x8086, 0x1bca, B_S,    DEP, "Intel", "Emmitsburg Chipset SKU",	enable_flash_c740},
 | 
			
		||||
	{0x8086, 0xa2c4, B_S,    NT,  "Intel", "H270",				enable_flash_pch100},
 | 
			
		||||
	{0x8086, 0xa2c5, B_S,    NT,  "Intel", "Z270",				enable_flash_pch100},
 | 
			
		||||
	{0x8086, 0xa2c6, B_S,    NT,  "Intel", "Q270",				enable_flash_pch100},
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,7 @@ ssize_t ich_number_of_regions(const enum ich_chipset cs, const struct ich_desc_c
 | 
			
		||||
	case CHIPSET_GEMINI_LAKE:
 | 
			
		||||
		return 6;
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -75,6 +76,7 @@ ssize_t ich_number_of_masters(const enum ich_chipset cs, const struct ich_desc_c
 | 
			
		||||
{
 | 
			
		||||
	switch (cs) {
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_APOLLO_LAKE:
 | 
			
		||||
	case CHIPSET_600_SERIES_ALDER_POINT:
 | 
			
		||||
	case CHIPSET_METEOR_LAKE:
 | 
			
		||||
@@ -117,9 +119,9 @@ void prettyprint_ich_chipset(enum ich_chipset cs)
 | 
			
		||||
		"5 series Ibex Peak", "6 series Cougar Point", "7 series Panther Point",
 | 
			
		||||
		"8 series Lynx Point", "Baytrail", "8 series Lynx Point LP", "8 series Wellsburg",
 | 
			
		||||
		"9 series Wildcat Point", "9 series Wildcat Point LP", "100 series Sunrise Point",
 | 
			
		||||
		"C620 series Lewisburg", "300 series Cannon Point", "400 series Comet Point",
 | 
			
		||||
		"500 series Tiger Point", "600 series Alder Point", "Meteor Lake",
 | 
			
		||||
		"Apollo Lake", "Gemini Lake", "Jasper Lake", "Elkhart Lake",
 | 
			
		||||
		"C620 series Lewisburg", "C740 series Emmitsburg", "300 series Cannon Point",
 | 
			
		||||
		"400 series Comet Point", "500 series Tiger Point", "600 series Alder Point",
 | 
			
		||||
		"Meteor Lake", "Apollo Lake", "Gemini Lake", "Jasper Lake", "Elkhart Lake",
 | 
			
		||||
	};
 | 
			
		||||
	if (cs < CHIPSET_ICH8 || cs - CHIPSET_ICH8 + 1 >= ARRAY_SIZE(chipset_names))
 | 
			
		||||
		cs = 0;
 | 
			
		||||
@@ -211,6 +213,7 @@ static const char *pprint_density(enum ich_chipset cs, const struct ich_descript
 | 
			
		||||
	case CHIPSET_9_SERIES_WILDCAT_POINT_LP:
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -313,6 +316,7 @@ static const char *pprint_freq(enum ich_chipset cs, uint8_t value)
 | 
			
		||||
		return freq_str[2][value];
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
	case CHIPSET_600_SERIES_ALDER_POINT:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_METEOR_LAKE:
 | 
			
		||||
		return freq_str[3][value];
 | 
			
		||||
	case CHIPSET_ELKHART_LAKE:
 | 
			
		||||
@@ -357,6 +361,7 @@ void prettyprint_ich_descriptor_component(enum ich_chipset cs, const struct ich_
 | 
			
		||||
	switch (cs) {
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -472,15 +477,27 @@ void prettyprint_ich_descriptor_region(const enum ich_chipset cs, const struct i
 | 
			
		||||
void prettyprint_ich_descriptor_master(const enum ich_chipset cs, const struct ich_descriptors *const desc)
 | 
			
		||||
{
 | 
			
		||||
	ssize_t i;
 | 
			
		||||
	const ssize_t nm = ich_number_of_masters(cs, &desc->content);
 | 
			
		||||
	ssize_t nm = ich_number_of_masters(cs, &desc->content);
 | 
			
		||||
	msg_pdbg2("=== Master Section ===\n");
 | 
			
		||||
	if (nm < 0) {
 | 
			
		||||
		msg_pdbg2("%s: number of masters too high (%d).\n", __func__,
 | 
			
		||||
			  desc->content.NM + 1);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	if (cs == CHIPSET_C740_SERIES_EMMITSBURG) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * The SPI programming guide says there are 6 masters (thus NM=6), but it
 | 
			
		||||
		 * can only name 5. If there's a 6th then it's undocumented.
 | 
			
		||||
		 * However the first 5 are matching '500 Series PCH' and since C740 is a
 | 
			
		||||
		 * 500 Series clone, this field probably was not updated when writing the
 | 
			
		||||
		 * document.
 | 
			
		||||
		 * Hardcode to 5 to be compatible with '500 Series PCH' below.
 | 
			
		||||
		 */
 | 
			
		||||
		nm = 5;
 | 
			
		||||
	}
 | 
			
		||||
	for (i = 0; i < nm; i++)
 | 
			
		||||
		msg_pdbg2("FLMSTR%zd  0x%08"PRIx32"\n", i + 1, desc->master.FLMSTRs[i]);
 | 
			
		||||
 | 
			
		||||
	msg_pdbg2("\n");
 | 
			
		||||
 | 
			
		||||
	msg_pdbg2("--- Details ---\n");
 | 
			
		||||
@@ -489,6 +506,7 @@ void prettyprint_ich_descriptor_master(const enum ich_chipset cs, const struct i
 | 
			
		||||
	    cs == CHIPSET_400_SERIES_COMET_POINT ||
 | 
			
		||||
	    cs == CHIPSET_500_SERIES_TIGER_POINT ||
 | 
			
		||||
	    cs == CHIPSET_600_SERIES_ALDER_POINT ||
 | 
			
		||||
	    cs == CHIPSET_C740_SERIES_EMMITSBURG ||
 | 
			
		||||
	    cs == CHIPSET_JASPER_LAKE || cs == CHIPSET_METEOR_LAKE) {
 | 
			
		||||
		const char *const master_names[] = {
 | 
			
		||||
			"BIOS", "ME", "GbE", "DevE", "EC",
 | 
			
		||||
@@ -1021,8 +1039,8 @@ static enum ich_chipset guess_ich_chipset_from_content(const struct ich_desc_con
 | 
			
		||||
			warn_peculiar_desc("Gemini Lake");
 | 
			
		||||
			return CHIPSET_GEMINI_LAKE;
 | 
			
		||||
		}
 | 
			
		||||
		if (content->ISL <= 80)
 | 
			
		||||
			return CHIPSET_C620_SERIES_LEWISBURG;
 | 
			
		||||
		if (content->ISL == 0x50)
 | 
			
		||||
			return CHIPSET_C740_SERIES_EMMITSBURG;
 | 
			
		||||
		warn_peculiar_desc("Ibex Peak");
 | 
			
		||||
		return CHIPSET_5_SERIES_IBEX_PEAK;
 | 
			
		||||
	} else if (upper->MDTBA == 0x00) {
 | 
			
		||||
@@ -1095,6 +1113,7 @@ static enum ich_chipset guess_ich_chipset(const struct ich_desc_content *const c
 | 
			
		||||
		break;
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_APOLLO_LAKE:
 | 
			
		||||
		if (component->modes.freq_read != 6) {
 | 
			
		||||
			msg_pwarn("\nThe flash descriptor looks like a Skylake/Sunrise Point descriptor.\n"
 | 
			
		||||
@@ -1242,6 +1261,7 @@ int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors
 | 
			
		||||
	case CHIPSET_9_SERIES_WILDCAT_POINT_LP:
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -1287,6 +1307,7 @@ static uint32_t read_descriptor_reg(enum ich_chipset cs, uint8_t section, uint16
 | 
			
		||||
	switch (cs) {
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								ichspi.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								ichspi.c
									
									
									
									
									
								
							@@ -457,6 +457,7 @@ static void prettyprint_ich9_reg_hsfs(uint16_t reg_val, enum ich_chipset ich_gen
 | 
			
		||||
	switch (ich_gen) {
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -470,6 +471,7 @@ static void prettyprint_ich9_reg_hsfs(uint16_t reg_val, enum ich_chipset ich_gen
 | 
			
		||||
	switch (ich_gen) {
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -492,6 +494,7 @@ static void prettyprint_ich9_reg_hsfc(uint16_t reg_val, enum ich_chipset ich_gen
 | 
			
		||||
	switch (ich_gen) {
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -2050,6 +2053,7 @@ static void init_chipset_properties(struct swseq_data *swseq, struct hwseq_data
 | 
			
		||||
	switch (ich_gen) {
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -2087,6 +2091,7 @@ static void init_chipset_properties(struct swseq_data *swseq, struct hwseq_data
 | 
			
		||||
		*num_freg = 10;
 | 
			
		||||
		break;
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
		*num_freg = 12;	/* 12 MMIO regs, but 16 regions in FD spec */
 | 
			
		||||
		break;
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
@@ -2150,6 +2155,7 @@ static int init_ich_default(const struct programmer_cfg *cfg, void *spibar, enum
 | 
			
		||||
	switch (ich_gen) {
 | 
			
		||||
	case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
	case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
	case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
	case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
	case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
	case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -2230,6 +2236,7 @@ static int init_ich_default(const struct programmer_cfg *cfg, void *spibar, enum
 | 
			
		||||
		case CHIPSET_ICH8:
 | 
			
		||||
		case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
		case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
		case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
		case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
		case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
		case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -2269,6 +2276,7 @@ static int init_ich_default(const struct programmer_cfg *cfg, void *spibar, enum
 | 
			
		||||
		case CHIPSET_ICH8:
 | 
			
		||||
		case CHIPSET_100_SERIES_SUNRISE_POINT:
 | 
			
		||||
		case CHIPSET_C620_SERIES_LEWISBURG:
 | 
			
		||||
		case CHIPSET_C740_SERIES_EMMITSBURG:
 | 
			
		||||
		case CHIPSET_300_SERIES_CANNON_POINT:
 | 
			
		||||
		case CHIPSET_400_SERIES_COMET_POINT:
 | 
			
		||||
		case CHIPSET_500_SERIES_TIGER_POINT:
 | 
			
		||||
@@ -2310,7 +2318,8 @@ static int init_ich_default(const struct programmer_cfg *cfg, void *spibar, enum
 | 
			
		||||
	     ich_gen == CHIPSET_300_SERIES_CANNON_POINT ||
 | 
			
		||||
	     ich_gen == CHIPSET_400_SERIES_COMET_POINT ||
 | 
			
		||||
	     ich_gen == CHIPSET_500_SERIES_TIGER_POINT ||
 | 
			
		||||
	     ich_gen == CHIPSET_600_SERIES_ALDER_POINT)) {
 | 
			
		||||
	     ich_gen == CHIPSET_600_SERIES_ALDER_POINT ||
 | 
			
		||||
	     ich_gen == CHIPSET_C740_SERIES_EMMITSBURG)) {
 | 
			
		||||
		msg_pdbg("Enabling hardware sequencing by default for 100+ series PCH.\n");
 | 
			
		||||
		ich_spi_mode = ich_hwseq;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -354,6 +354,7 @@ enum ich_chipset {
 | 
			
		||||
	CHIPSET_9_SERIES_WILDCAT_POINT_LP,
 | 
			
		||||
	CHIPSET_100_SERIES_SUNRISE_POINT, /* also 6th/7th gen Core i/o (LP) variants */
 | 
			
		||||
	CHIPSET_C620_SERIES_LEWISBURG,
 | 
			
		||||
	CHIPSET_C740_SERIES_EMMITSBURG,
 | 
			
		||||
	CHIPSET_300_SERIES_CANNON_POINT,
 | 
			
		||||
	CHIPSET_400_SERIES_COMET_POINT,
 | 
			
		||||
	CHIPSET_500_SERIES_TIGER_POINT,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user