From 5e80819ba9f3d10787fde61dbacea2fcfd6ffdfd Mon Sep 17 00:00:00 2001 From: Florian Lohoff Date: Sun, 3 Dec 2000 10:14:25 +0000 Subject: Fix for early crash on KN04 2.1k on diskboot --- drivers/net/declance.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 7dab57926..4692c301b 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c @@ -554,6 +554,7 @@ static int lance_rx(struct net_device *dev) ib = (struct lance_init_block *) (dev->mem_start); #ifdef TEST_HITS + { int i; printk("["); @@ -566,8 +567,10 @@ static int lance_rx(struct net_device *dev) ib->brx_ring[i].rmd1_bits & LE_R1_OWN ? "." : "1"); } printk("]"); + } #endif + for (rd = &ib->brx_ring[lp->rx_new]; !((bits = rd->rmd1_bits) & LE_R1_OWN); rd = &ib->brx_ring[lp->rx_new]) { @@ -608,9 +611,11 @@ static int lance_rx(struct net_device *dev) skb->dev = dev; skb_reserve(skb, 2); /* 16 byte align */ skb_put(skb, len); /* make room */ + cp_from_buf(skb->data, (char *) lp->rx_buf_ptr_cpu[lp->rx_new], len); + skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); lp->stats.rx_packets++; @@ -758,6 +763,7 @@ static void lance_interrupt(const int irq, void *dev_id, struct pt_regs *regs) init_restart_lance(lp); netif_wake_queue(dev); } + writereg(&ll->rdp, LE_C0_INEA); writereg(&ll->rdp, LE_C0_INEA); } @@ -773,11 +779,6 @@ static int lance_open(struct net_device *dev) last_dev = dev; - /* Associate IRQ with lance_interrupt */ - if (request_irq(dev->irq, &lance_interrupt, 0, lp->name, dev)) { - printk("Lance: Can't get irq %d\n", dev->irq); - return -EAGAIN; - } /* Stop the Lance */ writereg(&ll->rap, LE_CSR0); writereg(&ll->rdp, LE_C0_STOP); @@ -797,6 +798,12 @@ static int lance_open(struct net_device *dev) netif_start_queue(dev); + /* Associate IRQ with lance_interrupt */ + if (request_irq(dev->irq, &lance_interrupt, 0, lp->name, dev)) { + printk("Lance: Can't get irq %d\n", dev->irq); + return -EAGAIN; + } + status = init_restart_lance(lp); /* @@ -1034,10 +1041,13 @@ static int __init dec_lance_init(struct net_device *dev, const int type) /* * FIXME: ugly hack! */ - dev->mem_start = KSEG1ADDR(0x0020000); + dev->mem_start = KSEG1ADDR(0x00020000); dev->mem_end = dev->mem_start + 0x00020000; dev->irq = ETHER; esar_base = system_base + ESAR; + + /* Workaround crash with booting KN04 2.1k from Disk */ + memset(dev->mem_start, 0, dev->mem_end - dev->mem_start); /* * setup the pointer arrays, this sucks [tm] :-( @@ -1212,6 +1222,7 @@ static int __init dec_lance_probe(void) root_lance_dev = NULL; #endif + #ifdef CONFIG_TC int slot = -1; -- cgit v1.2.3