Mike Banon has uploaded this change for review. ( https://review.coreboot.org/23258
Change subject: [v4,1/6] Add support for selecting the erased bit value with a flag
......................................................................
[v4,1/6] Add support for selecting the erased bit value with a flag
Most flash chips are erased to ones and programmed to zeros. However, some
other chips, such as the ENE KB9012 internal flash, work the opposite way.
Original patch has been created by Paul Kocialkowski, the previous version:
http://patchwork.coreboot.org/patch/4412/
Now it has been ported to the latest source code of flashrom master branch
Change-Id: Ia7b0de8568e31f9bf263ba0ad6b051e837477b6b
Signed-off-by: Mike Banon <mikebdp2(a)gmail.com>
---
M flash.h
M flashrom.c
2 files changed, 24 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/58/23258/1
diff --git a/flash.h b/flash.h
index d31b256..a3aebc5 100644
--- a/flash.h
+++ b/flash.h
@@ -130,6 +130,13 @@
#define FEATURE_4BA_NATIVE (FEATURE_4BA_READ | FEATURE_4BA_FAST_READ | FEATURE_4BA_WRITE)
#define FEATURE_4BA (FEATURE_4BA_ENTER | FEATURE_4BA_EXT_ADDR | FEATURE_4BA_NATIVE)
#define FEATURE_4BA_WREN (FEATURE_4BA_ENTER_WREN | FEATURE_4BA_EXT_ADDR | FEATURE_4BA_NATIVE)
+/*
+ * Most flash chips are erased to ones and programmed to zeros. However, some
+ * other flash chips, such as the ENE KB9012 internal flash, work the opposite way.
+ */
+#define FEATURE_ERASED_ZERO (1 << 16)
+
+#define ERASED_VALUE(flash) (((flash)->chip->feature_bits & FEATURE_ERASED_ZERO) ? 0x00 : 0xff)
enum test_state {
OK = 0,
@@ -298,7 +305,7 @@
int read_flash_to_file(struct flashctx *flash, const char *filename);
char *extract_param(const char *const *haystack, const char *needle, const char *delim);
int verify_range(struct flashctx *flash, const uint8_t *cmpbuf, unsigned int start, unsigned int len);
-int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len, enum write_granularity gran);
+int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len, enum write_granularity gran, const uint8_t erased_value);
void print_version(void);
void print_buildinfo(void);
void print_banner(void);
diff --git a/flashrom.c b/flashrom.c
index ac987fd..361a44f 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -700,12 +700,13 @@
{
int ret;
uint8_t *cmpbuf = malloc(len);
+ const uint8_t erased_value = ERASED_VALUE(flash);
if (!cmpbuf) {
msg_gerr("Could not allocate memory!\n");
exit(1);
}
- memset(cmpbuf, 0xff, len);
+ memset(cmpbuf, erased_value, len);
ret = verify_range(flash, cmpbuf, start, len);
free(cmpbuf);
return ret;
@@ -758,7 +759,7 @@
}
/* Helper function for need_erase() that focuses on granularities of gran bytes. */
-static int need_erase_gran_bytes(const uint8_t *have, const uint8_t *want, unsigned int len, unsigned int gran)
+static int need_erase_gran_bytes(const uint8_t *have, const uint8_t *want, unsigned int len, unsigned int gran, const uint8_t erased_value)
{
unsigned int i, j, limit;
for (j = 0; j < len / gran; j++) {
@@ -768,7 +769,7 @@
continue;
/* have needs to be in erased state. */
for (i = 0; i < limit; i++)
- if (have[j * gran + i] != 0xff)
+ if (have[j * gran + i] != erased_value)
return 1;
}
return 0;
@@ -788,7 +789,7 @@
* @gran write granularity (enum, not count)
* @return 0 if no erase is needed, 1 otherwise
*/
-int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len, enum write_granularity gran)
+int need_erase(const uint8_t *have, const uint8_t *want, unsigned int len, enum write_granularity gran, const uint8_t erased_value)
{
int result = 0;
unsigned int i;
@@ -803,31 +804,31 @@
break;
case write_gran_1byte:
for (i = 0; i < len; i++)
- if ((have[i] != want[i]) && (have[i] != 0xff)) {
+ if ((have[i] != want[i]) && (have[i] != erased_value)) {
result = 1;
break;
}
break;
case write_gran_128bytes:
- result = need_erase_gran_bytes(have, want, len, 128);
+ result = need_erase_gran_bytes(have, want, len, 128, erased_value);
break;
case write_gran_256bytes:
- result = need_erase_gran_bytes(have, want, len, 256);
+ result = need_erase_gran_bytes(have, want, len, 256, erased_value);
break;
case write_gran_264bytes:
- result = need_erase_gran_bytes(have, want, len, 264);
+ result = need_erase_gran_bytes(have, want, len, 264, erased_value);
break;
case write_gran_512bytes:
- result = need_erase_gran_bytes(have, want, len, 512);
+ result = need_erase_gran_bytes(have, want, len, 512, erased_value);
break;
case write_gran_528bytes:
- result = need_erase_gran_bytes(have, want, len, 528);
+ result = need_erase_gran_bytes(have, want, len, 528, erased_value);
break;
case write_gran_1024bytes:
- result = need_erase_gran_bytes(have, want, len, 1024);
+ result = need_erase_gran_bytes(have, want, len, 1024, erased_value);
break;
case write_gran_1056bytes:
- result = need_erase_gran_bytes(have, want, len, 1056);
+ result = need_erase_gran_bytes(have, want, len, 1056, erased_value);
break;
case write_gran_1byte_implicit_erase:
/* Do not erase, handle content changes from anything->0xff by writing 0xff. */
@@ -1769,11 +1770,12 @@
ret = 1;
bool skipped = true;
uint8_t *const curcontents = info->curcontents + info->erase_start;
- if (need_erase(curcontents, newcontents, erase_len, flashctx->chip->gran)) {
+ const uint8_t erased_value = ERASED_VALUE(flashctx);
+ if (need_erase(curcontents, newcontents, erase_len, flashctx->chip->gran, erased_value)) {
if (erase_block(flashctx, info, erasefn))
goto _free_ret;
/* Erase was successful. Adjust curcontents. */
- memset(curcontents, 0xff, erase_len);
+ memset(curcontents, erased_value, erase_len);
skipped = false;
}
--
To view, visit https://review.coreboot.org/23258
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7b0de8568e31f9bf263ba0ad6b051e837477b6b
Gerrit-Change-Number: 23258
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Mike Banon has abandoned this change. ( https://review.coreboot.org/23257 )
Change subject: Insert the description of the change.
......................................................................
Abandoned
--
To view, visit https://review.coreboot.org/23257
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: Ieef213d92847d7452200cab929d49e16cb262c39
Gerrit-Change-Number: 23257
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Mike Banon has restored this change. ( https://review.coreboot.org/23257 )
Change subject: Insert the description of the change.
......................................................................
Restored
--
To view, visit https://review.coreboot.org/23257
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: restore
Gerrit-Change-Id: Ieef213d92847d7452200cab929d49e16cb262c39
Gerrit-Change-Number: 23257
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Mike Banon has abandoned this change. ( https://review.coreboot.org/23257 )
Change subject: Insert the description of the change.
......................................................................
Abandoned
--
To view, visit https://review.coreboot.org/23257
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: Ieef213d92847d7452200cab929d49e16cb262c39
Gerrit-Change-Number: 23257
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Mike Banon has posted comments on this change. ( https://review.coreboot.org/23257 )
Change subject: Insert the description of the change.
......................................................................
Set Ready For Review
--
To view, visit https://review.coreboot.org/23257
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ieef213d92847d7452200cab929d49e16cb262c39
Gerrit-Change-Number: 23257
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sun, 14 Jan 2018 19:53:12 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No
Hello Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/23225
to look at the new patch set (#2).
Change subject: Whitelist Lenovo Thinkpad X220
......................................................................
Whitelist Lenovo Thinkpad X220
Change-Id: Idd667da8209a664469c1a909a549d2b625714a78
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M board_enable.c
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/25/23225/2
--
To view, visit https://review.coreboot.org/23225
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Idd667da8209a664469c1a909a549d2b625714a78
Gerrit-Change-Number: 23225
Gerrit-PatchSet: 2
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Hello David Hendricks, Paul Menzel, build bot (Jenkins), Nico Huber,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/23057
to look at the new patch set (#4).
Change subject: buspirate_spi: Add support for variable serial speeds
......................................................................
buspirate_spi: Add support for variable serial speeds
This patch sets the default baud rate for communication between
the host device and the Bus Pirate for hardware versions 3.0
and greater to 2M baud.
It also introduces the ability to manually set the baud rate via
the added 'serialspeed' programmer parameter.
This is done in two parts. Firstly, the requested serial speed is looked up
in a table to determine the appropriate clock divisor and the divisor is sent
to the bus pirate. Then, the system's baud rate for the selected serial port
is set using serial.c's 'serialport_config'. This function's prototype had to
be added to programmer.h.
In testing, using the 2M baud rate was able to significantly decrease
flash times (down from 20+ minutes to less than 2 minutes for an 8MB flash).
Change-Id: I3706f17a94fdf056063f2ad4a5f0a219665cdcbf
Signed-off-by: Shawn Anastasio <shawnanastasio(a)yahoo.com>
---
M buspirate_spi.c
M flashrom.8.tmpl
M programmer.h
3 files changed, 136 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/57/23057/4
--
To view, visit https://review.coreboot.org/23057
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3706f17a94fdf056063f2ad4a5f0a219665cdcbf
Gerrit-Change-Number: 23057
Gerrit-PatchSet: 4
Gerrit-Owner: Shawn Anastasio <shawnanastasio(a)yahoo.com>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Shawn Anastasio <shawnanastasio(a)yahoo.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Shawn Anastasio has posted comments on this change. ( https://review.coreboot.org/23057 )
Change subject: buspirate_spi: Add support for variable serial speeds
......................................................................
Patch Set 3:
Fair enough. I think a good compromise is to remove all speeds < 115200 and keep spispeed so that users can specify an intermediate value. I'll also change the check to allow BP < v3.0 owners manually set the speed (and display a warning).
--
To view, visit https://review.coreboot.org/23057
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3706f17a94fdf056063f2ad4a5f0a219665cdcbf
Gerrit-Change-Number: 23057
Gerrit-PatchSet: 3
Gerrit-Owner: Shawn Anastasio <shawnanastasio(a)yahoo.com>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Shawn Anastasio <shawnanastasio(a)yahoo.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Fri, 12 Jan 2018 23:21:00 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No