diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-22 05:56:38 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-27 05:04:11 -0400 |
commit | fd8c8d46ca9402c15383d2cf0bc3ee7740de3b62 (patch) | |
tree | 66a33db3ea837f2fb6c66e077a9b5fae7009c3ba /drivers/firewire/nosy-user.h | |
parent | c89db7b8bc88d8288dcfbe7a885b950d2560d564 (diff) |
firewire: nosy: endianess fixes and annotations
1.) The DMA programs (struct pcl) are PCI-endian = little endian data
(except for the 3rd quadlet in a PCL which the controller does not
touch). Annotate them as such.
Fix all accesses of the PCL to work with big endian CPUs also. Not
actually tested, I only have a little endian PC to test with. This
includes replacement of a bitfield struct pcl_status by open-coded
shift and mask operations.
2.) The two __attribute__ ((packed)) at struct pcl are not really
required since it consists of u32/__le32 only, i.e. there will be no
padding with or without the attribute.
3.) The received IEEE 1394 data are byteswapped by the controller from
IEEE 1394 endian = big endian to PCI endian = little endian because the
PCL_BIGENDIAN control bit is set. Therefore annotate the DMA buffer as
a __le32 array.
Fix the one access of the DMA buffer (the check of the transaction code
of link packets) to work with big endian CPUs. Also fix the two
accesses of the client bounce buffer (the reading of packet length).
4.) Add a comment to the userspace ABI header that all of the data gets
out as little endian data, except for the timestamp which is CPU endian.
(We could make it little endian too, but why? Vice versa, an ioctl
could be added to dump packet data in big endian byte order...)
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/nosy-user.h')
-rw-r--r-- | drivers/firewire/nosy-user.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/firewire/nosy-user.h b/drivers/firewire/nosy-user.h index ebef97f4ecf9..e48aa6200c72 100644 --- a/drivers/firewire/nosy-user.h +++ b/drivers/firewire/nosy-user.h | |||
@@ -17,9 +17,9 @@ struct nosy_stats { | |||
17 | /* | 17 | /* |
18 | * Format of packets returned from the kernel driver: | 18 | * Format of packets returned from the kernel driver: |
19 | * | 19 | * |
20 | * quadlet with timestamp (microseconds) | 20 | * quadlet with timestamp (microseconds, CPU endian) |
21 | * quadlet padded packet data... | 21 | * quadlet-padded packet data... (little endian) |
22 | * quadlet with ack | 22 | * quadlet with ack (little endian) |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #endif /* __nosy_user_h */ | 25 | #endif /* __nosy_user_h */ |