Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/74165 )
Change subject: tree/: Case write_granularity enum values ......................................................................
tree/: Case write_granularity enum values
Change-Id: Ic8c655225abe477c1b618dc685b743e691c16ebd Signed-off-by: Edward O'Callaghan quasisec@google.com --- M at45db.c M flashchips.c M flashrom.c M include/flash.h M nicintel_eeprom.c 5 files changed, 51 insertions(+), 41 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/65/74165/1
diff --git a/at45db.c b/at45db.c index 7877330..6d66a6e 100644 --- a/at45db.c +++ b/at45db.c @@ -200,12 +200,12 @@ }
switch (chip->page_size) { - case 256: chip->gran = write_gran_256bytes; break; - case 264: chip->gran = write_gran_264bytes; break; - case 512: chip->gran = write_gran_512bytes; break; - case 528: chip->gran = write_gran_528bytes; break; - case 1024: chip->gran = write_gran_1024bytes; break; - case 1056: chip->gran = write_gran_1056bytes; break; + case 256: chip->gran = WRITE_GRAN_256BYTES; break; + case 264: chip->gran = WRITE_GRAN_264BYTES; break; + case 512: chip->gran = WRITE_GRAN_512BYTES; break; + case 528: chip->gran = WRITE_GRAN_528BYTES; break; + case 1024: chip->gran = WRITE_GRAN_1024BYTES; break; + case 1056: chip->gran = WRITE_GRAN_1056BYTES; break; default: msg_cerr("%s: unknown page size %d.\n", __func__, chip->page_size); return 0; diff --git a/flashchips.c b/flashchips.c index dc6e882..6a5cf49 100644 --- a/flashchips.c +++ b/flashchips.c @@ -2762,7 +2762,7 @@ .write = SPI_WRITE_AT45DB, .read = SPI_READ_AT45DB, .voltage = {2700, 3600}, - .gran = write_gran_1056bytes, + .gran = WRITE_GRAN_1056BYTES, },
{ @@ -3015,7 +3015,7 @@ .write = SPI_WRITE_AT45DB, .read = SPI_READ_AT45DB_E8, /* 3 address and 4 dummy bytes */ .voltage = {2700, 3600}, - .gran = write_gran_528bytes, + .gran = WRITE_GRAN_528BYTES, },
{ @@ -3638,7 +3638,7 @@ .write = EDI_CHIP_WRITE, .read = EDI_CHIP_READ, .voltage = {2700, 3600}, - .gran = write_gran_128bytes, + .gran = WRITE_GRAN_128BYTES, },
{ diff --git a/flashrom.c b/flashrom.c index b135e58..cee96d6 100644 --- a/flashrom.c +++ b/flashrom.c @@ -723,42 +723,42 @@ unsigned int i;
switch (gran) { - case write_gran_1bit: + case WRITE_GRAN_1BIT: for (i = 0; i < len; i++) if ((have[i] & want[i]) != want[i]) { result = 1; break; } break; - case write_gran_1byte: + case WRITE_GRAN_1BYTE: for (i = 0; i < len; i++) if ((have[i] != want[i]) && (have[i] != erased_value)) { result = 1; break; } break; - case write_gran_128bytes: + case WRITE_GRAN_128BYTES: result = need_erase_gran_bytes(have, want, len, 128, erased_value); break; - case write_gran_256bytes: + case WRITE_GRAN_256BYTES: result = need_erase_gran_bytes(have, want, len, 256, erased_value); break; - case write_gran_264bytes: + case WRITE_GRAN_264BYTES: result = need_erase_gran_bytes(have, want, len, 264, erased_value); break; - case write_gran_512bytes: + case WRITE_GRAN_512BYTES: result = need_erase_gran_bytes(have, want, len, 512, erased_value); break; - case write_gran_528bytes: + case WRITE_GRAN_528BYTES: result = need_erase_gran_bytes(have, want, len, 528, erased_value); break; - case write_gran_1024bytes: + case WRITE_GRAN_1024BYTES: result = need_erase_gran_bytes(have, want, len, 1024, erased_value); break; - case write_gran_1056bytes: + case WRITE_GRAN_1056BYTES: result = need_erase_gran_bytes(have, want, len, 1056, erased_value); break; - case write_gran_1byte_implicit_erase: + case WRITE_GRAN_1BYTE_IMPLICIT_ERASE: /* Do not erase, handle content changes from anything->0xff by writing 0xff. */ result = 0; break; @@ -801,30 +801,30 @@ unsigned int i, limit, stride;
switch (gran) { - case write_gran_1bit: - case write_gran_1byte: - case write_gran_1byte_implicit_erase: + case WRITE_GRAN_1BIT: + case WRITE_GRAN_1BYTE: + case WRITE_GRAN_1BYTE_IMPLICIT_ERASE: stride = 1; break; - case write_gran_128bytes: + case WRITE_GRAN_128BYTES: stride = 128; break; - case write_gran_256bytes: + case WRITE_GRAN_256BYTES: stride = 256; break; - case write_gran_264bytes: + case WRITE_GRAN_264BYTES: stride = 264; break; - case write_gran_512bytes: + case WRITE_GRAN_512BYTES: stride = 512; break; - case write_gran_528bytes: + case WRITE_GRAN_528BYTES: stride = 528; break; - case write_gran_1024bytes: + case WRITE_GRAN_1024BYTES: stride = 1024; break; - case write_gran_1056bytes: + case WRITE_GRAN_1056BYTES: stride = 1056; break; default: diff --git a/include/flash.h b/include/flash.h index f0357cb..3e9c885 100644 --- a/include/flash.h +++ b/include/flash.h @@ -83,17 +83,17 @@ */ enum write_granularity { /* We assume 256 byte granularity by default. */ - write_gran_256bytes = 0,/* If less than 256 bytes are written, the unwritten bytes are undefined. */ - write_gran_1bit, /* Each bit can be cleared individually. */ - write_gran_1byte, /* A byte can be written once. Further writes to an already written byte cause + WRITE_GRAN_256BYTES = 0,/* If less than 256 bytes are written, the unwritten bytes are undefined. */ + WRITE_GRAN_1BIT, /* Each bit can be cleared individually. */ + WRITE_GRAN_1BYTE, /* A byte can be written once. Further writes to an already written byte cause * its contents to be either undefined or to stay unchanged. */ - write_gran_128bytes, /* If less than 128 bytes are written, the unwritten bytes are undefined. */ - write_gran_264bytes, /* If less than 264 bytes are written, the unwritten bytes are undefined. */ - write_gran_512bytes, /* If less than 512 bytes are written, the unwritten bytes are undefined. */ - write_gran_528bytes, /* If less than 528 bytes are written, the unwritten bytes are undefined. */ - write_gran_1024bytes, /* If less than 1024 bytes are written, the unwritten bytes are undefined. */ - write_gran_1056bytes, /* If less than 1056 bytes are written, the unwritten bytes are undefined. */ - write_gran_1byte_implicit_erase, /* EEPROMs and other chips with implicit erase and 1-byte writes. */ + WRITE_GRAN_128BYTES, /* If less than 128 bytes are written, the unwritten bytes are undefined. */ + WRITE_GRAN_264BYTES, /* If less than 264 bytes are written, the unwritten bytes are undefined. */ + WRITE_GRAN_512BYTES, /* If less than 512 bytes are written, the unwritten bytes are undefined. */ + WRITE_GRAN_528BYTES, /* If less than 528 bytes are written, the unwritten bytes are undefined. */ + WRITE_GRAN_1024BYTES, /* If less than 1024 bytes are written, the unwritten bytes are undefined. */ + WRITE_GRAN_1056BYTES, /* If less than 1056 bytes are written, the unwritten bytes are undefined. */ + WRITE_GRAN_1BYTE_IMPLICIT_ERASE, /* EEPROMs and other chips with implicit erase and 1-byte writes. */ };
/* diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c index 80ccd88..2c351da 100644 --- a/nicintel_eeprom.c +++ b/nicintel_eeprom.c @@ -116,7 +116,7 @@ flash->chip->total_size = 4; flash->chip->page_size = flash->chip->total_size * 1024; flash->chip->tested = TEST_OK_PREWB; - flash->chip->gran = write_gran_1byte_implicit_erase; + flash->chip->gran = WRITE_GRAN_1BYTE_IMPLICIT_ERASE; flash->chip->block_erasers->eraseblocks[0].size = flash->chip->page_size; flash->chip->block_erasers->eraseblocks[0].count = 1;
@@ -147,7 +147,7 @@
flash->chip->page_size = EE_PAGE_MASK + 1; flash->chip->tested = TEST_OK_PREWB; - flash->chip->gran = write_gran_1byte_implicit_erase; + flash->chip->gran = WRITE_GRAN_1BYTE_IMPLICIT_ERASE; flash->chip->block_erasers->eraseblocks[0].size = (EE_PAGE_MASK + 1); flash->chip->block_erasers->eraseblocks[0].count = (flash->chip->total_size * 1024) / (EE_PAGE_MASK + 1);