[flashrom] [PATCH] More verbose failures for SPI commands
vincent at cojot.name
vincent at cojot.name
Mon Nov 16 16:00:25 CET 2009
Hi everyone, Hi Carl,
This patch provided help to debug the issue..
Acked-by: Vincent S. Cojot <openlook at cojot.name>
Thanks a lot for this help,
Vincent
On Mon, 16 Nov 2009, Carl-Daniel Hailfinger wrote:
> If a SPI command taking an address does fail, we want to know the
> address for easier debugging.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>
> Index: flashrom-spi_command_failure_verbose/spi.c
> ===================================================================
> --- flashrom-spi_command_failure_verbose/spi.c (Revision 763)
> +++ flashrom-spi_command_failure_verbose/spi.c (Arbeitskopie)
> @@ -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;
> }
>
>
>
--
,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,
Vincent S. Cojot, Computer Engineering. STEP project. _.,-*~'`^`'~*-,._.,-*~
Ecole Polytechnique de Montreal, Comite Micro-Informatique. _.,-*~'`^`'~*-,.
Linux Xview/OpenLook resources page _.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'
http://step.polymtl.ca/~coyote _.,-*~'`^`'~*-,._ coyote at NOSPAM4cojot.name
They cannot scare me with their empty spaces
Between stars - on stars where no human race is
I have it in me so much nearer home
To scare myself with my own desert places. - Robert Frost
More information about the flashrom
mailing list