Attention is currently required from: Nico Huber, Edward O'Callaghan, Anastasia Klimchuk, Sergii Dmytruk. Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58479 )
Change subject: libflashrom,writeprotect: add flashrom_wp_{read,write}_chip_config() ......................................................................
Patch Set 23:
(1 comment)
Patchset:
PS22:
Disregard typo above, start and len shouldn't be pointers in flashrom_wp_protect_flash(). […]
Passing an abstract configuration structure to WP functions is probably a better option than the interface in my previous comment. Something like:
``` struct flashrom_wp_cfg { enum flashrom_wp_mode { WP_MODE_DISABLED, WP_MODE_HARDWARE } prot_mode;
struct flashrom_wp_range { chipsize_t start, len; } prot_range; };
int flashrom_wp_get_cfg(struct flashrom_wp_cfg *, struct flashrom_flashctx *); int flashrom_wp_set_cfg(struct flashrom_flashctx *, struct flashrom_wp_cfg); ```
Then libflashrom users just populate the structure with the settings they want and the WP code will write them to the chip if it's possible to do so.
Direct SPI WP will be able to write any configuration, so won't lose any functionality that we have right now with the individual {get,set}_wp_{mode,range} functions.
And linux_mtd WP can just return an error if it's not possible to write the config (i.e. it doesn't map to a MTD ioctl).