public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent@Vivier.EU>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux1394-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Joe Perches <joe@perches.com>
Subject: Re: [PATCH 1/2] firewire: firewire is a big-endian bus
Date: Tue, 21 Apr 2015 18:04:55 +0200	[thread overview]
Message-ID: <55367527.1000600@Vivier.EU> (raw)
In-Reply-To: <20150421151335.45d1259f@kant>

[-- Attachment #1: Type: text/plain, Size: 2879 bytes --]

Le 21/04/2015 15:13, Stefan Richter a écrit :
> 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"...3"..|
>> 00000010  66 66 66 33 0b dd 05 00  c0 83 00 0c 1e 0d d0 03  |fff3............|
>> 00000020  03 00 00 81 01 00 00 17  08 00 00 81 b7 4c 06 00  |.............L..|
>> 00000030  00 00 00 00 00 00 00 00  75 6e 69 4c 69 46 20 78  |........uniLiF x|
>> 00000040  69 77 65 72 00 00 65 72  1c ff 03 00 00 00 00 00  |iwer..er........|
>> 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...".."3|
>> 00000010  33 66 66 66 00 05 dd 0b  0c 00 83 c0 03 d0 0d 1e  |3fff............|
>> 00000020  81 00 00 03 17 00 00 01  81 00 00 08 00 06 4c b7  |..............L.|
>> 00000030  00 00 00 00 00 00 00 00  4c 69 6e 75 78 20 46 69  |........Linux Fi|
>> 00000040  72 65 77 69 72 65 00 00  00 03 ff 1c 00 00 00 00  |rewire..........|
>> 00000050  00 00 00 00 4a 75 6a 75                           |....Juju|
>> 00000058
>>
>> This patch corrects this.
>>
>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> As defined in Documentation/ABI/stable/sysfs-bus-firewire we deliberately
> 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 package,
> 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-device.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 *dev,
>>  			       struct device_attribute *attr, char *buf)
>>  {
>>  	struct fw_device *device = fw_device(dev);
>> -	size_t length;
>> +	size_t i;
>>  
>>  	down_read(&fw_device_rwsem);
>> -	length = device->config_rom_length * 4;
>> -	memcpy(buf, device->config_rom, length);
>> +	for (i = 0; i < device->config_rom_length; i++)
>> +		((u32 *)buf)[i] = be32_to_cpu(device->config_rom[i]);
>>  	up_read(&fw_device_rwsem);
>>  
>> -	return length;
>> +	return i * 4;
>>  }
>>  
>>  static ssize_t guid_show(struct device *dev,
>
>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2015-04-21 16:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  0:36 [PATCH 0/2] Some firewire minor patches Laurent Vivier
2015-04-21  0:36 ` [PATCH 1/2] firewire: firewire is a big-endian bus Laurent Vivier
2015-04-21  1:04   ` Joe Perches
2015-04-21 14:13     ` Stefan Richter
2015-04-21 13:13   ` Stefan Richter
2015-04-21 16:04     ` Laurent Vivier [this message]
2015-04-21  0:36 ` [PATCH 2/2] firewire: add a parameter to force the speed of the devices Laurent Vivier
2015-04-21 14:03   ` Clemens Ladisch
2015-04-21 14:16     ` Stefan Richter
2015-04-21 14:33   ` Stefan Richter
2015-04-21 16:55     ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55367527.1000600@Vivier.EU \
    --to=laurent@vivier.eu \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=stefanr@s5r6.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox