Patchwork Warn about unhandled one-time programmable memory

login
register
about
Submitter Daniel Lenski
Date 2010-07-29 19:10:06
Message ID <1280430606-18194-1-git-send-email-dlenski@gmail.com>
Download mbox | patch
Permalink /patch/1699/
State Superseded
Headers show

Comments

Daniel Lenski - 2010-07-29 19:10:06
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@gmail.com>
---
 flash.h      |    1 +
 flashchips.c |    2 ++
 flashrom.c   |    8 ++++++++
 3 files changed, 11 insertions(+), 0 deletions(-)

Patch

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[])