Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Jakub Czapiga: Looks good to me, approved
spi: Add new struct spi_flash_bpbits for block protection bits

Currently the block protection bits are being passed around as
individual arguments. We will use this new struct to replace the
corresponding arguments in the winbond_bpbits_to_region and
winbond_set_write_protection functions.

Change-Id: I02828b1f764aea29374e794001e74cdc86a94c92
Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42112
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub Czapiga <czapiga@google.com>
---
M src/include/spi_flash.h
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/include/spi_flash.h b/src/include/spi_flash.h
index fe77e3e..d5471a4 100644
--- a/src/include/spi_flash.h
+++ b/src/include/spi_flash.h
@@ -49,6 +49,17 @@
int (*status)(const struct spi_flash *flash, u8 *reg);
};

+struct spi_flash_bpbits {
+ unsigned int bp; /*< block protection select bits */
+ bool cmp; /*< complement protect */
+ bool tb; /*< top=0 / bottom=1 select */
+ union {
+ struct {
+ bool srp1, srp0;
+ } winbond;
+ };
+};
+
/* Current code assumes all callbacks are supplied in this object. */
struct spi_flash_protection_ops {
/*

To view, visit change 42112. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I02828b1f764aea29374e794001e74cdc86a94c92
Gerrit-Change-Number: 42112
Gerrit-PatchSet: 27
Gerrit-Owner: Daniel Gröber (dxld) <coreboot@dxld.at>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Jakub Czapiga <czapiga@google.com>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus@gmail.com>
Gerrit-CC: Daniel Gröber
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-CC: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-MessageType: merged