mail.coreboot.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
List overview
Download
flashrom-gerrit
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
flashrom-gerrit@flashrom.org
20577 discussions
Start a n
N
ew thread
Change in flashrom[staging]: flashrom: Add Skylake platform support
by build bot (Jenkins) (Code Review)
21 Mar '17
21 Mar '17
build bot (Jenkins) has posted comments on this change. (
https://review.coreboot.org/18932
) Change subject: flashrom: Add Skylake platform support ...................................................................... Patch Set 1: Verified-1 Build Failed
https://qa.coreboot.org/job/flashrom_gerrit/43/
: FAILURE
https://qa.coreboot.org/job/flashrom-customrules/26/
: SUCCESS -- To view, visit
https://review.coreboot.org/18932
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I0e8ad2d3281c148414fd357427fcd445afc7d045 Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de> Gerrit-Reviewer: build bot (Jenkins) Gerrit-HasComments: No
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18940
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support ichspi: Decode DLOCK register Change-Id: Idc57fec7c2007926dafd8b84119d15e86c5e111d Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ichspi.c 1 file changed, 43 insertions(+), 0 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/40/18940/1 diff --git a/ichspi.c b/ichspi.c index 413d97c..3ff0c55 100644 --- a/ichspi.c +++ b/ichspi.c @@ -48,6 +48,28 @@ #define PCH100_FADDR_FLA 0x07ffffff +#define PCH100_REG_DLOCK 0x0c /* 32 Bits Discrete Lock Bits */ +#define DLOCK_BMWAG_LOCKDN_OFF 0 +#define DLOCK_BMWAG_LOCKDN (0x1 << DLOCK_BMWAG_LOCKDN_OFF) +#define DLOCK_BMRAG_LOCKDN_OFF 1 +#define DLOCK_BMRAG_LOCKDN (0x1 << DLOCK_BMRAG_LOCKDN_OFF) +#define DLOCK_SBMWAG_LOCKDN_OFF 2 +#define DLOCK_SBMWAG_LOCKDN (0x1 << DLOCK_SBMWAG_LOCKDN_OFF) +#define DLOCK_SBMRAG_LOCKDN_OFF 3 +#define DLOCK_SBMRAG_LOCKDN (0x1 << DLOCK_SBMRAG_LOCKDN_OFF) +#define DLOCK_PR0_LOCKDN_OFF 8 +#define DLOCK_PR0_LOCKDN (0x1 << DLOCK_PR0_LOCKDN_OFF) +#define DLOCK_PR1_LOCKDN_OFF 9 +#define DLOCK_PR1_LOCKDN (0x1 << DLOCK_PR1_LOCKDN_OFF) +#define DLOCK_PR2_LOCKDN_OFF 10 +#define DLOCK_PR2_LOCKDN (0x1 << DLOCK_PR2_LOCKDN_OFF) +#define DLOCK_PR3_LOCKDN_OFF 11 +#define DLOCK_PR3_LOCKDN (0x1 << DLOCK_PR3_LOCKDN_OFF) +#define DLOCK_PR4_LOCKDN_OFF 12 +#define DLOCK_PR4_LOCKDN (0x1 << DLOCK_PR4_LOCKDN_OFF) +#define DLOCK_SSEQ_LOCKDN_OFF 16 +#define DLOCK_SSEQ_LOCKDN (0x1 << DLOCK_SSEQ_LOCKDN_OFF) + #define PCH100_REG_FPR0 0x84 /* 32 Bytes Protected Range 0 */ #define PCH100_REG_SSFSC 0xA0 /* 32 Bits Status (8) + Control (24) */ @@ -391,6 +413,21 @@ pprint_reg(SSFC, DBC, reg_val, ", "); pprint_reg(SSFC, SME, reg_val, ", "); pprint_reg(SSFC, SCF, reg_val, "\n"); +} + +static void prettyprint_pch100_reg_dlock(const uint32_t reg_val) +{ + msg_pdbg("DLOCK: "); + pprint_reg(DLOCK, BMWAG_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, BMRAG_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, SBMWAG_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, SBMRAG_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, PR0_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, PR1_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, PR2_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, PR3_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, PR4_LOCKDN, reg_val, ", "); + pprint_reg(DLOCK, SSEQ_LOCKDN, reg_val, "\n"); } static struct { @@ -1751,6 +1788,12 @@ tmp = mmio_readl(ich_spibar + ICH9_REG_FADDR); msg_pdbg2("0x08: 0x%08x (FADDR)\n", tmp); + if (ich_gen == CHIPSET_100_SERIES_SUNRISE_POINT) { + const uint32_t dlock = mmio_readl(ich_spibar + PCH100_REG_DLOCK); + msg_pdbg("0x0c: 0x%08x (DLOCK)\n", dlock); + prettyprint_pch100_reg_dlock(dlock); + } + if (desc_valid) { tmp = mmio_readl(ich_spibar + ICH9_REG_FRAP); msg_pdbg("0x50: 0x%08x (FRAP)\n", tmp); -- To view, visit
https://review.coreboot.org/18940
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Idc57fec7c2007926dafd8b84119d15e86c5e111d Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18939
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support ich_descriptors: Decode component density for Sunrise Point Change-Id: I825b3a6d33bc5dcf41fd58a71c666dfecad32809 Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ich_descriptors.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/39/18939/1 diff --git a/ich_descriptors.c b/ich_descriptors.c index 32cc804..92318df 100644 --- a/ich_descriptors.c +++ b/ich_descriptors.c @@ -829,6 +829,7 @@ case CHIPSET_8_SERIES_LYNX_POINT_LP: case CHIPSET_8_SERIES_WELLSBURG: case CHIPSET_9_SERIES_WILDCAT_POINT: + case CHIPSET_100_SERIES_SUNRISE_POINT: if (idx == 0) { size_enc = desc->component.dens_new.comp1_density; } else { -- To view, visit
https://review.coreboot.org/18939
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I825b3a6d33bc5dcf41fd58a71c666dfecad32809 Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18938
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support ichspi: Abstract over swseq register offsets and consolidate init. SSFS/C register offset is guessed. Change-Id: I0ad46f7944d92d3381975c5e10af0918ec163782 Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ichspi.c 1 file changed, 64 insertions(+), 160 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/38/18938/1 diff --git a/ichspi.c b/ichspi.c index 3b7e5d8..413d97c 100644 --- a/ichspi.c +++ b/ichspi.c @@ -50,9 +50,10 @@ #define PCH100_REG_FPR0 0x84 /* 32 Bytes Protected Range 0 */ -#define PCH100_REG_PREOP_OPTYPE 0xA4 /* 32 Bits */ -#define PCH100_REG_OPMENU_LOWER 0xA8 /* 32 Bits */ -#define PCH100_REG_OPMENU_UPPER 0xAC /* 32 Bits */ +#define PCH100_REG_SSFSC 0xA0 /* 32 Bits Status (8) + Control (24) */ +#define PCH100_REG_PREOP 0xA4 /* 16 Bits */ +#define PCH100_REG_OPTYPE 0xA6 /* 16 Bits */ +#define PCH100_REG_OPMENU 0xA8 /* 64 Bits */ /* ICH9 controller register definition */ #define ICH9_REG_HSFS 0x04 /* 16 Bits Hardware Sequencing Flash Status */ @@ -392,6 +393,13 @@ pprint_reg(SSFC, SCF, reg_val, "\n"); } +static struct { + size_t reg_ssfsc; + size_t reg_preop; + size_t reg_optype; + size_t reg_opmenu; +} swseq_data; + static uint8_t lookup_spi_type(uint8_t opcode) { int a; @@ -495,18 +503,12 @@ opmenu[0] = REGREAD32(ICH7_REG_OPMENU); opmenu[1] = REGREAD32(ICH7_REG_OPMENU + 4); break; - case CHIPSET_100_SERIES_SUNRISE_POINT: - preop = REGREAD16(PCH100_REG_PREOP_OPTYPE); - optype = REGREAD16(PCH100_REG_PREOP_OPTYPE + 2); - opmenu[0] = REGREAD32(PCH100_REG_OPMENU_LOWER); - opmenu[1] = REGREAD32(PCH100_REG_OPMENU_UPPER); - break; case CHIPSET_ICH8: default: /* Future version might behave the same */ - preop = REGREAD16(ICH9_REG_PREOP); - optype = REGREAD16(ICH9_REG_OPTYPE); - opmenu[0] = REGREAD32(ICH9_REG_OPMENU); - opmenu[1] = REGREAD32(ICH9_REG_OPMENU + 4); + preop = REGREAD16(swseq_data.reg_preop); + optype = REGREAD16(swseq_data.reg_optype); + opmenu[0] = REGREAD32(swseq_data.reg_opmenu); + opmenu[1] = REGREAD32(swseq_data.reg_opmenu + 4); break; } @@ -582,32 +584,19 @@ mmio_writel(opmenu[0], ich_spibar + ICH7_REG_OPMENU); mmio_writel(opmenu[1], ich_spibar + ICH7_REG_OPMENU + 4); break; - case CHIPSET_100_SERIES_SUNRISE_POINT: - /* Register undo only for enable_undo=1, i.e. first call. */ - if (enable_undo) { - rmmio_valw(ich_spibar + PCH100_REG_PREOP_OPTYPE); - rmmio_valw(ich_spibar + PCH100_REG_PREOP_OPTYPE + 2); - rmmio_vall(ich_spibar + PCH100_REG_OPMENU_LOWER); - rmmio_vall(ich_spibar + PCH100_REG_OPMENU_UPPER); - } - mmio_writew(preop, ich_spibar + PCH100_REG_PREOP_OPTYPE); - mmio_writew(optype, ich_spibar + PCH100_REG_PREOP_OPTYPE + 2); - mmio_writel(opmenu[0], ich_spibar + PCH100_REG_OPMENU_LOWER); - mmio_writel(opmenu[1], ich_spibar + PCH100_REG_OPMENU_UPPER); - break; case CHIPSET_ICH8: default: /* Future version might behave the same */ /* Register undo only for enable_undo=1, i.e. first call. */ if (enable_undo) { - rmmio_valw(ich_spibar + ICH9_REG_PREOP); - rmmio_valw(ich_spibar + ICH9_REG_OPTYPE); - rmmio_vall(ich_spibar + ICH9_REG_OPMENU); - rmmio_vall(ich_spibar + ICH9_REG_OPMENU + 4); + rmmio_valw(ich_spibar + swseq_data.reg_preop); + rmmio_valw(ich_spibar + swseq_data.reg_optype); + rmmio_vall(ich_spibar + swseq_data.reg_opmenu); + rmmio_vall(ich_spibar + swseq_data.reg_opmenu + 4); } - mmio_writew(preop, ich_spibar + ICH9_REG_PREOP); - mmio_writew(optype, ich_spibar + ICH9_REG_OPTYPE); - mmio_writel(opmenu[0], ich_spibar + ICH9_REG_OPMENU); - mmio_writel(opmenu[1], ich_spibar + ICH9_REG_OPMENU + 4); + mmio_writew(preop, ich_spibar + swseq_data.reg_preop); + mmio_writew(optype, ich_spibar + swseq_data.reg_optype); + mmio_writel(opmenu[0], ich_spibar + swseq_data.reg_opmenu); + mmio_writel(opmenu[1], ich_spibar + swseq_data.reg_opmenu + 4); break; } @@ -894,7 +883,7 @@ } timeout = 100 * 60; /* 60 ms are 9.6 million cycles at 16 MHz. */ - while ((REGREAD8(ICH9_REG_SSFS) & SSFS_SCIP) && --timeout) { + while ((REGREAD8(swseq_data.reg_ssfsc) & SSFS_SCIP) && --timeout) { programmer_delay(10); } if (!timeout) { @@ -912,12 +901,12 @@ ich_fill_data(data, datalength, ICH9_REG_FDATA0); /* Assemble SSFS + SSFC */ - temp32 = REGREAD32(ICH9_REG_SSFS); + temp32 = REGREAD32(swseq_data.reg_ssfsc); /* Keep reserved bits only */ temp32 &= SSFS_RESERVED_MASK | SSFC_RESERVED_MASK; /* Clear cycle done and cycle error status registers */ temp32 |= (SSFS_FDONE | SSFS_FCERR); - REGWRITE32(ICH9_REG_SSFS, temp32); + REGWRITE32(swseq_data.reg_ssfsc, temp32); /* Use 20 MHz */ temp32 |= SSFC_SCF_20MHZ; @@ -971,21 +960,21 @@ temp32 |= SSFC_SCGO; /* write it */ - REGWRITE32(ICH9_REG_SSFS, temp32); + REGWRITE32(swseq_data.reg_ssfsc, temp32); /* Wait for Cycle Done Status or Flash Cycle Error. */ - while (((REGREAD32(ICH9_REG_SSFS) & (SSFS_FDONE | SSFS_FCERR)) == 0) && + while (((REGREAD32(swseq_data.reg_ssfsc) & (SSFS_FDONE | SSFS_FCERR)) == 0) && --timeout) { programmer_delay(10); } if (!timeout) { - msg_perr("timeout, ICH9_REG_SSFS=0x%08x\n", - REGREAD32(ICH9_REG_SSFS)); + msg_perr("timeout, REG_SSFS=0x%08x\n", + REGREAD32(swseq_data.reg_ssfsc)); return 1; } /* FIXME make sure we do not needlessly cause transaction errors. */ - temp32 = REGREAD32(ICH9_REG_SSFS); + temp32 = REGREAD32(swseq_data.reg_ssfsc); if (temp32 & SSFS_FCERR) { msg_perr("Transaction error!\n"); prettyprint_ich9_reg_ssfs(temp32); @@ -993,7 +982,7 @@ /* keep reserved bits */ temp32 &= SSFS_RESERVED_MASK | SSFC_RESERVED_MASK; /* Clear the transaction error. */ - REGWRITE32(ICH9_REG_SSFS, temp32 | SSFS_FCERR); + REGWRITE32(swseq_data.reg_ssfsc, temp32 | SSFS_FCERR); return 1; } @@ -1644,6 +1633,25 @@ ich_generation = ich_gen; ich_spibar = spibar; + /* Moving registers / bits */ + if (ich_generation == CHIPSET_100_SERIES_SUNRISE_POINT) { + swseq_data.reg_ssfsc = PCH100_REG_SSFSC; + swseq_data.reg_preop = PCH100_REG_PREOP; + swseq_data.reg_optype = PCH100_REG_OPTYPE; + swseq_data.reg_opmenu = PCH100_REG_OPMENU; + hwseq_data.addr_mask = PCH100_FADDR_FLA; + hwseq_data.only_4k = true; + hwseq_data.hsfc_fcycle = PCH100_HSFC_FCYCLE; + } else { + swseq_data.reg_ssfsc = ICH9_REG_SSFS; + swseq_data.reg_preop = ICH9_REG_PREOP; + swseq_data.reg_optype = ICH9_REG_OPTYPE; + swseq_data.reg_opmenu = ICH9_REG_OPMENU; + hwseq_data.addr_mask = ICH9_FADDR_FLA; + hwseq_data.only_4k = false; + hwseq_data.hsfc_fcycle = HSFC_FCYCLE; + } + switch (ich_generation) { case CHIPSET_ICH7: case CHIPSET_TUNNEL_CREEK: @@ -1679,112 +1687,8 @@ ich_set_bbar(0); register_spi_master(&spi_master_ich7); break; - case CHIPSET_100_SERIES_SUNRISE_POINT: - hwseq_data.addr_mask = PCH100_FADDR_FLA; - hwseq_data.only_4k = true; - hwseq_data.hsfc_fcycle = PCH100_HSFC_FCYCLE; - - arg = extract_programmer_param("ich_spi_mode"); - if (arg && !strcmp(arg, "hwseq")) { - ich_spi_mode = ich_hwseq; - msg_pspew("user selected hwseq\n"); - } else if (arg && !strcmp(arg, "swseq")) { - ich_spi_mode = ich_swseq; - msg_pspew("user selected swseq\n"); - } else if (arg && !strcmp(arg, "auto")) { - msg_pspew("user selected auto\n"); - ich_spi_mode = ich_auto; - } else if (arg && !strlen(arg)) { - msg_perr("Missing argument for ich_spi_mode.\n"); - free(arg); - return ERROR_FATAL; - } else if (arg) { - msg_perr("Unknown argument for ich_spi_mode: %s\n", - arg); - free(arg); - return ERROR_FATAL; - } - free(arg); - tmp = mmio_readl(ich_spibar + ICH9_REG_HSFS); - msg_pdbg("0x04: 0x%04x (HSFSC)\n", tmp); - if (tmp & HSFS_FLOCKDN) { - msg_perr("WARNING: SPI Configuration " - "Lockdown activated.\n"); - ichspi_lock = 1; - } - if (tmp & HSFS_FDV) - desc_valid = 1; - - if (!(tmp & HSFS_FDOPSS) && desc_valid) - msg_perr("The Flash Descriptor Security Override " - "Strap-Pin is set. Restrictions implied\n" - "by the FRAP and FREG registers are NOT in " - "effect. Please note that Protected\n" - "Range (PR) restrictions still apply.\n"); - ich_init_opcodes(); - - tmp = mmio_readl(ich_spibar + ICH9_REG_FADDR); - msg_pdbg("0x08: 0x%08x (FADDR)\n", tmp); - if (desc_valid) { - tmp = mmio_readl(ich_spibar + ICH9_REG_FRAP); - msg_cdbg("0x50: 0x%08x (FRAP)\n", tmp); - msg_cdbg("BMWAG 0x%02x, ", ICH_BMWAG(tmp)); - msg_cdbg("BMRAG 0x%02x, ", ICH_BMRAG(tmp)); - msg_cdbg("BRWA 0x%02x, ", ICH_BRWA(tmp)); - msg_cdbg("BRRA 0x%02x\n", ICH_BRRA(tmp)); - - /* Decode and print FREGx and FRAP registers */ - for (i = 0; i < 5; i++) - ich9_handle_frap(tmp, i); - } - /* try to disable PR locks before printing them */ - if (!ichspi_lock) - for (i = 0; i < 5; i++) - ich9_set_pr(i, 0, 0, ich_generation); - for (i = 0; i < 5; i++) - ich9_handle_pr(i, ich_generation); - if (desc_valid) { - if (read_ich_descriptors_via_fdo(ich_gen, ich_spibar, &desc) == ICH_RET_OK) - prettyprint_ich_descriptors(CHIPSET_ICH_UNKNOWN, - &desc); - /* If the descriptor is valid and indicates multiple - * flash devices we need to use hwseq to be able to - * access the second flash device. - */ - if (ich_spi_mode == ich_auto && desc.content.NC != 0) { - msg_pinfo("Enabling hardware sequencing due to " - "multiple flash chips detected.\n"); - ich_spi_mode = ich_hwseq; - } - } - - if (ich_spi_mode == ich_auto && ichspi_lock && - ich_missing_opcodes()) { - msg_pinfo("Enabling hardware sequencing because " - "some important opcode is locked.\n"); - ich_spi_mode = ich_hwseq; - } - - if (ich_spi_mode == ich_hwseq) { - if (!desc_valid) { - msg_perr("Hardware sequencing was requested " - "but the flash descriptor is not " - "valid. Aborting.\n"); - return ERROR_FATAL; - } - hwseq_data.size_comp0 = getFCBA_component_density(ich_gen, &desc, 0); - hwseq_data.size_comp1 = getFCBA_component_density(ich_gen, &desc, 1); - register_opaque_master(&opaque_master_ich_hwseq); - } else { - register_spi_master(&spi_master_ich9); - } - break; case CHIPSET_ICH8: default: /* Future version might behave the same */ - hwseq_data.addr_mask = ICH9_FADDR_FLA; - hwseq_data.only_4k = false; - hwseq_data.hsfc_fcycle = HSFC_FCYCLE; - arg = extract_programmer_param("ich_spi_mode"); if (arg && !strcmp(arg, "hwseq")) { ich_spi_mode = ich_hwseq; @@ -1884,30 +1788,30 @@ msg_pinfo("Continuing with write support because the user forced us to!\n"); } - tmp = mmio_readl(ich_spibar + ICH9_REG_SSFS); - msg_pdbg("0x90: 0x%02x (SSFS)\n", tmp & 0xff); + tmp = mmio_readl(ich_spibar + swseq_data.reg_ssfsc); + msg_pdbg("0x%zx: 0x%02x (SSFS)\n", swseq_data.reg_ssfsc, tmp & 0xff); prettyprint_ich9_reg_ssfs(tmp); if (tmp & SSFS_FCERR) { msg_pdbg("Clearing SSFS.FCERR\n"); - mmio_writeb(SSFS_FCERR, ich_spibar + ICH9_REG_SSFS); + mmio_writeb(SSFS_FCERR, ich_spibar + swseq_data.reg_ssfsc); } - msg_pdbg("0x91: 0x%06x (SSFC)\n", tmp >> 8); + msg_pdbg("0x%zx: 0x%06x (SSFC)\n", swseq_data.reg_ssfsc + 1, tmp >> 8); prettyprint_ich9_reg_ssfc(tmp); - msg_pdbg("0x94: 0x%04x (PREOP)\n", - mmio_readw(ich_spibar + ICH9_REG_PREOP)); - msg_pdbg("0x96: 0x%04x (OPTYPE)\n", - mmio_readw(ich_spibar + ICH9_REG_OPTYPE)); - msg_pdbg("0x98: 0x%08x (OPMENU)\n", - mmio_readl(ich_spibar + ICH9_REG_OPMENU)); - msg_pdbg("0x9C: 0x%08x (OPMENU+4)\n", - mmio_readl(ich_spibar + ICH9_REG_OPMENU + 4)); + msg_pdbg("0x%zx: 0x%04x (PREOP)\n", + swseq_data.reg_preop, mmio_readw(ich_spibar + swseq_data.reg_preop)); + msg_pdbg("0x%zx: 0x%04x (OPTYPE)\n", + swseq_data.reg_optype, mmio_readw(ich_spibar + swseq_data.reg_optype)); + msg_pdbg("0x%zx: 0x%08x (OPMENU)\n", + swseq_data.reg_opmenu, mmio_readl(ich_spibar + swseq_data.reg_opmenu)); + msg_pdbg("0x%zx: 0x%08x (OPMENU+4)\n", + swseq_data.reg_opmenu + 4, mmio_readl(ich_spibar + swseq_data.reg_opmenu + 4)); if (ich_generation == CHIPSET_ICH8 && desc_valid) { tmp = mmio_readl(ich_spibar + ICH8_REG_VSCC); msg_pdbg("0xC1: 0x%08x (VSCC)\n", tmp); msg_pdbg("VSCC: "); prettyprint_ich_reg_vscc(tmp, MSG_DEBUG, true); - } else { + } else if (ich_generation != CHIPSET_100_SERIES_SUNRISE_POINT) { if (ich_generation != CHIPSET_BAYTRAIL && desc_valid) { ichspi_bbar = mmio_readl(ich_spibar + ICH9_REG_BBAR); msg_pdbg("0xA0: 0x%08x (BBAR)\n", -- To view, visit
https://review.coreboot.org/18938
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I0ad46f7944d92d3381975c5e10af0918ec163782 Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18937
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support ichspi: Consolidate copy-pasta hwseq code Change-Id: I79d0c6284397ca382ce8e531c6f9490c74d31cc1 Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ichspi.c 1 file changed, 31 insertions(+), 234 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/37/18937/1 diff --git a/ichspi.c b/ichspi.c index 81da495..3b7e5d8 100644 --- a/ichspi.c +++ b/ichspi.c @@ -46,6 +46,8 @@ #define PCH100_HSFC_FCYCLE_OFF 1 /* 1-3: FLASH Cycle */ #define PCH100_HSFC_FCYCLE (0x7 << PCH100_HSFC_FCYCLE_OFF) +#define PCH100_FADDR_FLA 0x07ffffff + #define PCH100_REG_FPR0 0x84 /* 32 Bytes Protected Range 0 */ #define PCH100_REG_PREOP_OPTYPE 0xA4 /* 32 Bits */ @@ -85,6 +87,7 @@ #define HSFC_SME (0x1 << HSFC_SME_OFF) #define ICH9_REG_FADDR 0x08 /* 32 Bits */ +#define ICH9_FADDR_FLA 0x01ffffff #define ICH9_REG_FDATA0 0x10 /* 64 Bytes */ #define ICH9_REG_FRAP 0x50 /* 32 Bytes Flash Region Access Permissions */ @@ -1155,13 +1158,16 @@ static struct hwseq_data { uint32_t size_comp0; uint32_t size_comp1; + uint32_t addr_mask; + bool only_4k; + uint32_t hsfc_fcycle; } hwseq_data; -/* Sets FLA in FADDR to (addr & 0x01FFFFFF) without touching other bits. */ +/* Sets FLA in FADDR to (addr & hwseq_data.addr_mask) without touching other bits. */ static void ich_hwseq_set_addr(uint32_t addr) { - uint32_t addr_old = REGREAD32(ICH9_REG_FADDR) & ~0x01FFFFFF; - REGWRITE32(ICH9_REG_FADDR, (addr & 0x01FFFFFF) | addr_old); + uint32_t addr_old = REGREAD32(ICH9_REG_FADDR) & ~hwseq_data.addr_mask; + REGWRITE32(ICH9_REG_FADDR, (addr & hwseq_data.addr_mask) | addr_old); } /* Sets FADDR.FLA to 'addr' and returns the erase block size in bytes @@ -1173,17 +1179,18 @@ */ static uint32_t ich_hwseq_get_erase_block_size(unsigned int addr) { - uint8_t enc_berase; static const uint32_t dec_berase[4] = { 256, 4 * 1024, 8 * 1024, 64 * 1024 }; + const uint8_t enc_berase = + hwseq_data.only_4k ? 1 : + (REGREAD16(ICH9_REG_HSFS) & HSFS_BERASE) >> HSFS_BERASE_OFF; ich_hwseq_set_addr(addr); - enc_berase = (REGREAD16(ICH9_REG_HSFS) & HSFS_BERASE) >> - HSFS_BERASE_OFF; + return dec_berase[enc_berase]; } @@ -1205,7 +1212,7 @@ } REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); if (!timeout) { - addr = REGREAD32(ICH9_REG_FADDR) & 0x01FFFFFF; + addr = REGREAD32(ICH9_REG_FADDR) & hwseq_data.addr_mask; msg_perr("Timeout error between offset 0x%08x and " "0x%08x (= 0x%08x + %d)!\n", addr, addr + len - 1, addr, len - 1); @@ -1215,7 +1222,7 @@ } if (hsfs & HSFS_FCERR) { - addr = REGREAD32(ICH9_REG_FADDR) & 0x01FFFFFF; + addr = REGREAD32(ICH9_REG_FADDR) & hwseq_data.addr_mask; msg_perr("Transaction error between offset 0x%08x and " "0x%08x (= 0x%08x + %d)!\n", addr, addr + len - 1, addr, len - 1); @@ -1243,7 +1250,10 @@ flash->chip->total_size = total_size / 1024; eraser = &(flash->chip->block_erasers[0]); - boundary = (REGREAD32(ICH9_REG_FPB) & FPB_FPBA) << 12; + if (!hwseq_data.only_4k) + boundary = (REGREAD32(ICH9_REG_FPB) & FPB_FPBA) << 12; + else + boundary = 0; size_high = total_size - boundary; erase_size_high = ich_hwseq_get_erase_block_size(boundary); @@ -1317,7 +1327,7 @@ REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); hsfc = REGREAD16(ICH9_REG_HSFC); - hsfc &= ~HSFC_FCYCLE; /* clear operation */ + hsfc &= ~hwseq_data.hsfc_fcycle; /* clear operation */ hsfc |= (0x3 << HSFC_FCYCLE_OFF); /* set erase operation */ hsfc |= HSFC_FGO; /* start */ msg_pdbg("HSFC used for block erasing: "); @@ -1354,7 +1364,7 @@ ich_hwseq_set_addr(addr); hsfc = REGREAD16(ICH9_REG_HSFC); - hsfc &= ~HSFC_FCYCLE; /* set read operation */ + hsfc &= ~hwseq_data.hsfc_fcycle; /* set read operation */ hsfc &= ~HSFC_FDBC; /* clear byte count */ /* set byte count */ hsfc |= (((block_len - 1) << HSFC_FDBC_OFF) & HSFC_FDBC); @@ -1395,7 +1405,7 @@ block_len = min(block_len, 256 - (addr & 0xFF)); ich_fill_data(buf, block_len, ICH9_REG_FDATA0); hsfc = REGREAD16(ICH9_REG_HSFC); - hsfc &= ~HSFC_FCYCLE; /* clear operation */ + hsfc &= ~hwseq_data.hsfc_fcycle; /* clear operation */ hsfc |= (0x2 << HSFC_FCYCLE_OFF); /* set write operation */ hsfc &= ~HSFC_FDBC; /* clear byte count */ /* set byte count */ @@ -1404,218 +1414,6 @@ REGWRITE16(ICH9_REG_HSFC, hsfc); if (ich_hwseq_wait_for_cycle_complete(timeout, block_len)) - return -1; - addr += block_len; - buf += block_len; - len -= block_len; - } - return 0; -} - -/* Routines for PCH */ - -/* Sets FLA in FADDR to (addr & 0x07FFFFFF) without touching other bits. */ -static void pch_hwseq_set_addr(uint32_t addr) -{ - uint32_t addr_old = REGREAD32(ICH9_REG_FADDR) & ~0x07FFFFFF; - REGWRITE32(ICH9_REG_FADDR, (addr & 0x07FFFFFF) | addr_old); -} - -/* Sets FADDR.FLA to 'addr' and returns the erase block size in bytes - * of the block containing this address. May return nonsense if the address is - * not valid. The erase block size for a specific address depends on the flash - * partition layout as specified by FPB and the partition properties as defined - * by UVSCC and LVSCC respectively. An alternative to implement this method - * would be by querying FPB and the respective VSCC register directly. - */ -static uint32_t pch_hwseq_get_erase_block_size(unsigned int addr) -{ - pch_hwseq_set_addr(addr); - return 4 * 1024; -} - -/* Polls for Cycle Done Status, Flash Cycle Error or timeout in 8 us intervals. - Resets all error flags in HSFS. - Returns 0 if the cycle completes successfully without errors within - timeout us, 1 on errors. */ -static int pch_hwseq_wait_for_cycle_complete(unsigned int timeout, - unsigned int len) -{ - uint16_t hsfs; - uint32_t addr; - - timeout /= 8; /* scale timeout duration to counter */ - while ((((hsfs = REGREAD16(ICH9_REG_HSFS)) & - (HSFS_FDONE | HSFS_FCERR)) == 0) && - --timeout) { - programmer_delay(8); - } - REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); - if (!timeout) { - addr = REGREAD32(ICH9_REG_FADDR) & 0x07FFFFFF; - msg_perr("Timeout error between offset 0x%08x and " - "0x%08x (= 0x%08x + %d)!\n", - addr, addr + len - 1, addr, len - 1); - return 1; - } - - if (hsfs & HSFS_FCERR) { - addr = REGREAD32(ICH9_REG_FADDR) & 0x07FFFFFF; - msg_perr("Transaction error between offset 0x%08x and " - "0x%08x (= 0x%08x + %d)!\n", - addr, addr + len - 1, addr, len - 1); - return 1; - } - return 0; -} - - -int pch_hwseq_probe(struct flashctx *flash) -{ - uint32_t total_size, boundary = 0; /*There are no partitions in flash*/ - uint32_t erase_size_high, size_high; - struct block_eraser *eraser; - - total_size = hwseq_data.size_comp0 + hwseq_data.size_comp1; - msg_cdbg("Found %d attached SPI flash chip", - (hwseq_data.size_comp1 != 0) ? 2 : 1); - if (hwseq_data.size_comp1 != 0) - msg_cdbg("s with a combined"); - else - msg_cdbg(" with a"); - msg_cdbg(" density of %d kB.\n", total_size / 1024); - flash->chip->total_size = total_size / 1024; - eraser = &(flash->chip->block_erasers[0]); - size_high = total_size - boundary; - erase_size_high = pch_hwseq_get_erase_block_size(boundary); - eraser->eraseblocks[0].size = erase_size_high; - eraser->eraseblocks[0].count = size_high / erase_size_high; - msg_cdbg("There are %d erase blocks with %d B each.\n", - size_high / erase_size_high, erase_size_high); - flash->chip->tested = TEST_OK_PREW; - return 1; -} - -int pch_hwseq_block_erase(struct flashctx *flash, - unsigned int addr, - unsigned int len) -{ - uint32_t erase_block; - uint16_t hsfc; - uint32_t timeout = 5000 * 1000; /* 5 s for max 64 kB */ - - erase_block = pch_hwseq_get_erase_block_size(addr); - if (len != erase_block) { - msg_cerr("Erase block size for address 0x%06x is %d B, " - "but requested erase block size is %d B. " - "Not erasing anything.\n", addr, erase_block, len); - return -1; - } - - /* Although the hardware supports this (it would erase the whole block - * containing the address) we play safe here. */ - if (addr % erase_block != 0) { - msg_cerr("Erase address 0x%06x is not aligned to the erase " - "block boundary (any multiple of %d). " - "Not erasing anything.\n", addr, erase_block); - return -1; - } - - if (addr + len > flash->chip->total_size * 1024) { - msg_perr("Request to erase some inaccessible memory address(es)" - " (addr=0x%x, len=%d). " - "Not erasing anything.\n", addr, len); - return -1; - } - - msg_pdbg("Erasing %d bytes starting at 0x%06x.\n", len, addr); - - /* make sure FDONE, FCERR, AEL are cleared by writing 1 to them */ - REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); - - hsfc = REGREAD16(ICH9_REG_HSFC); - hsfc &= ~PCH100_HSFC_FCYCLE; /* clear operation */ - hsfc |= (0x3 << HSFC_FCYCLE_OFF); /* set erase operation */ - hsfc |= HSFC_FGO; /* start */ - msg_pdbg("HSFC used for block erasing: "); - REGWRITE16(ICH9_REG_HSFC, hsfc); - - if (pch_hwseq_wait_for_cycle_complete(timeout, len)) - return -1; - return 0; -} - -int pch_hwseq_read(struct flashctx *flash, uint8_t *buf, unsigned int addr, - unsigned int len) -{ - uint16_t hsfc; - uint16_t timeout = 100 * 60; - uint8_t block_len; - - - if ((addr + len) > (flash->chip->total_size * 1024)) { - msg_perr("Request to read from an inaccessible memory address " - "(addr=0x%x, len=%d).\n", addr, len); - return -1; - } - - msg_pdbg("Reading %d bytes starting at 0x%06x.\n", len, addr); - /* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */ - - REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); - - while (len > 0) { - block_len = min(len, flash->mst->opaque.max_data_read); - pch_hwseq_set_addr(addr); - hsfc = REGREAD16(ICH9_REG_HSFC); - hsfc &= ~PCH100_HSFC_FCYCLE; /* set read operation */ - hsfc &= ~HSFC_FDBC; /* clear byte count */ - /* set byte count */ - hsfc |= (((block_len - 1) << HSFC_FDBC_OFF) & HSFC_FDBC); - hsfc |= HSFC_FGO; /* start */ - REGWRITE16(ICH9_REG_HSFC, hsfc); - - if (pch_hwseq_wait_for_cycle_complete(timeout, block_len)) - return 1; - ich_read_data(buf, block_len, ICH9_REG_FDATA0); - addr += block_len; - buf += block_len; - len -= block_len; - } - return 0; -} - -int pch_hwseq_write(struct flashctx *flash, const uint8_t *buf, unsigned int addr, - unsigned int len) -{ - uint16_t hsfc; - uint16_t timeout = 100 * 60; - uint8_t block_len; - - if ((addr + len) > (flash->chip->total_size * 1024)) { - msg_perr("Request to write to an inaccessible memory address " - "(addr=0x%x, len=%d).\n", addr, len); - return -1; - } - - msg_pdbg("Writing %d bytes starting at 0x%06x.\n", len, addr); - /* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */ - REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); - - while (len > 0) { - pch_hwseq_set_addr(addr); - block_len = min(len, flash->mst->opaque.max_data_write); - ich_fill_data(buf, block_len, ICH9_REG_FDATA0); - hsfc = REGREAD16(ICH9_REG_HSFC); - hsfc &= ~PCH100_HSFC_FCYCLE; /* clear operation */ - hsfc |= (0x2 << PCH100_HSFC_FCYCLE_OFF); /* set write operation */ - hsfc &= ~HSFC_FDBC; /* clear byte count */ - /* set byte count */ - hsfc |= (((block_len - 1) << HSFC_FDBC_OFF) & HSFC_FDBC); - hsfc |= HSFC_FGO; /* start */ - REGWRITE16(ICH9_REG_HSFC, hsfc); - - if (pch_hwseq_wait_for_cycle_complete(timeout, block_len)) return -1; addr += block_len; buf += block_len; @@ -1818,15 +1616,6 @@ .write_aai = default_spi_write_aai, }; -static struct opaque_master opaque_master_pch_hwseq = { - .max_data_read = 64, - .max_data_write = 64, - .probe = pch_hwseq_probe, - .read = pch_hwseq_read, - .write = pch_hwseq_write, - .erase = pch_hwseq_block_erase, -}; - static const struct opaque_master opaque_master_ich_hwseq = { .max_data_read = 64, .max_data_write = 64, @@ -1891,6 +1680,10 @@ register_spi_master(&spi_master_ich7); break; case CHIPSET_100_SERIES_SUNRISE_POINT: + hwseq_data.addr_mask = PCH100_FADDR_FLA; + hwseq_data.only_4k = true; + hwseq_data.hsfc_fcycle = PCH100_HSFC_FCYCLE; + arg = extract_programmer_param("ich_spi_mode"); if (arg && !strcmp(arg, "hwseq")) { ich_spi_mode = ich_hwseq; @@ -1981,13 +1774,17 @@ } hwseq_data.size_comp0 = getFCBA_component_density(ich_gen, &desc, 0); hwseq_data.size_comp1 = getFCBA_component_density(ich_gen, &desc, 1); - register_opaque_master(&opaque_master_pch_hwseq); + register_opaque_master(&opaque_master_ich_hwseq); } else { register_spi_master(&spi_master_ich9); } break; case CHIPSET_ICH8: default: /* Future version might behave the same */ + hwseq_data.addr_mask = ICH9_FADDR_FLA; + hwseq_data.only_4k = false; + hwseq_data.hsfc_fcycle = HSFC_FCYCLE; + arg = extract_programmer_param("ich_spi_mode"); if (arg && !strcmp(arg, "hwseq")) { ich_spi_mode = ich_hwseq; -- To view, visit
https://review.coreboot.org/18937
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I79d0c6284397ca382ce8e531c6f9490c74d31cc1 Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18936
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support Clean up register redefinitions Change-Id: If122368e852d83f0b04d58840ee3bbeccec1e36b Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ich_descriptors.h M ichspi.c 2 files changed, 57 insertions(+), 82 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/36/18936/1 diff --git a/ich_descriptors.h b/ich_descriptors.h index dbf73e2..df4dd76 100644 --- a/ich_descriptors.h +++ b/ich_descriptors.h @@ -34,7 +34,7 @@ #define ICH_RET_OOB -4 #define ICH9_REG_FDOC 0xB0 /* 32 Bits Flash Descriptor Observability Control */ -#define PCH100_REG_FDOC 0xB4 /* 32 bits FDOC in PCH */ +#define PCH100_REG_FDOC 0xB4 /* New offset from Sunrise Point on */ /* 0-1: reserved */ #define FDOC_FDSI_OFF 2 /* 2-11: Flash Descriptor Section Index */ #define FDOC_FDSI (0x3f << FDOC_FDSI_OFF) @@ -43,7 +43,7 @@ /* 15-31: reserved */ #define ICH9_REG_FDOD 0xB4 /* 32 Bits Flash Descriptor Observability Data */ -#define PCH100_REG_FDOD 0xB8 /* 32 bits FDOD in PCH */ +#define PCH100_REG_FDOD 0xB8 /* New offset from Sunrise Point on */ /* Field locations and semantics for LVSCC, UVSCC and related words in the flash * descriptor are equal therefore they all share the same macros below. */ diff --git a/ichspi.c b/ichspi.c index ac859e0..81da495 100644 --- a/ichspi.c +++ b/ichspi.c @@ -33,6 +33,25 @@ #include "spi.h" #include "ich_descriptors.h" +/* Sunrise Point */ + +/* Added HSFS Status bits */ +#define HSFS_WRSDIS_OFF 11 /* 11: Flash Configuration Lock-Down */ +#define HSFS_WRSDIS (0x1 << HSFSC_WRSDIS_OFF) +#define HSFS_PRR34LCKDN_OFF 12 /* 12: PRR3 PRR4 Lock-Down */ +#define HSFS_PRR34LCKDN (0x1 << HSFSC_PRR34LCKDN_OFF) +/* HSFS_BERASE vanished */ + +/* Changed HSFC Control bits */ +#define PCH100_HSFC_FCYCLE_OFF 1 /* 1-3: FLASH Cycle */ +#define PCH100_HSFC_FCYCLE (0x7 << PCH100_HSFC_FCYCLE_OFF) + +#define PCH100_REG_FPR0 0x84 /* 32 Bytes Protected Range 0 */ + +#define PCH100_REG_PREOP_OPTYPE 0xA4 /* 32 Bits */ +#define PCH100_REG_OPMENU_LOWER 0xA8 /* 32 Bits */ +#define PCH100_REG_OPMENU_UPPER 0xAC /* 32 Bits */ + /* ICH9 controller register definition */ #define ICH9_REG_HSFS 0x04 /* 16 Bits Hardware Sequencing Flash Status */ #define HSFS_FDONE_OFF 0 /* 0: Flash Cycle Done */ @@ -169,50 +188,6 @@ #define ICH7_REG_PREOP 0x54 /* 16 Bits */ #define ICH7_REG_OPTYPE 0x56 /* 16 Bits */ #define ICH7_REG_OPMENU 0x58 /* 64 Bits */ - -/*SUNRISE point*/ -/* 32 Bits Hardware Sequencing Flash Status */ -#define PCH100_REG_HSFSC 0x04 -/*Status bits*/ -#define HSFSC_FDONE_OFF 0 /* 0: Flash Cycle Done */ -#define HSFSC_FDONE (0x1 << HSFSC_FDONE_OFF) -#define HSFSC_FCERR_OFF 1 /* 1: Flash Cycle Error */ -#define HSFSC_FCERR (0x1 << HSFSC_FCERR_OFF) -#define HSFSC_AEL_OFF 2 /* 2: Access Error Log */ -#define HSFSC_AEL (0x1 << HSFSC_AEL_OFF) -#define HSFSC_SCIP_OFF 5 /* 5: SPI Cycle In Progress */ -#define HSFSC_SCIP (0x1 << HSFSC_SCIP_OFF) - /* 6-10: reserved */ -/* 11: Flash Configuration Lock-Down WRSDIS */ -#define HSFSC_WRSDIS_OFF 11 -#define HSFSC_WRSDIS (0x1 << HSFSC_WRSDIS_OFF) -#define HSFSC_PRR34LCKDN_OFF 12 -#define HSFSC_PRR34LCKDN (0x1 << HSFSC_PRR34LCKDN_OFF) -/* 13: Flash Descriptor Override Pin-Strap Status */ -#define HSFSC_FDOPSS_OFF 13 -#define HSFSC_FDOPSS (0x1 << HSFSC_FDOPSS_OFF) -#define HSFSC_FDV_OFF 14 /* 14: Flash Descriptor Valid */ -#define HSFSC_FDV (0x1 << HSFSC_FDV_OFF) -#define HSFSC_FLOCKDN_OFF 15 /* 11: Flash Configuration Lock-Down */ -#define HSFSC_FLOCKDN (0x1 << HSFSC_FLOCKDN_OFF) -/*Control bits*/ -#define HSFSC_FGO_OFF 0 /* 0: Flash Cycle Go */ -#define HSFSC_FGO (0x1 << HSFSC_FGO_OFF) -#define HSFSC_FCYCLE_OFF 1 /* 1-3: FLASH Cycle */ -#define HSFSC_FCYCLE (0x3 << HSFSC_FCYCLE_OFF) -#define HSFSC_FDBC_OFF 8 /*8-13 : Flash Data Byte Count */ -#define HSFSC_FDBC (0x3f << HSFSC_FDBC_OFF) - -#define PCH100_REG_FADDR 0x08 /* 32 Bits */ -#define PCH100_REG_FDATA0 0x10 /* 64 Bytes */ - -#define PCH100_REG_FPR0 0x84 /* 32 Bytes Protected Range 0 */ -#define PCH_WP_OFF 31 /* 31: write protection enable */ -#define PCH_RP_OFF 15 /* 15: read protection enable */ - -#define PCH100_REG_PREOP_OPTYPE 0xA4 /* 32 Bits */ -#define PCH100_REG_OPMENU_LOWER 0xA8 /* 32 Bits */ -#define PCH100_REG_OPMENU_UPPER 0xAC /* 32 Bits */ /* ICH SPI configuration lock-down. May be set during chipset enabling. */ static int ichspi_lock = 0; @@ -1442,8 +1417,8 @@ /* Sets FLA in FADDR to (addr & 0x07FFFFFF) without touching other bits. */ static void pch_hwseq_set_addr(uint32_t addr) { - uint32_t addr_old = REGREAD32(PCH100_REG_FADDR) & ~0x07FFFFFF; - REGWRITE32(PCH100_REG_FADDR, (addr & 0x07FFFFFF) | addr_old); + uint32_t addr_old = REGREAD32(ICH9_REG_FADDR) & ~0x07FFFFFF; + REGWRITE32(ICH9_REG_FADDR, (addr & 0x07FFFFFF) | addr_old); } /* Sets FADDR.FLA to 'addr' and returns the erase block size in bytes @@ -1470,22 +1445,22 @@ uint32_t addr; timeout /= 8; /* scale timeout duration to counter */ - while ((((hsfs = REGREAD16(PCH100_REG_HSFSC)) & - (HSFSC_FDONE | HSFSC_FCERR)) == 0) && + while ((((hsfs = REGREAD16(ICH9_REG_HSFS)) & + (HSFS_FDONE | HSFS_FCERR)) == 0) && --timeout) { programmer_delay(8); } - REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); if (!timeout) { - addr = REGREAD32(PCH100_REG_FADDR) & 0x07FFFFFF; + addr = REGREAD32(ICH9_REG_FADDR) & 0x07FFFFFF; msg_perr("Timeout error between offset 0x%08x and " "0x%08x (= 0x%08x + %d)!\n", addr, addr + len - 1, addr, len - 1); return 1; } - if (hsfs & HSFSC_FCERR) { - addr = REGREAD32(PCH100_REG_FADDR) & 0x07FFFFFF; + if (hsfs & HSFS_FCERR) { + addr = REGREAD32(ICH9_REG_FADDR) & 0x07FFFFFF; msg_perr("Transaction error between offset 0x%08x and " "0x%08x (= 0x%08x + %d)!\n", addr, addr + len - 1, addr, len - 1); @@ -1556,14 +1531,14 @@ msg_pdbg("Erasing %d bytes starting at 0x%06x.\n", len, addr); /* make sure FDONE, FCERR, AEL are cleared by writing 1 to them */ - REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); - hsfc = REGREAD16(PCH100_REG_HSFSC + 2); - hsfc &= ~HSFSC_FCYCLE; /* clear operation */ - hsfc |= (0x3 << HSFSC_FCYCLE_OFF); /* set erase operation */ - hsfc |= HSFSC_FGO; /* start */ + hsfc = REGREAD16(ICH9_REG_HSFC); + hsfc &= ~PCH100_HSFC_FCYCLE; /* clear operation */ + hsfc |= (0x3 << HSFC_FCYCLE_OFF); /* set erase operation */ + hsfc |= HSFC_FGO; /* start */ msg_pdbg("HSFC used for block erasing: "); - REGWRITE16(PCH100_REG_HSFSC + 2, hsfc); + REGWRITE16(ICH9_REG_HSFC, hsfc); if (pch_hwseq_wait_for_cycle_complete(timeout, len)) return -1; @@ -1587,22 +1562,22 @@ msg_pdbg("Reading %d bytes starting at 0x%06x.\n", len, addr); /* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */ - REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); while (len > 0) { block_len = min(len, flash->mst->opaque.max_data_read); pch_hwseq_set_addr(addr); - hsfc = REGREAD16(PCH100_REG_HSFSC + 2); - hsfc &= ~HSFSC_FCYCLE; /* set read operation */ - hsfc &= ~HSFSC_FDBC; /* clear byte count */ + hsfc = REGREAD16(ICH9_REG_HSFC); + hsfc &= ~PCH100_HSFC_FCYCLE; /* set read operation */ + hsfc &= ~HSFC_FDBC; /* clear byte count */ /* set byte count */ - hsfc |= (((block_len - 1) << HSFSC_FDBC_OFF) & HSFSC_FDBC); - hsfc |= HSFSC_FGO; /* start */ - REGWRITE16(PCH100_REG_HSFSC + 2, hsfc); + hsfc |= (((block_len - 1) << HSFC_FDBC_OFF) & HSFC_FDBC); + hsfc |= HSFC_FGO; /* start */ + REGWRITE16(ICH9_REG_HSFC, hsfc); if (pch_hwseq_wait_for_cycle_complete(timeout, block_len)) return 1; - ich_read_data(buf, block_len, PCH100_REG_FDATA0); + ich_read_data(buf, block_len, ICH9_REG_FDATA0); addr += block_len; buf += block_len; len -= block_len; @@ -1625,20 +1600,20 @@ msg_pdbg("Writing %d bytes starting at 0x%06x.\n", len, addr); /* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */ - REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + REGWRITE16(ICH9_REG_HSFS, REGREAD16(ICH9_REG_HSFS)); while (len > 0) { pch_hwseq_set_addr(addr); block_len = min(len, flash->mst->opaque.max_data_write); - ich_fill_data(buf, block_len, PCH100_REG_FDATA0); - hsfc = REGREAD16(PCH100_REG_HSFSC + 2); - hsfc &= ~HSFSC_FCYCLE; /* clear operation */ - hsfc |= (0x2 << HSFSC_FCYCLE_OFF); /* set write operation */ - hsfc &= ~HSFSC_FDBC; /* clear byte count */ + ich_fill_data(buf, block_len, ICH9_REG_FDATA0); + hsfc = REGREAD16(ICH9_REG_HSFC); + hsfc &= ~PCH100_HSFC_FCYCLE; /* clear operation */ + hsfc |= (0x2 << PCH100_HSFC_FCYCLE_OFF); /* set write operation */ + hsfc &= ~HSFC_FDBC; /* clear byte count */ /* set byte count */ - hsfc |= (((block_len - 1) << HSFSC_FDBC_OFF) & HSFSC_FDBC); - hsfc |= HSFSC_FGO; /* start */ - REGWRITE16(PCH100_REG_HSFSC + 2, hsfc); + hsfc |= (((block_len - 1) << HSFC_FDBC_OFF) & HSFC_FDBC); + hsfc |= HSFC_FGO; /* start */ + REGWRITE16(ICH9_REG_HSFC, hsfc); if (pch_hwseq_wait_for_cycle_complete(timeout, block_len)) return -1; @@ -1937,17 +1912,17 @@ return ERROR_FATAL; } free(arg); - tmp = mmio_readl(ich_spibar + PCH100_REG_HSFSC); + tmp = mmio_readl(ich_spibar + ICH9_REG_HSFS); msg_pdbg("0x04: 0x%04x (HSFSC)\n", tmp); - if (tmp & HSFSC_FLOCKDN) { + if (tmp & HSFS_FLOCKDN) { msg_perr("WARNING: SPI Configuration " "Lockdown activated.\n"); ichspi_lock = 1; } - if (tmp & HSFSC_FDV) + if (tmp & HSFS_FDV) desc_valid = 1; - if (!(tmp & HSFSC_FDOPSS) && desc_valid) + if (!(tmp & HSFS_FDOPSS) && desc_valid) msg_perr("The Flash Descriptor Security Override " "Strap-Pin is set. Restrictions implied\n" "by the FRAP and FREG registers are NOT in " @@ -1955,7 +1930,7 @@ "Range (PR) restrictions still apply.\n"); ich_init_opcodes(); - tmp = mmio_readl(ich_spibar + PCH100_REG_FADDR); + tmp = mmio_readl(ich_spibar + ICH9_REG_FADDR); msg_pdbg("0x08: 0x%08x (FADDR)\n", tmp); if (desc_valid) { tmp = mmio_readl(ich_spibar + ICH9_REG_FRAP); -- To view, visit
https://review.coreboot.org/18936
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: If122368e852d83f0b04d58840ee3bbeccec1e36b Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18934
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support ich_descriptors: Clean up chipset-gen parameter * Make it the first parameter to comply with other functions. * Use the correct type `enum ich_chipset` instead of `int`. Change-Id: I1b43c189cd19c573935fa553ae3ff23f2aa7e251 Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ich_descriptors.c M ich_descriptors.h M ichspi.c 3 files changed, 17 insertions(+), 20 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/34/18934/1 diff --git a/ich_descriptors.c b/ich_descriptors.c index 07cea8a..32cc804 100644 --- a/ich_descriptors.c +++ b/ich_descriptors.c @@ -852,13 +852,12 @@ return (1 << (19 + size_enc)); } -static uint32_t read_descriptor_reg(uint8_t section, uint16_t offset, - void *spibar, int chipset) +static uint32_t read_descriptor_reg(enum ich_chipset cs, uint8_t section, uint16_t offset, void *spibar) { uint32_t control = 0; control |= (section << FDOC_FDSS_OFF) & FDOC_FDSS; control |= (offset << FDOC_FDSI_OFF) & FDOC_FDSI; - if (chipset == CHIPSET_100_SERIES_SUNRISE_POINT) { + if (cs == CHIPSET_100_SERIES_SUNRISE_POINT) { mmio_le_writel(control, spibar + PCH100_REG_FDOC); return mmio_le_readl(spibar + PCH100_REG_FDOD); } else { @@ -868,8 +867,7 @@ } -int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc, - int chipset) +int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc) { uint8_t i; uint8_t nr; @@ -899,15 +897,15 @@ msg_pdbg2("Reading flash descriptors mapped by the chipset via FDOC/FDOD..."); /* content section */ - desc->content.FLVALSIG = read_descriptor_reg(0, 0, spibar, chipset); - desc->content.FLMAP0 = read_descriptor_reg(0, 1, spibar, chipset); - desc->content.FLMAP1 = read_descriptor_reg(0, 2, spibar, chipset); - desc->content.FLMAP2 = read_descriptor_reg(0, 3, spibar, chipset); + desc->content.FLVALSIG = read_descriptor_reg(cs, 0, 0, spibar); + desc->content.FLMAP0 = read_descriptor_reg(cs, 0, 1, spibar); + desc->content.FLMAP1 = read_descriptor_reg(cs, 0, 2, spibar); + desc->content.FLMAP2 = read_descriptor_reg(cs, 0, 3, spibar); /* component section */ - desc->component.FLCOMP = read_descriptor_reg(1, 0, spibar, chipset); - desc->component.FLILL = read_descriptor_reg(1, 1, spibar, chipset); - desc->component.FLPB = read_descriptor_reg(1, 2, spibar, chipset); + desc->component.FLCOMP = read_descriptor_reg(cs, 1, 0, spibar); + desc->component.FLILL = read_descriptor_reg(cs, 1, 1, spibar); + desc->component.FLPB = read_descriptor_reg(cs, 1, 2, spibar); /* region section */ nr = desc->content.NR + 1; @@ -917,12 +915,12 @@ return ICH_RET_ERR; } for (i = 0; i <= nr; i++) - desc->region.FLREGs[i] = read_descriptor_reg(2, i, spibar, chipset); + desc->region.FLREGs[i] = read_descriptor_reg(cs, 2, i, spibar); /* master section */ - desc->master.FLMSTR1 = read_descriptor_reg(3, 0, spibar, chipset); - desc->master.FLMSTR2 = read_descriptor_reg(3, 1, spibar, chipset); - desc->master.FLMSTR3 = read_descriptor_reg(3, 2, spibar, chipset); + desc->master.FLMSTR1 = read_descriptor_reg(cs, 3, 0, spibar); + desc->master.FLMSTR2 = read_descriptor_reg(cs, 3, 1, spibar); + desc->master.FLMSTR3 = read_descriptor_reg(cs, 3, 2, spibar); /* Accessing the strap section via FDOC/D is only possible on ICH8 and * reading the upper map is impossible on all chipsets, so don't bother. diff --git a/ich_descriptors.h b/ich_descriptors.h index a53f397..dbf73e2 100644 --- a/ich_descriptors.h +++ b/ich_descriptors.h @@ -592,7 +592,7 @@ #else /* ICH_DESCRIPTORS_FROM_DUMP */ -int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc, int chipset); +int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc); int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx); #endif /* ICH_DESCRIPTORS_FROM_DUMP */ diff --git a/ichspi.c b/ichspi.c index 47b019a..16bb2b5 100644 --- a/ichspi.c +++ b/ichspi.c @@ -1991,8 +1991,7 @@ for (i = 0; i < 5; i++) ich9_handle_pr(i, ich_generation); if (desc_valid) { - if (read_ich_descriptors_via_fdo(ich_spibar, &desc, - ich_generation) == ICH_RET_OK) + if (read_ich_descriptors_via_fdo(ich_gen, ich_spibar, &desc) == ICH_RET_OK) prettyprint_ich_descriptors(CHIPSET_ICH_UNKNOWN, &desc); /* If the descriptor is valid and indicates multiple @@ -2176,7 +2175,7 @@ } if (desc_valid) { - if (read_ich_descriptors_via_fdo(ich_spibar, &desc, ich_gen) == ICH_RET_OK) + if (read_ich_descriptors_via_fdo(ich_gen, ich_spibar, &desc) == ICH_RET_OK) prettyprint_ich_descriptors(ich_gen, &desc); /* If the descriptor is valid and indicates multiple -- To view, visit
https://review.coreboot.org/18934
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I1b43c189cd19c573935fa553ae3ff23f2aa7e251 Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18935
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support ichspi: Drop odd, constant erase block size mapping Change-Id: Iab0a8b71a7680b8dee4f7c6c5dabc05c8436d97e Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ichspi.c 1 file changed, 1 insertion(+), 16 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/35/18935/1 diff --git a/ichspi.c b/ichspi.c index 16bb2b5..ac859e0 100644 --- a/ichspi.c +++ b/ichspi.c @@ -214,15 +214,6 @@ #define PCH100_REG_OPMENU_LOWER 0xA8 /* 32 Bits */ #define PCH100_REG_OPMENU_UPPER 0xAC /* 32 Bits */ -/* The minimum erase block size in PCH which is 4k -* 256, -* 4 * 1024, -* 8 * 1024, -* 64 * 1024 -*/ -#define ERASE_BLOCK_SIZE 1 - - /* ICH SPI configuration lock-down. May be set during chipset enabling. */ static int ichspi_lock = 0; @@ -1464,14 +1455,8 @@ */ static uint32_t pch_hwseq_get_erase_block_size(unsigned int addr) { - static const uint32_t dec_berase[4] = { - 256, - 4 * 1024, - 8 * 1024, - 64 * 1024 - }; pch_hwseq_set_addr(addr); - return dec_berase[ERASE_BLOCK_SIZE]; + return 4 * 1024; } /* Polls for Cycle Done Status, Flash Cycle Error or timeout in 8 us intervals. -- To view, visit
https://review.coreboot.org/18935
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Iab0a8b71a7680b8dee4f7c6c5dabc05c8436d97e Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18932
) Change subject: flashrom: Add Skylake platform support ...................................................................... flashrom: Add Skylake platform support This is a rebase of the commit in the chromium repo. Changes to `chipset_enable.c` were skipped due to many conflicts and rewritten (see parent commit). The old test doesn't apply any more. Original commit message: This patch does the below: 1. Adds Skylake PCI device ID to flashrom. 2. Maps registers from ICH to PCH BUG=chrome-os-partner:37711 TEST=On B1 SKL-Y verified, 'flashrom -p internal:ich_spi_mode=hwseq -w <coreboot image>' Change-Id: I0e8ad2d3281c148414fd357427fcd445afc7d045 Signed-off-by: Nico Huber <nico.huber(a)secunet.com> Original-Change-Id: I790617e7c1cdeefe1d476341afb25fe71a98b033 Original-Signed-off-by: Sathya Prakash M R <sathya.prakash.m.r(a)intel.com> Original-Signed-off-by: Ramya Vijaykumar <ramya.vijaykumar(a)intel.com> Original-Reviewed-on:
https://chromium-review.googlesource.com/265818
Original-Tested-by: Wenkai Du <wenkai.du(a)intel.com> Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org> Original-Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org> Original-Commit-Queue: Wenkai Du <wenkai.du(a)intel.com> --- M ich_descriptors.c M ich_descriptors.h M ichspi.c 3 files changed, 447 insertions(+), 24 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/32/18932/1 diff --git a/ich_descriptors.c b/ich_descriptors.c index 593a375..07cea8a 100644 --- a/ich_descriptors.c +++ b/ich_descriptors.c @@ -852,16 +852,24 @@ return (1 << (19 + size_enc)); } -static uint32_t read_descriptor_reg(uint8_t section, uint16_t offset, void *spibar) +static uint32_t read_descriptor_reg(uint8_t section, uint16_t offset, + void *spibar, int chipset) { uint32_t control = 0; control |= (section << FDOC_FDSS_OFF) & FDOC_FDSS; control |= (offset << FDOC_FDSI_OFF) & FDOC_FDSI; - mmio_le_writel(control, spibar + ICH9_REG_FDOC); - return mmio_le_readl(spibar + ICH9_REG_FDOD); + if (chipset == CHIPSET_100_SERIES_SUNRISE_POINT) { + mmio_le_writel(control, spibar + PCH100_REG_FDOC); + return mmio_le_readl(spibar + PCH100_REG_FDOD); + } else { + mmio_le_writel(control, spibar + ICH9_REG_FDOC); + return mmio_le_readl(spibar + ICH9_REG_FDOD); + } + } -int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc) +int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc, + int chipset) { uint8_t i; uint8_t nr; @@ -891,15 +899,15 @@ msg_pdbg2("Reading flash descriptors mapped by the chipset via FDOC/FDOD..."); /* content section */ - desc->content.FLVALSIG = read_descriptor_reg(0, 0, spibar); - desc->content.FLMAP0 = read_descriptor_reg(0, 1, spibar); - desc->content.FLMAP1 = read_descriptor_reg(0, 2, spibar); - desc->content.FLMAP2 = read_descriptor_reg(0, 3, spibar); + desc->content.FLVALSIG = read_descriptor_reg(0, 0, spibar, chipset); + desc->content.FLMAP0 = read_descriptor_reg(0, 1, spibar, chipset); + desc->content.FLMAP1 = read_descriptor_reg(0, 2, spibar, chipset); + desc->content.FLMAP2 = read_descriptor_reg(0, 3, spibar, chipset); /* component section */ - desc->component.FLCOMP = read_descriptor_reg(1, 0, spibar); - desc->component.FLILL = read_descriptor_reg(1, 1, spibar); - desc->component.FLPB = read_descriptor_reg(1, 2, spibar); + desc->component.FLCOMP = read_descriptor_reg(1, 0, spibar, chipset); + desc->component.FLILL = read_descriptor_reg(1, 1, spibar, chipset); + desc->component.FLPB = read_descriptor_reg(1, 2, spibar, chipset); /* region section */ nr = desc->content.NR + 1; @@ -908,13 +916,13 @@ __func__, nr); return ICH_RET_ERR; } - for (i = 0; i < 5; i++) - desc->region.FLREGs[i] = read_descriptor_reg(2, i, spibar); + for (i = 0; i <= nr; i++) + desc->region.FLREGs[i] = read_descriptor_reg(2, i, spibar, chipset); /* master section */ - desc->master.FLMSTR1 = read_descriptor_reg(3, 0, spibar); - desc->master.FLMSTR2 = read_descriptor_reg(3, 1, spibar); - desc->master.FLMSTR3 = read_descriptor_reg(3, 2, spibar); + desc->master.FLMSTR1 = read_descriptor_reg(3, 0, spibar, chipset); + desc->master.FLMSTR2 = read_descriptor_reg(3, 1, spibar, chipset); + desc->master.FLMSTR3 = read_descriptor_reg(3, 2, spibar, chipset); /* Accessing the strap section via FDOC/D is only possible on ICH8 and * reading the upper map is impossible on all chipsets, so don't bother. diff --git a/ich_descriptors.h b/ich_descriptors.h index 2c21598..a53f397 100644 --- a/ich_descriptors.h +++ b/ich_descriptors.h @@ -34,6 +34,7 @@ #define ICH_RET_OOB -4 #define ICH9_REG_FDOC 0xB0 /* 32 Bits Flash Descriptor Observability Control */ +#define PCH100_REG_FDOC 0xB4 /* 32 bits FDOC in PCH */ /* 0-1: reserved */ #define FDOC_FDSI_OFF 2 /* 2-11: Flash Descriptor Section Index */ #define FDOC_FDSI (0x3f << FDOC_FDSI_OFF) @@ -42,6 +43,7 @@ /* 15-31: reserved */ #define ICH9_REG_FDOD 0xB4 /* 32 Bits Flash Descriptor Observability Data */ +#define PCH100_REG_FDOD 0xB8 /* 32 bits FDOD in PCH */ /* Field locations and semantics for LVSCC, UVSCC and related words in the flash * descriptor are equal therefore they all share the same macros below. */ @@ -590,7 +592,7 @@ #else /* ICH_DESCRIPTORS_FROM_DUMP */ -int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc); +int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc, int chipset); int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx); #endif /* ICH_DESCRIPTORS_FROM_DUMP */ diff --git a/ichspi.c b/ichspi.c index e1395ee..3c26406 100644 --- a/ichspi.c +++ b/ichspi.c @@ -170,6 +170,59 @@ #define ICH7_REG_OPTYPE 0x56 /* 16 Bits */ #define ICH7_REG_OPMENU 0x58 /* 64 Bits */ +/*SUNRISE point*/ +/* 32 Bits Hardware Sequencing Flash Status */ +#define PCH100_REG_HSFSC 0x04 +/*Status bits*/ +#define HSFSC_FDONE_OFF 0 /* 0: Flash Cycle Done */ +#define HSFSC_FDONE (0x1 << HSFSC_FDONE_OFF) +#define HSFSC_FCERR_OFF 1 /* 1: Flash Cycle Error */ +#define HSFSC_FCERR (0x1 << HSFSC_FCERR_OFF) +#define HSFSC_AEL_OFF 2 /* 2: Access Error Log */ +#define HSFSC_AEL (0x1 << HSFSC_AEL_OFF) +#define HSFSC_SCIP_OFF 5 /* 5: SPI Cycle In Progress */ +#define HSFSC_SCIP (0x1 << HSFSC_SCIP_OFF) + /* 6-10: reserved */ +/* 11: Flash Configuration Lock-Down WRSDIS */ +#define HSFSC_WRSDIS_OFF 11 +#define HSFSC_WRSDIS (0x1 << HSFSC_WRSDIS_OFF) +#define HSFSC_PRR34LCKDN_OFF 12 +#define HSFSC_PRR34LCKDN (0x1 << HSFSC_PRR34LCKDN_OFF) +/* 13: Flash Descriptor Override Pin-Strap Status */ +#define HSFSC_FDOPSS_OFF 13 +#define HSFSC_FDOPSS (0x1 << HSFSC_FDOPSS_OFF) +#define HSFSC_FDV_OFF 14 /* 14: Flash Descriptor Valid */ +#define HSFSC_FDV (0x1 << HSFSC_FDV_OFF) +#define HSFSC_FLOCKDN_OFF 15 /* 11: Flash Configuration Lock-Down */ +#define HSFSC_FLOCKDN (0x1 << HSFSC_FLOCKDN_OFF) +/*Control bits*/ +#define HSFSC_FGO_OFF 0 /* 0: Flash Cycle Go */ +#define HSFSC_FGO (0x1 << HSFSC_FGO_OFF) +#define HSFSC_FCYCLE_OFF 1 /* 1-3: FLASH Cycle */ +#define HSFSC_FCYCLE (0x3 << HSFSC_FCYCLE_OFF) +#define HSFSC_FDBC_OFF 8 /*8-13 : Flash Data Byte Count */ +#define HSFSC_FDBC (0x3f << HSFSC_FDBC_OFF) + +#define PCH100_REG_FADDR 0x08 /* 32 Bits */ +#define PCH100_REG_FDATA0 0x10 /* 64 Bytes */ + +#define PCH100_REG_FPR0 0x84 /* 32 Bytes Protected Range 0 */ +#define PCH_WP_OFF 31 /* 31: write protection enable */ +#define PCH_RP_OFF 15 /* 15: read protection enable */ + +#define PCH100_REG_PREOP_OPTYPE 0xA4 /* 32 Bits */ +#define PCH100_REG_OPMENU_LOWER 0xA8 /* 32 Bits */ +#define PCH100_REG_OPMENU_UPPER 0xAC /* 32 Bits */ + +/* The minimum erase block size in PCH which is 4k +* 256, +* 4 * 1024, +* 8 * 1024, +* 64 * 1024 +*/ +#define ERASE_BLOCK_SIZE 1 + + /* ICH SPI configuration lock-down. May be set during chipset enabling. */ static int ichspi_lock = 0; @@ -473,6 +526,12 @@ opmenu[0] = REGREAD32(ICH7_REG_OPMENU); opmenu[1] = REGREAD32(ICH7_REG_OPMENU + 4); break; + case CHIPSET_100_SERIES_SUNRISE_POINT: + preop = REGREAD16(PCH100_REG_PREOP_OPTYPE); + optype = REGREAD16(PCH100_REG_PREOP_OPTYPE + 2); + opmenu[0] = REGREAD32(PCH100_REG_OPMENU_LOWER); + opmenu[1] = REGREAD32(PCH100_REG_OPMENU_UPPER); + break; case CHIPSET_ICH8: default: /* Future version might behave the same */ preop = REGREAD16(ICH9_REG_PREOP); @@ -553,6 +612,19 @@ mmio_writew(optype, ich_spibar + ICH7_REG_OPTYPE); mmio_writel(opmenu[0], ich_spibar + ICH7_REG_OPMENU); mmio_writel(opmenu[1], ich_spibar + ICH7_REG_OPMENU + 4); + break; + case CHIPSET_100_SERIES_SUNRISE_POINT: + /* Register undo only for enable_undo=1, i.e. first call. */ + if (enable_undo) { + rmmio_valw(ich_spibar + PCH100_REG_PREOP_OPTYPE); + rmmio_valw(ich_spibar + PCH100_REG_PREOP_OPTYPE + 2); + rmmio_vall(ich_spibar + PCH100_REG_OPMENU_LOWER); + rmmio_vall(ich_spibar + PCH100_REG_OPMENU_UPPER); + } + mmio_writew(preop, ich_spibar + PCH100_REG_PREOP_OPTYPE); + mmio_writew(optype, ich_spibar + PCH100_REG_PREOP_OPTYPE + 2); + mmio_writel(opmenu[0], ich_spibar + PCH100_REG_OPMENU_LOWER); + mmio_writel(opmenu[1], ich_spibar + PCH100_REG_OPMENU_UPPER); break; case CHIPSET_ICH8: default: /* Future version might behave the same */ @@ -1374,6 +1446,225 @@ return 0; } +/* Routines for PCH */ + +/* Sets FLA in FADDR to (addr & 0x07FFFFFF) without touching other bits. */ +static void pch_hwseq_set_addr(uint32_t addr) +{ + uint32_t addr_old = REGREAD32(PCH100_REG_FADDR) & ~0x07FFFFFF; + REGWRITE32(PCH100_REG_FADDR, (addr & 0x07FFFFFF) | addr_old); +} + +/* Sets FADDR.FLA to 'addr' and returns the erase block size in bytes + * of the block containing this address. May return nonsense if the address is + * not valid. The erase block size for a specific address depends on the flash + * partition layout as specified by FPB and the partition properties as defined + * by UVSCC and LVSCC respectively. An alternative to implement this method + * would be by querying FPB and the respective VSCC register directly. + */ +static uint32_t pch_hwseq_get_erase_block_size(unsigned int addr) +{ + uint8_t enc_berase; + static const uint32_t dec_berase[4] = { + 256, + 4 * 1024, + 8 * 1024, + 64 * 1024 + }; + pch_hwseq_set_addr(addr); + return dec_berase[ERASE_BLOCK_SIZE]; +} + +/* Polls for Cycle Done Status, Flash Cycle Error or timeout in 8 us intervals. + Resets all error flags in HSFS. + Returns 0 if the cycle completes successfully without errors within + timeout us, 1 on errors. */ +static int pch_hwseq_wait_for_cycle_complete(unsigned int timeout, + unsigned int len) +{ + uint16_t hsfs; + uint32_t addr; + + timeout /= 8; /* scale timeout duration to counter */ + while ((((hsfs = REGREAD16(PCH100_REG_HSFSC)) & + (HSFSC_FDONE | HSFSC_FCERR)) == 0) && + --timeout) { + programmer_delay(8); + } + REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + if (!timeout) { + addr = REGREAD32(PCH100_REG_FADDR) & 0x07FFFFFF; + msg_perr("Timeout error between offset 0x%08x and " + "0x%08x (= 0x%08x + %d)!\n", + addr, addr + len - 1, addr, len - 1); + return 1; + } + + if (hsfs & HSFSC_FCERR) { + addr = REGREAD32(PCH100_REG_FADDR) & 0x07FFFFFF; + msg_perr("Transaction error between offset 0x%08x and " + "0x%08x (= 0x%08x + %d)!\n", + addr, addr + len - 1, addr, len - 1); + return 1; + } + return 0; +} + + +int pch_hwseq_probe(struct flashctx *flash) +{ + uint32_t total_size, boundary = 0; /*There are no partitions in flash*/ + uint32_t erase_size_low, size_low, erase_size_high, size_high; + struct block_eraser *eraser; + + total_size = hwseq_data.size_comp0 + hwseq_data.size_comp1; + msg_cdbg("Found %d attached SPI flash chip", + (hwseq_data.size_comp1 != 0) ? 2 : 1); + if (hwseq_data.size_comp1 != 0) + msg_cdbg("s with a combined"); + else + msg_cdbg(" with a"); + msg_cdbg(" density of %d kB.\n", total_size / 1024); + flash->chip->total_size = total_size / 1024; + eraser = &(flash->chip->block_erasers[0]); + size_high = total_size - boundary; + erase_size_high = pch_hwseq_get_erase_block_size(boundary); + eraser->eraseblocks[0].size = erase_size_high; + eraser->eraseblocks[0].count = size_high / erase_size_high; + msg_cdbg("There are %d erase blocks with %d B each.\n", + size_high / erase_size_high, erase_size_high); + flash->chip->tested = TEST_OK_PREW; + return 1; +} + +int pch_hwseq_block_erase(struct flashctx *flash, + unsigned int addr, + unsigned int len) +{ + uint32_t erase_block; + uint16_t hsfc; + uint32_t timeout = 5000 * 1000; /* 5 s for max 64 kB */ + + erase_block = pch_hwseq_get_erase_block_size(addr); + if (len != erase_block) { + msg_cerr("Erase block size for address 0x%06x is %d B, " + "but requested erase block size is %d B. " + "Not erasing anything.\n", addr, erase_block, len); + return -1; + } + + /* Although the hardware supports this (it would erase the whole block + * containing the address) we play safe here. */ + if (addr % erase_block != 0) { + msg_cerr("Erase address 0x%06x is not aligned to the erase " + "block boundary (any multiple of %d). " + "Not erasing anything.\n", addr, erase_block); + return -1; + } + + if (addr + len > flash->chip->total_size * 1024) { + msg_perr("Request to erase some inaccessible memory address(es)" + " (addr=0x%x, len=%d). " + "Not erasing anything.\n", addr, len); + return -1; + } + + msg_pdbg("Erasing %d bytes starting at 0x%06x.\n", len, addr); + + /* make sure FDONE, FCERR, AEL are cleared by writing 1 to them */ + REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + + hsfc = REGREAD16(PCH100_REG_HSFSC + 2); + hsfc &= ~HSFSC_FCYCLE; /* clear operation */ + hsfc |= (0x3 << HSFSC_FCYCLE_OFF); /* set erase operation */ + hsfc |= HSFSC_FGO; /* start */ + msg_pdbg("HSFC used for block erasing: "); + REGWRITE16(PCH100_REG_HSFSC + 2, hsfc); + + if (pch_hwseq_wait_for_cycle_complete(timeout, len)) + return -1; + return 0; +} + +int pch_hwseq_read(struct flashctx *flash, uint8_t *buf, unsigned int addr, + unsigned int len) +{ + uint16_t hsfc; + uint16_t timeout = 100 * 60; + uint8_t block_len; + + + if ((addr + len) > (flash->chip->total_size * 1024)) { + msg_perr("Request to read from an inaccessible memory address " + "(addr=0x%x, len=%d).\n", addr, len); + return -1; + } + + msg_pdbg("Reading %d bytes starting at 0x%06x.\n", len, addr); + /* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */ + + REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + + while (len > 0) { + block_len = min(len, flash->mst->opaque.max_data_read); + pch_hwseq_set_addr(addr); + hsfc = REGREAD16(PCH100_REG_HSFSC + 2); + hsfc &= ~HSFSC_FCYCLE; /* set read operation */ + hsfc &= ~HSFSC_FDBC; /* clear byte count */ + /* set byte count */ + hsfc |= (((block_len - 1) << HSFSC_FDBC_OFF) & HSFSC_FDBC); + hsfc |= HSFSC_FGO; /* start */ + REGWRITE16(PCH100_REG_HSFSC + 2, hsfc); + + if (pch_hwseq_wait_for_cycle_complete(timeout, block_len)) + return 1; + ich_read_data(buf, block_len, PCH100_REG_FDATA0); + addr += block_len; + buf += block_len; + len -= block_len; + } + return 0; +} + +int pch_hwseq_write(struct flashctx *flash, const uint8_t *buf, unsigned int addr, + unsigned int len) +{ + uint16_t hsfc; + uint16_t timeout = 100 * 60; + uint8_t block_len; + + if ((addr + len) > (flash->chip->total_size * 1024)) { + msg_perr("Request to write to an inaccessible memory address " + "(addr=0x%x, len=%d).\n", addr, len); + return -1; + } + + msg_pdbg("Writing %d bytes starting at 0x%06x.\n", len, addr); + /* clear FDONE, FCERR, AEL by writing 1 to them (if they are set) */ + REGWRITE16(PCH100_REG_HSFSC, REGREAD16(PCH100_REG_HSFSC)); + + while (len > 0) { + pch_hwseq_set_addr(addr); + block_len = min(len, flash->mst->opaque.max_data_write); + ich_fill_data(buf, block_len, PCH100_REG_FDATA0); + hsfc = REGREAD16(PCH100_REG_HSFSC + 2); + hsfc &= ~HSFSC_FCYCLE; /* clear operation */ + hsfc |= (0x2 << HSFSC_FCYCLE_OFF); /* set write operation */ + hsfc &= ~HSFSC_FDBC; /* clear byte count */ + /* set byte count */ + hsfc |= (((block_len - 1) << HSFSC_FDBC_OFF) & HSFSC_FDBC); + hsfc |= HSFSC_FGO; /* start */ + REGWRITE16(PCH100_REG_HSFSC + 2, hsfc); + + if (pch_hwseq_wait_for_cycle_complete(timeout, block_len)) + return -1; + addr += block_len; + buf += block_len; + len -= block_len; + } + return 0; +} + static int ich_spi_send_multicommand(struct flashctx *flash, struct spi_command *cmds) { @@ -1487,12 +1778,20 @@ ((~((pr) >> PR_WP_OFF) & 1) << 1)) /* returns 0 if range is unused (i.e. r/w) */ -static int ich9_handle_pr(int i) +static int ich9_handle_pr(int i, int chipset) { static const char *const access_names[3] = { "locked", "read-only", "write-only" }; - uint8_t off = ICH9_REG_PR0 + (i * 4); + uint8_t off; + switch (chipset) { + case CHIPSET_100_SERIES_SUNRISE_POINT: + off = PCH100_REG_FPR0 + (i * 4); + break; + default: + off = ICH9_REG_PR0 + (i * 4); + break; + } uint32_t pr = mmio_readl(ich_spibar + off); unsigned int rwperms = ICH_PR_PERMS(pr); @@ -1509,9 +1808,17 @@ /* Set/Clear the read and write protection enable bits of PR register @i * according to @read_prot and @write_prot. */ -static void ich9_set_pr(int i, int read_prot, int write_prot) +static void ich9_set_pr(int i, int read_prot, int write_prot, int chipset) { - void *addr = ich_spibar + ICH9_REG_PR0 + (i * 4); + void *addr; + switch (chipset) { + case CHIPSET_100_SERIES_SUNRISE_POINT: + addr = ich_spibar + PCH100_REG_FPR0 + (i * 4); + break; + default: + addr = ich_spibar + ICH9_REG_PR0 + (i * 4); + break; + } uint32_t old = mmio_readl(addr); uint32_t new; @@ -1550,6 +1857,15 @@ .read = default_spi_read, .write_256 = default_spi_write_256, .write_aai = default_spi_write_aai, +}; + +static struct opaque_master opaque_master_pch_hwseq = { + .max_data_read = 64, + .max_data_write = 64, + .probe = pch_hwseq_probe, + .read = pch_hwseq_read, + .write = pch_hwseq_write, + .erase = pch_hwseq_block_erase, }; static const struct opaque_master opaque_master_ich_hwseq = { @@ -1614,6 +1930,103 @@ ich_init_opcodes(); ich_set_bbar(0); register_spi_master(&spi_master_ich7); + break; + case CHIPSET_100_SERIES_SUNRISE_POINT: + arg = extract_programmer_param("ich_spi_mode"); + if (arg && !strcmp(arg, "hwseq")) { + ich_spi_mode = ich_hwseq; + msg_pspew("user selected hwseq\n"); + } else if (arg && !strcmp(arg, "swseq")) { + ich_spi_mode = ich_swseq; + msg_pspew("user selected swseq\n"); + } else if (arg && !strcmp(arg, "auto")) { + msg_pspew("user selected auto\n"); + ich_spi_mode = ich_auto; + } else if (arg && !strlen(arg)) { + msg_perr("Missing argument for ich_spi_mode.\n"); + free(arg); + return ERROR_FATAL; + } else if (arg) { + msg_perr("Unknown argument for ich_spi_mode: %s\n", + arg); + free(arg); + return ERROR_FATAL; + } + free(arg); + tmp = mmio_readl(ich_spibar + PCH100_REG_HSFSC); + msg_pdbg("0x04: 0x%04x (HSFSC)\n", tmp); + if (tmp & HSFSC_FLOCKDN) { + msg_perr("WARNING: SPI Configuration " + "Lockdown activated.\n"); + ichspi_lock = 1; + } + if (tmp & HSFSC_FDV) + desc_valid = 1; + + if (!(tmp & HSFSC_FDOPSS) && desc_valid) + msg_perr("The Flash Descriptor Security Override " + "Strap-Pin is set. Restrictions implied\n" + "by the FRAP and FREG registers are NOT in " + "effect. Please note that Protected\n" + "Range (PR) restrictions still apply.\n"); + ich_init_opcodes(); + + tmp = mmio_readl(ich_spibar + PCH100_REG_FADDR); + msg_pdbg("0x08: 0x%08x (FADDR)\n", tmp); + if (desc_valid) { + tmp = mmio_readl(ich_spibar + ICH9_REG_FRAP); + msg_cdbg("0x50: 0x%08x (FRAP)\n", tmp); + msg_cdbg("BMWAG 0x%02x, ", ICH_BMWAG(tmp)); + msg_cdbg("BMRAG 0x%02x, ", ICH_BMRAG(tmp)); + msg_cdbg("BRWA 0x%02x, ", ICH_BRWA(tmp)); + msg_cdbg("BRRA 0x%02x\n", ICH_BRRA(tmp)); + + /* Decode and print FREGx and FRAP registers */ + for (i = 0; i < 5; i++) + ich9_handle_frap(tmp, i); + } + /* try to disable PR locks before printing them */ + if (!ichspi_lock) + for (i = 0; i < 5; i++) + ich9_set_pr(i, 0, 0, ich_generation); + for (i = 0; i < 5; i++) + ich9_handle_pr(i, ich_generation); + if (desc_valid) { + if (read_ich_descriptors_via_fdo(ich_spibar, &desc, + ich_generation) == ICH_RET_OK) + prettyprint_ich_descriptors(CHIPSET_ICH_UNKNOWN, + &desc); + /* If the descriptor is valid and indicates multiple + * flash devices we need to use hwseq to be able to + * access the second flash device. + */ + if (ich_spi_mode == ich_auto && desc.content.NC != 0) { + msg_pinfo("Enabling hardware sequencing due to " + "multiple flash chips detected.\n"); + ich_spi_mode = ich_hwseq; + } + } + + if (ich_spi_mode == ich_auto && ichspi_lock && + ich_missing_opcodes()) { + msg_pinfo("Enabling hardware sequencing because " + "some important opcode is locked.\n"); + ich_spi_mode = ich_hwseq; + } + + if (ich_spi_mode == ich_hwseq) { + if (!desc_valid) { + msg_perr("Hardware sequencing was requested " + "but the flash descriptor is not " + "valid. Aborting.\n"); + return ERROR_FATAL; + } + hwseq_data.size_comp0 = getFCBA_component_density(ich_gen, &desc, 0); + hwseq_data.size_comp1 = getFCBA_component_density(ich_gen, &desc, 1); + register_opaque_master(&opaque_master_pch_hwseq); + } else { + register_spi_master(&spi_master_ich9); + } break; case CHIPSET_ICH8: default: /* Future version might behave the same */ @@ -1700,8 +2113,8 @@ for (i = 0; i < 5; i++) { /* if not locked down try to disable PR locks first */ if (!ichspi_lock) - ich9_set_pr(i, 0, 0); - ich_spi_rw_restricted |= ich9_handle_pr(i); + ich9_set_pr(i, 0, 0, ich_gen); + ich_spi_rw_restricted |= ich9_handle_pr(i, ich_gen); } if (ich_spi_rw_restricted) { @@ -1764,7 +2177,7 @@ } if (desc_valid) { - if (read_ich_descriptors_via_fdo(ich_spibar, &desc) == ICH_RET_OK) + if (read_ich_descriptors_via_fdo(ich_spibar, &desc, ich_gen) == ICH_RET_OK) prettyprint_ich_descriptors(ich_gen, &desc); /* If the descriptor is valid and indicates multiple -- To view, visit
https://review.coreboot.org/18932
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I0e8ad2d3281c148414fd357427fcd445afc7d045 Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
Change in flashrom[staging]: fixup! flashrom: Add Skylake platform support
by Nico Huber (Code Review)
21 Mar '17
21 Mar '17
Nico Huber has uploaded a new change for review. (
https://review.coreboot.org/18933
) Change subject: fixup! flashrom: Add Skylake platform support ...................................................................... fixup! flashrom: Add Skylake platform support Fix `unused variable` warnings. Change-Id: Ibeddffc2de6ee8384d7bf493cfb5f7d6174b31bc Signed-off-by: Nico Huber <nico.huber(a)secunet.com> --- M ichspi.c 1 file changed, 1 insertion(+), 2 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/33/18933/1 diff --git a/ichspi.c b/ichspi.c index 3c26406..47b019a 100644 --- a/ichspi.c +++ b/ichspi.c @@ -1464,7 +1464,6 @@ */ static uint32_t pch_hwseq_get_erase_block_size(unsigned int addr) { - uint8_t enc_berase; static const uint32_t dec_berase[4] = { 256, 4 * 1024, @@ -1514,7 +1513,7 @@ int pch_hwseq_probe(struct flashctx *flash) { uint32_t total_size, boundary = 0; /*There are no partitions in flash*/ - uint32_t erase_size_low, size_low, erase_size_high, size_high; + uint32_t erase_size_high, size_high; struct block_eraser *eraser; total_size = hwseq_data.size_comp0 + hwseq_data.size_comp1; -- To view, visit
https://review.coreboot.org/18933
To unsubscribe, visit
https://review.coreboot.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Ibeddffc2de6ee8384d7bf493cfb5f7d6174b31bc Gerrit-PatchSet: 1 Gerrit-Project: flashrom Gerrit-Branch: staging Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
1
0
0
0
← Newer
1
...
2053
2054
2055
2056
2057
2058
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
Results per page:
10
25
50
100
200