[flashrom] [commit] r764 - trunk

svn at flashrom.org svn at flashrom.org
Mon Nov 16 16:03:35 CET 2009


Author: hailfinger
Date: 2009-11-16 16:03:35 +0100 (Mon, 16 Nov 2009)
New Revision: 764

Modified:
   trunk/spi.c
Log:
If a SPI command taking an address does fail, we want to know the
address for easier debugging.

Vincent wrote: This patch provided help to debug the partial write on
ICH in descriptor mode.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Vincent S. Cojot <openlook at cojot.name> 


Modified: trunk/spi.c
===================================================================
--- trunk/spi.c	2009-11-16 14:13:09 UTC (rev 763)
+++ trunk/spi.c	2009-11-16 15:03:35 UTC (rev 764)
@@ -615,8 +615,8 @@
 
 	result = spi_send_multicommand(cmds);
 	if (result) {
-		fprintf(stderr, "%s failed during command execution\n",
-			__func__);
+		fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+			__func__, addr);
 		return result;
 	}
 	/* Wait until the Write-In-Progress bit is cleared.
@@ -659,7 +659,8 @@
 
 	result = spi_send_multicommand(cmds);
 	if (result) {
-		fprintf(stderr, "%s failed during command execution\n", __func__);
+		fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+			__func__, addr);
 		return result;
 	}
 	/* Wait until the Write-In-Progress bit is cleared.
@@ -721,8 +722,8 @@
 
 	result = spi_send_multicommand(cmds);
 	if (result) {
-		fprintf(stderr, "%s failed during command execution\n",
-			__func__);
+		fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+			__func__, addr);
 		return result;
 	}
 	/* Wait until the Write-In-Progress bit is cleared.
@@ -827,21 +828,21 @@
 
 	result = spi_send_multicommand(cmds);
 	if (result) {
-		fprintf(stderr, "%s failed during command execution\n",
-			__func__);
+		fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+			__func__, addr);
 	}
 	return result;
 }
 
-int spi_nbyte_program(int address, uint8_t *bytes, int len)
+int spi_nbyte_program(int addr, uint8_t *bytes, int len)
 {
 	int result;
 	/* FIXME: Switch to malloc based on len unless that kills speed. */
 	unsigned char cmd[JEDEC_BYTE_PROGRAM_OUTSIZE - 1 + 256] = {
 		JEDEC_BYTE_PROGRAM,
-		(address >> 16) & 0xff,
-		(address >> 8) & 0xff,
-		(address >> 0) & 0xff,
+		(addr >> 16) & 0xff,
+		(addr >> 8) & 0xff,
+		(addr >> 0) & 0xff,
 	};
 	struct spi_command cmds[] = {
 	{
@@ -874,8 +875,8 @@
 
 	result = spi_send_multicommand(cmds);
 	if (result) {
-		fprintf(stderr, "%s failed during command execution\n",
-			__func__);
+		fprintf(stderr, "%s failed during command execution at address 0x%x\n",
+			__func__, addr);
 	}
 	return result;
 }





More information about the flashrom mailing list