[flashrom] [commit] r943 - trunk

repository service svn at flashrom.org
Tue Mar 16 04:09:10 CET 2010


Author: snelson
Date: Tue Mar 16 04:09:10 2010
New Revision: 943
URL: http://flashrom.org/trac/coreboot/changeset/943

Log:
convert _sst_fwhub functions to jedec
kill unused sst_fwhub.c functions
make unlock_* check if unlock was successful and only return 0 when fully successful
Signed-off-by: Sean Nelson <audiohacked at gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Modified:
   trunk/chipdrivers.h
   trunk/flashchips.c
   trunk/sst_fwhub.c

Modified: trunk/chipdrivers.h
==============================================================================
--- trunk/chipdrivers.h	Tue Mar 16 02:00:50 2010	(r942)
+++ trunk/chipdrivers.h	Tue Mar 16 04:09:10 2010	(r943)
@@ -111,11 +111,8 @@
 int unlock_49lfxxxc(struct flashchip *flash);
 
 /* sst_fwhub.c */
-int erase_sst_fwhub(struct flashchip *flash);
-int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, unsigned int page_size);
-int erase_sst_fwhub_sector(struct flashchip *flash, unsigned int offset, unsigned int page_size);
-int write_sst_fwhub(struct flashchip *flash, uint8_t *buf);
 int printlock_sst_fwhub(struct flashchip *flash);
+int unlock_sst_fwhub(struct flashchip *flash);
 
 /* w39v040c.c */
 int printlock_w39v040c(struct flashchip *flash);

Modified: trunk/flashchips.c
==============================================================================
--- trunk/flashchips.c	Tue Mar 16 02:00:50 2010	(r942)
+++ trunk/flashchips.c	Tue Mar 16 04:09:10 2010	(r943)
@@ -4084,17 +4084,19 @@
 		{
 			{
 				.eraseblocks = { {4 * 1024, 64} },
-				.block_erase = erase_sst_fwhub_sector,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {16 * 1024, 16} },
-				.block_erase = erase_sst_fwhub_block,
+				.block_erase = erase_block_jedec,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
 				.block_erase = NULL, /* AA 55 80 AA 55 10, only in A/A mux mode */
 			}
 		},
 		.printlock	= printlock_sst_fwhub,
-		.write		= write_sst_fwhub,
+		.printlock	= printlock_sst_fwhub,
+		.unlock		= unlock_sst_fwhub,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4114,17 +4116,19 @@
 		{
 			{
 				.eraseblocks = { {4 * 1024, 96} },
-				.block_erase = erase_sst_fwhub_sector,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {64 * 1024, 6} },
-				.block_erase = erase_sst_fwhub_block,
+				.block_erase = erase_block_jedec,
 			}, {
 				.eraseblocks = { {384 * 1024, 1} },
 				.block_erase = NULL, /* AA 55 80 AA 55 10, only in A/A mux mode */
 			}
 		},
 		.printlock	= printlock_sst_fwhub,
-		.write		= write_sst_fwhub,
+		.printlock	= printlock_sst_fwhub,
+		.unlock		= unlock_sst_fwhub,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4147,17 +4151,19 @@
 		{
 			{
 				.eraseblocks = { {4 * 1024, 128} },
-				.block_erase = erase_sector_jedec, /* missing unlock */
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {64 * 1024, 8} },
-				.block_erase = erase_sst_fwhub_block, /* same as erase_block_jedec, but with unlock */
+				.block_erase = erase_block_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = NULL, /* AA 55 80 AA 55 10, only in A/A mux mode */
 			},
 		},
 		.printlock	= printlock_sst_fwhub,
-		.write		= write_sst_fwhub,
+		.printlock	= printlock_sst_fwhub,
+		.unlock		= unlock_sst_fwhub,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4208,17 +4214,19 @@
 		{
 			{
 				.eraseblocks = { {4 * 1024, 256} },
-				.block_erase = erase_sst_fwhub_sector,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {64 * 1024, 16} },
-				.block_erase = erase_sst_fwhub_block,
+				.block_erase = erase_block_jedec,
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
 				.block_erase = NULL, /* AA 55 80 AA 55 10, only in A/A mux mode */
 			}
 		},
 		.printlock	= printlock_sst_fwhub,
-		.write		= write_sst_fwhub,
+		.printlock	= printlock_sst_fwhub,
+		.unlock		= unlock_sst_fwhub,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 

Modified: trunk/sst_fwhub.c
==============================================================================
--- trunk/sst_fwhub.c	Tue Mar 16 02:00:50 2010	(r942)
+++ trunk/sst_fwhub.c	Tue Mar 16 04:09:10 2010	(r943)
@@ -27,18 +27,6 @@
 #include "flash.h"
 #include "chipdrivers.h"
 
-// I need that Berkeley bit-map printer
-void print_sst_fwhub_status(uint8_t status)
-{
-	printf("%s", status & 0x80 ? "Ready:" : "Busy:");
-	printf("%s", status & 0x40 ? "BE SUSPEND:" : "BE RUN/FINISH:");
-	printf("%s", status & 0x20 ? "BE ERROR:" : "BE OK:");
-	printf("%s", status & 0x10 ? "PROG ERR:" : "PROG OK:");
-	printf("%s", status & 0x8 ? "VP ERR:" : "VPP OK:");
-	printf("%s", status & 0x4 ? "PROG SUSPEND:" : "PROG RUN/FINISH:");
-	printf("%s", status & 0x2 ? "WP|TBL#|WP#,ABORT:" : "UNLOCK:");
-}
-
 int check_sst_fwhub_block_lock(struct flashchip *flash, int offset)
 {
 	chipaddr registers = flash->virtual_registers;
@@ -93,91 +81,18 @@
 	return 0;
 }
 
-int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, unsigned int page_size)
+int unlock_sst_fwhub(struct flashchip *flash)
 {
-	uint8_t blockstatus = clear_sst_fwhub_block_lock(flash, offset);
+	int i, ret=0;
 
-	if (blockstatus) {
-		printf("Block lock clearing failed, not erasing block "
-			"at 0x%06x\n", offset);
-		return 1;
-	}
-
-	if (erase_block_jedec(flash, offset, page_size)) {
-		fprintf(stderr, "ERASE FAILED!\n");
-		return -1;
-	}
-	toggle_ready_jedec(flash->virtual_memory);
-
-	return 0;
-}
-
-int erase_sst_fwhub_sector(struct flashchip *flash, unsigned int offset, unsigned int page_size)
-{
-	uint8_t blockstatus = clear_sst_fwhub_block_lock(flash, offset);
-
-	if (blockstatus) {
-		printf("Sector lock clearing failed, not erasing sector "
-			"at 0x%06x\n", offset);
-		return 1;
-	}
-
-	if (erase_sector_jedec(flash, offset, page_size)) {
-		fprintf(stderr, "ERASE FAILED!\n");
-		return -1;
-	}
-	toggle_ready_jedec(flash->virtual_memory);
-
-	return 0;
-}
-
-int erase_sst_fwhub(struct flashchip *flash)
-{
-	int i;
-	unsigned int total_size = flash->total_size * 1024;
-
-	for (i = 0; i < total_size; i += flash->page_size) {
-		if (erase_sst_fwhub_block(flash, i, flash->page_size)) {
-			fprintf(stderr, "ERASE FAILED!\n");
-			return -1;
+	for (i = 0; i < flash->total_size * 1024; i += flash->page_size)
+	{
+		if (clear_sst_fwhub_block_lock(flash, i))
+		{
+			msg_cdbg("Warning: Unlock Failed for block 0x%06x\n", i);
+			ret++;
 		}
 	}
-
-	return 0;
+	return ret;
 }
 
-int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
-{
-	int i, rc;
-	int total_size = flash->total_size * 1024;
-	int page_size = flash->page_size;
-	chipaddr bios = flash->virtual_memory;
-	uint8_t *readbuf = malloc(page_size);
-	
-	printf("Programming page: ");
-	for (i = 0; i < total_size / page_size; i++) {
-		printf("%04d at address: 0x%08x", i, i * page_size);
-
-		/* Auto Skip Blocks, which already contain the desired data:
-		 * Faster, because we only write, what has changed
-		 * More secure, because blocks, which are excluded
-		 * (with the exclude or layout feature)
-		 * are not erased and rewritten; data is retained also
-		 * in sudden power off situations
-		 */
-		flash->read(flash, readbuf, i * page_size, page_size);
-		if (memcmp((void *)(buf + i * page_size),
-			   (void *)(readbuf), page_size)) {
-			rc = erase_sst_fwhub_block(flash, i * page_size,
-						   page_size);
-			if (rc)
-				return 1;
-			write_sector_jedec_common(flash, buf + i * page_size,
-					   bios + i * page_size, page_size, 0xffff);
-		}
-		printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
-	}
-	printf("\n");
-
-	return 0;
-}




More information about the flashrom mailing list