patch-2.1.53 linux/drivers/net/myri_sbus.c
Next file: linux/drivers/net/slip.c
Previous file: linux/drivers/net/ibmtr.c
Back to the patch index
Back to the overall index
- Lines: 138
- Date:
Thu Sep 4 13:25:28 1997
- Orig file:
v2.1.52/linux/drivers/net/myri_sbus.c
- Orig date:
Mon Aug 4 16:25:37 1997
diff -u --recursive --new-file v2.1.52/linux/drivers/net/myri_sbus.c linux/drivers/net/myri_sbus.c
@@ -19,7 +19,9 @@
#include <linux/in.h>
#include <linux/malloc.h>
#include <linux/string.h>
+#include <linux/delay.h>
#include <linux/init.h>
+
#include <asm/system.h>
#include <asm/bitops.h>
#include <asm/io.h>
@@ -34,6 +36,7 @@
#include <asm/auxio.h>
#include <asm/system.h>
#include <asm/pgtable.h>
+#include <asm/irq.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
@@ -275,7 +278,7 @@
mp->rx_skbs[i] = skb;
skb->dev = dev;
skb_put(skb, RX_ALLOC_SIZE);
- rxd[i].myri_scatters[0].addr = (unsigned long) skb->data;
+ rxd[i].myri_scatters[0].addr = (u32) ((unsigned long)skb->data);
rxd[i].myri_scatters[0].len = RX_ALLOC_SIZE;
rxd[i].ctx = i;
rxd[i].num_sg = 1;
@@ -338,6 +341,11 @@
mp->tx_skbs[entry] = NULL;
mp->enet_stats.tx_packets++;
+#ifdef NEED_DMA_SYNCHRONIZATION
+ mmu_sync_dma(((u32)((unsigned long)skb->data)),
+ skb->len, mp->myri_sbus_dev->my_bus);
+#endif
+
entry = NEXT_TX(entry);
}
mp->tx_old = entry;
@@ -429,7 +437,8 @@
drops++;
DRX(("DROP "));
mp->enet_stats.rx_dropped++;
- rxd->myri_scatters[0].addr = (unsigned long) skb->data;
+ rxd->myri_scatters[0].addr =
+ (u32) ((unsigned long)skb->data);
rxd->myri_scatters[0].len = RX_ALLOC_SIZE;
rxd->ctx = index;
rxd->num_sg = 1;
@@ -437,6 +446,11 @@
goto next;
}
+#ifdef NEED_DMA_SYNCHRONIZATION
+ mmu_sync_dma(((u32)((unsigned long)skb->data)),
+ skb->len, mp->myri_sbus_dev->my_bus);
+#endif
+
DRX(("len[%d] ", len));
if(len > RX_COPY_THRESHOLD) {
struct sk_buff *new_skb;
@@ -450,7 +464,8 @@
mp->rx_skbs[index] = new_skb;
new_skb->dev = dev;
skb_put(new_skb, RX_ALLOC_SIZE);
- rxd->myri_scatters[0].addr = (unsigned long) new_skb->data;
+ rxd->myri_scatters[0].addr =
+ (u32) ((unsigned long)new_skb->data);
rxd->myri_scatters[0].len = RX_ALLOC_SIZE;
rxd->ctx = index;
rxd->num_sg = 1;
@@ -474,7 +489,8 @@
/* Reuse original ring buffer. */
DRX(("reuse "));
- rxd->myri_scatters[0].addr = (unsigned long) skb->data;
+ rxd->myri_scatters[0].addr =
+ (u32) ((unsigned long)skb->data);
rxd->myri_scatters[0].len = RX_ALLOC_SIZE;
rxd->ctx = index;
rxd->num_sg = 1;
@@ -618,7 +634,8 @@
txd = &sq->myri_txd[entry];
mp->tx_skbs[entry] = skb;
- txd->myri_gathers[0].addr = (unsigned long) skb->data;
+ txd->myri_gathers[0].addr =
+ (unsigned int) ((unsigned long)skb->data);
txd->myri_gathers[0].len = len;
txd->num_sg = 1;
txd->chan = KERNEL_CHANNEL;
@@ -837,12 +854,12 @@
case CPUVERS_3_0:
case CPUVERS_3_1:
case CPUVERS_3_2:
- mp->reg_size = (3 * 128 * 1024) + PAGE_SIZE;
+ mp->reg_size = (3 * 128 * 1024) + 4096;
break;
case CPUVERS_4_0:
case CPUVERS_4_1:
- mp->reg_size = ((PAGE_SIZE<<1) + mp->eeprom.ramsz);
+ mp->reg_size = ((4096<<1) + mp->eeprom.ramsz);
break;
case CPUVERS_4_2:
@@ -850,7 +867,7 @@
default:
printk("myricom: AIEEE weird cpu version %04x assuming pre4.0\n",
mp->eeprom.cpuvers);
- mp->reg_size = (3 * 128 * 1024) + PAGE_SIZE;
+ mp->reg_size = (3 * 128 * 1024) + 4096;
};
}
@@ -1077,6 +1094,22 @@
/* Register interrupt handler now. */
DET(("Requesting MYRIcom IRQ line.\n"));
+#ifdef __sparc_v9__
+ if(sparc_cpu_model == sun4u) {
+ struct devid_cookie dcookie;
+
+ dcookie.real_dev_id = dev;
+ dcookie.imap = dcookie.iclr = 0;
+ dcookie.pil = -1;
+ dcookie.bus_cookie = sdev->my_bus;
+ if(request_irq(dev->irq, &myri_interrupt,
+ (SA_SHIRQ | SA_SBUS | SA_DCOOKIE),
+ "MyriCOM Ethernet", &dcookie)) {
+ printk("MyriCOM: Cannot register interrupt handler.\n");
+ return ENODEV;
+ }
+ } else
+#endif
if(request_irq(dev->irq, &myri_interrupt,
SA_SHIRQ, "MyriCOM Ethernet", (void *) dev)) {
printk("MyriCOM: Cannot register interrupt handler.\n");
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov