Don't protect firmware now if protect-ro-at-boot is not set

Otherwise, EC software sync protects the entire firmware except in recovery mode, regardless of the WP pin.

BUG=chrome-os-partner:11847
TEST=boot with WP enabled but RO-at-boot disabled; flashinfo should show
entire flash still writable

CQ-DEPEND=28444

Change-Id: I58d60adfaa952b127e8695213f95f6da0e34821d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28445
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2012-07-25 16:44:12 -07:00
committed by Gerrit
parent 36a3989fc4
commit 3cc4745be2

View File

@@ -326,8 +326,12 @@ int flash_set_protect(uint32_t mask, uint32_t flags)
retval = rv;
}
/* All subsequent flags only work if write protect is disabled */
if (!(flash_get_protect() & EC_FLASH_PROTECT_GPIO_ASSERTED))
/*
* All subsequent flags only work if write protect is enabled (that is,
* hardware WP flag) *and* RO is protected at boot (software WP flag).
*/
if ((~flash_get_protect()) & (EC_FLASH_PROTECT_GPIO_ASSERTED |
EC_FLASH_PROTECT_RO_AT_BOOT))
return retval;
if ((mask & EC_FLASH_PROTECT_RO_NOW) &&