flashrom.c: Fail immediately when trying to write/erase wp regions#17
flashrom.c: Fail immediately when trying to write/erase wp regions#17m-iwanicki wants to merge 5 commits into
Conversation
6892f59 to
4dc3fa9
Compare
Can you change this so that only attempting to flash the actually protected ranges will throw an error? For example if someone has WP_RO protected but only wants to flash RW_SECTION_* |
337da02 to
e7b4efa
Compare
Tests@mkopec
|
e7b4efa to
ababbe1
Compare
|
Seems to work as described 👍 tested on NV40MB (Tiger Lake) |
| target/ | ||
|
|
||
| subprojects/cmocka-*/ | ||
| subprojects/packagecache/ |
There was a problem hiding this comment.
Either remove or split into a separate commit, please
| } | ||
|
|
||
| if ((write_it || erase_it) && !flash->flags.force) { | ||
| if(write_protect_check(flash)) { |
There was a problem hiding this comment.
| if(write_protect_check(flash)) { | |
| if (write_protect_check(flash)) { |
Please make code style consistent
|
|
||
| prot->base = ICH_FREG_BASE(pr); | ||
| prot->limit = ICH_FREG_LIMIT(pr); | ||
| prot->write_prot = rwperms == WRITE_PROT; |
There was a problem hiding this comment.
| prot->write_prot = rwperms == WRITE_PROT; | |
| prot->write_prot = (rwperms == WRITE_PROT) || (rwperms == LOCKED); |
I think, at least
There was a problem hiding this comment.
I assumed based on
Line 2267 in ababbe1
If I'm reading this correctly in case
ich_spi_rw_restricted == LOCKED then warning will only mention that's it's read-protected
ababbe1 to
c80f032
Compare
Change-Id: Ic39b4acf1da73d093ce3a7df71c1c549d92240d5 Signed-off-by: Michał Iwanicki <michal.iwanicki@3mdeb.com>
Change-Id: I989006eae97f5e015df20026b6f5361ad41223c1 Signed-off-by: Michał Iwanicki <michal.iwanicki@3mdeb.com>
Change-Id: Iee172044959df8efd7148adb3a918a7dad963f6f Signed-off-by: Michał Iwanicki <michal.iwanicki@3mdeb.com>
Change-Id: I1cdcfacaf61285bf4d7789610461a3f02ea4c64b Signed-off-by: Michał Iwanicki <michal.iwanicki@3mdeb.com>
Change-Id: I0d8034aac411049e0223ad50f56b584602aa6899 Signed-off-by: Michał Iwanicki <michal.iwanicki@3mdeb.com>
4de6d01 to
a772b30
Compare
write_protect_checkcan be deleted and PR0 check will still happen but only one region at a time, so if we write/erase multiple regions (e.g.-i fd -i bios) then first region might get written if it is read-write.In case of e.g.
FREG1: BIOS region (0x00580000-0x00ffffff) is read-write.&PR0: Warning: 0x00b00000-0x00ffffff is read-only.write/erase would still fail even if we tried to flash only unprotected parts of region e.g.0x00580000-0x00590000To force write/erase add
--forceargument.meson test:
Tested on Protectli VP6670:
Try to flash whole chip:
Try to flash protected part:
Try to flash unprotected part:
WP protection checked with dummy programmer:
unprotected part:
Protected part: