From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34645 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCXgE-0006bG-BS for qemu-devel@nongnu.org; Thu, 13 May 2010 08:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCXg5-00066M-SR for qemu-devel@nongnu.org; Thu, 13 May 2010 08:38:20 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:43221) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCXg5-00066F-GN for qemu-devel@nongnu.org; Thu, 13 May 2010 08:38:13 -0400 Message-ID: <4BEBF2AF.5010902@web.de> Date: Thu, 13 May 2010 14:38:07 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <201004222338.06194.michael@walle.cc> <201005130102.23124.michael@walle.cc> <4BEBAC83.6000209@web.de> <201005131258.28613.michael@walle.cc> <4BEBE688.5060204@web.de> <4BEBE93C.1060602@web.de> In-Reply-To: <4BEBE93C.1060602@web.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9F10C7BFBBF1DBD039F83111" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: Commit 9c9bb6c89d4 breaks code execution from flash List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Walle Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9F10C7BFBBF1DBD039F83111 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Jan Kiszka wrote: > Jan Kiszka wrote: >> Michael Walle wrote: >>> Am Thursday 13 May 2010 09:38:43 schrieb Jan Kiszka: >>>>> But i noticed another minor bug. The cfi02 doesn't handle 'read fla= sh id' >>>>> on 16bit accesses correctly. It always returns 8 bit. I used someth= ing >>>>> like >>>>> >>>>> if (width =3D=3D 2) >>>>> ret =3D pfl->ident[0] << 8 | pfl->ident[1]; /* rsp. ident[1]/i= dent[2] >>>>> */ >>>>> >>>>> within the 0x90 reading as a quick workaround. >>>> Are you sure that this is valid? The whole cfi_table is also only >>>> provided byte-wise, same in cfi01. >>> At least the JEDEC ID read returns 16 bit values with x16 devices. Ha= ve a look=20 >>> at: >>> http://www.spansion.com/Support/Datasheets/s29gl128_256n_sp_a2_e.pd= f >>> Table II on page 51 >>> >>> micromonitor (the program i tested with) and uboot uses 16bit reads t= o read=20 >>> the flash id. Have a look at >>> http://git.denx.de/cgi-bin/gitweb.cgi?p=3Du-boot.git;a=3Dblob;f=3Ddri= vers/mtd/cfi_flash.c;h=3D3267c5de36d1b12a190f93f9a3048ded598f84aa;hb=3DHE= AD#l1535 >>> >> Right, I came to the same conclusion based on chip I'm using for the >> Musicpal model. Working on a proper fix - now that I think to have fou= nd >> a solution for the XIP vs. mode switch conflict. >=20 > Wait! Access to ident[0..3] is already correct as those fields are > stored and returned as 16-bit values. I guess you just did not pass the= > proper IDs when registering your pflash_cfi02 instance. =2E.. or you suffered from a be/le issue. In contrast to data, the ID is not swapped according to the byte order that was specified during init. Does your target byte order differ from your host? >=20 > But this still leaves us with the 8-bit entries of the cfi_table. >=20 The CFI table is only returned byte-wise, even in 16- or 32-bit mode. But I guess it should be properly swapped to the right byte order nevertheless. Jan --------------enig9F10C7BFBBF1DBD039F83111 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkvr8rMACgkQitSsb3rl5xS9KwCgnAyjsmphC28mVckcUlBitJSs jKMAnjSzII2q6OSmp89yxUisxz4Z/T2K =8G7c -----END PGP SIGNATURE----- --------------enig9F10C7BFBBF1DBD039F83111--