firewire: Byteswap iso header so all headers are presented as be32.
authorKristian Høgsberg <krh@redhat.com>
Tue, 10 Apr 2007 22:11:16 +0000 (18:11 -0400)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Wed, 11 Apr 2007 22:18:57 +0000 (00:18 +0200)
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/fw-ohci.c

index b941239671d6f7b9303a76e5e253032309596f3d..2229ea0b630e3fe8292a101313e3e116649321f6 100644 (file)
@@ -1257,7 +1257,13 @@ static int handle_ir_dualbuffer_packet(struct context *context,
        p = db + 1;
        end = p + header_length;
        while (p < end && i + ctx->base.header_size <= PAGE_SIZE) {
-               memcpy(ctx->header + i, p + 4, ctx->base.header_size);
+               /* The iso header is byteswapped to little endian by
+                * the controller, but the remaining header quadlets
+                * are big endian.  We want to present all the headers
+                * as big endian, so we have to swap the first
+                * quadlet. */
+               *(u32 *) (ctx->header + i) = __swab32(*(u32 *) (p + 4));
+               memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4);
                i += ctx->base.header_size;
                p += ctx->base.header_size + 4;
        }