Commit bcb254fc authored by Kai Germaschewski's avatar Kai Germaschewski

Merge linux-isdn@linux-isdn.bkbits.net:linux-2.5.isdn

into tp1.ruhr-uni-bochum.de:/home/kai/kernel/linux-2.5.isdn
parents 7994321a 9f268b87
...@@ -90,9 +90,8 @@ release_io_hfcpci(struct IsdnCardState *cs) ...@@ -90,9 +90,8 @@ release_io_hfcpci(struct IsdnCardState *cs)
pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */ pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
del_timer(&cs->hw.hfcpci.timer); del_timer(&cs->hw.hfcpci.timer);
kfree(cs->hw.hfcpci.share_start); iounmap(cs->hw.hfcpci.pci_io);
cs->hw.hfcpci.share_start = NULL; pci_free_consistent(cs->hw.hfcpci.pdev, 32768, cs->hw.hfcpci.fifos, cs->hw.hfcpci.fifos_dma);
vfree(cs->hw.hfcpci.pci_io);
} }
/********************************************************************************/ /********************************************************************************/
...@@ -244,7 +243,7 @@ static void hfcpci_clear_fifo_rx(struct IsdnCardState *cs, int fifo) ...@@ -244,7 +243,7 @@ static void hfcpci_clear_fifo_rx(struct IsdnCardState *cs, int fifo)
cs->hw.hfcpci.fifo_en ^= fifo_state; cs->hw.hfcpci.fifo_en ^= fifo_state;
Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en); Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
cs->hw.hfcpci.last_bfifo_cnt[fifo] = 0; cs->hw.hfcpci.last_bfifo_cnt[fifo] = 0;
bzr->za[MAX_B_FRAMES].z1 = B_FIFO_SIZE + B_SUB_VAL - 1; bzr->za[MAX_B_FRAMES].z1 = cpu_to_le16(B_FIFO_SIZE + B_SUB_VAL - 1);
bzr->za[MAX_B_FRAMES].z2 = bzr->za[MAX_B_FRAMES].z1; bzr->za[MAX_B_FRAMES].z2 = bzr->za[MAX_B_FRAMES].z1;
bzr->f1 = MAX_B_FRAMES; bzr->f1 = MAX_B_FRAMES;
bzr->f2 = bzr->f1; /* init F pointers to remain constant */ bzr->f2 = bzr->f1; /* init F pointers to remain constant */
...@@ -270,7 +269,7 @@ static void hfcpci_clear_fifo_tx(struct IsdnCardState *cs, int fifo) ...@@ -270,7 +269,7 @@ static void hfcpci_clear_fifo_tx(struct IsdnCardState *cs, int fifo)
if (fifo_state) if (fifo_state)
cs->hw.hfcpci.fifo_en ^= fifo_state; cs->hw.hfcpci.fifo_en ^= fifo_state;
Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en); Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
bzt->za[MAX_B_FRAMES].z1 = B_FIFO_SIZE + B_SUB_VAL - 1; bzt->za[MAX_B_FRAMES].z1 = cpu_to_le16(B_FIFO_SIZE + B_SUB_VAL - 1);
bzt->za[MAX_B_FRAMES].z2 = bzt->za[MAX_B_FRAMES].z1; bzt->za[MAX_B_FRAMES].z2 = bzt->za[MAX_B_FRAMES].z1;
bzt->f1 = MAX_B_FRAMES; bzt->f1 = MAX_B_FRAMES;
bzt->f2 = bzt->f1; /* init F pointers to remain constant */ bzt->f2 = bzt->f1; /* init F pointers to remain constant */
...@@ -298,18 +297,18 @@ hfcpci_empty_fifo(struct BCState *bcs, bzfifo_type * bz, u_char * bdata, int cou ...@@ -298,18 +297,18 @@ hfcpci_empty_fifo(struct BCState *bcs, bzfifo_type * bz, u_char * bdata, int cou
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "hfcpci_empty_fifo"); debugl1(cs, "hfcpci_empty_fifo");
zp = &bz->za[bz->f2]; /* point to Z-Regs */ zp = &bz->za[bz->f2]; /* point to Z-Regs */
new_z2 = zp->z2 + count; /* new position in fifo */ new_z2 = le16_to_cpu(zp->z2) + count; /* new position in fifo */
if (new_z2 >= (B_FIFO_SIZE + B_SUB_VAL)) if (new_z2 >= (B_FIFO_SIZE + B_SUB_VAL))
new_z2 -= B_FIFO_SIZE; /* buffer wrap */ new_z2 -= B_FIFO_SIZE; /* buffer wrap */
new_f2 = (bz->f2 + 1) & MAX_B_FRAMES; new_f2 = (bz->f2 + 1) & MAX_B_FRAMES;
if ((count > HSCX_BUFMAX + 3) || (count < 4) || if ((count > HSCX_BUFMAX + 3) || (count < 4) ||
(*(bdata + (zp->z1 - B_SUB_VAL)))) { (*(bdata + (le16_to_cpu(zp->z1) - B_SUB_VAL)))) {
if (cs->debug & L1_DEB_WARN) if (cs->debug & L1_DEB_WARN)
debugl1(cs, "hfcpci_empty_fifo: incoming packet invalid length %d or crc", count); debugl1(cs, "hfcpci_empty_fifo: incoming packet invalid length %d or crc", count);
#ifdef ERROR_STATISTIC #ifdef ERROR_STATISTIC
bcs->err_inv++; bcs->err_inv++;
#endif #endif
bz->za[new_f2].z2 = new_z2; bz->za[new_f2].z2 = cpu_to_le16(new_z2);
bz->f2 = new_f2; /* next buffer */ bz->f2 = new_f2; /* next buffer */
skb = NULL; skb = NULL;
} else if (!(skb = dev_alloc_skb(count - 3))) } else if (!(skb = dev_alloc_skb(count - 3)))
...@@ -319,12 +318,12 @@ hfcpci_empty_fifo(struct BCState *bcs, bzfifo_type * bz, u_char * bdata, int cou ...@@ -319,12 +318,12 @@ hfcpci_empty_fifo(struct BCState *bcs, bzfifo_type * bz, u_char * bdata, int cou
count -= 3; count -= 3;
ptr = skb_put(skb, count); ptr = skb_put(skb, count);
if (zp->z2 + count <= B_FIFO_SIZE + B_SUB_VAL) if (le16_to_cpu(zp->z2) + count <= B_FIFO_SIZE + B_SUB_VAL)
maxlen = count; /* complete transfer */ maxlen = count; /* complete transfer */
else else
maxlen = B_FIFO_SIZE + B_SUB_VAL - zp->z2; /* maximum */ maxlen = B_FIFO_SIZE + B_SUB_VAL - le16_to_cpu(zp->z2); /* maximum */
ptr1 = bdata + (zp->z2 - B_SUB_VAL); /* start of data */ ptr1 = bdata + (le16_to_cpu(zp->z2) - B_SUB_VAL); /* start of data */
memcpy(ptr, ptr1, maxlen); /* copy data */ memcpy(ptr, ptr1, maxlen); /* copy data */
count -= maxlen; count -= maxlen;
...@@ -333,7 +332,7 @@ hfcpci_empty_fifo(struct BCState *bcs, bzfifo_type * bz, u_char * bdata, int cou ...@@ -333,7 +332,7 @@ hfcpci_empty_fifo(struct BCState *bcs, bzfifo_type * bz, u_char * bdata, int cou
ptr1 = bdata; /* start of buffer */ ptr1 = bdata; /* start of buffer */
memcpy(ptr, ptr1, count); /* rest */ memcpy(ptr, ptr1, count); /* rest */
} }
bz->za[new_f2].z2 = new_z2; bz->za[new_f2].z2 = cpu_to_le16(new_z2);
bz->f2 = new_f2; /* next buffer */ bz->f2 = new_f2; /* next buffer */
} }
...@@ -363,34 +362,34 @@ receive_dmsg(struct IsdnCardState *cs) ...@@ -363,34 +362,34 @@ receive_dmsg(struct IsdnCardState *cs)
} }
while (((df->f1 & D_FREG_MASK) != (df->f2 & D_FREG_MASK)) && count--) { while (((df->f1 & D_FREG_MASK) != (df->f2 & D_FREG_MASK)) && count--) {
zp = &df->za[df->f2 & D_FREG_MASK]; zp = &df->za[df->f2 & D_FREG_MASK];
rcnt = zp->z1 - zp->z2; rcnt = le16_to_cpu(zp->z1) - le16_to_cpu(zp->z2);
if (rcnt < 0) if (rcnt < 0)
rcnt += D_FIFO_SIZE; rcnt += D_FIFO_SIZE;
rcnt++; rcnt++;
if (cs->debug & L1_DEB_ISAC) if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "hfcpci recd f1(%d) f2(%d) z1(%x) z2(%x) cnt(%d)", debugl1(cs, "hfcpci recd f1(%d) f2(%d) z1(%x) z2(%x) cnt(%d)",
df->f1, df->f2, zp->z1, zp->z2, rcnt); df->f1, df->f2, le16_to_cpu(zp->z1), le16_to_cpu(zp->z2), rcnt);
if ((rcnt > MAX_DFRAME_LEN + 3) || (rcnt < 4) || if ((rcnt > MAX_DFRAME_LEN + 3) || (rcnt < 4) ||
(df->data[zp->z1])) { (df->data[le16_to_cpu(zp->z1)])) {
if (cs->debug & L1_DEB_WARN) if (cs->debug & L1_DEB_WARN)
debugl1(cs, "empty_fifo hfcpci paket inv. len %d or crc %d", rcnt, df->data[zp->z1]); debugl1(cs, "empty_fifo hfcpci paket inv. len %d or crc %d", rcnt, df->data[le16_to_cpu(zp->z1)]);
#ifdef ERROR_STATISTIC #ifdef ERROR_STATISTIC
cs->err_rx++; cs->err_rx++;
#endif #endif
df->f2 = ((df->f2 + 1) & MAX_D_FRAMES) | (MAX_D_FRAMES + 1); /* next buffer */ df->f2 = ((df->f2 + 1) & MAX_D_FRAMES) | (MAX_D_FRAMES + 1); /* next buffer */
df->za[df->f2 & D_FREG_MASK].z2 = (zp->z2 + rcnt) & (D_FIFO_SIZE - 1); df->za[df->f2 & D_FREG_MASK].z2 = cpu_to_le16((le16_to_cpu(zp->z2) + rcnt) & (D_FIFO_SIZE - 1));
} else if ((skb = dev_alloc_skb(rcnt - 3))) { } else if ((skb = dev_alloc_skb(rcnt - 3))) {
total = rcnt; total = rcnt;
rcnt -= 3; rcnt -= 3;
ptr = skb_put(skb, rcnt); ptr = skb_put(skb, rcnt);
if (zp->z2 + rcnt <= D_FIFO_SIZE) if ((le16_to_cpu(zp->z2) + rcnt) <= D_FIFO_SIZE)
maxlen = rcnt; /* complete transfer */ maxlen = rcnt; /* complete transfer */
else else
maxlen = D_FIFO_SIZE - zp->z2; /* maximum */ maxlen = D_FIFO_SIZE - le16_to_cpu(zp->z2); /* maximum */
ptr1 = df->data + zp->z2; /* start of data */ ptr1 = df->data + le16_to_cpu(zp->z2); /* start of data */
memcpy(ptr, ptr1, maxlen); /* copy data */ memcpy(ptr, ptr1, maxlen); /* copy data */
rcnt -= maxlen; rcnt -= maxlen;
...@@ -400,7 +399,7 @@ receive_dmsg(struct IsdnCardState *cs) ...@@ -400,7 +399,7 @@ receive_dmsg(struct IsdnCardState *cs)
memcpy(ptr, ptr1, rcnt); /* rest */ memcpy(ptr, ptr1, rcnt); /* rest */
} }
df->f2 = ((df->f2 + 1) & MAX_D_FRAMES) | (MAX_D_FRAMES + 1); /* next buffer */ df->f2 = ((df->f2 + 1) & MAX_D_FRAMES) | (MAX_D_FRAMES + 1); /* next buffer */
df->za[df->f2 & D_FREG_MASK].z2 = (zp->z2 + total) & (D_FIFO_SIZE - 1); df->za[df->f2 & D_FREG_MASK].z2 = cpu_to_le16((le16_to_cpu(zp->z2) + total) & (D_FIFO_SIZE - 1));
skb_queue_tail(&cs->rq, skb); skb_queue_tail(&cs->rq, skb);
sched_event_D_pci(cs, D_RCVBUFREADY); sched_event_D_pci(cs, D_RCVBUFREADY);
...@@ -425,7 +424,7 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata) ...@@ -425,7 +424,7 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata)
z1r = &bz->za[MAX_B_FRAMES].z1; /* pointer to z reg */ z1r = &bz->za[MAX_B_FRAMES].z1; /* pointer to z reg */
z2r = z1r + 1; z2r = z1r + 1;
if (!(fcnt = *z1r - *z2r)) if (!(fcnt = le16_to_cpu(*z1r) - le16_to_cpu(*z2r)))
return (0); /* no data avail */ return (0); /* no data avail */
if (fcnt <= 0) if (fcnt <= 0)
...@@ -433,7 +432,7 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata) ...@@ -433,7 +432,7 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata)
if (fcnt > HFCPCI_BTRANS_THRESHOLD) if (fcnt > HFCPCI_BTRANS_THRESHOLD)
fcnt = HFCPCI_BTRANS_THRESHOLD; /* limit size */ fcnt = HFCPCI_BTRANS_THRESHOLD; /* limit size */
new_z2 = *z2r + fcnt; /* new position in fifo */ new_z2 = le16_to_cpu(*z2r) + fcnt; /* new position in fifo */
if (new_z2 >= (B_FIFO_SIZE + B_SUB_VAL)) if (new_z2 >= (B_FIFO_SIZE + B_SUB_VAL))
new_z2 -= B_FIFO_SIZE; /* buffer wrap */ new_z2 -= B_FIFO_SIZE; /* buffer wrap */
...@@ -441,12 +440,12 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata) ...@@ -441,12 +440,12 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata)
printk(KERN_WARNING "HFCPCI: receive out of memory\n"); printk(KERN_WARNING "HFCPCI: receive out of memory\n");
else { else {
ptr = skb_put(skb, fcnt); ptr = skb_put(skb, fcnt);
if (*z2r + fcnt <= B_FIFO_SIZE + B_SUB_VAL) if (le16_to_cpu(*z2r) + fcnt <= B_FIFO_SIZE + B_SUB_VAL)
maxlen = fcnt; /* complete transfer */ maxlen = fcnt; /* complete transfer */
else else
maxlen = B_FIFO_SIZE + B_SUB_VAL - *z2r; /* maximum */ maxlen = B_FIFO_SIZE + B_SUB_VAL - le16_to_cpu(*z2r); /* maximum */
ptr1 = bdata + (*z2r - B_SUB_VAL); /* start of data */ ptr1 = bdata + (le16_to_cpu(*z2r) - B_SUB_VAL); /* start of data */
memcpy(ptr, ptr1, maxlen); /* copy data */ memcpy(ptr, ptr1, maxlen); /* copy data */
fcnt -= maxlen; fcnt -= maxlen;
...@@ -461,7 +460,7 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata) ...@@ -461,7 +460,7 @@ hfcpci_empty_fifo_trans(struct BCState *bcs, bzfifo_type * bz, u_char * bdata)
hfcpci_sched_event(bcs, B_RCVBUFREADY); hfcpci_sched_event(bcs, B_RCVBUFREADY);
} }
*z2r = new_z2; /* new position */ *z2r = cpu_to_le16(new_z2); /* new position */
return (1); return (1);
} /* hfcpci_empty_fifo_trans */ } /* hfcpci_empty_fifo_trans */
...@@ -506,13 +505,13 @@ main_rec_hfcpci(struct BCState *bcs) ...@@ -506,13 +505,13 @@ main_rec_hfcpci(struct BCState *bcs)
bcs->channel, bz->f1, bz->f2); bcs->channel, bz->f1, bz->f2);
zp = &bz->za[bz->f2]; zp = &bz->za[bz->f2];
rcnt = zp->z1 - zp->z2; rcnt = le16_to_cpu(zp->z1) - le16_to_cpu(zp->z2);
if (rcnt < 0) if (rcnt < 0)
rcnt += B_FIFO_SIZE; rcnt += B_FIFO_SIZE;
rcnt++; rcnt++;
if (cs->debug & L1_DEB_HSCX) if (cs->debug & L1_DEB_HSCX)
debugl1(cs, "hfcpci rec %d z1(%x) z2(%x) cnt(%d)", debugl1(cs, "hfcpci rec %d z1(%x) z2(%x) cnt(%d)",
bcs->channel, zp->z1, zp->z2, rcnt); bcs->channel, le16_to_cpu(zp->z1), le16_to_cpu(zp->z2), rcnt);
if ((skb = hfcpci_empty_fifo(bcs, bz, bdata, rcnt))) { if ((skb = hfcpci_empty_fifo(bcs, bz, bdata, rcnt))) {
cli(); cli();
skb_queue_tail(&bcs->rqueue, skb); skb_queue_tail(&bcs->rqueue, skb);
...@@ -564,7 +563,7 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs) ...@@ -564,7 +563,7 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs)
if (cs->debug & L1_DEB_ISAC) if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "hfcpci_fill_Dfifo f1(%d) f2(%d) z1(f1)(%x)", debugl1(cs, "hfcpci_fill_Dfifo f1(%d) f2(%d) z1(f1)(%x)",
df->f1, df->f2, df->f1, df->f2,
df->za[df->f1 & D_FREG_MASK].z1); le16_to_cpu(df->za[df->f1 & D_FREG_MASK].z1));
fcnt = df->f1 - df->f2; /* frame count actually buffered */ fcnt = df->f1 - df->f2; /* frame count actually buffered */
if (fcnt < 0) if (fcnt < 0)
fcnt += (MAX_D_FRAMES + 1); /* if wrap around */ fcnt += (MAX_D_FRAMES + 1); /* if wrap around */
...@@ -577,7 +576,7 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs) ...@@ -577,7 +576,7 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs)
return; return;
} }
/* now determine free bytes in FIFO buffer */ /* now determine free bytes in FIFO buffer */
count = df->za[df->f1 & D_FREG_MASK].z2 - df->za[df->f1 & D_FREG_MASK].z1; count = le16_to_cpu(df->za[df->f1 & D_FREG_MASK].z2) - le16_to_cpu(df->za[df->f1 & D_FREG_MASK].z1);
if (count <= 0) if (count <= 0)
count += D_FIFO_SIZE; /* count now contains available bytes */ count += D_FIFO_SIZE; /* count now contains available bytes */
...@@ -590,11 +589,11 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs) ...@@ -590,11 +589,11 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs)
return; return;
} }
count = cs->tx_skb->len; /* get frame len */ count = cs->tx_skb->len; /* get frame len */
new_z1 = (df->za[df->f1 & D_FREG_MASK].z1 + count) & (D_FIFO_SIZE - 1); new_z1 = (le16_to_cpu(df->za[df->f1 & D_FREG_MASK].z1) + count) & (D_FIFO_SIZE - 1);
new_f1 = ((df->f1 + 1) & D_FREG_MASK) | (D_FREG_MASK + 1); new_f1 = ((df->f1 + 1) & D_FREG_MASK) | (D_FREG_MASK + 1);
src = cs->tx_skb->data; /* source pointer */ src = cs->tx_skb->data; /* source pointer */
dst = df->data + df->za[df->f1 & D_FREG_MASK].z1; dst = df->data + le16_to_cpu(df->za[df->f1 & D_FREG_MASK].z1);
maxlen = D_FIFO_SIZE - df->za[df->f1 & D_FREG_MASK].z1; /* end fifo */ maxlen = D_FIFO_SIZE - le16_to_cpu(df->za[df->f1 & D_FREG_MASK].z1); /* end fifo */
if (maxlen > count) if (maxlen > count)
maxlen = count; /* limit size */ maxlen = count; /* limit size */
memcpy(dst, src, maxlen); /* first copy */ memcpy(dst, src, maxlen); /* first copy */
...@@ -607,8 +606,8 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs) ...@@ -607,8 +606,8 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs)
} }
save_flags(flags); save_flags(flags);
cli(); cli();
df->za[new_f1 & D_FREG_MASK].z1 = new_z1; /* for next buffer */ df->za[new_f1 & D_FREG_MASK].z1 = cpu_to_le16(new_z1); /* for next buffer */
df->za[df->f1 & D_FREG_MASK].z1 = new_z1; /* new pos actual buffer */ df->za[df->f1 & D_FREG_MASK].z1 = cpu_to_le16(new_z1); /* new pos actual buffer */
df->f1 = new_f1; /* next frame */ df->f1 = new_f1; /* next frame */
restore_flags(flags); restore_flags(flags);
...@@ -653,8 +652,8 @@ hfcpci_fill_fifo(struct BCState *bcs) ...@@ -653,8 +652,8 @@ hfcpci_fill_fifo(struct BCState *bcs)
z2t = z1t + 1; z2t = z1t + 1;
if (cs->debug & L1_DEB_HSCX) if (cs->debug & L1_DEB_HSCX)
debugl1(cs, "hfcpci_fill_fifo_trans %d z1(%x) z2(%x)", debugl1(cs, "hfcpci_fill_fifo_trans %d z1(%x) z2(%x)",
bcs->channel, *z1t, *z2t); bcs->channel, le16_to_cpu(*z1t), le16_to_cpu(*z2t));
fcnt = *z2t - *z1t; fcnt = le16_to_cpu(*z2t) - le16_to_cpu(*z1t);
if (fcnt <= 0) if (fcnt <= 0)
fcnt += B_FIFO_SIZE; /* fcnt contains available bytes in fifo */ fcnt += B_FIFO_SIZE; /* fcnt contains available bytes in fifo */
fcnt = B_FIFO_SIZE - fcnt; /* remaining bytes to send */ fcnt = B_FIFO_SIZE - fcnt; /* remaining bytes to send */
...@@ -664,12 +663,12 @@ hfcpci_fill_fifo(struct BCState *bcs) ...@@ -664,12 +663,12 @@ hfcpci_fill_fifo(struct BCState *bcs)
/* data is suitable for fifo */ /* data is suitable for fifo */
count = bcs->tx_skb->len; count = bcs->tx_skb->len;
new_z1 = *z1t + count; /* new buffer Position */ new_z1 = le16_to_cpu(*z1t) + count; /* new buffer Position */
if (new_z1 >= (B_FIFO_SIZE + B_SUB_VAL)) if (new_z1 >= (B_FIFO_SIZE + B_SUB_VAL))
new_z1 -= B_FIFO_SIZE; /* buffer wrap */ new_z1 -= B_FIFO_SIZE; /* buffer wrap */
src = bcs->tx_skb->data; /* source pointer */ src = bcs->tx_skb->data; /* source pointer */
dst = bdata + (*z1t - B_SUB_VAL); dst = bdata + (le16_to_cpu(*z1t) - B_SUB_VAL);
maxlen = (B_FIFO_SIZE + B_SUB_VAL) - *z1t; /* end of fifo */ maxlen = (B_FIFO_SIZE + B_SUB_VAL) - le16_to_cpu(*z1t); /* end of fifo */
if (maxlen > count) if (maxlen > count)
maxlen = count; /* limit size */ maxlen = count; /* limit size */
memcpy(dst, src, maxlen); /* first copy */ memcpy(dst, src, maxlen); /* first copy */
...@@ -682,7 +681,7 @@ hfcpci_fill_fifo(struct BCState *bcs) ...@@ -682,7 +681,7 @@ hfcpci_fill_fifo(struct BCState *bcs)
} }
bcs->tx_cnt -= bcs->tx_skb->len; bcs->tx_cnt -= bcs->tx_skb->len;
fcnt += bcs->tx_skb->len; fcnt += bcs->tx_skb->len;
*z1t = new_z1; /* now send data */ *z1t = cpu_to_le16(new_z1); /* now send data */
} else if (cs->debug & L1_DEB_HSCX) } else if (cs->debug & L1_DEB_HSCX)
debugl1(cs, "hfcpci_fill_fifo_trans %d frame length %d discarded", debugl1(cs, "hfcpci_fill_fifo_trans %d frame length %d discarded",
bcs->channel, bcs->tx_skb->len); bcs->channel, bcs->tx_skb->len);
...@@ -699,7 +698,7 @@ hfcpci_fill_fifo(struct BCState *bcs) ...@@ -699,7 +698,7 @@ hfcpci_fill_fifo(struct BCState *bcs)
if (cs->debug & L1_DEB_HSCX) if (cs->debug & L1_DEB_HSCX)
debugl1(cs, "hfcpci_fill_fifo_hdlc %d f1(%d) f2(%d) z1(f1)(%x)", debugl1(cs, "hfcpci_fill_fifo_hdlc %d f1(%d) f2(%d) z1(f1)(%x)",
bcs->channel, bz->f1, bz->f2, bcs->channel, bz->f1, bz->f2,
bz->za[bz->f1].z1); le16_to_cpu(bz->za[bz->f1].z1));
fcnt = bz->f1 - bz->f2; /* frame count actually buffered */ fcnt = bz->f1 - bz->f2; /* frame count actually buffered */
if (fcnt < 0) if (fcnt < 0)
...@@ -711,7 +710,7 @@ hfcpci_fill_fifo(struct BCState *bcs) ...@@ -711,7 +710,7 @@ hfcpci_fill_fifo(struct BCState *bcs)
return; return;
} }
/* now determine free bytes in FIFO buffer */ /* now determine free bytes in FIFO buffer */
count = bz->za[bz->f1].z2 - bz->za[bz->f1].z1; count = le16_to_cpu(bz->za[bz->f1].z2) - le16_to_cpu(bz->za[bz->f1].z1);
if (count <= 0) if (count <= 0)
count += B_FIFO_SIZE; /* count now contains available bytes */ count += B_FIFO_SIZE; /* count now contains available bytes */
...@@ -727,14 +726,14 @@ hfcpci_fill_fifo(struct BCState *bcs) ...@@ -727,14 +726,14 @@ hfcpci_fill_fifo(struct BCState *bcs)
return; return;
} }
count = bcs->tx_skb->len; /* get frame len */ count = bcs->tx_skb->len; /* get frame len */
new_z1 = bz->za[bz->f1].z1 + count; /* new buffer Position */ new_z1 = le16_to_cpu(bz->za[bz->f1].z1) + count; /* new buffer Position */
if (new_z1 >= (B_FIFO_SIZE + B_SUB_VAL)) if (new_z1 >= (B_FIFO_SIZE + B_SUB_VAL))
new_z1 -= B_FIFO_SIZE; /* buffer wrap */ new_z1 -= B_FIFO_SIZE; /* buffer wrap */
new_f1 = ((bz->f1 + 1) & MAX_B_FRAMES); new_f1 = ((bz->f1 + 1) & MAX_B_FRAMES);
src = bcs->tx_skb->data; /* source pointer */ src = bcs->tx_skb->data; /* source pointer */
dst = bdata + (bz->za[bz->f1].z1 - B_SUB_VAL); dst = bdata + (le16_to_cpu(bz->za[bz->f1].z1) - B_SUB_VAL);
maxlen = (B_FIFO_SIZE + B_SUB_VAL) - bz->za[bz->f1].z1; /* end fifo */ maxlen = (B_FIFO_SIZE + B_SUB_VAL) - le16_to_cpu(bz->za[bz->f1].z1); /* end fifo */
if (maxlen > count) if (maxlen > count)
maxlen = count; /* limit size */ maxlen = count; /* limit size */
memcpy(dst, src, maxlen); /* first copy */ memcpy(dst, src, maxlen); /* first copy */
...@@ -751,7 +750,7 @@ hfcpci_fill_fifo(struct BCState *bcs) ...@@ -751,7 +750,7 @@ hfcpci_fill_fifo(struct BCState *bcs)
bcs->st->lli.l1writewakeup(bcs->st, bcs->tx_skb->len); bcs->st->lli.l1writewakeup(bcs->st, bcs->tx_skb->len);
cli(); cli();
bz->za[new_f1].z1 = new_z1; /* for next buffer */ bz->za[new_f1].z1 = cpu_to_le16(new_z1); /* for next buffer */
bz->f1 = new_f1; /* next frame */ bz->f1 = new_f1; /* next frame */
restore_flags(flags); restore_flags(flags);
...@@ -892,34 +891,34 @@ receive_emsg(struct IsdnCardState *cs) ...@@ -892,34 +891,34 @@ receive_emsg(struct IsdnCardState *cs)
bz->f1, bz->f2); bz->f1, bz->f2);
zp = &bz->za[bz->f2]; zp = &bz->za[bz->f2];
rcnt = zp->z1 - zp->z2; rcnt = le16_to_cpu(zp->z1) - le16_to_cpu(zp->z2);
if (rcnt < 0) if (rcnt < 0)
rcnt += B_FIFO_SIZE; rcnt += B_FIFO_SIZE;
rcnt++; rcnt++;
if (cs->debug & L1_DEB_ISAC) if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "hfcpci e_rec z1(%x) z2(%x) cnt(%d)", debugl1(cs, "hfcpci e_rec z1(%x) z2(%x) cnt(%d)",
zp->z1, zp->z2, rcnt); le16_to_cpu(zp->z1), le16_to_cpu(zp->z2), rcnt);
new_z2 = zp->z2 + rcnt; /* new position in fifo */ new_z2 = le16_to_cpu(zp->z2) + rcnt; /* new position in fifo */
if (new_z2 >= (B_FIFO_SIZE + B_SUB_VAL)) if (new_z2 >= (B_FIFO_SIZE + B_SUB_VAL))
new_z2 -= B_FIFO_SIZE; /* buffer wrap */ new_z2 -= B_FIFO_SIZE; /* buffer wrap */
new_f2 = (bz->f2 + 1) & MAX_B_FRAMES; new_f2 = (bz->f2 + 1) & MAX_B_FRAMES;
if ((rcnt > 256 + 3) || (count < 4) || if ((rcnt > 256 + 3) || (count < 4) ||
(*(bdata + (zp->z1 - B_SUB_VAL)))) { (*(bdata + (le16_to_cpu(zp->z1) - B_SUB_VAL)))) {
if (cs->debug & L1_DEB_WARN) if (cs->debug & L1_DEB_WARN)
debugl1(cs, "hfcpci_empty_echan: incoming packet invalid length %d or crc", rcnt); debugl1(cs, "hfcpci_empty_echan: incoming packet invalid length %d or crc", rcnt);
bz->za[new_f2].z2 = new_z2; bz->za[new_f2].z2 = cpu_to_le16(new_z2);
bz->f2 = new_f2; /* next buffer */ bz->f2 = new_f2; /* next buffer */
} else { } else {
total = rcnt; total = rcnt;
rcnt -= 3; rcnt -= 3;
ptr = e_buffer; ptr = e_buffer;
if (zp->z2 <= B_FIFO_SIZE + B_SUB_VAL) if (le16_to_cpu(zp->z2) <= (B_FIFO_SIZE + B_SUB_VAL))
maxlen = rcnt; /* complete transfer */ maxlen = rcnt; /* complete transfer */
else else
maxlen = B_FIFO_SIZE + B_SUB_VAL - zp->z2; /* maximum */ maxlen = B_FIFO_SIZE + B_SUB_VAL - le16_to_cpu(zp->z2); /* maximum */
ptr1 = bdata + (zp->z2 - B_SUB_VAL); /* start of data */ ptr1 = bdata + (le16_to_cpu(zp->z2) - B_SUB_VAL); /* start of data */
memcpy(ptr, ptr1, maxlen); /* copy data */ memcpy(ptr, ptr1, maxlen); /* copy data */
rcnt -= maxlen; rcnt -= maxlen;
...@@ -928,7 +927,7 @@ receive_emsg(struct IsdnCardState *cs) ...@@ -928,7 +927,7 @@ receive_emsg(struct IsdnCardState *cs)
ptr1 = bdata; /* start of buffer */ ptr1 = bdata; /* start of buffer */
memcpy(ptr, ptr1, rcnt); /* rest */ memcpy(ptr, ptr1, rcnt); /* rest */
} }
bz->za[new_f2].z2 = new_z2; bz->za[new_f2].z2 = cpu_to_le16(new_z2);
bz->f2 = new_f2; /* next buffer */ bz->f2 = new_f2; /* next buffer */
if (cs->debug & DEB_DLOG_HEX) { if (cs->debug & DEB_DLOG_HEX) {
ptr = cs->dlog; ptr = cs->dlog;
...@@ -1688,9 +1687,6 @@ setup_hfcpci(struct IsdnCard *card) ...@@ -1688,9 +1687,6 @@ setup_hfcpci(struct IsdnCard *card)
int i; int i;
struct pci_dev *tmp_hfcpci = NULL; struct pci_dev *tmp_hfcpci = NULL;
#ifdef __BIG_ENDIAN
#error "not running on big endian machines now"
#endif
strcpy(tmp, hfcpci_revision); strcpy(tmp, hfcpci_revision);
printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp)); printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
#if CONFIG_PCI #if CONFIG_PCI
...@@ -1721,6 +1717,7 @@ setup_hfcpci(struct IsdnCard *card) ...@@ -1721,6 +1717,7 @@ setup_hfcpci(struct IsdnCard *card)
cs->hw.hfcpci.pci_bus = dev_hfcpci->bus->number; cs->hw.hfcpci.pci_bus = dev_hfcpci->bus->number;
cs->hw.hfcpci.pci_device_fn = dev_hfcpci->devfn; cs->hw.hfcpci.pci_device_fn = dev_hfcpci->devfn;
cs->irq = dev_hfcpci->irq; cs->irq = dev_hfcpci->irq;
cs->hw.hfcpci.pdev = tmp_hfcpci;
if (!cs->irq) { if (!cs->irq) {
printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n"); printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n");
return (0); return (0);
...@@ -1738,22 +1735,22 @@ setup_hfcpci(struct IsdnCard *card) ...@@ -1738,22 +1735,22 @@ setup_hfcpci(struct IsdnCard *card)
/* Allocate memory for FIFOS */ /* Allocate memory for FIFOS */
/* Because the HFC-PCI needs a 32K physical alignment, we */ /* Because the HFC-PCI needs a 32K physical alignment, we */
/* need to allocate the double mem and align the address */ /* need to allocate the double mem and align the address */
if (!((void *) cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) { cs->hw.hfcpci.fifos = pci_alloc_consistent(tmp_hfcpci, 32768, &cs->hw.hfcpci.fifos_dma);
if (!cs->hw.hfcpci.fifos) {
printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n"); printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
return 0; return 0;
} }
(ulong) cs->hw.hfcpci.fifos =
(((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
pcibios_write_config_dword(cs->hw.hfcpci.pci_bus, pcibios_write_config_dword(cs->hw.hfcpci.pci_bus,
cs->hw.hfcpci.pci_device_fn, 0x80, cs->hw.hfcpci.pci_device_fn, 0x80,
(u_int) virt_to_bus(cs->hw.hfcpci.fifos)); (u_int)cs->hw.hfcpci.fifos_dma);
cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256); cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
printk(KERN_INFO printk(KERN_INFO
"HFC-PCI: defined at mem %#x fifo %#x(%#x) IRQ %d HZ %d\n", "HFC-PCI: defined at mem %#x fifo %#x(%#x) IRQ %d HZ %d\n",
(u_int) cs->hw.hfcpci.pci_io, (u_int) cs->hw.hfcpci.pci_io,
(u_int) cs->hw.hfcpci.fifos, (u_int) cs->hw.hfcpci.fifos,
(u_int) virt_to_bus(cs->hw.hfcpci.fifos), (u_int) cs->hw.hfcpci.fifos_dma,
cs->irq, HZ); cs->irq, HZ);
printk("ChipID: %x\n", Read_hfc(cs, HFCPCI_CHIP_ID));
pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, PCI_ENA_MEMIO); /* enable memory mapped ports, disable busmaster */ pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, PCI_ENA_MEMIO); /* enable memory mapped ports, disable busmaster */
cs->hw.hfcpci.int_m2 = 0; /* disable alle interrupts */ cs->hw.hfcpci.int_m2 = 0; /* disable alle interrupts */
cs->hw.hfcpci.int_m1 = 0; cs->hw.hfcpci.int_m1 = 0;
......
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
typedef struct { typedef struct {
unsigned short z1; /* Z1 pointer 16 Bit */ unsigned short z1; /* Z1 pointer 16 Bit */
unsigned short z2; /* Z2 pointer 16 Bit */ unsigned short z2; /* Z2 pointer 16 Bit */
} z_type; } __attribute__((packed)) z_type;
typedef struct { typedef struct {
u_char data[D_FIFO_SIZE]; /* FIFO data space */ u_char data[D_FIFO_SIZE]; /* FIFO data space */
...@@ -194,20 +194,20 @@ typedef struct { ...@@ -194,20 +194,20 @@ typedef struct {
u_char fill2[0x20C0-0x20A2]; /* reserved, do not use */ u_char fill2[0x20C0-0x20A2]; /* reserved, do not use */
z_type za[MAX_D_FRAMES+1]; /* mask index with D_FREG_MASK for access */ z_type za[MAX_D_FRAMES+1]; /* mask index with D_FREG_MASK for access */
u_char fill3[0x4000-0x2100]; /* align 16K */ u_char fill3[0x4000-0x2100]; /* align 16K */
} dfifo_type; } __attribute__((packed)) dfifo_type;
typedef struct { typedef struct {
z_type za[MAX_B_FRAMES+1]; /* only range 0x0..0x1F allowed */ z_type za[MAX_B_FRAMES+1]; /* only range 0x0..0x1F allowed */
u_char f1,f2; /* f pointers */ u_char f1,f2; /* f pointers */
u_char fill[0x2100-0x2082]; /* alignment */ u_char fill[0x2100-0x2082]; /* alignment */
} bzfifo_type; } __attribute__((packed)) bzfifo_type;
typedef union { typedef union {
struct { struct {
dfifo_type d_tx; /* D-send channel */ dfifo_type d_tx; /* D-send channel */
dfifo_type d_rx; /* D-receive channel */ dfifo_type d_rx; /* D-receive channel */
} d_chan; } __attribute__((packed)) d_chan;
struct { struct {
u_char fill1[0x200]; u_char fill1[0x200];
u_char txdat_b1[B_FIFO_SIZE]; u_char txdat_b1[B_FIFO_SIZE];
...@@ -223,13 +223,15 @@ typedef union { ...@@ -223,13 +223,15 @@ typedef union {
bzfifo_type rxbz_b2; bzfifo_type rxbz_b2;
u_char rxdat_b2[B_FIFO_SIZE]; u_char rxdat_b2[B_FIFO_SIZE];
} b_chans; } __attribute__((packed)) b_chans;
u_char fill[32768]; u_char fill[32768];
} fifo_area; } __attribute__((packed)) fifo_area;
#define Write_hfc(a,b,c) (*(((u_char *)a->hw.hfcpci.pci_io)+b) = c) //#define Write_hfc(a,b,c) (*(((u_char *)a->hw.hfcpci.pci_io)+b) = c)
#define Read_hfc(a,b) (*(((u_char *)a->hw.hfcpci.pci_io)+b)) //#define Read_hfc(a,b) (*(((u_char *)a->hw.hfcpci.pci_io)+b))
#define Write_hfc(a,b,c) writeb(c, ((u_char *)a->hw.hfcpci.pci_io)+b)
#define Read_hfc(a,b) readb(((u_char *)a->hw.hfcpci.pci_io)+b)
extern void main_irq_hcpci(struct BCState *bcs); extern void main_irq_hcpci(struct BCState *bcs);
extern void inithfcpci(struct IsdnCardState *cs); extern void inithfcpci(struct IsdnCardState *cs);
......
...@@ -422,10 +422,11 @@ struct hfcB_hw { ...@@ -422,10 +422,11 @@ struct hfcB_hw {
struct tiger_hw { struct tiger_hw {
u_int *send; u_int *send;
u_int *s_irq; dma_addr_t send_dma;
u_int *s_end; u_int *s_end;
u_int *sendp; u_int *sendp;
u_int *rec; u_int *rec;
dma_addr_t rec_dma;
int free; int free;
u_char *rcvbuf; u_char *rcvbuf;
u_char *sendbuf; u_char *sendbuf;
...@@ -660,6 +661,7 @@ struct njet_hw { ...@@ -660,6 +661,7 @@ struct njet_hw {
unsigned char irqmask0; unsigned char irqmask0;
unsigned char irqstat0; unsigned char irqstat0;
unsigned char last_is0; unsigned char last_is0;
struct pci_dev *pdev;
}; };
struct hfcPCI_hw { struct hfcPCI_hw {
...@@ -683,8 +685,9 @@ struct hfcPCI_hw { ...@@ -683,8 +685,9 @@ struct hfcPCI_hw {
unsigned char pci_bus; unsigned char pci_bus;
unsigned char pci_device_fn; unsigned char pci_device_fn;
unsigned char *pci_io; /* start of PCI IO memory */ unsigned char *pci_io; /* start of PCI IO memory */
void *share_start; /* shared memory for Fifos start */
void *fifos; /* FIFO memory */ void *fifos; /* FIFO memory */
dma_addr_t fifos_dma;
struct pci_dev* pdev;
int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */ int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
struct timer_list timer; struct timer_list timer;
}; };
......
...@@ -659,7 +659,9 @@ void netjet_fill_dma(struct BCState *bcs) ...@@ -659,7 +659,9 @@ void netjet_fill_dma(struct BCState *bcs)
if (test_and_clear_bit(BC_FLG_NOFRAME, &bcs->Flag)) { if (test_and_clear_bit(BC_FLG_NOFRAME, &bcs->Flag)) {
write_raw(bcs, bcs->hw.tiger.sendp, bcs->hw.tiger.free); write_raw(bcs, bcs->hw.tiger.sendp, bcs->hw.tiger.free);
} else if (test_and_clear_bit(BC_FLG_HALF, &bcs->Flag)) { } else if (test_and_clear_bit(BC_FLG_HALF, &bcs->Flag)) {
p = bus_to_virt(inl(bcs->cs->hw.njet.base + NETJET_DMA_READ_ADR)); p = inl(bcs->cs->hw.njet.base + NETJET_DMA_READ_ADR)
- bcs->hw.tiger.send_dma
+ bcs->hw.tiger.send;
sp = bcs->hw.tiger.sendp; sp = bcs->hw.tiger.sendp;
if (p == bcs->hw.tiger.s_end) if (p == bcs->hw.tiger.s_end)
p = bcs->hw.tiger.send -1; p = bcs->hw.tiger.send -1;
...@@ -680,7 +682,9 @@ void netjet_fill_dma(struct BCState *bcs) ...@@ -680,7 +682,9 @@ void netjet_fill_dma(struct BCState *bcs)
write_raw(bcs, p, bcs->hw.tiger.free - cnt); write_raw(bcs, p, bcs->hw.tiger.free - cnt);
} }
} else if (test_and_clear_bit(BC_FLG_EMPTY, &bcs->Flag)) { } else if (test_and_clear_bit(BC_FLG_EMPTY, &bcs->Flag)) {
p = bus_to_virt(inl(bcs->cs->hw.njet.base + NETJET_DMA_READ_ADR)); p = inl(bcs->cs->hw.njet.base + NETJET_DMA_READ_ADR)
- bcs->hw.tiger.send_dma
+ bcs->hw.tiger.send;
cnt = bcs->hw.tiger.s_end - p; cnt = bcs->hw.tiger.s_end - p;
if (cnt < 2) { if (cnt < 2) {
p = bcs->hw.tiger.send + 1; p = bcs->hw.tiger.send + 1;
...@@ -935,29 +939,36 @@ setstack_tiger(struct PStack *st, struct BCState *bcs) ...@@ -935,29 +939,36 @@ setstack_tiger(struct PStack *st, struct BCState *bcs)
void __init void __init
inittiger(struct IsdnCardState *cs) inittiger(struct IsdnCardState *cs)
{ {
if (!(cs->bcs[0].hw.tiger.send = kmalloc(NETJET_DMA_TXSIZE * sizeof(unsigned int), cs->bcs[0].hw.tiger.send =
GFP_KERNEL | GFP_DMA))) { pci_alloc_consistent(cs->hw.njet.pdev,
NETJET_DMA_TXSIZE * sizeof(unsigned int),
&cs->bcs[0].hw.tiger.send_dma);
if (!cs->bcs[0].hw.tiger.send) {
printk(KERN_WARNING printk(KERN_WARNING
"HiSax: No memory for tiger.send\n"); "HiSax: No memory for tiger.send\n");
return; return;
} }
cs->bcs[0].hw.tiger.s_irq = cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE/2 - 1;
cs->bcs[0].hw.tiger.s_end = cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1; cs->bcs[0].hw.tiger.s_end = cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1;
cs->bcs[1].hw.tiger.send = cs->bcs[0].hw.tiger.send; cs->bcs[1].hw.tiger.send = cs->bcs[0].hw.tiger.send;
cs->bcs[1].hw.tiger.s_irq = cs->bcs[0].hw.tiger.s_irq; cs->bcs[1].hw.tiger.send_dma = cs->bcs[0].hw.tiger.send_dma;
cs->bcs[1].hw.tiger.s_end = cs->bcs[0].hw.tiger.s_end; cs->bcs[1].hw.tiger.s_end = cs->bcs[0].hw.tiger.s_end;
memset(cs->bcs[0].hw.tiger.send, 0xff, NETJET_DMA_TXSIZE * sizeof(unsigned int)); memset(cs->bcs[0].hw.tiger.send, 0xff, NETJET_DMA_TXSIZE * sizeof(unsigned int));
debugl1(cs, "tiger: send buf %x - %x", (u_int)cs->bcs[0].hw.tiger.send, debugl1(cs, "tiger: send buf %x - %x", (u_int)cs->bcs[0].hw.tiger.send,
(u_int)(cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1)); (u_int)(cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1));
outl(virt_to_bus(cs->bcs[0].hw.tiger.send), outl(cs->bcs[0].hw.tiger.send_dma,
cs->hw.njet.base + NETJET_DMA_READ_START); cs->hw.njet.base + NETJET_DMA_READ_START);
outl(virt_to_bus(cs->bcs[0].hw.tiger.s_irq), outl(cs->bcs[0].hw.tiger.send_dma + NETJET_DMA_TXSIZE/2 - 1,
cs->hw.njet.base + NETJET_DMA_READ_IRQ); cs->hw.njet.base + NETJET_DMA_READ_IRQ);
outl(virt_to_bus(cs->bcs[0].hw.tiger.s_end), outl(cs->bcs[0].hw.tiger.send_dma + NETJET_DMA_TXSIZE - 1,
cs->hw.njet.base + NETJET_DMA_READ_END); cs->hw.njet.base + NETJET_DMA_READ_END);
if (!(cs->bcs[0].hw.tiger.rec = kmalloc(NETJET_DMA_RXSIZE * sizeof(unsigned int),
GFP_KERNEL | GFP_DMA))) { cs->bcs[0].hw.tiger.rec =
pci_alloc_consistent(cs->hw.njet.pdev,
NETJET_DMA_RXSIZE * sizeof(unsigned int),
&cs->bcs[0].hw.tiger.rec_dma);
if (!cs->bcs[0].hw.tiger.rec) {
printk(KERN_WARNING printk(KERN_WARNING
"HiSax: No memory for tiger.rec\n"); "HiSax: No memory for tiger.rec\n");
return; return;
...@@ -965,12 +976,13 @@ inittiger(struct IsdnCardState *cs) ...@@ -965,12 +976,13 @@ inittiger(struct IsdnCardState *cs)
debugl1(cs, "tiger: rec buf %x - %x", (u_int)cs->bcs[0].hw.tiger.rec, debugl1(cs, "tiger: rec buf %x - %x", (u_int)cs->bcs[0].hw.tiger.rec,
(u_int)(cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1)); (u_int)(cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1));
cs->bcs[1].hw.tiger.rec = cs->bcs[0].hw.tiger.rec; cs->bcs[1].hw.tiger.rec = cs->bcs[0].hw.tiger.rec;
cs->bcs[1].hw.tiger.rec_dma = cs->bcs[0].hw.tiger.rec_dma;
memset(cs->bcs[0].hw.tiger.rec, 0xff, NETJET_DMA_RXSIZE * sizeof(unsigned int)); memset(cs->bcs[0].hw.tiger.rec, 0xff, NETJET_DMA_RXSIZE * sizeof(unsigned int));
outl(virt_to_bus(cs->bcs[0].hw.tiger.rec), outl(cs->bcs[0].hw.tiger.rec_dma,
cs->hw.njet.base + NETJET_DMA_WRITE_START); cs->hw.njet.base + NETJET_DMA_WRITE_START);
outl(virt_to_bus(cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE/2 - 1), outl(cs->bcs[0].hw.tiger.rec_dma + NETJET_DMA_RXSIZE/2 - 1,
cs->hw.njet.base + NETJET_DMA_WRITE_IRQ); cs->hw.njet.base + NETJET_DMA_WRITE_IRQ);
outl(virt_to_bus(cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1), outl(cs->bcs[0].hw.tiger.rec_dma + NETJET_DMA_RXSIZE - 1,
cs->hw.njet.base + NETJET_DMA_WRITE_END); cs->hw.njet.base + NETJET_DMA_WRITE_END);
debugl1(cs, "tiger: dmacfg %x/%x pulse=%d", debugl1(cs, "tiger: dmacfg %x/%x pulse=%d",
inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR), inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR),
...@@ -987,14 +999,20 @@ void ...@@ -987,14 +999,20 @@ void
releasetiger(struct IsdnCardState *cs) releasetiger(struct IsdnCardState *cs)
{ {
if (cs->bcs[0].hw.tiger.send) { if (cs->bcs[0].hw.tiger.send) {
kfree(cs->bcs[0].hw.tiger.send); pci_free_consistent(cs->hw.njet.pdev,
NETJET_DMA_TXSIZE * sizeof(unsigned int),
cs->bcs[0].hw.tiger.send,
cs->bcs[0].hw.tiger.send_dma);
cs->bcs[0].hw.tiger.send = NULL; cs->bcs[0].hw.tiger.send = NULL;
} }
if (cs->bcs[1].hw.tiger.send) { if (cs->bcs[1].hw.tiger.send) {
cs->bcs[1].hw.tiger.send = NULL; cs->bcs[1].hw.tiger.send = NULL;
} }
if (cs->bcs[0].hw.tiger.rec) { if (cs->bcs[0].hw.tiger.rec) {
kfree(cs->bcs[0].hw.tiger.rec); pci_free_consistent(cs->hw.njet.pdev,
NETJET_DMA_RXSIZE * sizeof(unsigned int),
cs->bcs[0].hw.tiger.rec,
cs->bcs[0].hw.tiger.rec_dma);
cs->bcs[0].hw.tiger.rec = NULL; cs->bcs[0].hw.tiger.rec = NULL;
} }
if (cs->bcs[1].hw.tiger.rec) { if (cs->bcs[1].hw.tiger.rec) {
......
...@@ -184,6 +184,7 @@ setup_netjet_s(struct IsdnCard *card) ...@@ -184,6 +184,7 @@ setup_netjet_s(struct IsdnCard *card)
printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n"); printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n");
return(0); return(0);
} }
cs->hw.njet.pdev = dev_netjet;
} else { } else {
printk(KERN_WARNING "NETjet-S: No PCI card found\n"); printk(KERN_WARNING "NETjet-S: No PCI card found\n");
return(0); return(0);
......
...@@ -186,6 +186,7 @@ setup_netjet_u(struct IsdnCard *card) ...@@ -186,6 +186,7 @@ setup_netjet_u(struct IsdnCard *card)
printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n"); printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n");
return(0); return(0);
} }
cs->hw.njet.pdev = dev_netjet;
} else { } else {
printk(KERN_WARNING "NETspider-U: No PCI card found\n"); printk(KERN_WARNING "NETspider-U: No PCI card found\n");
return(0); return(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment