Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Anastasia Klimchuk. Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58474 )
Change subject: [RFC] writeprotect, cli_classic: delete old writeprotect code ......................................................................
Patch Set 6:
(3 comments)
File cli_classic.c:
https://review.coreboot.org/c/flashrom/+/58474/comment/849a7fdb_8885f4d0 PS5, Line 778: set_wp_disable should be done before setting the range
Or even have `set_wp_range` disable WP beforehand (bail out if it fails) and restore the WP state af […]
The comment is misleading, the only real requirement is that wp_set_range() should be called before before wp_enable() to avoid locking the status register before the desired range is selected.
However calling wp_disable() before wp_set_range() won't help, since wp_disable() will only succeed if protection is already disabled or if the WP pin is inactive, and in either case wp_set_range() would succeed anyway.
https://review.coreboot.org/c/flashrom/+/58474/comment/ec3a1c99_3d6c7f8e PS5, Line 783: set_wp_range must happen before set_wp_enable
Same question as previous, can set_wp_enable check that set_wp_range has been called? […]
There isn't really anything to check, though we probably should keep the comment in some form. Something like "do this last" before the wp_enable code.
File writeprotect.c:
PS3:
The only reason I was thinking to temporarily keep struct wp, is to keep cli_classic compiling. So that _wp_ functions can be added one at a time, with implementation. At the end of the patch series there would be no struct wp, one way or the other. I thought this can be another approach on how to add one function at a time.
In the end I decided to delete all the old code in this commit and add things back as when they are ready. I think that will be easiest to review.