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);
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:
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
}
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);
}
}
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)
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;