Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37299
b: refs/heads/master
c: 9531f13
h: refs/heads/master
i:
  37297: 311fd6c
  37295: 2d33257
v: v3
  • Loading branch information
Stefan Richter committed Sep 17, 2006
1 parent c1a40e6 commit 2324e9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cf82703dc6f8197341ca6be33cd38e80332685f0
refs/heads/master: 9531f13ae56b136d0ad09e6e5c8308a7dc58f3f0
27 changes: 13 additions & 14 deletions trunk/drivers/ieee1394/ohci1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,36 +181,35 @@ static int alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d,
static void ohci1394_pci_remove(struct pci_dev *pdev);

#ifndef __LITTLE_ENDIAN
static unsigned hdr_sizes[] =
{
const static size_t hdr_sizes[] = {
3, /* TCODE_WRITEQ */
4, /* TCODE_WRITEB */
3, /* TCODE_WRITE_RESPONSE */
0, /* ??? */
0, /* reserved */
3, /* TCODE_READQ */
4, /* TCODE_READB */
3, /* TCODE_READQ_RESPONSE */
4, /* TCODE_READB_RESPONSE */
1, /* TCODE_CYCLE_START (???) */
1, /* TCODE_CYCLE_START */
4, /* TCODE_LOCK_REQUEST */
2, /* TCODE_ISO_DATA */
4, /* TCODE_LOCK_RESPONSE */
/* rest is reserved or link-internal */
};

/* Swap headers */
static inline void packet_swab(quadlet_t *data, int tcode)
static inline void header_le32_to_cpu(quadlet_t *data, unsigned char tcode)
{
size_t size = hdr_sizes[tcode];
size_t size;

if (tcode > TCODE_LOCK_RESPONSE || hdr_sizes[tcode] == 0)
if (unlikely(tcode >= ARRAY_SIZE(hdr_sizes)))
return;

size = hdr_sizes[tcode];
while (size--)
data[size] = swab32(data[size]);
data[size] = le32_to_cpu(data[size]);
}
#else
/* Don't waste cycles on same sex byte swaps */
#define packet_swab(w,x) do {} while (0)
#define header_le32_to_cpu(w,x) do {} while (0)
#endif /* !LITTLE_ENDIAN */

/***********************************
Expand Down Expand Up @@ -701,7 +700,7 @@ static void insert_packet(struct ti_ohci *ohci,
d->prg_cpu[idx]->data[2] = packet->header[2];
d->prg_cpu[idx]->data[3] = packet->header[3];
}
packet_swab(d->prg_cpu[idx]->data, packet->tcode);
header_le32_to_cpu(d->prg_cpu[idx]->data, packet->tcode);
}

if (packet->data_size) { /* block transmit */
Expand Down Expand Up @@ -777,7 +776,7 @@ static void insert_packet(struct ti_ohci *ohci,
d->prg_cpu[idx]->data[0] = packet->speed_code<<16 |
(packet->header[0] & 0xFFFF);
d->prg_cpu[idx]->data[1] = packet->header[0] & 0xFFFF0000;
packet_swab(d->prg_cpu[idx]->data, packet->tcode);
header_le32_to_cpu(d->prg_cpu[idx]->data, packet->tcode);

d->prg_cpu[idx]->begin.control =
cpu_to_le32(DMA_CTL_OUTPUT_MORE |
Expand Down Expand Up @@ -2731,7 +2730,7 @@ static void dma_rcv_tasklet (unsigned long data)
* bus reset. We always ignore it. */
if (tcode != OHCI1394_TCODE_PHY) {
if (!ohci->no_swap_incoming)
packet_swab(d->spb, tcode);
header_le32_to_cpu(d->spb, tcode);
DBGMSG("Packet received from node"
" %d ack=0x%02X spd=%d tcode=0x%X"
" length=%d ctx=%d tlabel=%d",
Expand Down

0 comments on commit 2324e9d

Please sign in to comment.