Hi,
Following patches add new infrastructure for status register(s) and locking/unlocking of access protection. Detailed points for explaining each patch are included within them.
Some general thoughts - - The code has a lot TODOs and FIXMEs (most of which I have addressed to myself). They are short-term targets and represent the work-in-progress nature of the patches. Future revisions will resolve them. - There are a lot of comments. Eventually much of that will be relocated to documentation and wiki, so comments in future revisions will shrink. - Some CLI code is borrowed from the ChromiumOS fork (https://chromium.googlesource.com/chromiumos/third_party/flashrom/). IMO, the exact words to use for the options is subjective. - The names for struct status_register and struct wp defines (in statusreg_layouts.c and writeprotect_layouts.c respectively) are not very creative and tend to be long. I couldn't come up with a generic scheme that captures most of the information regarding it. You are welcome to offer creative suggestions ;)
Further work - - Read and write "configuration" registers (a lot of Spansion chips have those) - Add tested/untested status for new infrastructure similar to what we have for chips (like TEST_PREW, etc.) - write protection modes - protection ranges - Access protection for non-SPI chips (pointed to by Stefan over IRC) - Reuse layouts for locking/unlocking (pointed to by Stafan and David over IRC) - Handling WPS bit (a couple of GigaDevice chips have this) - Exotic chips (mostly Atmel, now Adesto, chips fall under this category)
This is what I particularly seek - - Feedback on code - Feedback on CLI - Any other ideas that you'd like to add tu further work - Please add support for a few chips that you might have, and if possible also test them - would like to know how cumbersome it is
Thank you for your time. I am looking forward to your feedback and having a discussion. I hope this contribution (and many more in the future) adds value to flashrom and its community.
Bye, Hatim
Hatim Kanchwala (6): Status register infrastructure Locking/unlocking access protection infrastructure WIP: Add support for status register infrastructure to existing chips WIP: Add support for access protection infrastructure to existing chips Integrate new infrastructure with existing codebase Add command-line interface to expose new infrastructure
Makefile | 6 +- chipdrivers.h | 24 +++ cli_classic.c | 200 +++++++++++++++++++++++- flash.h | 46 +++++- flashchips.c | 176 +++++++++++++++++---- flashrom.8.tmpl | 56 ++++++- flashrom.c | 17 +- spi.h | 8 +- spi25.c | 164 +++++++++++++++---- spi25_statusreg.c | 416 +++++++++++++++++++++++++++++++++++++++++++++++++ spi25_statusreg.h | 115 ++++++++++++++ statusreg_layouts.c | 320 +++++++++++++++++++++++++++++++++++++ writeprotect.c | 405 +++++++++++++++++++++++++++++++++++++++++++++++ writeprotect.h | 40 +++++ writeprotect_layouts.c | 166 ++++++++++++++++++++ 15 files changed, 2083 insertions(+), 76 deletions(-) create mode 100644 spi25_statusreg.h create mode 100644 statusreg_layouts.c create mode 100644 writeprotect.c create mode 100644 writeprotect.h create mode 100644 writeprotect_layouts.c