Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/28731
Change subject: drivers/spi/winbond: Fix read protection bits ......................................................................
drivers/spi/winbond: Fix read protection bits
Don't care about SRPx and print correct protected range.
Change-Id: I051f1459c585a7ed6a4878dc217d11df5ef00d74 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/drivers/spi/winbond.c 1 file changed, 5 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/28731/1
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c index a0e3884..ac7c2be 100644 --- a/src/drivers/spi/winbond.c +++ b/src/drivers/spi/winbond.c @@ -297,8 +297,6 @@
ret = spi_flash_cmd(&flash->spi, flash->status_cmd, ®1_bp3.u, sizeof(reg1_bp3.u)); - if (ret) - return ret;
if (reg1_bp3.sec) { // FIXME: not supported @@ -312,8 +310,6 @@
ret = spi_flash_cmd(&flash->spi, flash->status_cmd, ®1_bp4.u, sizeof(reg1_bp4.u)); - if (ret) - return ret;
bp = reg1_bp4.bp; tb = reg1_bp4.tb; @@ -321,6 +317,8 @@ // FIXME: not supported return -1; } + if (ret) + return ret;
ret = spi_flash_cmd(&flash->spi, CMD_W25_RDSR2, ®2.u, sizeof(reg2.u)); @@ -330,14 +328,15 @@ winbond_bpbits_to_region(granularity, bp, tb, reg2.cmp, flash->size, &wp_region);
- if (!reg2.srp1 || !wp_region.size) { + if (!region_sz(&wp_region)) { printk(BIOS_DEBUG, "WINBOND: flash isn't protected\n");
return 0; }
printk(BIOS_DEBUG, "WINBOND: flash protected range 0x%08zx-0x%08zx\n", - wp_region.offset, wp_region.size); + region_offset(&wp_region), + region_offset(&wp_region) + region_sz(&wp_region));
return region_is_subregion(&wp_region, region); }