[flashrom] [PATCH] Warn about unhandled one-time programmable memory

Daniel Lenski dlenski at gmail.com
Thu Jul 29 21:10:06 CEST 2010


Added feature bit FEATURE_UNHANDLED_OTP, and a warning for chips like AMIC
A25L032 and A25LQ032 which contain small regions of one-time programmable
memory that flashrom can neither read, nor write, nor erase.

Signed-off-by: Daniel Lenski <dlenski at gmail.com>
---
 flash.h      |    1 +
 flashchips.c |    2 ++
 flashrom.c   |    8 ++++++++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/flash.h b/flash.h
index 6f0d7c0..6db4c48 100644
--- a/flash.h
+++ b/flash.h
@@ -85,6 +85,7 @@ enum chipbustype {
 #define FEATURE_ADDR_SHIFTED	(1 << 5)
 #define FEATURE_WRSR_EWSR	(1 << 6)
 #define FEATURE_WRSR_WREN	(1 << 7)
+#define FEATURE_UNHANDLED_OTP	(1 << 8)
 #define FEATURE_WRSR_EITHER	(FEATURE_WRSR_EWSR | FEATURE_WRSR_WREN)
 
 struct flashchip {
diff --git a/flashchips.c b/flashchips.c
index efd7599..07b9635 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -817,6 +817,7 @@ struct flashchip flashchips[] = {
 		.model_id	= AMIC_A25L032,
 		.total_size	= 4096,
 		.page_size	= 256,
+		.feature_bits	= FEATURE_UNHANDLED_OTP,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
@@ -852,6 +853,7 @@ struct flashchip flashchips[] = {
 		.model_id	= AMIC_A25LQ032,
 		.total_size	= 4096,
 		.page_size	= 256,
+		.feature_bits	= FEATURE_UNHANDLED_OTP,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
diff --git a/flashrom.c b/flashrom.c
index 2690151..a7471a6 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1434,6 +1434,14 @@ void check_chip_supported(struct flashchip *flash)
 			  "Thanks for your help!\n"
 			  "===\n");
 	}
+	if (flash->feature_bits & FEATURE_UNHANDLED_OTP) {
+		msg_cinfo("===\n"
+		          "This flash part contains a region of one-time programmable memory\n"
+		          "which flashrom cannot read, and may never be able to write or\n"
+		          "erase.  flashrom may not be able to completely backup and rewrite\n"
+		          "the contents of this chip.\n"
+		          "===\n");
+	}
 }
 
 int main(int argc, char *argv[])
-- 
1.7.0.4





More information about the flashrom mailing list