[flashrom] [PATCH] dummyflasher.c: add support for SFDP by adding a new emulator chip: MX25L6436
Stefan Tauner
stefan.tauner at student.tuwien.ac.at
Mon May 7 02:44:09 CEST 2012
On Sat, 05 May 2012 21:13:21 +0200
Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net> wrote:
> Am 23.02.2012 02:26 schrieb Stefan Tauner:
>
> > On Mon, 20 Feb 2012 19:49:38 +0100 Carl-Daniel Hailfinger wrote:
>
> Not what I meant.
> The big issue with SFDP and FAST READ and other commands is that the
> dummy byte after command+address can be either a written or read byte
> (the chip does not care). Our emulation should be able to handle both.
> This means a writecnt of 4 is completely legal, but in that case we have
> to set the copy destination to &readarr[1] instead of &readarr[0]. My
> logic tried to address that, but it was not completely correct.
> I have annotated your patch with my suggested changes at the end of this
> mail. They seem to work in my tests.
ah! :)
please re-review that part of this iteration, sorry.
NB: we have changed the SFDP code to use a dummy read instead of the
write in the meantime. i have tested with both dummy reads and writes
and all looks find. if there is no response for a week, ill commit it
anyway.
> > diff --git a/dummyflasher.c b/dummyflasher.c
> > index afe0518..794a2f6 100644
> > --- a/dummyflasher.c
> > +++ b/dummyflasher.c
> > @@ -629,7 +681,33 @@ static int emulate_spi_chip_response(unsigned int writecnt,
> > /* emu_jedec_ce_c7_size is emu_chip_size. */
> > memset(flashchip_contents, 0xff, emu_jedec_ce_c7_size);
> > break;
> > - default:
> > + case JEDEC_SFDP: {
> > + unsigned int toread;
> > + if (emu_chip != EMULATE_MACRONIX_MX25L6436)
> > + break;
> > + if (writecnt < 5)
>
> Replace with
> if (writecnt < 4)
>
> > + break;
> > + offs = writearr[1] << 16 | writearr[2] << 8 | writearr[3];
>
> Insert
>
> + /* SFDP expects one dummy byte after the address. */
> + if (writecnt < 5) {
this can be simplified then... see patch.
> + /* The dummy byte was not written, make sure it is read
> + * instead. Shifting and shortening the read array does
> + * achieve the goal.
> + */
> + readarr += 5 - writecnt;
> + readcnt -= 5 - writecnt;
> + writecnt = 5;
> + }
--
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-dummyflasher.c-add-support-for-SFDP-by-adding-a-new-.patch
Type: text/x-patch
Size: 6376 bytes
Desc: not available
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20120507/e57659f7/attachment.patch>
More information about the flashrom
mailing list