On Thu, Jul 21, 2011 at 05:54:46PM +0200, Stefan Tauner wrote:
> previously the dummies were initialized to be empty (all ones), which makes writes skip
> erasing altogether. with this patch the default is to fill it with random bytes instead and the
> old behavior can be enforced with stating "empty=yes" on the command line.
>
> Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
I'd make the programmer options a bit more generic to allow for other
content easily and consistently:
-p dummy:content=ff
-p dummy:content=00
-p dummy:content=random
-p dummy:content=incrementing
etc.
The default should be documented in the manpage.
> + empty = extract_programmer_param("empty");
> + if (empty != NULL) {
> + if (strstr(empty, "yes"))
Why not strcasecmp() here?
Uwe.
--
http://hermann-uwe.de | http://sigrok.orghttp://randomprojects.org | http://unmaintained-free-software.org
Author: hailfinger
Date: Thu Jul 21 23:21:04 2011
New Revision: 1380
URL: http://flashrom.org/trac/flashrom/changeset/1380
Log:
Fix out-of-bounds access if all erase functions fail.
Fix detection of unchanged chip contents on erase failure.
Return error if no usable erase functions exist.
Thanks to Stefan Tauner for spotting the last problem.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Acked-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
Modified:
trunk/flashrom.c
Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c Thu Jul 21 21:59:34 2011 (r1379)
+++ trunk/flashrom.c Thu Jul 21 23:21:04 2011 (r1380)
@@ -1507,7 +1507,7 @@
int erase_and_write_flash(struct flashchip *flash, uint8_t *oldcontents, uint8_t *newcontents)
{
- int k, ret = 0;
+ int k, ret = 1;
uint8_t *curcontents;
unsigned long size = flash->total_size * 1024;
unsigned int usable_erasefunctions = count_usable_erasers(flash);
@@ -1522,8 +1522,12 @@
memcpy(curcontents, oldcontents, size);
for (k = 0; k < NUM_ERASEFUNCTIONS; k++) {
+ if (!usable_erasefunctions) {
+ msg_cdbg("No usable erase functions left.\n");
+ break;
+ }
msg_cdbg("Looking at blockwise erase function %i... ", k);
- if (check_block_eraser(flash, k, 1) && usable_erasefunctions) {
+ if (check_block_eraser(flash, k, 1)) {
msg_cdbg("Looking for another erase function.\n");
continue;
}
@@ -1535,10 +1539,8 @@
if (!ret)
break;
/* Write/erase failed, so try to find out what the current chip
- * contents are. If no usable erase functions remain, we could
- * abort the loop instead of continuing, the effect is the same.
- * The only difference is whether the reason for other unusable
- * functions is printed or not. If in doubt, verbosity wins.
+ * contents are. If no usable erase functions remain, we can
+ * skip this: the next iteration will break immediately anyway.
*/
if (!usable_erasefunctions)
continue;
Am Donnerstag, den 21.07.2011, 14:23 +0200 schrieb Stefan Tauner:
> old output:
> Calibrating delay loop... OK.
> Found chipset "Intel QS57", enabling flash write... OK.
> This chipset supports the following protocols: FWH, SPI.
>
> new non-verbose output for tested chipsets:
> Calibrating delay loop... OK.
> Found chipset "Intel QS57". Enabling flash write... OK.
> This chipset supports the following protocols: FWH, SPI.
>
> new non-verbose output for untested chipsets:
> Found chipset "Intel QS57".
> This chipset is marked as untested. If you are using an up-to-date version
> of flashrom please email a report to flashrom(a)flashrom.org including a
> verbose (-V) log. Thank you!
A similar message should be shown somewhere else. I would put more
information in it.
This chipset is marked as untested. If you are using an up-to-date
version of flashrom <http://flashrom.org/Downloads> please email a
report to flashrom(a)flashrom.org with the subject (variable with the name
(here Intel QS57) including a verbose (-V) log. Thank you!
Do we have preferences if the log should be pasted or attached?
> Enabling flash write... OK.
> This chipset supports the following protocols: FWH, SPI.
>
> Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
> ---
> chipset_enable.c | 19 ++++++++++++++-----
> 1 files changed, 14 insertions(+), 5 deletions(-)
[…]
Thanks,
Paul
On Thu, Jul 21, 2011 at 02:23:05PM +0200, Stefan Tauner wrote:
> Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
> + msg_pinfo("Found chipset \"%s %s\"",
> + chipset_enables[i].vendor_name,
> + chipset_enables[i].device_name);
> + msg_pdbg("with PCI ID %04x:%04x",
> chipset_enables[i].vendor_id,
> chipset_enables[i].device_id);
I'd print the IDs unconditionally, not only with -V, but that's for
another patch.
Uwe.
--
http://hermann-uwe.de | http://sigrok.orghttp://randomprojects.org | http://unmaintained-free-software.org
Author: stefanct
Date: Thu Jul 21 21:59:34 2011
New Revision: 1379
URL: http://flashrom.org/trac/flashrom/changeset/1379
Log:
chipset_enable.c: add a message for untested chipset enables
old output:
Calibrating delay loop... OK.
Found chipset "Intel QS57", enabling flash write... OK.
This chipset supports the following protocols: FWH, SPI.
new non-verbose output for tested chipsets:
Calibrating delay loop... OK.
Found chipset "Intel QS57". Enabling flash write... OK.
This chipset supports the following protocols: FWH, SPI.
new non-verbose output for untested chipsets:
Found chipset "Intel QS57".
This chipset is marked as untested. If you are using an up-to-date version
of flashrom please email a report to flashrom(a)flashrom.org including a
verbose (-V) log. Thank you!
Enabling flash write... OK.
This chipset supports the following protocols: FWH, SPI.
Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified:
trunk/chipset_enable.c
Modified: trunk/chipset_enable.c
==============================================================================
--- trunk/chipset_enable.c Thu Jul 21 21:52:00 2011 (r1378)
+++ trunk/chipset_enable.c Thu Jul 21 21:59:34 2011 (r1379)
@@ -1226,13 +1226,22 @@
chipset_enables[i].device_name);
continue;
}
- msg_pinfo("Found chipset \"%s %s\", enabling flash write... ",
- chipset_enables[i].vendor_name,
- chipset_enables[i].device_name);
- msg_pdbg("chipset PCI ID is %04x:%04x, ",
+ msg_pinfo("Found chipset \"%s %s\"",
+ chipset_enables[i].vendor_name,
+ chipset_enables[i].device_name);
+ msg_pdbg("with PCI ID %04x:%04x",
chipset_enables[i].vendor_id,
chipset_enables[i].device_id);
+ msg_pinfo(". ");
+ if (chipset_enables[i].status == NT) {
+ msg_pinfo("\nThis chipset is marked as untested. If "
+ "you are using an up-to-date version\nof "
+ "flashrom please email a report to "
+ "flashrom(a)flashrom.org including a\nverbose "
+ "(-V) log. Thank you!\n");
+ }
+ msg_pinfo("Enabling flash write... ");
ret = chipset_enables[i].doit(dev,
chipset_enables[i].device_name);
if (ret == NOT_DONE_YET) {
Author: stefanct
Date: Thu Jul 21 21:52:00 2011
New Revision: 1378
URL: http://flashrom.org/trac/flashrom/changeset/1378
Log:
flashrom.8: explain read accesses as part of the write operation
Signed-off-by: Stefan Tauner <stefan.tauner(a)student.tuwien.ac.at>
Acked-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified:
trunk/flashrom.8
Modified: trunk/flashrom.8
==============================================================================
--- trunk/flashrom.8 Thu Jul 21 11:18:18 2011 (r1377)
+++ trunk/flashrom.8 Thu Jul 21 21:52:00 2011 (r1378)
@@ -45,6 +45,13 @@
into flash ROM. This will first automatically
.B erase
the chip, then write to it.
+.sp
+In the process the chip is also read several times. First an in-memory backup
+is made for disaster recovery and to be able to skip regions that are
+already equal to the image file. This copy is updated along with the write
+operation. In case of erase errors it is even re-read completely. After
+writing has finished and if verification is enabled, the whole flash chip is
+read out and compared with the input image.
.TP
.B "\-n, \-\-noverify"
Skip the automatic verification of flash ROM contents after writing. Using this
@@ -541,7 +548,7 @@
backup. This is caused by the embedded controller (EC) present in many laptops,
which interacts badly with any flash attempts. This is a hardware limitation
and flashrom will attempt to detect it and abort immediately for safety reasons.
-.SH LICENCE
+.SH LICENSE
.B flashrom
is covered by the GNU General Public License (GPL), version 2. Some files are
additionally available under the GPL (version 2, or any later version).
@@ -623,6 +630,6 @@
.br
All authors can be reached via email at <flashrom(a)flashrom.org>.
.PP
-This manual page was written by Uwe Hermann <uwe(a)hermann-uwe.de>
-and Carl-Daniel Hailfinger.
+This manual page was written by Uwe Hermann <uwe(a)hermann-uwe.de>,
+Carl-Daniel Hailfinger and others.
It is licensed under the terms of the GNU GPL (version 2 or later).