[flashrom] [PATCH] ichspi: reprogram_opcode_on_the_fly return code fix.

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Wed Oct 3 18:36:36 CEST 2012


On Wed, 12 Sep 2012 16:29:44 +0200
Stefan Tauner <stefan.tauner at student.tuwien.ac.at> wrote:

> From: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
> 
> by carldani, found in our paste service history
> ---
>  ichspi.c |   20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/ichspi.c b/ichspi.c
> index ce9c553..fbc6ea7 100644
> --- a/ichspi.c
> +++ b/ichspi.c
> @@ -409,13 +409,19 @@ static int reprogram_opcode_on_the_fly(uint8_t opcode, unsigned int writecnt, un
>  		else // we have an invalid case
>  			return SPI_INVALID_LENGTH;
>  	}
> -	int oppos = 2;	// use original JEDEC_BE_D8 offset
> -	curopcodes->opcode[oppos].opcode = opcode;
> -	curopcodes->opcode[oppos].spi_type = spi_type;
> -	program_opcodes(curopcodes, 0);
> -	oppos = find_opcode(curopcodes, opcode);
> -	msg_pdbg2("on-the-fly OPCODE (0x%02X) re-programmed, op-pos=%d\n", opcode, oppos);
> -	return oppos;
> +	if (spi_type <= 3) {
> +		int oppos = 2;	// use original JEDEC_BE_D8 offset
> +		curopcodes->opcode[oppos].opcode = opcode;
> +		curopcodes->opcode[oppos].spi_type = spi_type;
> +		program_opcodes(curopcodes, 0);
> +		oppos = find_opcode(curopcodes, opcode);
> +		msg_pdbg2("on-the-fly OPCODE (0x%02X) re-programmed, op-pos=%d\n", opcode, oppos);
> +		return oppos;
> +	}
> +	/* This case only happens if the writecnt/readcnt combination is
> +	 * impossible to achieve on ICH SPI.
> +	 */
> +	return SPI_INVALID_LENGTH;
>  }
>  
>  static int find_opcode(OPCODES *op, uint8_t opcode)

I think this patch is made obsolete by my latest check_trans patch set.
I'll mark it superseded in patchwork.
http://patchwork.coreboot.org/patch/3746/

-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner




More information about the flashrom mailing list