Attention is currently required from: Nico Huber, Paul Menzel, Edward O'Callaghan, Angel Pons, Nikolai Artemiev, Sergii Dmytruk. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58738 )
Change subject: cli_classic: add writeprotect CLI ......................................................................
Patch Set 17:
(4 comments)
Patchset:
PS17: It would be really great if other people have a look, re: API discussion started in CB:58482 thank you!
File cli_classic.c:
https://review.coreboot.org/c/flashrom/+/58738/comment/1b1090d8_31cd10d6 PS15, Line 66: " --wp-range=<start>,<len> set write protect range\n" : " --wp-region <region> set write protect region\n" I am just wondering, there are commands to set wp range/region, but how to unset? Or is it --wp-disable command to unset everything that has been set previously?
File cli_classic.c:
https://review.coreboot.org/c/flashrom/+/58738/comment/1c7ad4a9_eefcca04 PS17, Line 220: ret = flashrom_wp_set_range(flash, &cfg, &range); : if (ret) { : msg_gerr("The chip does not support the requested range.\n"); : return ret; : } : : /* Write range before other operations (i.e. enabling HW protection) */ : ret = write_wp_config(flash, &cfg); : if (ret) : return ret; Continuing the conversation about libflashrom vs cli. If we have a a command "set wp range", from this code it looks like it needs two operations, flashrom_wp_set_range and write_wp_config , to be performed in order? Does it mean libflashrom users would have to remember to perform two operations, in order? What happens if you do flashrom_wp_set_range but forget to do write_wp_config? range won't be set properly I assume?
I think flashrom_wp_set_range should include write_wp_config, so that just calling flashrom_wp_set_range is sufficient to perform a command.
I understand we need to print extra messages here. To achieve that, flashrom_wp_set_range need to return error codes, can be 1,2,3 etc. Here, we can print messages depending on error code.
https://review.coreboot.org/c/flashrom/+/58738/comment/b8d345d0_fce2b5b5 PS17, Line 236: ret = flashrom_wp_set_mode(&cfg, mode); : if (ret) { : msg_gerr("The chip does not support the requested mode.\n"); : return ret; : } : : /* Write mode before other operations */ : ret = write_wp_config(flash, &cfg); : if (ret) : return ret; Same comment, seems like an operation consists of two steps.