From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933797AbbDUQFN (ORCPT ); Tue, 21 Apr 2015 12:05:13 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:49542 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932377AbbDUQFI (ORCPT ); Tue, 21 Apr 2015 12:05:08 -0400 Message-ID: <55367527.1000600@Vivier.EU> Date: Tue, 21 Apr 2015 18:04:55 +0200 From: Laurent Vivier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Stefan Richter CC: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Joe Perches Subject: Re: [PATCH 1/2] firewire: firewire is a big-endian bus References: <1429576576-1637-1-git-send-email-laurent@vivier.eu> <1429576576-1637-2-git-send-email-laurent@vivier.eu> <20150421151335.45d1259f@kant> In-Reply-To: <20150421151335.45d1259f@kant> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PHhpk27DwRe3CEbQ9UFnA00eH3dFSitCo" X-Provags-ID: V03:K0:J2PEss6BLooh3WDbeIclDOYGlKNwrgLDwmA/o2DTB8yZWp0/27i sAPB/Xg3W6K6J88wbUvN1kM5uzsbzvJozpmtKvCfOuV1XWrGaLHM9xjDsgvkTuU0uKE/0cr aUaaykOoISw3j+LhHTPWuSS427IezDB0XsZ0YMgOh5hQF0gWGTJvIVJSISFNSHcKcHuzX5e y4YH+hYbhPLX+21UcJvPw== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --PHhpk27DwRe3CEbQ9UFnA00eH3dFSitCo Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Le 21/04/2015 15:13, Stefan Richter a =E9crit : > On Apr 21 Laurent Vivier wrote: >> So, dump config_rom data as big-endian values. >> >> The value given by /sys/bus/firewire/devices/fw0 were correctly >> given on a big-endian host (like powermac) not on a little-endian host= >> (like PC), for instance: >> >> 00000000 87 a4 04 04 34 39 33 31 22 a2 00 f0 33 22 11 00 |....4931"= =2E..3"..| >> 00000010 66 66 66 33 0b dd 05 00 c0 83 00 0c 1e 0d d0 03 |fff3.....= =2E......| >> 00000020 03 00 00 81 01 00 00 17 08 00 00 81 b7 4c 06 00 |.........= =2E...L..| >> 00000030 00 00 00 00 00 00 00 00 75 6e 69 4c 69 46 20 78 |........u= niLiF x| >> 00000040 69 77 65 72 00 00 65 72 1c ff 03 00 00 00 00 00 |iwer..er.= =2E......| >> 00000050 00 00 00 00 75 6a 75 4a |....ujuJ|= >> 00000058 >> >> instead of: >> >> 00000000 04 04 a4 87 31 33 39 34 f0 00 a2 22 00 11 22 33 |....1394.= =2E.".."3| >> 00000010 33 66 66 66 00 05 dd 0b 0c 00 83 c0 03 d0 0d 1e |3fff.....= =2E......| >> 00000020 81 00 00 03 17 00 00 01 81 00 00 08 00 06 4c b7 |.........= =2E....L.| >> 00000030 00 00 00 00 00 00 00 00 4c 69 6e 75 78 20 46 69 |........L= inux Fi| >> 00000040 72 65 77 69 72 65 00 00 00 03 ff 1c 00 00 00 00 |rewire...= =2E......| >> 00000050 00 00 00 00 4a 75 6a 75 |....Juju|= >> 00000058 >> >> This patch corrects this. >> >> Signed-off-by: Laurent Vivier > As defined in Documentation/ABI/stable/sysfs-bus-firewire we deliberate= ly > export the Configuration ROM as an array of host-endian quadlets. As a= > stable kernel ABI, this will not be changed. OK, I understand. > > (A python script called crpp which transforms this kind of binary data = into > a richly annotated hexdump is available as part of the jujuutils packag= e, > or standalone from http://me.in-berlin.de/~s5r6/linux1394/utils/.) Thank you for the information. Regards, Laurent > >> --- >> drivers/firewire/core-device.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-de= vice.c >> index f9e3aee..5245567 100644 >> --- a/drivers/firewire/core-device.c >> +++ b/drivers/firewire/core-device.c >> @@ -399,14 +399,14 @@ static ssize_t config_rom_show(struct device *de= v, >> struct device_attribute *attr, char *buf) >> { >> struct fw_device *device =3D fw_device(dev); >> - size_t length; >> + size_t i; >> =20 >> down_read(&fw_device_rwsem); >> - length =3D device->config_rom_length * 4; >> - memcpy(buf, device->config_rom, length); >> + for (i =3D 0; i < device->config_rom_length; i++) >> + ((u32 *)buf)[i] =3D be32_to_cpu(device->config_rom[i]); >> up_read(&fw_device_rwsem); >> =20 >> - return length; >> + return i * 4; >> } >> =20 >> static ssize_t guid_show(struct device *dev, > > --PHhpk27DwRe3CEbQ9UFnA00eH3dFSitCo 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.22 (GNU/Linux) iEYEARECAAYFAlU2dScACgkQNKT2yavzbFNTtgCgmG8iaOX/ejgqpmuAIGSdb4Ua N28AnA5nvsS+vdMThlm+hM0WK8mWaj/v =CJmG -----END PGP SIGNATURE----- --PHhpk27DwRe3CEbQ9UFnA00eH3dFSitCo--