Namyoon Woo has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/44881 )
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
support 4-byte address format for VARIOUS_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIOUS_SIZE dummy flash device, so that it can emulate an flash size larger than 16 MBytes.
TEST=ran the command line below: $ flashrom -p dummy:image=${TMP_FILE},size=33554432, \ emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \ emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \ emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f
Signed-off-by: Namyoon Woo namyoon@google.com Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e --- M dummyflasher.c M flashchips.c 2 files changed, 25 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/81/44881/1
diff --git a/dummyflasher.c b/dummyflasher.c index 4024f2a..b5a0f1b 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -719,6 +719,13 @@ if (readcnt > 0) memcpy(readarr, flashchip_contents + offs, readcnt); break; + case JEDEC_READ_4BA: + offs = writearr[1] << 24 | writearr[2] << 16 | writearr[3] << 8 | writearr[4]; + /* Truncate to emu_chip_size. */ + offs %= emu_chip_size; + if (readcnt > 0) + memcpy(readarr, flashchip_contents + offs, readcnt); + break; case JEDEC_BYTE_PROGRAM: offs = writearr[1] << 16 | writearr[2] << 8 | writearr[3]; /* Truncate to emu_chip_size. */ @@ -733,6 +740,20 @@ } memcpy(flashchip_contents + offs, writearr + 4, writecnt - 4); break; + case JEDEC_BYTE_PROGRAM_4BA: + offs = writearr[1] << 24 | writearr[2] << 16 | writearr[3] << 8 | writearr[4]; + /* Truncate to emu_chip_size. */ + offs %= emu_chip_size; + if (writecnt < 6) { + msg_perr("BYTE PROGRAM size too short!\n"); + return 1; + } + if (writecnt - 5 > emu_max_byteprogram_size) { + msg_perr("Max BYTE PROGRAM size exceeded!\n"); + return 1; + } + memcpy(flashchip_contents + offs, writearr + 5, writecnt - 5); + break; case JEDEC_AAI_WORD_PROGRAM: if (!emu_max_aai_size) break; @@ -978,8 +999,8 @@ if (eraser->block_erase == NULL) break;
- eraser->eraseblocks[0].count = emu_chip_size / - eraser->eraseblocks[0].size; + eraser->eraseblocks[0].count = 1; + eraser->eraseblocks[0].size = emu_chip_size; msg_cdbg("%s: eraser.size=%d, .count=%d\n", __func__, eraser->eraseblocks[0].size, eraser->eraseblocks[0].count); diff --git a/flashchips.c b/flashchips.c index e99073b..34b7702 100644 --- a/flashchips.c +++ b/flashchips.c @@ -18765,13 +18765,14 @@ .model_id = VARIABLE_SIZE_DEVICE_ID, .total_size = 64, /* This size is set temporarily */ .page_size = 256, + .feature_bits = FEATURE_4BA, .tested = TEST_OK_PREW, .probe = probe_variable_size, .block_erasers = { { .eraseblocks = { {64 * 1024, 1} }, - .block_erase = spi_block_erase_d8, + .block_erase = spi_block_erase_c7, } }, .write = spi_chip_write_256,
Hello build bot (Jenkins), Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/44881
to look at the new patch set (#2).
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
support 4-byte address format for VARIOUS_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIOUS_SIZE dummy flash device, so that it can emulate an flash size larger than 16 MBytes. - assigned a feature bits FEATURE_4BA to VARIOUS_SIZE flash config. - added codes handling two commands, JEDEC_READ_4BA and JEDEC_BYTE_PROGRAM_4BA. - changed blockeraser to use Chip-Erase command so that it can be free from flash address byte format.
TEST=ran the command line below: $ flashrom -p dummy:image=${TMP_FILE},size=33554432, \ emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \ emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \ emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f
Signed-off-by: Namyoon Woo namyoon@google.com Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e --- M dummyflasher.c M flashchips.c 2 files changed, 25 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/81/44881/2
Hello build bot (Jenkins), Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/44881
to look at the new patch set (#3).
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
support 4-byte address format for VARIOUS_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIOUS_SIZE dummy flash device, so that it can emulate an flash size larger than 16 MBytes. - assigned a feature bits FEATURE_4BA to VARIOUS_SIZE flash config. - added codes handling two commands, JEDEC_READ_4BA and JEDEC_BYTE_PROGRAM_4BA. - changed blockeraser to use Chip-Erase command so that it can be free from flash address byte format.
TEST=ran the command line below: $ flashrom -p dummy:image=${TMP_FILE},size=33554432, \ emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \ emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \ emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f
Signed-off-by: Namyoon Woo namyoon@google.com Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e --- M dummyflasher.c M flashchips.c 2 files changed, 25 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/81/44881/3
Hello build bot (Jenkins), Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/44881
to look at the new patch set (#4).
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
support 4-byte address format for VARIOUS_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIOUS_SIZE dummy flash device, so that it can emulate an flash size larger than 16 MBytes. - assigned a feature bits FEATURE_4BA to VARIOUS_SIZE flash config. - added codes handling two commands, JEDEC_READ_4BA and JEDEC_BYTE_PROGRAM_4BA. - changed blockeraser to use Chip-Erase command so that it can be free from flash address byte format.
TEST=ran the command line below: $ flashrom -p dummy:image=${TMP_FILE},size=33554432, \ emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \ emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \ emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f
Signed-off-by: Namyoon Woo namyoon@google.com Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e --- M dummyflasher.c M flashchips.c 2 files changed, 27 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/81/44881/4
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/44881 )
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
Patch Set 4: Code-Review+2
Hello build bot (Jenkins), Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/44881
to look at the new patch set (#6).
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
support 4-byte address format for VARIOUS_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIOUS_SIZE dummy flash device, so that it can emulate an flash size larger than 16 MBytes. - assigned a feature bits FEATURE_4BA to VARIOUS_SIZE flash config. - added codes handling two commands, JEDEC_READ_4BA and JEDEC_BYTE_PROGRAM_4BA. - changed blockeraser to use Chip-Erase command so that it can be free from flash address byte format.
TEST=ran the command line below: $ flashrom -p dummy:image=${TMP_FILE},size=33554432, \ emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \ emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \ emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f
Signed-off-by: Namyoon Woo namyoon@google.com Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e --- M dummyflasher.c M flashchips.c 2 files changed, 26 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/81/44881/6
Namyoon Woo has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/44881 )
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
Patch Set 6:
(3 comments)
https://review.coreboot.org/c/flashrom/+/44881/5/dummyflasher.c File dummyflasher.c:
https://review.coreboot.org/c/flashrom/+/44881/5/dummyflasher.c@718 PS5, Line 718: offs = writearr[1] << 24 | writearr[2] << 16 | : writearr[3] << 8 | writearr[4]; For better readability, converting this into one line.
https://review.coreboot.org/c/flashrom/+/44881/5/dummyflasher.c@740 PS5, Line 740: offs = writearr[1] << 24 | writearr[2] << 16 | : writearr[3] << 8 | writearr[4]; For better readability, converting this into one line.
https://review.coreboot.org/c/flashrom/+/44881/6/dummyflasher.c File dummyflasher.c:
https://review.coreboot.org/c/flashrom/+/44881/6/dummyflasher.c@753 PS6, Line 753: emu_modified = 1; Added this line in patch#6 after rebasing this on https://review.coreboot.org/c/flashrom/+/44907.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/44881 )
Change subject: support 4-byte address format for VARIOUS_SIZE dummy flash device ......................................................................
Patch Set 7: Code-Review+2
Hello build bot (Jenkins), Edward O'Callaghan, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/44881
to look at the new patch set (#9).
Change subject: support 4-byte address format for VARIABLE_SIZE dummy flash device ......................................................................
support 4-byte address format for VARIABLE_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIABLE_SIZE dummy flash device, so that it can emulate an flash size larger than 16 MBytes. - assigned a feature bits FEATURE_4BA to VARIABLE_SIZE flash config. - added codes handling two commands, JEDEC_READ_4BA and JEDEC_BYTE_PROGRAM_4BA. - changed blockeraser to use Chip-Erase command so that it can be free from flash address byte format.
TEST=ran the command line below: $ flashrom -p dummy:image=${TMP_FILE},size=33554432, \ emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \ emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \ emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f
Signed-off-by: Namyoon Woo namyoon@google.com Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e --- M dummyflasher.c M flashchips.c 2 files changed, 26 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/81/44881/9
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/44881 )
Change subject: support 4-byte address format for VARIABLE_SIZE dummy flash device ......................................................................
support 4-byte address format for VARIABLE_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIABLE_SIZE dummy flash device, so that it can emulate an flash size larger than 16 MBytes. - assigned a feature bits FEATURE_4BA to VARIABLE_SIZE flash config. - added codes handling two commands, JEDEC_READ_4BA and JEDEC_BYTE_PROGRAM_4BA. - changed blockeraser to use Chip-Erase command so that it can be free from flash address byte format.
TEST=ran the command line below: $ flashrom -p dummy:image=${TMP_FILE},size=33554432, \ emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \ emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \ emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f
Signed-off-by: Namyoon Woo namyoon@google.com Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e Reviewed-on: https://review.coreboot.org/c/flashrom/+/44881 Reviewed-by: Edward O'Callaghan quasisec@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M dummyflasher.c M flashchips.c 2 files changed, 26 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved
diff --git a/dummyflasher.c b/dummyflasher.c index 145fe11..85908af 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -686,6 +686,13 @@ if (readcnt > 0) memcpy(readarr, flashchip_contents + offs, readcnt); break; + case JEDEC_READ_4BA: + offs = writearr[1] << 24 | writearr[2] << 16 | writearr[3] << 8 | writearr[4]; + /* Truncate to emu_chip_size. */ + offs %= emu_chip_size; + if (readcnt > 0) + memcpy(readarr, flashchip_contents + offs, readcnt); + break; case JEDEC_BYTE_PROGRAM: offs = writearr[1] << 16 | writearr[2] << 8 | writearr[3]; /* Truncate to emu_chip_size. */ @@ -701,6 +708,21 @@ memcpy(flashchip_contents + offs, writearr + 4, writecnt - 4); emu_modified = 1; break; + case JEDEC_BYTE_PROGRAM_4BA: + offs = writearr[1] << 24 | writearr[2] << 16 | writearr[3] << 8 | writearr[4]; + /* Truncate to emu_chip_size. */ + offs %= emu_chip_size; + if (writecnt < 6) { + msg_perr("BYTE PROGRAM size too short!\n"); + return 1; + } + if (writecnt - 5 > emu_max_byteprogram_size) { + msg_perr("Max BYTE PROGRAM size exceeded!\n"); + return 1; + } + memcpy(flashchip_contents + offs, writearr + 5, writecnt - 5); + emu_modified = 1; + break; case JEDEC_AAI_WORD_PROGRAM: if (!emu_max_aai_size) break; @@ -949,8 +971,8 @@ if (!eraser->block_erase) break;
- eraser->eraseblocks[0].count = emu_chip_size / - eraser->eraseblocks[0].size; + eraser->eraseblocks[0].count = 1; + eraser->eraseblocks[0].size = emu_chip_size; msg_cdbg("%s: eraser.size=%d, .count=%d\n", __func__, eraser->eraseblocks[0].size, eraser->eraseblocks[0].count); diff --git a/flashchips.c b/flashchips.c index 6fced9e..7d10abf 100644 --- a/flashchips.c +++ b/flashchips.c @@ -18765,13 +18765,14 @@ .model_id = PROGDEV_ID, .total_size = 64, /* This size is set temporarily */ .page_size = 256, + .feature_bits = FEATURE_4BA, .tested = TEST_OK_PREW, .probe = probe_variable_size, .block_erasers = { { .eraseblocks = { {64 * 1024, 1} }, - .block_erase = spi_block_erase_d8, + .block_erase = spi_block_erase_c7, } }, .write = spi_chip_write_256,