Nikolai Artemiev has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/48778 )
Change subject: WIP: spi25_statusreg.c: restore SR contents at flashrom exit
......................................................................
WIP: spi25_statusreg.c: restore SR contents at flashrom exit
spi_disable_blockprotect_generic() now uses
register_chip_restore() to reset the chip's status
register at flashrom exit.
Imported from cros flashrom at `b170dd4e1d5c33b169c5`
Change-Id: If2f0e73518d40519b7569f627c90a34c364df47c
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
---
M spi25_statusreg.c
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/78/48778/1
diff --git a/spi25_statusreg.c b/spi25_statusreg.c
index 34f9ad4..5dda912 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -108,6 +108,12 @@
return readarr[0];
}
+static int spi_restore_status(struct flashctx *flash, uint8_t status)
+{
+ msg_cdbg("restoring chip status (0x%02x)\n", status);
+ return spi_write_status_register(flash, status);
+}
+
/* A generic block protection disable.
* Tests if a protection is enabled with the block protection mask (bp_mask) and returns success otherwise.
* Tests if the register bits are locked with the lock_mask (lock_mask).
@@ -139,6 +145,9 @@
return 0;
}
+ /* restore status register content upon exit */
+ register_chip_restore(spi_restore_status, flash, status);
+
msg_cdbg("Some block protection in effect, disabling... ");
if ((status & lock_mask) != 0) {
msg_cdbg("\n\tNeed to disable the register lock first... ");
--
To view, visit https://review.coreboot.org/c/flashrom/+/48778
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If2f0e73518d40519b7569f627c90a34c364df47c
Gerrit-Change-Number: 48778
Gerrit-PatchSet: 1
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-MessageType: newchange
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/47909 )
Change subject: realtek_mst_i2c_spi.c: Make consistent with std=c99
......................................................................
realtek_mst_i2c_spi.c: Make consistent with std=c99
Use 'modern' C to scope iterator declarations only to
the loop constructs they are used in.
BUG=none
TEST=builds
Change-Id: I9d9d1bf01209a7840f7b3fa2c6f7592375a74330
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M realtek_mst_i2c_spi.c
1 file changed, 4 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/09/47909/1
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 538b07a..151f7f6 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -205,7 +205,6 @@
const unsigned char *writearr,
unsigned char *readarr)
{
- unsigned i;
int max_timeout_mul = 1;
int ret = 0;
@@ -262,7 +261,7 @@
ret |= realtek_mst_i2c_spi_write_register(fd, 0x60, ctrl_reg_val);
ret |= realtek_mst_i2c_spi_write_register(fd, 0x61, writearr[0]); /* opcode */
- for (i = 0; i < writecnt; ++i)
+ for (unsigned i = 0; i < writecnt; ++i)
ret |= realtek_mst_i2c_spi_write_register(fd, 0x64 + i, writearr[i + 1]);
ret |= realtek_mst_i2c_spi_write_register(fd, 0x60, ctrl_reg_val | 0x1);
if (ret)
@@ -272,7 +271,7 @@
if (ret)
return ret;
- for (i = 0; i < readcnt; ++i)
+ for (unsigned i = 0; i < readcnt; ++i)
ret |= realtek_mst_i2c_spi_read_register(fd, 0x67 + i, &readarr[i]);
return ret;
@@ -306,7 +305,6 @@
static int realtek_mst_i2c_spi_read(struct flashctx *flash, uint8_t *buf,
unsigned int start, unsigned int len)
{
- unsigned i;
int ret = 0;
if (start & 0xff)
@@ -339,7 +337,7 @@
uint8_t dummy;
realtek_mst_i2c_spi_read_register(fd, MCU_DATA_PORT, &dummy);
- for (i = 0; i < len; i += PAGE_SIZE) {
+ for (unsigned i = 0; i < len; i += PAGE_SIZE) {
ret |= realtek_mst_i2c_spi_read_data(fd, REGISTER_ADDRESS,
buf + i, min(len - i, PAGE_SIZE));
if (ret)
@@ -352,7 +350,6 @@
static int realtek_mst_i2c_spi_write_256(struct flashctx *flash, const uint8_t *buf,
unsigned int start, unsigned int len)
{
- unsigned i;
int ret = 0;
if (start & 0xff)
@@ -369,7 +366,7 @@
ret |= realtek_mst_i2c_spi_write_register(fd, 0x6D, 0x02); /* write opcode */
ret |= realtek_mst_i2c_spi_write_register(fd, 0x71, (PAGE_SIZE - 1)); /* fit len=256 */
- for (i = 0; i < len; i += PAGE_SIZE) {
+ for (unsigned i = 0; i < len; i += PAGE_SIZE) {
uint16_t page_len = min(len - i, PAGE_SIZE);
if (len - i < PAGE_SIZE)
ret |= realtek_mst_i2c_spi_write_register(fd, 0x71, page_len-1);
--
To view, visit https://review.coreboot.org/c/flashrom/+/47909
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9d9d1bf01209a7840f7b3fa2c6f7592375a74330
Gerrit-Change-Number: 47909
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange
Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/47910 )
Change subject: lspcon_i2c_spi.c: Make consistent with std=c99
......................................................................
lspcon_i2c_spi.c: Make consistent with std=c99
Use 'modern' C to scope iterator declarations only to
the loop constructs they are used in.
BUG=none
TEST=builds
Change-Id: Id61f8416416d2f625d424760e00f94dc730105f4
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M lspcon_i2c_spi.c
1 file changed, 3 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/10/47910/1
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 7b9f1c0..6ee2840 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -127,14 +127,13 @@
static int lspcon_i2c_spi_register_control(int fd, packet_t *packet)
{
- int i;
int ret = lspcon_i2c_spi_write_register(fd, SWSPI_WDATA, packet->command);
if (ret)
return ret;
/* Higher 4 bits are read size. */
int write_size = packet->data_size & 0x0f;
- for (i = 0; i < write_size; ++i) {
+ for (unsigned i = 0; i < write_size; ++i) {
ret |= lspcon_i2c_spi_write_register(fd, SWSPI_WDATA, packet->data[i]);
}
@@ -256,7 +255,6 @@
const unsigned char *writearr,
unsigned char *readarr)
{
- unsigned int i;
if (writecnt > 16 || readcnt > 16 || writecnt == 0) {
msg_perr("%s: Invalid read/write count for send command.\n",
__func__);
@@ -285,7 +283,7 @@
if (ret)
return ret;
- for (i = 0; i < readcnt; ++i) {
+ for (unsigned i = 0; i < readcnt; ++i) {
ret |= lspcon_i2c_spi_read_register(fd, SWSPI_RDATA, &readarr[i]);
}
@@ -340,7 +338,6 @@
static int lspcon_i2c_spi_read(struct flashctx *flash, uint8_t *buf,
unsigned int start, unsigned int len)
{
- unsigned int i;
int ret = 0;
if (start & 0xff)
return default_spi_read(flash, buf, start, len);
@@ -349,7 +346,7 @@
if (fd < 0)
return SPI_GENERIC_ERROR;
- for (i = 0; i < len; i += PAGE_SIZE) {
+ for (unsigned i = 0; i < len; i += PAGE_SIZE) {
ret |= lspcon_i2c_spi_map_page(fd, start + i);
ret |= lspcon_i2c_spi_read_data(fd, PAGE_ADDRESS, buf + i, min(len - i, PAGE_SIZE));
}
--
To view, visit https://review.coreboot.org/c/flashrom/+/47910
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id61f8416416d2f625d424760e00f94dc730105f4
Gerrit-Change-Number: 47910
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange
Alan Green has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/35479 )
Change subject: flashchips.c: Take GD25LQ40 from downstream
......................................................................
flashchips.c: Take GD25LQ40 from downstream
Take definition of GD25LQ40 from ChromiumOS repository. This chip was
added in `commit 59543cd1` by dnschneid(a)chromium.org on 2016-04-27. The
commit message notes that some testing had been done, even thought the
.tested attribute was left as UNTESTED.
Signed-off-by: Alan Green <avg(a)google.com>
Change-Id: I978745b38536cda807adf07af4e4d093d0d93ad1
---
M flashchips.c
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/79/35479/1
diff --git a/flashchips.c b/flashchips.c
index 5c797fd..ac07fa8 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -6009,7 +6009,7 @@
.total_size = 512,
.page_size = 256,
/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
- .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
+ .feature_bits = FEATURE_WRSR_WREN,
.tested = TEST_UNTESTED,
.probe = probe_spi_rdid,
.probe_timing = TIMING_ZERO,
@@ -6032,8 +6032,7 @@
.block_erase = spi_block_erase_c7,
}
},
- .printlock = spi_prettyprint_status_register_bp4_srwd,
- .unlock = spi_disable_blockprotect_bp4_srwd, /* TODO: 2nd status reg (read with 0x35) */
+ .unlock = spi_disable_blockprotect,
.write = spi_chip_write_256,
.read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
.voltage = {1695, 1950},
--
To view, visit https://review.coreboot.org/c/flashrom/+/35479
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I978745b38536cda807adf07af4e4d093d0d93ad1
Gerrit-Change-Number: 35479
Gerrit-PatchSet: 1
Gerrit-Owner: Alan Green <avg(a)google.com>
Gerrit-MessageType: newchange
Jonathan Zhang has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/49001 )
Change subject: ichspi: print transaction error in debug mode
......................................................................
ichspi: print transaction error in debug mode
When "--fmap" option is used, flashrom does binary search in flash for
fmap. When it reads flash region that is locked, transaction error happens.
Print transaction error in debug mode, so that following message:
Transaction error between offset 0x02cb4000 and 0x02cb4007 (= 0x02cb4000 + 7)!
shows up only when "-V" is specified.
Change-Id: Iebed1ae7f15b7f06b90a0b5947b953f7f0e1567d
Signed-off-by: Jonathan Zhang <jonzhang(a)fb.com>
---
M ichspi.c
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/01/49001/1
diff --git a/ichspi.c b/ichspi.c
index 4209d60..6dde7b2 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -1311,11 +1311,17 @@
if (hsfs & HSFS_FCERR) {
addr = REGREAD32(ICH9_REG_FADDR) & hwseq_data.addr_mask;
- msg_perr("Transaction error between offset 0x%08x and "
+
+ /*
+ * If the partition is locked, this transaction error happens.
+ * Print in verbose mode to avoid excessive messages.
+ */
+ msg_cdbg("Transaction error between offset 0x%08x and "
"0x%08x (= 0x%08x + %d)!\n",
addr, addr + len - 1, addr, len - 1);
prettyprint_ich9_reg_hsfs(hsfs, ich_gen);
prettyprint_ich9_reg_hsfc(REGREAD16(ICH9_REG_HSFC), ich_gen);
+
return 1;
}
return 0;
--
To view, visit https://review.coreboot.org/c/flashrom/+/49001
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iebed1ae7f15b7f06b90a0b5947b953f7f0e1567d
Gerrit-Change-Number: 49001
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Zhang <jonzhang(a)fb.com>
Gerrit-MessageType: newchange