mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
tree/: Case write_granularity enum values
Change-Id: Ic8c655225abe477c1b618dc685b743e691c16ebd Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/74165 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
67b5526d5c
commit
21901c11e7
12
at45db.c
12
at45db.c
@ -200,12 +200,12 @@ int probe_spi_at45db(struct flashctx *flash)
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -2762,7 +2762,7 @@ const struct flashchip flashchips[] = {
|
||||
.write = SPI_WRITE_AT45DB,
|
||||
.read = SPI_READ_AT45DB,
|
||||
.voltage = {2700, 3600},
|
||||
.gran = write_gran_1056bytes,
|
||||
.gran = WRITE_GRAN_1056BYTES,
|
||||
},
|
||||
|
||||
{
|
||||
@ -3015,7 +3015,7 @@ const struct flashchip flashchips[] = {
|
||||
.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 @@ const struct flashchip flashchips[] = {
|
||||
.write = EDI_CHIP_WRITE,
|
||||
.read = EDI_CHIP_READ,
|
||||
.voltage = {2700, 3600},
|
||||
.gran = write_gran_128bytes,
|
||||
.gran = WRITE_GRAN_128BYTES,
|
||||
},
|
||||
|
||||
{
|
||||
|
40
flashrom.c
40
flashrom.c
@ -719,42 +719,42 @@ int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len,
|
||||
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;
|
||||
@ -797,30 +797,30 @@ unsigned int get_next_write(const uint8_t *have, const uint8_t *want, unsigned i
|
||||
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:
|
||||
|
@ -83,17 +83,17 @@ enum chipbustype {
|
||||
*/
|
||||
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. */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -116,7 +116,7 @@ static int nicintel_ee_probe_i210(struct flashctx *flash)
|
||||
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 @@ static int nicintel_ee_probe_82580(struct flashctx *flash)
|
||||
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user