From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1gHn-0003rt-Cm for qemu-devel@nongnu.org; Sat, 02 Feb 2013 11:49:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1gHm-0007Bn-CG for qemu-devel@nongnu.org; Sat, 02 Feb 2013 11:49:51 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:62026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1gHm-0007Bi-5J for qemu-devel@nongnu.org; Sat, 02 Feb 2013 11:49:50 -0500 Received: by mail-lb0-f180.google.com with SMTP id q12so5435455lbc.39 for ; Sat, 02 Feb 2013 08:49:48 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1359823557-5748-1-git-send-email-afaerber@suse.de> References: <1359823557-5748-1-git-send-email-afaerber@suse.de> From: Peter Maydell Date: Sat, 2 Feb 2013 16:49:28 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=C3=A4rber?= Cc: agraf@suse.de, qemu-devel@nongnu.org, blauwirbel@gmail.com, dantesu@gmail.com, =?UTF-8?Q?Andreas_F=C3=A4rber?= , rth@twiddle.net On 2 February 2013 16:45, Andreas F=C3=A4rber wrote: > From: Andreas F=C3=A4rber > > The libqos driver for omap_i2c currently does not work on Big Endian. > Introduce helpers for reading from and writing to 16-bit armel registers. > > This fixes tmp105-test failures on ppc. > > Signed-off-by: Andreas F=C3=A4rber > --- > tests/libi2c-omap.c | 51 ++++++++++++++++++++++++++++++++-------------= ------ > 1 Datei ge=C3=A4ndert, 32 Zeilen hinzugef=C3=BCgt(+), 19 Zeilen entfernt= (-) > > diff --git a/tests/libi2c-omap.c b/tests/libi2c-omap.c > index 9be57e9..7d50ef2 100644 > --- a/tests/libi2c-omap.c > +++ b/tests/libi2c-omap.c > @@ -12,6 +12,7 @@ > #include > > #include "qemu/osdep.h" > +#include "qemu/bswap.h" > #include "libqtest.h" > > enum OMAPI2CRegisters { > @@ -48,12 +49,24 @@ typedef struct OMAPI2C { > } OMAPI2C; > > > +static inline void omap_i2c_read16(uint64_t addr, uint16_t *data) > +{ > + memread(addr, data, 2); > + *data =3D le16_to_cpu(*data); > +} > + > +static inline void omap_i2c_write16(uint64_t addr, uint16_t data) > +{ > + data =3D cpu_to_le16(data); > + memwrite(addr, &data, 2); > +} There's nothing special about the OMAP i2c device that I know of: shouldn't the test code just be using a generic "write 16 bit value to memory with appropriate endianness for target CPU" function ? -- PMM