build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23261 )
Change subject: [v4,4/6] ENE EDI - print debug info like others while probing for ENE chips
......................................................................
Patch Set 1: Verified+1
Build Successful
https://qa.coreboot.org/job/flashrom_gerrit/878/ : SUCCESS
https://qa.coreboot.org/job/flashrom-customrules/1029/ : SUCCESS
--
To view, visit https://review.coreboot.org/23261
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: Id8e62bc9f6785b4bf0be0aaf0f74c8120d77c0d4
Gerrit-Change-Number: 23261
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 22:14:15 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23260 )
Change subject: [v4,3/6] ENE EDI - add dummy read to ensure proper detection of ENE chips
......................................................................
Patch Set 1: Verified+1
Build Successful
https://qa.coreboot.org/job/flashrom_gerrit/877/ : SUCCESS
https://qa.coreboot.org/job/flashrom-customrules/1028/ : SUCCESS
--
To view, visit https://review.coreboot.org/23260
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: I69ee71674649cd8ba4fc635f889cb39a1cd204b9
Gerrit-Change-Number: 23260
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 22:14:15 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23263 )
Change subject: [v4,6/6] Add support for reading the current flash contents from a file
......................................................................
Patch Set 1: Verified+1
Build Successful
https://qa.coreboot.org/job/flashrom_gerrit/879/ : SUCCESS
https://qa.coreboot.org/job/flashrom-customrules/1030/ : SUCCESS
--
To view, visit https://review.coreboot.org/23263
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: Idf153b6955f37779ae9bfb228a434ed10c304947
Gerrit-Change-Number: 23263
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 22:14:13 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23258 )
Change subject: [v4,1/6] Add support for selecting the erased bit value with a flag
......................................................................
Patch Set 1: Verified+1
Build Successful
https://qa.coreboot.org/job/flashrom_gerrit/876/ : SUCCESS
https://qa.coreboot.org/job/flashrom-customrules/1027/ : SUCCESS
--
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: comment
Gerrit-Change-Id: Ia7b0de8568e31f9bf263ba0ad6b051e837477b6b
Gerrit-Change-Number: 23258
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 22:14:03 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23259 )
Change subject: [v4,2/6] ENE Embedded Debug Interface EDI and ENE KB9012 EC flashing support
......................................................................
Patch Set 1: Verified+1
Build Successful
https://qa.coreboot.org/job/flashrom_gerrit/875/ : SUCCESS
https://qa.coreboot.org/job/flashrom-customrules/1026/ : SUCCESS
--
To view, visit https://review.coreboot.org/23259
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: Ib8b2eb2feeef5c337d725d15ebf994a299897854
Gerrit-Change-Number: 23259
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 22:13:58 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
Mike Banon has uploaded this change for review. ( https://review.coreboot.org/23263
Change subject: [v4,6/6] Add support for reading the current flash contents from a file
......................................................................
[v4,6/6] Add support for reading the current flash contents from a file
When developing software that has to be flashed to a flash chip to be
executed, it often takes a long time to read the current flash contents
(for flashrom to know what pages to erase and reprogram) each time
when writing the new image. However, when the flash was just reprogrammed,
its current state is known to be the previous image that was flashed
(assuming it was verified).
Thus, it makes sense to provide that image as a file for the flash contents
instead of wasting valuable time read the whole flash each time.
Original patch has been created by Paul Kocialkowski, the previous version:
http://patchwork.coreboot.org/patch/4414/
Now it has been ported to the latest source code of flashrom master branch
Change-Id: Idf153b6955f37779ae9bfb228a434ed10c304947
Signed-off-by: Mike Banon <mikebdp2(a)gmail.com>
---
M cli_classic.c
M flash.h
M flashrom.c
M libflashrom.h
4 files changed, 82 insertions(+), 50 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/63/23263/1
diff --git a/cli_classic.c b/cli_classic.c
index 441fc91..c210e03 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -45,26 +45,27 @@
"[-E|(-r|-w|-v) <file>] [(-l <layoutfile>|--ifd) [-i <imagename>]...] [-n] [-N] [-f]]\n"
"[-V[V[V]]] [-o <logfile>]\n\n", name);
- printf(" -h | --help print this help text\n"
- " -R | --version print version (release)\n"
- " -r | --read <file> read flash and save to <file>\n"
- " -w | --write <file> write <file> to flash\n"
- " -v | --verify <file> verify flash against <file>\n"
- " -E | --erase erase flash memory\n"
- " -V | --verbose more verbose output\n"
- " -c | --chip <chipname> probe only for specified flash chip\n"
- " -f | --force force specific operations (see man page)\n"
- " -n | --noverify don't auto-verify\n"
- " -N | --noverify-all verify included regions only (cf. -i)\n"
- " -l | --layout <layoutfile> read ROM layout from <layoutfile>\n"
- " --ifd read layout from an Intel Firmware Descriptor\n"
- " -i | --image <name> only flash image <name> from flash layout\n"
- " -o | --output <logfile> log output to <logfile>\n"
- " -L | --list-supported print supported devices\n"
+ printf(" -h | --help print this help text\n"
+ " -R | --version print version (release)\n"
+ " -r | --read <file> read flash and save to <file>\n"
+ " -w | --write <file> write <file> to flash\n"
+ " -v | --verify <file> verify flash against <file>\n"
+ " -E | --erase erase flash memory\n"
+ " -V | --verbose more verbose output\n"
+ " -c | --chip <chipname> probe only for specified flash chip\n"
+ " -f | --force force specific operations (see man page)\n"
+ " -n | --noverify don't auto-verify\n"
+ " -N | --noverify-all verify included regions only (cf. -i)\n"
+ " -l | --layout <layoutfile> read ROM layout from <layoutfile>\n"
+ " --ifd read layout from an Intel Firmware Descriptor\n"
+ " -i | --image <name> only flash image <name> from flash layout\n"
+ " -o | --output <logfile> log output to <logfile>\n"
+ " -C | --flash-contents <contentsfile> assume flash contents to be <contentsfile>\n"
+ " -L | --list-supported print supported devices\n"
#if CONFIG_PRINT_WIKI == 1
- " -z | --list-supported-wiki print supported devices in wiki syntax\n"
+ " -z | --list-supported-wiki print supported devices in wiki syntax\n"
#endif
- " -p | --programmer <name>[:<param>] specify the programmer device. One of\n");
+ " -p | --programmer <name>[:<param>] specify the programmer device. One of\n");
list_programmers_linebreak(4, 80, 0);
printf(".\n\nYou can specify one of -h, -R, -L, "
#if CONFIG_PRINT_WIKI == 1
@@ -110,7 +111,7 @@
enum programmer prog = PROGRAMMER_INVALID;
int ret = 0;
- static const char optstring[] = "r:Rw:v:nNVEfc:l:i:p:Lzho:";
+ static const char optstring[] = "r:Rw:v:nNVEfc:l:i:C:p:Lzho:";
static const struct option long_options[] = {
{"read", 1, NULL, 'r'},
{"write", 1, NULL, 'w'},
@@ -124,6 +125,7 @@
{"layout", 1, NULL, 'l'},
{"ifd", 0, NULL, 0x0100},
{"image", 1, NULL, 'i'},
+ {"flash-contents", 1, NULL, 'C'},
{"list-supported", 0, NULL, 'L'},
{"list-supported-wiki", 0, NULL, 'z'},
{"programmer", 1, NULL, 'p'},
@@ -134,6 +136,7 @@
};
char *filename = NULL;
+ char *contentsfile = NULL;
char *layoutfile = NULL;
#ifndef STANDALONE
char *logfile = NULL;
@@ -243,6 +246,9 @@
cli_classic_abort_usage();
}
break;
+ case 'C':
+ contentsfile = strdup(optarg);
+ break;
case 'L':
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
@@ -354,6 +360,9 @@
if (layoutfile && check_filename(layoutfile, "layout")) {
cli_classic_abort_usage();
}
+ if (contentsfile && check_filename(contentsfile, "contents")) {
+ cli_classic_abort_usage();
+ }
#ifndef STANDALONE
if (logfile && check_filename(logfile, "log"))
@@ -569,7 +578,7 @@
else if (erase_it)
ret = do_erase(fill_flash);
else if (write_it)
- ret = do_write(fill_flash, filename);
+ ret = do_write(fill_flash, filename, contentsfile);
else if (verify_it)
ret = do_verify(fill_flash, filename);
@@ -583,6 +592,7 @@
layout_cleanup();
free(filename);
+ free(contentsfile);
free(layoutfile);
free(pparam);
/* clean up global variables */
diff --git a/flash.h b/flash.h
index 1c4a38c..c1c827e 100644
--- a/flash.h
+++ b/flash.h
@@ -325,7 +325,7 @@
void finalize_flash_access(struct flashctx *);
int do_read(struct flashctx *, const char *filename);
int do_erase(struct flashctx *);
-int do_write(struct flashctx *, const char *const filename);
+int do_write(struct flashctx *, const char *const filename, const char *const contentsfile);
int do_verify(struct flashctx *, const char *const filename);
/* Something happened that shouldn't happen, but we can go on. */
diff --git a/flashrom.c b/flashrom.c
index f699798..1190fda 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -2352,7 +2352,7 @@
* 2 if write failed and flash contents changed,
* or 1 on any other failure.
*/
-int flashrom_image_write(struct flashctx *const flashctx, void *const buffer, const size_t buffer_len)
+int flashrom_image_write(struct flashctx *const flashctx, void *const buffer, const size_t buffer_len, const char *contentsfile)
{
const size_t flash_size = flashctx->chip->total_size * 1024;
const bool verify_all = flashctx->flags.verify_whole_chip;
@@ -2389,42 +2389,64 @@
goto _free_ret;
/*
- * Read the whole chip to be able to check whether regions need to be
- * erased and to give better diagnostics in case write fails.
- * The alternative is to read only the regions which are to be
- * preserved, but in that case we might perform unneeded erase which
- * takes time as well.
+ * When developing software that has to be flashed to a flash chip to be executed,
+ * it often takes a long time to read the current flash contents (for flashrom to
+ * know what pages to erase and reprogram) each time, when writing the new image.
+ * However, when the flash was just reprogrammed, its current state is known to be
+ * the previous image that was flashed (assuming it was verified).
+ *
+ * Thus, it makes sense to provide that image as a file for the flash contents
+ * instead of wasting valuable time read the whole flash each time.
*/
- msg_cinfo("Reading old flash chip contents... ");
- if (verify_all) {
- if (flashctx->chip->read(flashctx, oldcontents, 0, flash_size)) {
+
+ if (contentsfile) {
+ msg_cinfo("Reading old flash chip contents from file... ");
+ if (read_buf_from_file(oldcontents, flash_size, contentsfile)) {
+ ret = 1;
msg_cinfo("FAILED.\n");
goto _finalize_ret;
}
- memcpy(curcontents, oldcontents, flash_size);
} else {
- if (read_by_layout(flashctx, curcontents)) {
- msg_cinfo("FAILED.\n");
- goto _finalize_ret;
+
+ /*
+ * Read the whole chip to be able to check whether regions need to be
+ * erased and to give better diagnostics in case write fails.
+ * The alternative is to read only the regions which are to be
+ * preserved, but in that case we might perform unneeded erase which
+ * takes time as well.
+ */
+
+ msg_cinfo("Reading old flash chip contents... ");
+ if (verify_all) {
+ if (flashctx->chip->read(flashctx, oldcontents, 0, flash_size)) {
+ msg_cinfo("FAILED.\n");
+ goto _finalize_ret;
+ }
+ memcpy(curcontents, oldcontents, flash_size);
+ } else {
+ if (read_by_layout(flashctx, curcontents)) {
+ msg_cinfo("FAILED.\n");
+ goto _finalize_ret;
+ }
}
+ msg_cinfo("done.\n");
}
- msg_cinfo("done.\n");
if (write_by_layout(flashctx, curcontents, newcontents)) {
msg_cerr("Uh oh. Erase/write failed. ");
ret = 2;
- if (verify_all) {
- msg_cerr("Checking if anything has changed.\n");
- msg_cinfo("Reading current flash chip contents... ");
- if (!flashctx->chip->read(flashctx, curcontents, 0, flash_size)) {
- msg_cinfo("done.\n");
- if (!memcmp(oldcontents, curcontents, flash_size)) {
- nonfatal_help_message();
- goto _finalize_ret;
- }
- msg_cerr("Apparently at least some data has changed.\n");
- } else
- msg_cerr("Can't even read anymore!\n");
+ if (verify_all) {
+ msg_cerr("Checking if anything has changed.\n");
+ msg_cinfo("Reading current flash chip contents... ");
+ if (!flashctx->chip->read(flashctx, curcontents, 0, flash_size)) {
+ msg_cinfo("done.\n");
+ if (!memcmp(oldcontents, curcontents, flash_size)) {
+ nonfatal_help_message();
+ goto _finalize_ret;
+ }
+ msg_cerr("Apparently at least some data has changed.\n");
+ } else
+ msg_cerr("Can't even read anymore!\n");
emergency_help_message();
goto _finalize_ret;
} else {
@@ -2543,7 +2565,7 @@
return ret;
}
-int do_write(struct flashctx *const flash, const char *const filename)
+int do_write(struct flashctx *const flash, const char *const filename, const char *contentsfile)
{
const size_t flash_size = flash->chip->total_size * 1024;
int ret = 1;
@@ -2557,7 +2579,7 @@
if (read_buf_from_file(newcontents, flash_size, filename))
goto _free_ret;
- ret = flashrom_image_write(flash, newcontents, flash_size);
+ ret = flashrom_image_write(flash, newcontents, flash_size, contentsfile);
_free_ret:
free(newcontents);
diff --git a/libflashrom.h b/libflashrom.h
index d3f3ded..7ebac8d 100644
--- a/libflashrom.h
+++ b/libflashrom.h
@@ -60,7 +60,7 @@
bool flashrom_flag_get(const struct flashrom_flashctx *, enum flashrom_flag);
int flashrom_image_read(struct flashrom_flashctx *, void *buffer, size_t buffer_len);
-int flashrom_image_write(struct flashrom_flashctx *, void *buffer, size_t buffer_len);
+int flashrom_image_write(struct flashrom_flashctx *, void *buffer, size_t buffer_len, const char *contentsfile);
int flashrom_image_verify(struct flashrom_flashctx *, const void *buffer, size_t buffer_len);
struct flashrom_layout;
--
To view, visit https://review.coreboot.org/23263
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: Idf153b6955f37779ae9bfb228a434ed10c304947
Gerrit-Change-Number: 23263
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Mike Banon has uploaded this change for review. ( https://review.coreboot.org/23262
Change subject: [v4,5/6] Add the hidden-from-probing chips category and make KB9012 hidden
......................................................................
[v4,5/6] Add the hidden-from-probing chips category and make KB9012 hidden
There are some chips like ENE KB9012, probing for which
could cause the other chips to misbehave. Therefore, such chips
should be "hidden" - not probed for unless the user wants
This commit introduces a new field to the "flashchip" structure:
int hidden;
Now it is possible to "hide" any chip by adding this line
.hidden = 1,
to the "struct flashchip flashchips[]" structure of a chip, like
.write = edi_chip_write,
.read = edi_chip_read,
.voltage = {2700, 3600},
.hidden = 1,
},
^^^ KB9012 has been "hidden" this way, and it will never be probed for
unless explicitly specified by its' chip name: --chip "KB9012 (EDI)"
Now, flashrom will probe for a chip only if one of these conditions is true:
1) no chip has been specified AND this chip is not "hidden"
2) this chip has been specified by -c | --chip <chipname>
Change-Id: I89a53ccaef2791a2ac32904d7ab813da7478a6f0
Signed-off-by: Mike Banon <mikebdp2(a)gmail.com>
---
M flash.h
M flashchips.c
M flashrom.c
3 files changed, 17 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/62/23262/1
diff --git a/flash.h b/flash.h
index a3aebc5..1c4a38c 100644
--- a/flash.h
+++ b/flash.h
@@ -190,6 +190,14 @@
enum test_state write;
} tested;
+ /*
+ * There are some chips, probing for which could cause the other chips to misbehave.
+ * Therefore, such chips should be "hidden" - not probed for unless the user wants
+ *
+ * If set to 1, do not probe for this chip unless specified by -c | --chip <chipname>
+ */
+ int hidden;
+
int (*probe) (struct flashctx *flash);
/* Delay after "enter/exit ID mode" commands in microseconds.
diff --git a/flashchips.c b/flashchips.c
index 866d8e1..7b82602 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -43,6 +43,7 @@
* .total_size = Total size in (binary) kbytes
* .page_size = Page or eraseblock(?) size in bytes
* .tested = Test status
+ * .hidden = If set to 1, do not probe unless specified
* .probe = Probe function
* .probe_timing = Probe function delay
* .block_erasers[] = Array of erase layouts and erase functions
@@ -3302,6 +3303,7 @@
.write = edi_chip_write,
.read = edi_chip_read,
.voltage = {2700, 3600},
+ .hidden = 1,
},
{
diff --git a/flashrom.c b/flashrom.c
index 361a44f..f699798 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1205,7 +1205,13 @@
char *tmp;
for (chip = flashchips + startchip; chip && chip->name; chip++) {
- if (chip_to_probe && strcmp(chip->name, chip_to_probe) != 0)
+ /*
+ * Probe for a chip only if one of these conditions is true:
+ * 1) no chip has been specified AND this chip is not "hidden"
+ * 2) this chip has been specified by -c | --chip <chipname>
+ */
+ if (!((!chip_to_probe && !chip->hidden) ||
+ (chip_to_probe && strcmp(chip->name, chip_to_probe) == 0)))
continue;
buses_common = mst->buses_supported & chip->bustype;
if (!buses_common)
--
To view, visit https://review.coreboot.org/23262
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: I89a53ccaef2791a2ac32904d7ab813da7478a6f0
Gerrit-Change-Number: 23262
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>
Mike Banon has uploaded this change for review. ( https://review.coreboot.org/23260
Change subject: [v4,3/6] ENE EDI - add dummy read to ensure proper detection of ENE chips
......................................................................
[v4,3/6] ENE EDI - add dummy read to ensure proper detection of ENE chips
ENE chips enable EDI by detecting a clock frequency between 1 MHz and 8 MHz.
In many cases, the chip won't be able to both detect the clock signal and
serve the associated request at the same time.
Thus, a dummy read has to be added to ensure that EDI is enabled and
operational starting from the next request.
Original patch has been created by Paul Kocialkowski, the previous version:
http://git.code.paulk.fr/gitweb/?p=flashrom.git;a=shortlog;h=refs/heads/next
Now it has been ported to the latest source code of flashrom master branch
Change-Id: I69ee71674649cd8ba4fc635f889cb39a1cd204b9
Signed-off-by: Mike Banon <mikebdp2(a)gmail.com>
---
M edi.c
1 file changed, 18 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/60/23260/1
diff --git a/edi.c b/edi.c
index 0ca1704..fde5ff1 100644
--- a/edi.c
+++ b/edi.c
@@ -163,6 +163,14 @@
return 0;
}
+static void edi_detect(struct flashctx *flash)
+{
+ unsigned char hwversion;
+
+ /* This dummy read ensures proper detection of EDI. */
+ edi_read(flash, ENE_EC_HWVERSION, &hwversion);
+}
+
static int edi_spi_enable(struct flashctx *flash)
{
unsigned char buffer;
@@ -481,6 +489,16 @@
int probe;
int rc;
+ /*
+ * ENE chips enable EDI by detecting a clock frequency between 1 MHz and
+ * 8 MHz. In many cases, the chip won't be able to both detect the clock
+ * signal and serve the associated request at the same time.
+ *
+ * Thus, a dummy read has to be added to ensure that EDI is enabled and
+ * operational starting from the next request.
+ */
+ edi_detect(flash);
+
probe = edi_chip_probe(flash, &ene_kb9012);
if (!probe)
return 0;
--
To view, visit https://review.coreboot.org/23260
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: I69ee71674649cd8ba4fc635f889cb39a1cd204b9
Gerrit-Change-Number: 23260
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2(a)gmail.com>