ChangeSet 1.1966.86.1, 2005/01/18 00:54:29-05:00, [EMAIL PROTECTED]

        Merge pobox.com:/garz/repo/linux-2.6
        into pobox.com:/garz/repo/netdev-2.6/viro-isa-ectomy



 es3210.c    |   32 +++++++++++++---------
 ewrk3.c     |   84 ++++++++++++++++++++++++++++++++----------------------------
 smc-mca.c   |   37 +++++++++++++++-----------
 smc-ultra.c |   34 ++++++++++++++----------
 wd.c        |   36 +++++++++++++++----------
 5 files changed, 128 insertions(+), 95 deletions(-)


diff -Nru a/drivers/net/es3210.c b/drivers/net/es3210.c
--- a/drivers/net/es3210.c      2005-03-09 11:07:55 -08:00
+++ b/drivers/net/es3210.c      2005-03-09 11:07:55 -08:00
@@ -159,6 +159,7 @@
 {
        free_irq(dev->irq, dev);
        release_region(dev->base_addr, ES_IO_EXTENT);
+       iounmap(ei_status.mem);
 }
 
 #ifndef MODULE
@@ -271,9 +272,14 @@
                printk(" assigning ");
        }
 
-       dev->mem_end = ei_status.rmem_end = dev->mem_start
-               + (ES_STOP_PG - ES_START_PG)*256;
-       ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
+       ei_status.mem = ioremap(dev->mem_start, (ES_STOP_PG - ES_START_PG)*256);
+       if (!ei_status.mem) {
+               printk("ioremap failed - giving up\n");
+               retval = -ENXIO;
+               goto out1;
+       }
+
+       dev->mem_end = dev->mem_start + (ES_STOP_PG - ES_START_PG)*256;
 
        printk("mem %#lx-%#lx\n", dev->mem_start, dev->mem_end-1);
 
@@ -353,8 +359,8 @@
 static void
 es_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int 
ring_page)
 {
-       unsigned long hdr_start = dev->mem_start + ((ring_page - 
ES_START_PG)<<8);
-       isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+       void __iomem *hdr_start = ei_status.mem + ((ring_page - 
ES_START_PG)<<8);
+       memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
        hdr->count = (hdr->count + 3) & ~3;     /* Round up allocation. */
 }
 
@@ -367,27 +373,27 @@
 static void es_block_input(struct net_device *dev, int count, struct sk_buff 
*skb,
                                                  int ring_offset)
 {
-       unsigned long xfer_start = dev->mem_start + ring_offset - 
(ES_START_PG<<8);
+       void __iomem *xfer_start = ei_status.mem + ring_offset - 
ES_START_PG*256;
 
-       if (xfer_start + count > ei_status.rmem_end) {
+       if (ring_offset + count > ES_STOP_PG*256) {
                /* Packet wraps over end of ring buffer. */
-               int semi_count = ei_status.rmem_end - xfer_start;
-               isa_memcpy_fromio(skb->data, xfer_start, semi_count);
+               int semi_count = ES_STOP_PG*256 - ring_offset;
+               memcpy_fromio(skb->data, xfer_start, semi_count);
                count -= semi_count;
-               isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, 
count);
+               memcpy_fromio(skb->data + semi_count, ei_status.mem, count);
        } else {
                /* Packet is in one chunk. */
-               isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
+               eth_io_copy_and_sum(skb, xfer_start, count, 0);
        }
 }
 
 static void es_block_output(struct net_device *dev, int count,
                                const unsigned char *buf, int start_page)
 {
-       unsigned long shmem = dev->mem_start + ((start_page - ES_START_PG)<<8);
+       void __iomem *shmem = ei_status.mem + ((start_page - ES_START_PG)<<8);
 
        count = (count + 3) & ~3;     /* Round up to doubleword */
-       isa_memcpy_toio(shmem, buf, count);
+       memcpy_toio(shmem, buf, count);
 }
 
 static int es_open(struct net_device *dev)
diff -Nru a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
--- a/drivers/net/ewrk3.c       2005-03-09 11:07:55 -08:00
+++ b/drivers/net/ewrk3.c       2005-03-09 11:07:55 -08:00
@@ -273,6 +273,7 @@
 struct ewrk3_private {
        char adapter_name[80];  /* Name exported to /proc/ioports */
        u_long shmem_base;      /* Shared memory start address */
+       void __iomem *shmem;
        u_long shmem_length;    /* Shared memory window length */
        struct net_device_stats stats;  /* Public stats */
        struct ewrk3_stats pktStats; /* Private stats counters */
@@ -281,7 +282,7 @@
        u_char lemac;           /* Chip rev. level */
        u_char hard_strapped;   /* Don't allow a full open */
        u_char txc;             /* Transmit cut through */
-       u_char *mctbl;          /* Pointer to the multicast table */
+       void __iomem *mctbl;    /* Pointer to the multicast table */
        u_char led_mask;        /* Used to reserve LED access for ethtool */
        spinlock_t hw_lock;
 };
@@ -535,6 +536,9 @@
 
        lp = netdev_priv(dev);
        lp->shmem_base = mem_start;
+       lp->shmem = ioremap(mem_start, shmem_length);
+       if (!lp->shmem)
+               return -ENOMEM;
        lp->shmem_length = shmem_length;
        lp->lemac = lemac;
        lp->hard_strapped = hard_strapped;
@@ -590,6 +594,7 @@
                                } else {
                                        printk(", but incorrect IRQ line 
detected.\n");
                                }
+                               iounmap(lp->shmem);
                                return -ENXIO;
                        }
 
@@ -768,7 +773,7 @@
 {
        struct ewrk3_private *lp = netdev_priv(dev);
        u_long iobase = dev->base_addr;
-       u_long buf = 0;
+       void __iomem *buf = NULL;
        u_char icr;
        u_char page;
 
@@ -801,13 +806,13 @@
        if (lp->shmem_length == IO_ONLY) {
                outb (page, EWRK3_IOPR);
        } else if (lp->shmem_length == SHMEM_2K) {
-               buf = lp->shmem_base;
+               buf = lp->shmem;
                outb (page, EWRK3_MPR);
        } else if (lp->shmem_length == SHMEM_32K) {
-               buf = ((((short) page << 11) & 0x7800) + lp->shmem_base);
+               buf = (((short) page << 11) & 0x7800) + lp->shmem;
                outb ((page >> 4), EWRK3_MPR);
        } else if (lp->shmem_length == SHMEM_64K) {
-               buf = ((((short) page << 11) & 0xf800) + lp->shmem_base);
+               buf = (((short) page << 11) & 0xf800) + lp->shmem;
                outb ((page >> 5), EWRK3_MPR);
        } else {
                printk (KERN_ERR "%s: Oops - your private data area is 
hosed!\n",
@@ -831,30 +836,28 @@
                }
                outb (page, EWRK3_TQ);  /* Start sending pkt */
        } else {
-               isa_writeb ((char) (TCR_QMODE | TCR_PAD | TCR_IFC), buf);       
/* ctrl byte */
+               writeb ((char) (TCR_QMODE | TCR_PAD | TCR_IFC), buf);   /* ctrl 
byte */
                buf += 1;
-               isa_writeb ((char) (skb->len & 0xff), buf);     /* length (16 
bit xfer) */
+               writeb ((char) (skb->len & 0xff), buf); /* length (16 bit xfer) 
*/
                buf += 1;
                if (lp->txc) {
-                       isa_writeb ((char)
-                                   (((skb->len >> 8) & 0xff) | XCT), buf);
+                       writeb(((skb->len >> 8) & 0xff) | XCT, buf);
                        buf += 1;
-                       isa_writeb (0x04, buf); /* index byte */
+                       writeb (0x04, buf);     /* index byte */
                        buf += 1;
-                       isa_writeb (0x00, (buf + skb->len));    /* Write the 
XCT flag */
-                       isa_memcpy_toio (buf, skb->data, PRELOAD);      /* 
Write PRELOAD bytes */
+                       writeb (0x00, (buf + skb->len));        /* Write the 
XCT flag */
+                       memcpy_toio (buf, skb->data, PRELOAD);  /* Write 
PRELOAD bytes */
                        outb (page, EWRK3_TQ);  /* Start sending pkt */
-                       isa_memcpy_toio (buf + PRELOAD,
+                       memcpy_toio (buf + PRELOAD,
                                         skb->data + PRELOAD,
                                         skb->len - PRELOAD);
-                       isa_writeb (0xff, (buf + skb->len));    /* Write the 
XCT flag */
+                       writeb (0xff, (buf + skb->len));        /* Write the 
XCT flag */
                } else {
-                       isa_writeb ((char)
-                                   ((skb->len >> 8) & 0xff), buf);
+                       writeb ((skb->len >> 8) & 0xff, buf);
                        buf += 1;
-                       isa_writeb (0x04, buf); /* index byte */
+                       writeb (0x04, buf);     /* index byte */
                        buf += 1;
-                       isa_memcpy_toio (buf, skb->data, skb->len);     /* 
Write data bytes */
+                       memcpy_toio (buf, skb->data, skb->len); /* Write data 
bytes */
                        outb (page, EWRK3_TQ);  /* Start sending pkt */
                }
        }
@@ -940,7 +943,7 @@
        u_long iobase = dev->base_addr;
        int i, status = 0;
        u_char page;
-       u_long buf = 0;
+       void __iomem *buf = NULL;
 
        while (inb(EWRK3_RQC) && !status) {     /* Whilst there's incoming data 
*/
                if ((page = inb(EWRK3_RQ)) < lp->mPage) {       /* Get next 
entry's buffer page */
@@ -950,13 +953,13 @@
                        if (lp->shmem_length == IO_ONLY) {
                                outb(page, EWRK3_IOPR);
                        } else if (lp->shmem_length == SHMEM_2K) {
-                               buf = lp->shmem_base;
+                               buf = lp->shmem;
                                outb(page, EWRK3_MPR);
                        } else if (lp->shmem_length == SHMEM_32K) {
-                               buf = ((((short) page << 11) & 0x7800) + 
lp->shmem_base);
+                               buf = (((short) page << 11) & 0x7800) + 
lp->shmem;
                                outb((page >> 4), EWRK3_MPR);
                        } else if (lp->shmem_length == SHMEM_64K) {
-                               buf = ((((short) page << 11) & 0xf800) + 
lp->shmem_base);
+                               buf = (((short) page << 11) & 0xf800) + 
lp->shmem;
                                outb((page >> 5), EWRK3_MPR);
                        } else {
                                status = -1;
@@ -972,9 +975,9 @@
                                        pkt_len = inb(EWRK3_DATA);
                                        pkt_len |= ((u_short) inb(EWRK3_DATA) 
<< 8);
                                } else {
-                                       rx_status = isa_readb(buf);
+                                       rx_status = readb(buf);
                                        buf += 1;
-                                       pkt_len = isa_readw(buf);
+                                       pkt_len = readw(buf);
                                        buf += 3;
                                }
 
@@ -1001,7 +1004,7 @@
                                                                *p++ = 
inb(EWRK3_DATA);
                                                        }
                                                } else {
-                                                       isa_memcpy_fromio(p, 
buf, pkt_len);
+                                                       memcpy_fromio(p, buf, 
pkt_len);
                                                }
 
                                                for (i = 1; i < 
EWRK3_PKT_STAT_SZ - 1; i++) {
@@ -1153,9 +1156,9 @@
        csr = inb(EWRK3_CSR);
 
        if (lp->shmem_length == IO_ONLY) {
-               lp->mctbl = (char *) PAGE0_HTE;
+               lp->mctbl = NULL;
        } else {
-               lp->mctbl = (char *) (lp->shmem_base + PAGE0_HTE);
+               lp->mctbl = lp->shmem + PAGE0_HTE;
        }
 
        csr &= ~(CSR_PME | CSR_MCE);
@@ -1184,7 +1187,7 @@
        u_long iobase = dev->base_addr;
        int i;
        char *addrs, bit, byte;
-       short *p = (short *) lp->mctbl;
+       short __iomem *p = lp->mctbl;
        u16 hashcode;
        u32 crc;
 
@@ -1192,7 +1195,7 @@
 
        if (lp->shmem_length == IO_ONLY) {
                outb(0, EWRK3_IOPR);
-               outw(EEPROM_OFFSET(lp->mctbl), EWRK3_PIR1);
+               outw(PAGE0_HTE, EWRK3_PIR1);
        } else {
                outb(0, EWRK3_MPR);
        }
@@ -1202,7 +1205,7 @@
                        if (lp->shmem_length == IO_ONLY) {
                                outb(0xff, EWRK3_DATA);
                        } else {        /* memset didn't work here */
-                               isa_writew(0xffff, (int) p);
+                               writew(0xffff, p);
                                p++;
                                i++;
                        }
@@ -1219,8 +1222,8 @@
                                outb(0x00, EWRK3_DATA);
                        }
                } else {
-                       isa_memset_io((int) lp->mctbl, 0, (HASH_TABLE_LEN >> 
3));
-                       isa_writeb(0x80, (int) (lp->mctbl + (HASH_TABLE_LEN >> 
4) - 1));
+                       memset_io(lp->mctbl, 0, HASH_TABLE_LEN >> 3);
+                       writeb(0x80, lp->mctbl + (HASH_TABLE_LEN >> 4) - 1);
                }
 
                /* Update table */
@@ -1237,13 +1240,13 @@
                                if (lp->shmem_length == IO_ONLY) {
                                        u_char tmp;
 
-                                       outw((short) ((long) lp->mctbl) + byte, 
EWRK3_PIR1);
+                                       outw(PAGE0_HTE + byte, EWRK3_PIR1);
                                        tmp = inb(EWRK3_DATA);
                                        tmp |= bit;
-                                       outw((short) ((long) lp->mctbl) + byte, 
EWRK3_PIR1);
+                                       outw(PAGE0_HTE + byte, EWRK3_PIR1);
                                        outb(tmp, EWRK3_DATA);
                                } else {
-                                       isa_writeb(isa_readb((int)(lp->mctbl + 
byte)) | bit, (int)(lp->mctbl + byte));
+                                       writeb(readb(lp->mctbl + byte) | bit, 
lp->mctbl + byte);
                                }
                        }
                }
@@ -1784,7 +1787,7 @@
                        }
                } else {
                        outb(0, EWRK3_MPR);
-                       isa_memcpy_fromio(tmp->addr, lp->shmem_base + 
PAGE0_HTE, (HASH_TABLE_LEN >> 3));
+                       memcpy_fromio(tmp->addr, lp->shmem + PAGE0_HTE, 
(HASH_TABLE_LEN >> 3));
                }
                spin_unlock_irqrestore(&lp->hw_lock, flags);
 
@@ -1954,10 +1957,13 @@
        int i;
 
        for( i=0; i<ndevs; i++ ) {
-               unregister_netdev(ewrk3_devs[i]);
-               release_region(ewrk3_devs[i]->base_addr, EWRK3_TOTAL_SIZE);
-               free_netdev(ewrk3_devs[i]);
+               struct net_device *dev = ewrk3_devs[i];
+               struct ewrk3_private *lp = netdev_priv(dev);
                ewrk3_devs[i] = NULL;
+               unregister_netdev(dev);
+               release_region(dev->base_addr, EWRK3_TOTAL_SIZE);
+               iounmap(lp->shmem);
+               free_netdev(dev);
        }
 }
 
diff -Nru a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c
--- a/drivers/net/smc-mca.c     2005-03-09 11:07:55 -08:00
+++ b/drivers/net/smc-mca.c     2005-03-09 11:07:55 -08:00
@@ -310,9 +310,13 @@
        ei_status.rx_start_page = START_PG + TX_PAGES;
        ei_status.stop_page = num_pages;
 
-       ei_status.rmem_start = dev->mem_start + TX_PAGES * 256;
-       dev->mem_end = ei_status.rmem_end =
-       dev->mem_start + (ei_status.stop_page - START_PG) * 256;
+       ei_status.mem = ioremap(dev->mem_start, (ei_status.stop_page - 
START_PG) * 256);
+       if (!ei_status.mem) {
+               rc = -ENOMEM;
+               goto err_release_region;
+       }
+
+       dev->mem_end = dev->mem_start + (ei_status.stop_page - START_PG) * 256;
 
        printk(", IRQ %d memory %#lx-%#lx.\n",
        dev->irq, dev->mem_start, dev->mem_end - 1);
@@ -334,10 +338,12 @@
 
        rc = register_netdev(dev);
        if (rc)
-               goto err_release_region;
+               goto err_unmap;
 
        return 0;
 
+err_unmap:
+       iounmap(ei_status.mem);
 err_release_region:
        release_region(ioaddr, ULTRA_IO_EXTENT);
 err_unclaim:
@@ -395,13 +401,13 @@
 
 static void ultramca_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr 
*hdr, int ring_page)
 {
-       unsigned long hdr_start = dev->mem_start + ((ring_page - START_PG) << 
8);
+       void __iomem *hdr_start = ei_status.mem + ((ring_page - START_PG) << 8);
 
 #ifdef notdef
        /* Officially this is what we are doing, but the readl() is faster */
-       isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+       memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
 #else
-       ((unsigned int*)hdr)[0] = isa_readl(hdr_start);
+       ((unsigned int*)hdr)[0] = readl(hdr_start);
 #endif
 }
 
@@ -411,17 +417,17 @@
 
 static void ultramca_block_input(struct net_device *dev, int count, struct 
sk_buff *skb, int ring_offset)
 {
-       unsigned long xfer_start = dev->mem_start + ring_offset - (START_PG << 
8);
+       void __iomem *xfer_start = ei_status.mem + ring_offset - START_PG * 256;
 
-       if (xfer_start + count > ei_status.rmem_end) {
+       if (ring_offset + count > ei_status.stop_page * 256) {
                /* We must wrap the input move. */
-               int semi_count = ei_status.rmem_end - xfer_start;
-               isa_memcpy_fromio(skb->data, xfer_start, semi_count);
+               int semi_count = ei_status.stop_page * 256 - ring_offset;
+               memcpy_fromio(skb->data, xfer_start, semi_count);
                count -= semi_count;
-               isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, 
count);
+               memcpy_fromio(skb->data + semi_count, ei_status.mem + TX_PAGES 
* 256, count);
        } else {
                /* Packet is in one chunk -- we can copy + cksum. */
-               isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
+               eth_io_copy_and_sum(skb, xfer_start, count, 0);
        }
 
 }
@@ -429,9 +435,9 @@
 static void ultramca_block_output(struct net_device *dev, int count, const 
unsigned char *buf,
                 int start_page)
 {
-       unsigned long shmem = dev->mem_start + ((start_page - START_PG) << 8);
+       void __iomem *shmem = ei_status.mem + ((start_page - START_PG) << 8);
 
-       isa_memcpy_toio(shmem, buf, count);
+       memcpy_toio(shmem, buf, count);
 }
 
 static int ultramca_close_card(struct net_device *dev)
@@ -466,6 +472,7 @@
                unregister_netdev(dev);
                mca_device_set_claim(mca_dev, 0);
                release_region(ioaddr, ULTRA_IO_EXTENT);
+               iounmap(ei_status.mem);
                free_netdev(dev);
        }
        return 0;
diff -Nru a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c
--- a/drivers/net/smc-ultra.c   2005-03-09 11:07:55 -08:00
+++ b/drivers/net/smc-ultra.c   2005-03-09 11:07:55 -08:00
@@ -176,6 +176,7 @@
                pnp_device_detach(idev);
 #endif
        release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT);
+       iounmap(ei_status.mem);
 }
 
 #ifndef MODULE
@@ -294,9 +295,14 @@
        ei_status.rx_start_page = START_PG + TX_PAGES;
        ei_status.stop_page = num_pages;
 
-       ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
-       dev->mem_end = ei_status.rmem_end
-               = dev->mem_start + (ei_status.stop_page - START_PG)*256;
+       ei_status.mem = ioremap(dev->mem_start, (ei_status.stop_page - 
START_PG)*256);
+       if (!ei_status.mem) {
+               printk(", failed to ioremap.\n");
+               retval =  -ENOMEM;
+               goto out;
+       }
+
+       dev->mem_end = dev->mem_start + (ei_status.stop_page - START_PG)*256;
 
        if (piomode) {
                printk(",%s IRQ %d programmed-I/O mode.\n",
@@ -430,16 +436,16 @@
 static void
 ultra_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int 
ring_page)
 {
-       unsigned long hdr_start = dev->mem_start + ((ring_page - START_PG)<<8);
+       void __iomem *hdr_start = ei_status.mem + ((ring_page - START_PG)<<8);
 
        outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET);  /* shmem on */
 #ifdef __BIG_ENDIAN
        /* Officially this is what we are doing, but the readl() is faster */
        /* unfortunately it isn't endian aware of the struct               */
-       isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+       memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
        hdr->count = le16_to_cpu(hdr->count);
 #else
-       ((unsigned int*)hdr)[0] = isa_readl(hdr_start);
+       ((unsigned int*)hdr)[0] = readl(hdr_start);
 #endif
        outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET); /* shmem off */
 }
@@ -450,20 +456,20 @@
 static void
 ultra_block_input(struct net_device *dev, int count, struct sk_buff *skb, int 
ring_offset)
 {
-       unsigned long xfer_start = dev->mem_start + ring_offset - (START_PG<<8);
+       void __iomem *xfer_start = ei_status.mem + ring_offset - (START_PG<<8);
 
        /* Enable shared memory. */
        outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET);
 
-       if (xfer_start + count > ei_status.rmem_end) {
+       if (ring_offset + count > ei_status.stop_page*256) {
                /* We must wrap the input move. */
-               int semi_count = ei_status.rmem_end - xfer_start;
-               isa_memcpy_fromio(skb->data, xfer_start, semi_count);
+               int semi_count = ei_status.stop_page*256 - ring_offset;
+               memcpy_fromio(skb->data, xfer_start, semi_count);
                count -= semi_count;
-               isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, 
count);
+               memcpy_fromio(skb->data + semi_count, ei_status.mem + TX_PAGES 
* 256, count);
        } else {
                /* Packet is in one chunk -- we can copy + cksum. */
-               isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
+               eth_io_copy_and_sum(skb, xfer_start, count, 0);
        }
 
        outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET);  /* Disable memory. */
@@ -473,12 +479,12 @@
 ultra_block_output(struct net_device *dev, int count, const unsigned char *buf,
                                int start_page)
 {
-       unsigned long shmem = dev->mem_start + ((start_page - START_PG)<<8);
+       void __iomem *shmem = ei_status.mem + ((start_page - START_PG)<<8);
 
        /* Enable shared memory. */
        outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET);
 
-       isa_memcpy_toio(shmem, buf, count);
+       memcpy_toio(shmem, buf, count);
 
        outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET); /* Disable memory. */
 }
diff -Nru a/drivers/net/wd.c b/drivers/net/wd.c
--- a/drivers/net/wd.c  2005-03-09 11:07:55 -08:00
+++ b/drivers/net/wd.c  2005-03-09 11:07:55 -08:00
@@ -131,6 +131,7 @@
 {
        free_irq(dev->irq, dev);
        release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT);
+       iounmap(ei_status.mem);
 }
 
 #ifndef MODULE
@@ -317,16 +318,22 @@
        ei_status.rx_start_page = WD_START_PG + TX_PAGES;
 
        /* Don't map in the shared memory until the board is actually opened. */
-       ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
 
        /* Some cards (eg WD8003EBT) can be jumpered for more (32k!) memory. */
        if (dev->mem_end != 0) {
                ei_status.stop_page = (dev->mem_end - dev->mem_start)/256;
+               ei_status.priv = dev->mem_end - dev->mem_start;
        } else {
                ei_status.stop_page = word16 ? WD13_STOP_PG : WD03_STOP_PG;
                dev->mem_end = dev->mem_start + (ei_status.stop_page - 
WD_START_PG)*256;
+               ei_status.priv = (ei_status.stop_page - WD_START_PG)*256;
+       }
+
+       ei_status.mem = ioremap(dev->mem_start, ei_status.priv);
+       if (!ei_status.mem) {
+               free_irq(dev->irq, dev);
+               return -ENOMEM;
        }
-       ei_status.rmem_end = dev->mem_end;
 
        printk(" %s, IRQ %d, shared memory at %#lx-%#lx.\n",
                   model_name, dev->irq, dev->mem_start, dev->mem_end-1);
@@ -397,7 +404,7 @@
 {
 
        int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
-       unsigned long hdr_start = dev->mem_start + ((ring_page - 
WD_START_PG)<<8);
+       void __iomem *hdr_start = ei_status.mem + ((ring_page - 
WD_START_PG)<<8);
 
        /* We'll always get a 4 byte header read followed by a packet read, so
           we enable 16 bit mode before the header, and disable after the body. 
*/
@@ -407,10 +414,10 @@
 #ifdef __BIG_ENDIAN
        /* Officially this is what we are doing, but the readl() is faster */
        /* unfortunately it isn't endian aware of the struct               */
-       isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+       memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
        hdr->count = le16_to_cpu(hdr->count);
 #else
-       ((unsigned int*)hdr)[0] = isa_readl(hdr_start);
+       ((unsigned int*)hdr)[0] = readl(hdr_start);
 #endif
 }
 
@@ -423,17 +430,18 @@
 wd_block_input(struct net_device *dev, int count, struct sk_buff *skb, int 
ring_offset)
 {
        int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
-       unsigned long xfer_start = dev->mem_start + ring_offset - 
(WD_START_PG<<8);
+       unsigned long offset = ring_offset - (WD_START_PG<<8);
+       void __iomem *xfer_start = ei_status.mem + offset;
 
-       if (xfer_start + count > ei_status.rmem_end) {
+       if (offset + count > ei_status.priv) {
                /* We must wrap the input move. */
-               int semi_count = ei_status.rmem_end - xfer_start;
-               isa_memcpy_fromio(skb->data, xfer_start, semi_count);
+               int semi_count = ei_status.priv - offset;
+               memcpy_fromio(skb->data, xfer_start, semi_count);
                count -= semi_count;
-               isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, 
count);
+               memcpy_fromio(skb->data + semi_count, ei_status.mem + TX_PAGES 
* 256, count);
        } else {
                /* Packet is in one chunk -- we can copy + cksum. */
-               isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
+               eth_io_copy_and_sum(skb, xfer_start, count, 0);
        }
 
        /* Turn off 16 bit access so that reboot works.  ISA brain-damage */
@@ -446,16 +454,16 @@
                                int start_page)
 {
        int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
-       long shmem = dev->mem_start + ((start_page - WD_START_PG)<<8);
+       void __iomem *shmem = ei_status.mem + ((start_page - WD_START_PG)<<8);
 
 
        if (ei_status.word16) {
                /* Turn on and off 16 bit access so that reboot works. */
                outb(ISA16 | ei_status.reg5, wd_cmdreg+WD_CMDREG5);
-               isa_memcpy_toio(shmem, buf, count);
+               memcpy_toio(shmem, buf, count);
                outb(ei_status.reg5, wd_cmdreg+WD_CMDREG5);
        } else
-               isa_memcpy_toio(shmem, buf, count);
+               memcpy_toio(shmem, buf, count);
 }
 
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to