Commit aa7976d7 authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/garz/repo/netdev-2.6/viro-old-eth

into pobox.com:/garz/repo/net-drivers-2.6
parents 18f955ce 2df5812d
...@@ -127,6 +127,7 @@ struct net_local { ...@@ -127,6 +127,7 @@ struct net_local {
ushort tx_reap; ushort tx_reap;
ushort tx_pkts_in_ring; ushort tx_pkts_in_ring;
spinlock_t lock; spinlock_t lock;
void __iomem *base;
}; };
/* /*
...@@ -348,6 +349,7 @@ struct net_device * __init el16_probe(int unit) ...@@ -348,6 +349,7 @@ struct net_device * __init el16_probe(int unit)
return dev; return dev;
out1: out1:
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
iounmap(((struct net_local *)netdev_priv(dev))->base);
release_region(dev->base_addr, EL16_IO_EXTENT); release_region(dev->base_addr, EL16_IO_EXTENT);
out: out:
free_netdev(dev); free_netdev(dev);
...@@ -395,7 +397,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr) ...@@ -395,7 +397,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
irqval = request_irq(irq, &el16_interrupt, 0, DRV_NAME, dev); irqval = request_irq(irq, &el16_interrupt, 0, DRV_NAME, dev);
if (irqval) { if (irqval) {
printk ("unable to get IRQ %d (irqval=%d).\n", irq, irqval); printk(KERN_ERR "3c507: unable to get IRQ %d (irqval=%d).\n", irq, irqval);
retval = -EAGAIN; retval = -EAGAIN;
goto out; goto out;
} }
...@@ -445,6 +447,12 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr) ...@@ -445,6 +447,12 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
lp = netdev_priv(dev); lp = netdev_priv(dev);
memset(lp, 0, sizeof(*lp)); memset(lp, 0, sizeof(*lp));
spin_lock_init(&lp->lock); spin_lock_init(&lp->lock);
lp->base = ioremap(dev->mem_start, RX_BUF_END);
if (!lp->base) {
printk(KERN_ERR "3c507: unable to remap memory\n");
retval = -EAGAIN;
goto out1;
}
dev->open = el16_open; dev->open = el16_open;
dev->stop = el16_close; dev->stop = el16_close;
...@@ -455,6 +463,8 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr) ...@@ -455,6 +463,8 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
dev->ethtool_ops = &netdev_ethtool_ops; dev->ethtool_ops = &netdev_ethtool_ops;
dev->flags &= ~IFF_MULTICAST; /* Multicast doesn't work */ dev->flags &= ~IFF_MULTICAST; /* Multicast doesn't work */
return 0; return 0;
out1:
free_irq(dev->irq, dev);
out: out:
release_region(ioaddr, EL16_IO_EXTENT); release_region(ioaddr, EL16_IO_EXTENT);
return retval; return retval;
...@@ -474,11 +484,11 @@ static void el16_tx_timeout (struct net_device *dev) ...@@ -474,11 +484,11 @@ static void el16_tx_timeout (struct net_device *dev)
{ {
struct net_local *lp = netdev_priv(dev); struct net_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr; int ioaddr = dev->base_addr;
unsigned long shmem = dev->mem_start; void __iomem *shmem = lp->base;
if (net_debug > 1) if (net_debug > 1)
printk ("%s: transmit timed out, %s? ", dev->name, printk ("%s: transmit timed out, %s? ", dev->name,
isa_readw (shmem + iSCB_STATUS) & 0x8000 ? "IRQ conflict" : readw(shmem + iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
"network cable problem"); "network cable problem");
/* Try to restart the adaptor. */ /* Try to restart the adaptor. */
if (lp->last_restart == lp->stats.tx_packets) { if (lp->last_restart == lp->stats.tx_packets) {
...@@ -491,7 +501,7 @@ static void el16_tx_timeout (struct net_device *dev) ...@@ -491,7 +501,7 @@ static void el16_tx_timeout (struct net_device *dev)
/* Issue the channel attention signal and hope it "gets better". */ /* Issue the channel attention signal and hope it "gets better". */
if (net_debug > 1) if (net_debug > 1)
printk ("Kicking board.\n"); printk ("Kicking board.\n");
isa_writew (0xf000 | CUC_START | RX_START, shmem + iSCB_CMD); writew(0xf000 | CUC_START | RX_START, shmem + iSCB_CMD);
outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */ outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
lp->last_restart = lp->stats.tx_packets; lp->last_restart = lp->stats.tx_packets;
} }
...@@ -539,7 +549,7 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -539,7 +549,7 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
struct net_local *lp; struct net_local *lp;
int ioaddr, status, boguscount = 0; int ioaddr, status, boguscount = 0;
ushort ack_cmd = 0; ushort ack_cmd = 0;
unsigned long shmem; void __iomem *shmem;
if (dev == NULL) { if (dev == NULL) {
printk ("net_interrupt(): irq %d for unknown device.\n", irq); printk ("net_interrupt(): irq %d for unknown device.\n", irq);
...@@ -548,11 +558,11 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -548,11 +558,11 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
lp = netdev_priv(dev); lp = netdev_priv(dev);
shmem = dev->mem_start; shmem = lp->base;
spin_lock(&lp->lock); spin_lock(&lp->lock);
status = isa_readw(shmem+iSCB_STATUS); status = readw(shmem+iSCB_STATUS);
if (net_debug > 4) { if (net_debug > 4) {
printk("%s: 3c507 interrupt, status %4.4x.\n", dev->name, status); printk("%s: 3c507 interrupt, status %4.4x.\n", dev->name, status);
...@@ -563,7 +573,7 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -563,7 +573,7 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* Reap the Tx packet buffers. */ /* Reap the Tx packet buffers. */
while (lp->tx_pkts_in_ring) { while (lp->tx_pkts_in_ring) {
unsigned short tx_status = isa_readw(shmem+lp->tx_reap); unsigned short tx_status = readw(shmem+lp->tx_reap);
if (!(tx_status & 0x8000)) { if (!(tx_status & 0x8000)) {
if (net_debug > 5) if (net_debug > 5)
printk("Tx command incomplete (%#x).\n", lp->tx_reap); printk("Tx command incomplete (%#x).\n", lp->tx_reap);
...@@ -619,11 +629,11 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -619,11 +629,11 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
printk("%s: Rx unit stopped, status %04x, restarting.\n", printk("%s: Rx unit stopped, status %04x, restarting.\n",
dev->name, status); dev->name, status);
init_rx_bufs(dev); init_rx_bufs(dev);
isa_writew(RX_BUF_START,shmem+iSCB_RFA); writew(RX_BUF_START,shmem+iSCB_RFA);
ack_cmd |= RX_START; ack_cmd |= RX_START;
} }
isa_writew(ack_cmd,shmem+iSCB_CMD); writew(ack_cmd,shmem+iSCB_CMD);
outb(0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */ outb(0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
/* Clear the latched interrupt. */ /* Clear the latched interrupt. */
...@@ -637,13 +647,14 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -637,13 +647,14 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static int el16_close(struct net_device *dev) static int el16_close(struct net_device *dev)
{ {
struct net_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr; int ioaddr = dev->base_addr;
unsigned long shmem = dev->mem_start; void __iomem *shmem = lp->base;
netif_stop_queue(dev); netif_stop_queue(dev);
/* Flush the Tx and disable Rx. */ /* Flush the Tx and disable Rx. */
isa_writew(RX_SUSPEND | CUC_SUSPEND,shmem+iSCB_CMD); writew(RX_SUSPEND | CUC_SUSPEND,shmem+iSCB_CMD);
outb(0, ioaddr + SIGNAL_CA); outb(0, ioaddr + SIGNAL_CA);
/* Disable the 82586's input to the interrupt line. */ /* Disable the 82586's input to the interrupt line. */
...@@ -671,7 +682,7 @@ static struct net_device_stats *el16_get_stats(struct net_device *dev) ...@@ -671,7 +682,7 @@ static struct net_device_stats *el16_get_stats(struct net_device *dev)
static void init_rx_bufs(struct net_device *dev) static void init_rx_bufs(struct net_device *dev)
{ {
struct net_local *lp = netdev_priv(dev); struct net_local *lp = netdev_priv(dev);
unsigned long write_ptr; void __iomem *write_ptr;
unsigned short SCB_base = SCB_BASE; unsigned short SCB_base = SCB_BASE;
int cur_rxbuf = lp->rx_head = RX_BUF_START; int cur_rxbuf = lp->rx_head = RX_BUF_START;
...@@ -679,26 +690,26 @@ static void init_rx_bufs(struct net_device *dev) ...@@ -679,26 +690,26 @@ static void init_rx_bufs(struct net_device *dev)
/* Initialize each Rx frame + data buffer. */ /* Initialize each Rx frame + data buffer. */
do { /* While there is room for one more. */ do { /* While there is room for one more. */
write_ptr = dev->mem_start + cur_rxbuf; write_ptr = lp->base + cur_rxbuf;
isa_writew(0x0000,write_ptr); /* Status */ writew(0x0000,write_ptr); /* Status */
isa_writew(0x0000,write_ptr+=2); /* Command */ writew(0x0000,write_ptr+=2); /* Command */
isa_writew(cur_rxbuf + RX_BUF_SIZE,write_ptr+=2); /* Link */ writew(cur_rxbuf + RX_BUF_SIZE,write_ptr+=2); /* Link */
isa_writew(cur_rxbuf + 22,write_ptr+=2); /* Buffer offset */ writew(cur_rxbuf + 22,write_ptr+=2); /* Buffer offset */
isa_writew(0x0000,write_ptr+=2); /* Pad for dest addr. */ writew(0x0000,write_ptr+=2); /* Pad for dest addr. */
isa_writew(0x0000,write_ptr+=2); writew(0x0000,write_ptr+=2);
isa_writew(0x0000,write_ptr+=2); writew(0x0000,write_ptr+=2);
isa_writew(0x0000,write_ptr+=2); /* Pad for source addr. */ writew(0x0000,write_ptr+=2); /* Pad for source addr. */
isa_writew(0x0000,write_ptr+=2); writew(0x0000,write_ptr+=2);
isa_writew(0x0000,write_ptr+=2); writew(0x0000,write_ptr+=2);
isa_writew(0x0000,write_ptr+=2); /* Pad for protocol. */ writew(0x0000,write_ptr+=2); /* Pad for protocol. */
isa_writew(0x0000,write_ptr+=2); /* Buffer: Actual count */ writew(0x0000,write_ptr+=2); /* Buffer: Actual count */
isa_writew(-1,write_ptr+=2); /* Buffer: Next (none). */ writew(-1,write_ptr+=2); /* Buffer: Next (none). */
isa_writew(cur_rxbuf + 0x20 + SCB_base,write_ptr+=2);/* Buffer: Address low */ writew(cur_rxbuf + 0x20 + SCB_base,write_ptr+=2);/* Buffer: Address low */
isa_writew(0x0000,write_ptr+=2); writew(0x0000,write_ptr+=2);
/* Finally, the number of bytes in the buffer. */ /* Finally, the number of bytes in the buffer. */
isa_writew(0x8000 + RX_BUF_SIZE-0x20,write_ptr+=2); writew(0x8000 + RX_BUF_SIZE-0x20,write_ptr+=2);
lp->rx_tail = cur_rxbuf; lp->rx_tail = cur_rxbuf;
cur_rxbuf += RX_BUF_SIZE; cur_rxbuf += RX_BUF_SIZE;
...@@ -706,16 +717,16 @@ static void init_rx_bufs(struct net_device *dev) ...@@ -706,16 +717,16 @@ static void init_rx_bufs(struct net_device *dev)
/* Terminate the list by setting the EOL bit, and wrap the pointer to make /* Terminate the list by setting the EOL bit, and wrap the pointer to make
the list a ring. */ the list a ring. */
write_ptr = dev->mem_start + lp->rx_tail + 2; write_ptr = lp->base + lp->rx_tail + 2;
isa_writew(0xC000,write_ptr); /* Command, mark as last. */ writew(0xC000,write_ptr); /* Command, mark as last. */
isa_writew(lp->rx_head,write_ptr+2); /* Link */ writew(lp->rx_head,write_ptr+2); /* Link */
} }
static void init_82586_mem(struct net_device *dev) static void init_82586_mem(struct net_device *dev)
{ {
struct net_local *lp = netdev_priv(dev); struct net_local *lp = netdev_priv(dev);
short ioaddr = dev->base_addr; short ioaddr = dev->base_addr;
unsigned long shmem = dev->mem_start; void __iomem *shmem = lp->base;
/* Enable loopback to protect the wire while starting up, /* Enable loopback to protect the wire while starting up,
and hold the 586 in reset during the memory initialization. */ and hold the 586 in reset during the memory initialization. */
...@@ -726,13 +737,13 @@ static void init_82586_mem(struct net_device *dev) ...@@ -726,13 +737,13 @@ static void init_82586_mem(struct net_device *dev)
init_words[7] = SCB_BASE; init_words[7] = SCB_BASE;
/* Write the words at 0xfff6 (address-aliased to 0xfffff6). */ /* Write the words at 0xfff6 (address-aliased to 0xfffff6). */
isa_memcpy_toio(dev->mem_end-10, init_words, 10); memcpy_toio(lp->base + RX_BUF_END - 10, init_words, 10);
/* Write the words at 0x0000. */ /* Write the words at 0x0000. */
isa_memcpy_toio(dev->mem_start, init_words + 5, sizeof(init_words) - 10); memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10);
/* Fill in the station address. */ /* Fill in the station address. */
isa_memcpy_toio(dev->mem_start+SA_OFFSET, dev->dev_addr, memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr,
sizeof(dev->dev_addr)); sizeof(dev->dev_addr));
/* The Tx-block list is written as needed. We just set up the values. */ /* The Tx-block list is written as needed. We just set up the values. */
...@@ -750,11 +761,11 @@ static void init_82586_mem(struct net_device *dev) ...@@ -750,11 +761,11 @@ static void init_82586_mem(struct net_device *dev)
{ {
int boguscnt = 50; int boguscnt = 50;
while (isa_readw(shmem+iSCB_STATUS) == 0) while (readw(shmem+iSCB_STATUS) == 0)
if (--boguscnt == 0) { if (--boguscnt == 0) {
printk("%s: i82586 initialization timed out with status %04x," printk("%s: i82586 initialization timed out with status %04x,"
"cmd %04x.\n", dev->name, "cmd %04x.\n", dev->name,
isa_readw(shmem+iSCB_STATUS), isa_readw(shmem+iSCB_CMD)); readw(shmem+iSCB_STATUS), readw(shmem+iSCB_CMD));
break; break;
} }
/* Issue channel-attn -- the 82586 won't start. */ /* Issue channel-attn -- the 82586 won't start. */
...@@ -765,7 +776,7 @@ static void init_82586_mem(struct net_device *dev) ...@@ -765,7 +776,7 @@ static void init_82586_mem(struct net_device *dev)
outb(0x84, ioaddr + MISC_CTRL); outb(0x84, ioaddr + MISC_CTRL);
if (net_debug > 4) if (net_debug > 4)
printk("%s: Initialized 82586, status %04x.\n", dev->name, printk("%s: Initialized 82586, status %04x.\n", dev->name,
isa_readw(shmem+iSCB_STATUS)); readw(shmem+iSCB_STATUS));
return; return;
} }
...@@ -774,33 +785,33 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length ...@@ -774,33 +785,33 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length
struct net_local *lp = netdev_priv(dev); struct net_local *lp = netdev_priv(dev);
short ioaddr = dev->base_addr; short ioaddr = dev->base_addr;
ushort tx_block = lp->tx_head; ushort tx_block = lp->tx_head;
unsigned long write_ptr = dev->mem_start + tx_block; void __iomem *write_ptr = lp->base + tx_block;
static char padding[ETH_ZLEN]; static char padding[ETH_ZLEN];
/* Set the write pointer to the Tx block, and put out the header. */ /* Set the write pointer to the Tx block, and put out the header. */
isa_writew(0x0000,write_ptr); /* Tx status */ writew(0x0000,write_ptr); /* Tx status */
isa_writew(CMD_INTR|CmdTx,write_ptr+=2); /* Tx command */ writew(CMD_INTR|CmdTx,write_ptr+=2); /* Tx command */
isa_writew(tx_block+16,write_ptr+=2); /* Next command is a NoOp. */ writew(tx_block+16,write_ptr+=2); /* Next command is a NoOp. */
isa_writew(tx_block+8,write_ptr+=2); /* Data Buffer offset. */ writew(tx_block+8,write_ptr+=2); /* Data Buffer offset. */
/* Output the data buffer descriptor. */ /* Output the data buffer descriptor. */
isa_writew((pad + length) | 0x8000,write_ptr+=2); /* Byte count parameter. */ writew((pad + length) | 0x8000,write_ptr+=2); /* Byte count parameter. */
isa_writew(-1,write_ptr+=2); /* No next data buffer. */ writew(-1,write_ptr+=2); /* No next data buffer. */
isa_writew(tx_block+22+SCB_BASE,write_ptr+=2); /* Buffer follows the NoOp command. */ writew(tx_block+22+SCB_BASE,write_ptr+=2); /* Buffer follows the NoOp command. */
isa_writew(0x0000,write_ptr+=2); /* Buffer address high bits (always zero). */ writew(0x0000,write_ptr+=2); /* Buffer address high bits (always zero). */
/* Output the Loop-back NoOp command. */ /* Output the Loop-back NoOp command. */
isa_writew(0x0000,write_ptr+=2); /* Tx status */ writew(0x0000,write_ptr+=2); /* Tx status */
isa_writew(CmdNOp,write_ptr+=2); /* Tx command */ writew(CmdNOp,write_ptr+=2); /* Tx command */
isa_writew(tx_block+16,write_ptr+=2); /* Next is myself. */ writew(tx_block+16,write_ptr+=2); /* Next is myself. */
/* Output the packet at the write pointer. */ /* Output the packet at the write pointer. */
isa_memcpy_toio(write_ptr+2, buf, length); memcpy_toio(write_ptr+2, buf, length);
if (pad) if (pad)
isa_memcpy_toio(write_ptr+length+2, padding, pad); memcpy_toio(write_ptr+length+2, padding, pad);
/* Set the old command link pointing to this send packet. */ /* Set the old command link pointing to this send packet. */
isa_writew(tx_block,dev->mem_start + lp->tx_cmd_link); writew(tx_block,lp->base + lp->tx_cmd_link);
lp->tx_cmd_link = tx_block + 20; lp->tx_cmd_link = tx_block + 20;
/* Set the next free tx region. */ /* Set the next free tx region. */
...@@ -821,19 +832,19 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length ...@@ -821,19 +832,19 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length
static void el16_rx(struct net_device *dev) static void el16_rx(struct net_device *dev)
{ {
struct net_local *lp = netdev_priv(dev); struct net_local *lp = netdev_priv(dev);
unsigned long shmem = dev->mem_start; void __iomem *shmem = lp->base;
ushort rx_head = lp->rx_head; ushort rx_head = lp->rx_head;
ushort rx_tail = lp->rx_tail; ushort rx_tail = lp->rx_tail;
ushort boguscount = 10; ushort boguscount = 10;
short frame_status; short frame_status;
while ((frame_status = isa_readw(shmem+rx_head)) < 0) { /* Command complete */ while ((frame_status = readw(shmem+rx_head)) < 0) { /* Command complete */
unsigned long read_frame = dev->mem_start + rx_head; void __iomem *read_frame = lp->base + rx_head;
ushort rfd_cmd = isa_readw(read_frame+2); ushort rfd_cmd = readw(read_frame+2);
ushort next_rx_frame = isa_readw(read_frame+4); ushort next_rx_frame = readw(read_frame+4);
ushort data_buffer_addr = isa_readw(read_frame+6); ushort data_buffer_addr = readw(read_frame+6);
unsigned long data_frame = dev->mem_start + data_buffer_addr; void __iomem *data_frame = lp->base + data_buffer_addr;
ushort pkt_len = isa_readw(data_frame); ushort pkt_len = readw(data_frame);
if (rfd_cmd != 0 || data_buffer_addr != rx_head + 22 if (rfd_cmd != 0 || data_buffer_addr != rx_head + 22
|| (pkt_len & 0xC000) != 0xC000) { || (pkt_len & 0xC000) != 0xC000) {
...@@ -865,7 +876,7 @@ static void el16_rx(struct net_device *dev) ...@@ -865,7 +876,7 @@ static void el16_rx(struct net_device *dev)
skb->dev = dev; skb->dev = dev;
/* 'skb->data' points to the start of sk_buff data area. */ /* 'skb->data' points to the start of sk_buff data area. */
isa_memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len); memcpy_fromio(skb_put(skb,pkt_len), data_frame + 10, pkt_len);
skb->protocol=eth_type_trans(skb,dev); skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb); netif_rx(skb);
...@@ -875,10 +886,10 @@ static void el16_rx(struct net_device *dev) ...@@ -875,10 +886,10 @@ static void el16_rx(struct net_device *dev)
} }
/* Clear the status word and set End-of-List on the rx frame. */ /* Clear the status word and set End-of-List on the rx frame. */
isa_writew(0,read_frame); writew(0,read_frame);
isa_writew(0xC000,read_frame+2); writew(0xC000,read_frame+2);
/* Clear the end-of-list on the prev. RFD. */ /* Clear the end-of-list on the prev. RFD. */
isa_writew(0x0000,dev->mem_start + rx_tail + 2); writew(0x0000,lp->base + rx_tail + 2);
rx_tail = rx_head; rx_tail = rx_head;
rx_head = next_rx_frame; rx_head = next_rx_frame;
...@@ -935,6 +946,7 @@ cleanup_module(void) ...@@ -935,6 +946,7 @@ cleanup_module(void)
struct net_device *dev = dev_3c507; struct net_device *dev = dev_3c507;
unregister_netdev(dev); unregister_netdev(dev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
iounmap(((struct net_local *)netdev_priv(dev))->base);
release_region(dev->base_addr, EL16_IO_EXTENT); release_region(dev->base_addr, EL16_IO_EXTENT);
free_netdev(dev); free_netdev(dev);
} }
......
...@@ -52,6 +52,7 @@ struct ei_device { ...@@ -52,6 +52,7 @@ struct ei_device {
void (*block_input)(struct net_device *, int, struct sk_buff *, int); void (*block_input)(struct net_device *, int, struct sk_buff *, int);
unsigned long rmem_start; unsigned long rmem_start;
unsigned long rmem_end; unsigned long rmem_end;
void __iomem *mem;
unsigned char mcfilter[8]; unsigned char mcfilter[8];
unsigned open:1; unsigned open:1;
unsigned word16:1; /* We have the 16-bit (vs 8-bit) version of the card. */ unsigned word16:1; /* We have the 16-bit (vs 8-bit) version of the card. */
......
...@@ -128,8 +128,7 @@ static void cleanup_card(struct net_device *dev) ...@@ -128,8 +128,7 @@ static void cleanup_card(struct net_device *dev)
/* Someday free_irq may be in ac_close_card() */ /* Someday free_irq may be in ac_close_card() */
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
release_region(dev->base_addr, AC_IO_EXTENT); release_region(dev->base_addr, AC_IO_EXTENT);
if (ei_status.reg0) iounmap(ei_status.mem);
iounmap((void *)dev->mem_start);
} }
#ifndef MODULE #ifndef MODULE
...@@ -237,32 +236,22 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev) ...@@ -237,32 +236,22 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
/* /*
* BEWARE!! Some dain-bramaged EISA SCUs will allow you to put * BEWARE!! Some dain-bramaged EISA SCUs will allow you to put
* the card mem within the region covered by `normal' RAM !!! * the card mem within the region covered by `normal' RAM !!!
*
* ioremap() will fail in that case.
*/ */
if (dev->mem_start > 1024*1024) { /* phys addr > 1MB */ ei_status.mem = ioremap(dev->mem_start, AC_STOP_PG*0x100);
if (dev->mem_start < virt_to_phys(high_memory)) { if (!ei_status.mem) {
printk(KERN_CRIT "ac3200.c: Card RAM overlaps with normal memory!!!\n"); printk(KERN_ERR "ac3200.c: Unable to remap card memory above 1MB !!\n");
printk(KERN_CRIT "ac3200.c: Use EISA SCU to set card memory below 1MB,\n"); printk(KERN_ERR "ac3200.c: Try using EISA SCU to set memory below 1MB.\n");
printk(KERN_CRIT "ac3200.c: or to an address above 0x%lx.\n", virt_to_phys(high_memory)); printk(KERN_ERR "ac3200.c: Driver NOT installed.\n");
printk(KERN_CRIT "ac3200.c: Driver NOT installed.\n"); retval = -EINVAL;
retval = -EINVAL; goto out1;
goto out1;
}
dev->mem_start = (unsigned long)ioremap(dev->mem_start, AC_STOP_PG*0x100);
if (dev->mem_start == 0) {
printk(KERN_ERR "ac3200.c: Unable to remap card memory above 1MB !!\n");
printk(KERN_ERR "ac3200.c: Try using EISA SCU to set memory below 1MB.\n");
printk(KERN_ERR "ac3200.c: Driver NOT installed.\n");
retval = -EINVAL;
goto out1;
}
ei_status.reg0 = 1; /* Use as remap flag */
printk("ac3200.c: remapped %dkB card memory to virtual address %#lx\n",
AC_STOP_PG/4, dev->mem_start);
} }
printk("ac3200.c: remapped %dkB card memory to virtual address %p\n",
AC_STOP_PG/4, ei_status.mem);
ei_status.rmem_start = dev->mem_start + TX_PAGES*256; dev->mem_start = (unsigned long)ei_status.mem;
dev->mem_end = ei_status.rmem_end = dev->mem_start dev->mem_end = dev->mem_start + (AC_STOP_PG - AC_START_PG)*256;
+ (AC_STOP_PG - AC_START_PG)*256;
ei_status.name = "AC3200"; ei_status.name = "AC3200";
ei_status.tx_start_page = AC_START_PG; ei_status.tx_start_page = AC_START_PG;
...@@ -324,8 +313,8 @@ static void ac_reset_8390(struct net_device *dev) ...@@ -324,8 +313,8 @@ static void ac_reset_8390(struct net_device *dev)
static void static void
ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{ {
unsigned long hdr_start = dev->mem_start + ((ring_page - AC_START_PG)<<8); void __iomem *hdr_start = ei_status.mem + ((ring_page - AC_START_PG)<<8);
isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr)); memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
} }
/* Block input and output are easy on shared memory ethercards, the only /* Block input and output are easy on shared memory ethercards, the only
...@@ -334,26 +323,27 @@ ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page ...@@ -334,26 +323,27 @@ ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page
static void ac_block_input(struct net_device *dev, int count, struct sk_buff *skb, static void ac_block_input(struct net_device *dev, int count, struct sk_buff *skb,
int ring_offset) int ring_offset)
{ {
unsigned long xfer_start = dev->mem_start + ring_offset - (AC_START_PG<<8); void __iomem *start = ei_status.mem + ring_offset - AC_START_PG*256;
if (xfer_start + count > ei_status.rmem_end) { if (ring_offset + count > AC_STOP_PG*256) {
/* We must wrap the input move. */ /* We must wrap the input move. */
int semi_count = ei_status.rmem_end - xfer_start; int semi_count = AC_STOP_PG*256 - ring_offset;
isa_memcpy_fromio(skb->data, xfer_start, semi_count); memcpy_fromio(skb->data, start, semi_count);
count -= 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 { } else {
/* Packet is in one chunk -- we can copy + cksum. */ /* 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, start, count, 0);
} }
} }
static void ac_block_output(struct net_device *dev, int count, static void ac_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page) const unsigned char *buf, int start_page)
{ {
unsigned long shmem = dev->mem_start + ((start_page - AC_START_PG)<<8); void __iomem *shmem = ei_status.mem + ((start_page - AC_START_PG)<<8);
isa_memcpy_toio(shmem, buf, count); memcpy_toio(shmem, buf, count);
} }
static int ac_close_card(struct net_device *dev) static int ac_close_card(struct net_device *dev)
......
...@@ -463,11 +463,11 @@ struct depca_private { ...@@ -463,11 +463,11 @@ struct depca_private {
} depca_bus; /* type of bus */ } depca_bus; /* type of bus */
struct depca_init init_block; /* Shadow Initialization block */ struct depca_init init_block; /* Shadow Initialization block */
/* CPU address space fields */ /* CPU address space fields */
struct depca_rx_desc *rx_ring; /* Pointer to start of RX descriptor ring */ struct depca_rx_desc __iomem *rx_ring; /* Pointer to start of RX descriptor ring */
struct depca_tx_desc *tx_ring; /* Pointer to start of TX descriptor ring */ struct depca_tx_desc __iomem *tx_ring; /* Pointer to start of TX descriptor ring */
void *rx_buff[NUM_RX_DESC]; /* CPU virt address of sh'd memory buffs */ void __iomem *rx_buff[NUM_RX_DESC]; /* CPU virt address of sh'd memory buffs */
void *tx_buff[NUM_TX_DESC]; /* CPU virt address of sh'd memory buffs */ void __iomem *tx_buff[NUM_TX_DESC]; /* CPU virt address of sh'd memory buffs */
void *sh_mem; /* CPU mapped virt address of device RAM */ void __iomem *sh_mem; /* CPU mapped virt address of device RAM */
u_long mem_start; /* Bus address of device RAM (before remap) */ u_long mem_start; /* Bus address of device RAM (before remap) */
u_long mem_len; /* device memory size */ u_long mem_len; /* device memory size */
/* Device address space fields */ /* Device address space fields */
...@@ -693,11 +693,11 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) ...@@ -693,11 +693,11 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
/* Tx & Rx descriptors (aligned to a quadword boundary) */ /* Tx & Rx descriptors (aligned to a quadword boundary) */
offset = (offset + DEPCA_ALIGN) & ~DEPCA_ALIGN; offset = (offset + DEPCA_ALIGN) & ~DEPCA_ALIGN;
lp->rx_ring = (struct depca_rx_desc *) (lp->sh_mem + offset); lp->rx_ring = (struct depca_rx_desc __iomem *) (lp->sh_mem + offset);
lp->rx_ring_offset = offset; lp->rx_ring_offset = offset;
offset += (sizeof(struct depca_rx_desc) * NUM_RX_DESC); offset += (sizeof(struct depca_rx_desc) * NUM_RX_DESC);
lp->tx_ring = (struct depca_tx_desc *) (lp->sh_mem + offset); lp->tx_ring = (struct depca_tx_desc __iomem *) (lp->sh_mem + offset);
lp->tx_ring_offset = offset; lp->tx_ring_offset = offset;
offset += (sizeof(struct depca_tx_desc) * NUM_TX_DESC); offset += (sizeof(struct depca_tx_desc) * NUM_TX_DESC);
...@@ -1649,7 +1649,7 @@ static int __devexit depca_device_remove (struct device *device) ...@@ -1649,7 +1649,7 @@ static int __devexit depca_device_remove (struct device *device)
static int __init DepcaSignature(char *name, u_long base_addr) static int __init DepcaSignature(char *name, u_long base_addr)
{ {
u_int i, j, k; u_int i, j, k;
void *ptr; void __iomem *ptr;
char tmpstr[16]; char tmpstr[16];
u_long prom_addr = base_addr + 0xc000; u_long prom_addr = base_addr + 0xc000;
u_long mem_addr = base_addr + 0x8000; /* 32KB */ u_long mem_addr = base_addr + 0x8000; /* 32KB */
...@@ -1876,17 +1876,17 @@ static void depca_dbg_open(struct net_device *dev) ...@@ -1876,17 +1876,17 @@ static void depca_dbg_open(struct net_device *dev)
printk("Descriptor addresses (CPU):\nRX: "); printk("Descriptor addresses (CPU):\nRX: ");
for (i = 0; i < lp->rxRingMask; i++) { for (i = 0; i < lp->rxRingMask; i++) {
if (i < 3) { if (i < 3) {
printk("0x%8.8lx ", (long) &lp->rx_ring[i].base); printk("%p ", &lp->rx_ring[i].base);
} }
} }
printk("...0x%8.8lx\n", (long) &lp->rx_ring[i].base); printk("...%p\n", &lp->rx_ring[i].base);
printk("TX: "); printk("TX: ");
for (i = 0; i < lp->txRingMask; i++) { for (i = 0; i < lp->txRingMask; i++) {
if (i < 3) { if (i < 3) {
printk("0x%8.8lx ", (long) &lp->tx_ring[i].base); printk("%p ", &lp->tx_ring[i].base);
} }
} }
printk("...0x%8.8lx\n", (long) &lp->tx_ring[i].base); printk("...%p\n", &lp->tx_ring[i].base);
printk("\nDescriptor buffers (Device):\nRX: "); printk("\nDescriptor buffers (Device):\nRX: ");
for (i = 0; i < lp->rxRingMask; i++) { for (i = 0; i < lp->rxRingMask; i++) {
if (i < 3) { if (i < 3) {
......
...@@ -72,7 +72,7 @@ static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0}; ...@@ -72,7 +72,7 @@ static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0};
#define E21_SAPROM 0x10 /* Offset to station address data. */ #define E21_SAPROM 0x10 /* Offset to station address data. */
#define E21_IO_EXTENT 0x20 #define E21_IO_EXTENT 0x20
static inline void mem_on(short port, volatile char *mem_base, static inline void mem_on(short port, volatile char __iomem *mem_base,
unsigned char start_page ) unsigned char start_page )
{ {
/* This is a little weird: set the shared memory window by doing a /* This is a little weird: set the shared memory window by doing a
...@@ -143,6 +143,7 @@ static int __init do_e2100_probe(struct net_device *dev) ...@@ -143,6 +143,7 @@ static int __init do_e2100_probe(struct net_device *dev)
static void cleanup_card(struct net_device *dev) static void cleanup_card(struct net_device *dev)
{ {
/* NB: e21_close() handles free_irq */ /* NB: e21_close() handles free_irq */
iounmap(ei_status.mem);
release_region(dev->base_addr, E21_IO_EXTENT); release_region(dev->base_addr, E21_IO_EXTENT);
} }
...@@ -257,6 +258,13 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr) ...@@ -257,6 +258,13 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
if (dev->mem_start == 0) if (dev->mem_start == 0)
dev->mem_start = 0xd0000; dev->mem_start = 0xd0000;
ei_status.mem = ioremap(dev->mem_start, 2*1024);
if (!ei_status.mem) {
printk("unable to remap memory\n");
retval = -EAGAIN;
goto out;
}
#ifdef notdef #ifdef notdef
/* These values are unused. The E2100 has a 2K window into the packet /* These values are unused. The E2100 has a 2K window into the packet
buffer. The window can be set to start on any page boundary. */ buffer. The window can be set to start on any page boundary. */
...@@ -329,7 +337,7 @@ e21_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_pag ...@@ -329,7 +337,7 @@ e21_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_pag
{ {
short ioaddr = dev->base_addr; short ioaddr = dev->base_addr;
char *shared_mem = (char *)dev->mem_start; char __iomem *shared_mem = ei_status.mem;
mem_on(ioaddr, shared_mem, ring_page); mem_on(ioaddr, shared_mem, ring_page);
...@@ -352,12 +360,12 @@ static void ...@@ -352,12 +360,12 @@ static void
e21_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) e21_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
{ {
short ioaddr = dev->base_addr; short ioaddr = dev->base_addr;
char *shared_mem = (char *)dev->mem_start; char __iomem *shared_mem = ei_status.mem;
mem_on(ioaddr, shared_mem, (ring_offset>>8)); mem_on(ioaddr, shared_mem, (ring_offset>>8));
/* Packet is always in one chunk -- we can copy + cksum. */ /* Packet is always in one chunk -- we can copy + cksum. */
eth_io_copy_and_sum(skb, dev->mem_start + (ring_offset & 0xff), count, 0); eth_io_copy_and_sum(skb, ei_status.mem + (ring_offset & 0xff), count, 0);
mem_off(ioaddr); mem_off(ioaddr);
} }
...@@ -367,7 +375,7 @@ e21_block_output(struct net_device *dev, int count, const unsigned char *buf, ...@@ -367,7 +375,7 @@ e21_block_output(struct net_device *dev, int count, const unsigned char *buf,
int start_page) int start_page)
{ {
short ioaddr = dev->base_addr; short ioaddr = dev->base_addr;
volatile char *shared_mem = (char *)dev->mem_start; volatile char __iomem *shared_mem = ei_status.mem;
/* Set the shared memory window start by doing a read, with the low address /* Set the shared memory window start by doing a read, with the low address
bits specifying the starting page. */ bits specifying the starting page. */
......
...@@ -149,8 +149,7 @@ static void cleanup_card(struct net_device *dev) ...@@ -149,8 +149,7 @@ static void cleanup_card(struct net_device *dev)
{ {
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
release_region(dev->base_addr, LNE390_IO_EXTENT); release_region(dev->base_addr, LNE390_IO_EXTENT);
if (ei_status.reg0) iounmap(ei_status.mem);
iounmap((void *)dev->mem_start);
} }
#ifndef MODULE #ifndef MODULE
...@@ -257,32 +256,22 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr) ...@@ -257,32 +256,22 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
/* /*
BEWARE!! Some dain-bramaged EISA SCUs will allow you to put BEWARE!! Some dain-bramaged EISA SCUs will allow you to put
the card mem within the region covered by `normal' RAM !!! the card mem within the region covered by `normal' RAM !!!
ioremap() will fail in that case.
*/ */
if (dev->mem_start > 1024*1024) { /* phys addr > 1MB */ ei_status.mem = ioremap(dev->mem_start, LNE390_STOP_PG*0x100);
if (dev->mem_start < virt_to_phys(high_memory)) { if (!ei_status.mem) {
printk(KERN_CRIT "lne390.c: Card RAM overlaps with normal memory!!!\n"); printk(KERN_ERR "lne390.c: Unable to remap card memory above 1MB !!\n");
printk(KERN_CRIT "lne390.c: Use EISA SCU to set card memory below 1MB,\n"); printk(KERN_ERR "lne390.c: Try using EISA SCU to set memory below 1MB.\n");
printk(KERN_CRIT "lne390.c: or to an address above 0x%lx.\n", virt_to_phys(high_memory)); printk(KERN_ERR "lne390.c: Driver NOT installed.\n");
printk(KERN_CRIT "lne390.c: Driver NOT installed.\n"); ret = -EAGAIN;
ret = -EINVAL; goto cleanup;
goto cleanup;
}
dev->mem_start = (unsigned long)ioremap(dev->mem_start, LNE390_STOP_PG*0x100);
if (dev->mem_start == 0) {
printk(KERN_ERR "lne390.c: Unable to remap card memory above 1MB !!\n");
printk(KERN_ERR "lne390.c: Try using EISA SCU to set memory below 1MB.\n");
printk(KERN_ERR "lne390.c: Driver NOT installed.\n");
ret = -EAGAIN;
goto cleanup;
}
ei_status.reg0 = 1; /* Use as remap flag */
printk("lne390.c: remapped %dkB card memory to virtual address %#lx\n",
LNE390_STOP_PG/4, dev->mem_start);
} }
printk("lne390.c: remapped %dkB card memory to virtual address %p\n",
LNE390_STOP_PG/4, ei_status.mem);
dev->mem_end = ei_status.rmem_end = dev->mem_start dev->mem_start = (unsigned long)ei_status.mem;
+ (LNE390_STOP_PG - LNE390_START_PG)*256; dev->mem_end = dev->mem_start + (LNE390_STOP_PG - LNE390_START_PG)*256;
ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
/* The 8390 offset is zero for the LNE390 */ /* The 8390 offset is zero for the LNE390 */
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
...@@ -352,8 +341,8 @@ static void lne390_reset_8390(struct net_device *dev) ...@@ -352,8 +341,8 @@ static void lne390_reset_8390(struct net_device *dev)
static void static void
lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{ {
unsigned long hdr_start = dev->mem_start + ((ring_page - LNE390_START_PG)<<8); void __iomem *hdr_start = ei_status.mem + ((ring_page - LNE390_START_PG)<<8);
isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr)); memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */ hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
} }
...@@ -366,27 +355,28 @@ lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_ ...@@ -366,27 +355,28 @@ lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_
static void lne390_block_input(struct net_device *dev, int count, struct sk_buff *skb, static void lne390_block_input(struct net_device *dev, int count, struct sk_buff *skb,
int ring_offset) int ring_offset)
{ {
unsigned long xfer_start = dev->mem_start + ring_offset - (LNE390_START_PG<<8); void __iomem *xfer_start = ei_status.mem + ring_offset - (LNE390_START_PG<<8);
if (xfer_start + count > ei_status.rmem_end) { if (ring_offset + count > (LNE390_STOP_PG<<8)) {
/* Packet wraps over end of ring buffer. */ /* Packet wraps over end of ring buffer. */
int semi_count = ei_status.rmem_end - xfer_start; int semi_count = (LNE390_STOP_PG<<8) - ring_offset;
isa_memcpy_fromio(skb->data, xfer_start, semi_count); memcpy_fromio(skb->data, xfer_start, semi_count);
count -= 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<<8), count);
} else { } else {
/* Packet is in one chunk. */ /* Packet is in one chunk. */
isa_memcpy_fromio(skb->data, xfer_start, count); memcpy_fromio(skb->data, xfer_start, count);
} }
} }
static void lne390_block_output(struct net_device *dev, int count, static void lne390_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page) const unsigned char *buf, int start_page)
{ {
unsigned long shmem = dev->mem_start + ((start_page - LNE390_START_PG)<<8); void __iomem *shmem = ei_status.mem + ((start_page - LNE390_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */ count = (count + 3) & ~3; /* Round up to doubleword */
isa_memcpy_toio(shmem, buf, count); memcpy_toio(shmem, buf, count);
} }
static int lne390_open(struct net_device *dev) static int lne390_open(struct net_device *dev)
......
...@@ -174,18 +174,17 @@ static int __init ne3210_eisa_probe (struct device *device) ...@@ -174,18 +174,17 @@ static int __init ne3210_eisa_probe (struct device *device)
printk("%dkB memory at physical address %#lx\n", printk("%dkB memory at physical address %#lx\n",
NE3210_STOP_PG/4, phys_mem); NE3210_STOP_PG/4, phys_mem);
dev->mem_start = (unsigned long)ioremap(phys_mem, NE3210_STOP_PG*0x100); ei_status.mem = ioremap(phys_mem, NE3210_STOP_PG*0x100);
if (dev->mem_start == 0) { if (!ei_status.mem) {
printk(KERN_ERR "ne3210.c: Unable to remap card memory !!\n"); printk(KERN_ERR "ne3210.c: Unable to remap card memory !!\n");
printk(KERN_ERR "ne3210.c: Driver NOT installed.\n"); printk(KERN_ERR "ne3210.c: Driver NOT installed.\n");
retval = -EAGAIN; retval = -EAGAIN;
goto out4; goto out4;
} }
printk("ne3210.c: remapped %dkB card memory to virtual address %#lx\n", printk("ne3210.c: remapped %dkB card memory to virtual address %p\n",
NE3210_STOP_PG/4, dev->mem_start); NE3210_STOP_PG/4, ei_status.mem);
dev->mem_end = ei_status.rmem_end = dev->mem_start dev->mem_start = (unsigned long)ei_status.mem;
+ (NE3210_STOP_PG - NE3210_START_PG)*256; dev->mem_end = dev->mem_start + (NE3210_STOP_PG - NE3210_START_PG)*256;
ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
/* The 8390 offset is zero for the NE3210 */ /* The 8390 offset is zero for the NE3210 */
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
...@@ -219,7 +218,7 @@ static int __init ne3210_eisa_probe (struct device *device) ...@@ -219,7 +218,7 @@ static int __init ne3210_eisa_probe (struct device *device)
return 0; return 0;
out5: out5:
iounmap((void *)dev->mem_start); iounmap(ei_status.mem);
out4: out4:
release_mem_region (phys_mem, NE3210_STOP_PG*0x100); release_mem_region (phys_mem, NE3210_STOP_PG*0x100);
out3: out3:
...@@ -240,7 +239,7 @@ static int __devexit ne3210_eisa_remove (struct device *device) ...@@ -240,7 +239,7 @@ static int __devexit ne3210_eisa_remove (struct device *device)
unsigned long ioaddr = to_eisa_device (device)->base_addr; unsigned long ioaddr = to_eisa_device (device)->base_addr;
unregister_netdev (dev); unregister_netdev (dev);
iounmap((void *)dev->mem_start); iounmap(ei_status.mem);
release_mem_region (ei_status.priv, NE3210_STOP_PG*0x100); release_mem_region (ei_status.priv, NE3210_STOP_PG*0x100);
free_irq (dev->irq, dev); free_irq (dev->irq, dev);
release_region (ioaddr + NE3210_CFG1, NE3210_CFG_EXTENT); release_region (ioaddr + NE3210_CFG1, NE3210_CFG_EXTENT);
...@@ -288,7 +287,7 @@ static void ne3210_reset_8390(struct net_device *dev) ...@@ -288,7 +287,7 @@ static void ne3210_reset_8390(struct net_device *dev)
static void static void
ne3210_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) ne3210_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{ {
unsigned long hdr_start = dev->mem_start + ((ring_page - NE3210_START_PG)<<8); void __iomem *hdr_start = ei_status.mem + ((ring_page - NE3210_START_PG)<<8);
memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr)); memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */ hdr->count = (hdr->count + 3) & ~3; /* Round up allocation. */
} }
...@@ -302,24 +301,25 @@ ne3210_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_ ...@@ -302,24 +301,25 @@ ne3210_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_
static void ne3210_block_input(struct net_device *dev, int count, struct sk_buff *skb, static void ne3210_block_input(struct net_device *dev, int count, struct sk_buff *skb,
int ring_offset) int ring_offset)
{ {
unsigned long xfer_start = dev->mem_start + ring_offset - (NE3210_START_PG<<8); void __iomem *start = ei_status.mem + ring_offset - NE3210_START_PG*256;
if (xfer_start + count > ei_status.rmem_end) { if (ring_offset + count > NE3210_STOP_PG*256) {
/* Packet wraps over end of ring buffer. */ /* Packet wraps over end of ring buffer. */
int semi_count = ei_status.rmem_end - xfer_start; int semi_count = NE3210_STOP_PG*256 - ring_offset;
memcpy_fromio(skb->data, xfer_start, semi_count); memcpy_fromio(skb->data, start, semi_count);
count -= semi_count; count -= semi_count;
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 { } else {
/* Packet is in one chunk. */ /* Packet is in one chunk. */
memcpy_fromio(skb->data, xfer_start, count); memcpy_fromio(skb->data, start, count);
} }
} }
static void ne3210_block_output(struct net_device *dev, int count, static void ne3210_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page) const unsigned char *buf, int start_page)
{ {
unsigned long shmem = dev->mem_start + ((start_page - NE3210_START_PG)<<8); void __iomem *shmem = ei_status.mem + ((start_page - NE3210_START_PG)<<8);
count = (count + 3) & ~3; /* Round up to doubleword */ count = (count + 3) & ~3; /* Round up to doubleword */
memcpy_toio(shmem, buf, count); memcpy_toio(shmem, buf, count);
......
...@@ -623,7 +623,7 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id) ...@@ -623,7 +623,7 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
{ {
win_req_t req; win_req_t req;
memreq_t mem; memreq_t mem;
u_char *base; u_char __iomem *base;
int i, j; int i, j;
/* Allocate a small memory window */ /* Allocate a small memory window */
...@@ -676,7 +676,7 @@ static int fmvj18x_setup_mfc(dev_link_t *link) ...@@ -676,7 +676,7 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
{ {
win_req_t req; win_req_t req;
memreq_t mem; memreq_t mem;
u_char *base; u_char __iomem *base;
int i, j; int i, j;
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
ioaddr_t ioaddr; ioaddr_t ioaddr;
......
...@@ -227,7 +227,7 @@ typedef struct pcnet_dev_t { ...@@ -227,7 +227,7 @@ typedef struct pcnet_dev_t {
dev_link_t link; dev_link_t link;
dev_node_t node; dev_node_t node;
u_int flags; u_int flags;
caddr_t base; void __iomem *base;
struct timer_list watchdog; struct timer_list watchdog;
int stale, fast_poll; int stale, fast_poll;
u_char phy_id; u_char phy_id;
...@@ -352,7 +352,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link) ...@@ -352,7 +352,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
win_req_t req; win_req_t req;
memreq_t mem; memreq_t mem;
u_char *base, *virt; u_char __iomem *base, *virt;
int i, j; int i, j;
/* Allocate a small memory window */ /* Allocate a small memory window */
...@@ -1491,9 +1491,10 @@ static int setup_dma_config(dev_link_t *link, int start_pg, ...@@ -1491,9 +1491,10 @@ static int setup_dma_config(dev_link_t *link, int start_pg,
/*====================================================================*/ /*====================================================================*/
static void copyin(u_char *dest, u_char *src, int c) static void copyin(void *dest, void __iomem *src, int c)
{ {
u_short *d = (u_short *)dest, *s = (u_short *)src; u_short *d = dest;
u_short __iomem *s = src;
int odd; int odd;
if (c <= 0) if (c <= 0)
...@@ -1508,9 +1509,10 @@ static void copyin(u_char *dest, u_char *src, int c) ...@@ -1508,9 +1509,10 @@ static void copyin(u_char *dest, u_char *src, int c)
*((u_char *)d) = readw(s) & 0xff; *((u_char *)d) = readw(s) & 0xff;
} }
static void copyout(u_char *dest, const u_char *src, int c) static void copyout(void __iomem *dest, const void *src, int c)
{ {
u_short *d = (u_short *)dest, *s = (u_short *)src; u_short __iomem *d = dest;
const u_short *s = src;
int odd; int odd;
if (c <= 0) if (c <= 0)
...@@ -1531,10 +1533,11 @@ static void shmem_get_8390_hdr(struct net_device *dev, ...@@ -1531,10 +1533,11 @@ static void shmem_get_8390_hdr(struct net_device *dev,
struct e8390_pkt_hdr *hdr, struct e8390_pkt_hdr *hdr,
int ring_page) int ring_page)
{ {
void *xfer_start = (void *)(ei_status.rmem_start + (ring_page << 8) void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8)
- (ei_status.rx_start_page << 8)); + (ring_page << 8)
- (ei_status.rx_start_page << 8);
copyin((void *)hdr, xfer_start, sizeof(struct e8390_pkt_hdr)); copyin(hdr, xfer_start, sizeof(struct e8390_pkt_hdr));
/* Fix for big endian systems */ /* Fix for big endian systems */
hdr->count = le16_to_cpu(hdr->count); hdr->count = le16_to_cpu(hdr->count);
} }
...@@ -1544,17 +1547,17 @@ static void shmem_get_8390_hdr(struct net_device *dev, ...@@ -1544,17 +1547,17 @@ static void shmem_get_8390_hdr(struct net_device *dev,
static void shmem_block_input(struct net_device *dev, int count, static void shmem_block_input(struct net_device *dev, int count,
struct sk_buff *skb, int ring_offset) struct sk_buff *skb, int ring_offset)
{ {
void *xfer_start = (void *)(ei_status.rmem_start + ring_offset void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8)
- (ei_status.rx_start_page << 8)); + ring_offset
- (ei_status.rx_start_page << 8);
char *buf = skb->data; char *buf = skb->data;
if (xfer_start + count > (void *)ei_status.rmem_end) { if (xfer_start + count > (void __iomem *)ei_status.rmem_end) {
/* We must wrap the input move. */ /* We must wrap the input move. */
int semi_count = (void*)ei_status.rmem_end - xfer_start; int semi_count = (void __iomem *)ei_status.rmem_end - xfer_start;
copyin(buf, xfer_start, semi_count); copyin(buf, xfer_start, semi_count);
buf += semi_count; buf += semi_count;
ring_offset = ei_status.rx_start_page << 8; xfer_start = ei_status.mem + (TX_PAGES<<8);
xfer_start = (void *)ei_status.rmem_start;
count -= semi_count; count -= semi_count;
} }
copyin(buf, xfer_start, count); copyin(buf, xfer_start, count);
...@@ -1565,7 +1568,7 @@ static void shmem_block_input(struct net_device *dev, int count, ...@@ -1565,7 +1568,7 @@ static void shmem_block_input(struct net_device *dev, int count,
static void shmem_block_output(struct net_device *dev, int count, static void shmem_block_output(struct net_device *dev, int count,
const u_char *buf, const int start_page) const u_char *buf, const int start_page)
{ {
void *shmem = (void *)dev->mem_start + (start_page << 8); void __iomem *shmem = ei_status.mem + (start_page << 8);
shmem -= ei_status.tx_start_page << 8; shmem -= ei_status.tx_start_page << 8;
copyout(shmem, buf, count); copyout(shmem, buf, count);
} }
...@@ -1617,8 +1620,8 @@ static int setup_shmem_window(dev_link_t *link, int start_pg, ...@@ -1617,8 +1620,8 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
goto failed; goto failed;
} }
dev->mem_start = (u_long)info->base + offset; ei_status.mem = info->base + offset;
ei_status.rmem_start = dev->mem_start + (TX_PAGES<<8); dev->mem_start = (u_long)ei_status.mem;
dev->mem_end = ei_status.rmem_end = (u_long)info->base + req.Size; dev->mem_end = ei_status.rmem_end = (u_long)info->base + req.Size;
ei_status.tx_start_page = start_pg; ei_status.tx_start_page = start_pg;
......
...@@ -120,7 +120,7 @@ struct smc_private { ...@@ -120,7 +120,7 @@ struct smc_private {
dev_node_t node; dev_node_t node;
struct sk_buff *saved_skb; struct sk_buff *saved_skb;
int packets_waiting; int packets_waiting;
caddr_t base; void __iomem *base;
u_short cfg; u_short cfg;
struct timer_list media; struct timer_list media;
int watchdog, tx_err; int watchdog, tx_err;
......
...@@ -365,7 +365,7 @@ typedef struct local_info_t { ...@@ -365,7 +365,7 @@ typedef struct local_info_t {
int dingo; /* a CEM56 type card */ int dingo; /* a CEM56 type card */
int new_mii; /* has full 10baseT/100baseT MII */ int new_mii; /* has full 10baseT/100baseT MII */
int modem; /* is a multi function card (i.e with a modem) */ int modem; /* is a multi function card (i.e with a modem) */
caddr_t dingo_ccr; /* only used for CEM56 cards */ void __iomem *dingo_ccr; /* only used for CEM56 cards */
unsigned last_ptr_value; /* last packets transmitted value */ unsigned last_ptr_value; /* last packets transmitted value */
const char *manf_str; const char *manf_str;
} local_info_t; } local_info_t;
......
...@@ -159,7 +159,7 @@ static void print_tx_state(struct net_device *dev) ...@@ -159,7 +159,7 @@ static void print_tx_state(struct net_device *dev)
struct xl_private *xl_priv = (struct xl_private *)dev->priv ; struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
struct xl_tx_desc *txd ; struct xl_tx_desc *txd ;
u8 *xl_mmio = xl_priv->xl_mmio ; u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
int i ; int i ;
printk("tx_ring_head: %d, tx_ring_tail: %d, free_ent: %d \n",xl_priv->tx_ring_head, printk("tx_ring_head: %d, tx_ring_tail: %d, free_ent: %d \n",xl_priv->tx_ring_head,
...@@ -182,7 +182,7 @@ static void print_rx_state(struct net_device *dev) ...@@ -182,7 +182,7 @@ static void print_rx_state(struct net_device *dev)
struct xl_private *xl_priv = (struct xl_private *)dev->priv ; struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
struct xl_rx_desc *rxd ; struct xl_rx_desc *rxd ;
u8 *xl_mmio = xl_priv->xl_mmio ; u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
int i ; int i ;
printk("rx_ring_tail: %d \n", xl_priv->rx_ring_tail) ; printk("rx_ring_tail: %d \n", xl_priv->rx_ring_tail) ;
...@@ -215,7 +215,7 @@ static void print_rx_state(struct net_device *dev) ...@@ -215,7 +215,7 @@ static void print_rx_state(struct net_device *dev)
static u16 xl_ee_read(struct net_device *dev, int ee_addr) static u16 xl_ee_read(struct net_device *dev, int ee_addr)
{ {
struct xl_private *xl_priv = (struct xl_private *)dev->priv ; struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
u8 *xl_mmio = xl_priv->xl_mmio ; u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
/* Wait for EEProm to not be busy */ /* Wait for EEProm to not be busy */
writel(IO_WORD_READ | EECONTROL, xl_mmio + MMIO_MAC_ACCESS_CMD) ; writel(IO_WORD_READ | EECONTROL, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
...@@ -247,7 +247,7 @@ static u16 xl_ee_read(struct net_device *dev, int ee_addr) ...@@ -247,7 +247,7 @@ static u16 xl_ee_read(struct net_device *dev, int ee_addr)
static void xl_ee_write(struct net_device *dev, int ee_addr, u16 ee_value) static void xl_ee_write(struct net_device *dev, int ee_addr, u16 ee_value)
{ {
struct xl_private *xl_priv = (struct xl_private *)dev->priv ; struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
u8 *xl_mmio = xl_priv->xl_mmio ; u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
/* Wait for EEProm to not be busy */ /* Wait for EEProm to not be busy */
writel(IO_WORD_READ | EECONTROL, xl_mmio + MMIO_MAC_ACCESS_CMD) ; writel(IO_WORD_READ | EECONTROL, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
...@@ -386,7 +386,7 @@ static int __init xl_init(struct net_device *dev) ...@@ -386,7 +386,7 @@ static int __init xl_init(struct net_device *dev)
static int xl_hw_reset(struct net_device *dev) static int xl_hw_reset(struct net_device *dev)
{ {
struct xl_private *xl_priv = (struct xl_private *)dev->priv ; struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
u8 *xl_mmio = xl_priv->xl_mmio ; u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
unsigned long t ; unsigned long t ;
u16 i ; u16 i ;
u16 result_16 ; u16 result_16 ;
...@@ -569,7 +569,7 @@ static int xl_hw_reset(struct net_device *dev) ...@@ -569,7 +569,7 @@ static int xl_hw_reset(struct net_device *dev)
static int xl_open(struct net_device *dev) static int xl_open(struct net_device *dev)
{ {
struct xl_private *xl_priv=(struct xl_private *)dev->priv; struct xl_private *xl_priv=(struct xl_private *)dev->priv;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
u8 i ; u8 i ;
u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */ u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
int open_err ; int open_err ;
...@@ -727,7 +727,7 @@ static int xl_open(struct net_device *dev) ...@@ -727,7 +727,7 @@ static int xl_open(struct net_device *dev)
static int xl_open_hw(struct net_device *dev) static int xl_open_hw(struct net_device *dev)
{ {
struct xl_private *xl_priv=(struct xl_private *)dev->priv; struct xl_private *xl_priv=(struct xl_private *)dev->priv;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
u16 vsoff ; u16 vsoff ;
char ver_str[33]; char ver_str[33];
int open_err ; int open_err ;
...@@ -891,7 +891,7 @@ static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on ...@@ -891,7 +891,7 @@ static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on
static void xl_rx(struct net_device *dev) static void xl_rx(struct net_device *dev)
{ {
struct xl_private *xl_priv=(struct xl_private *)dev->priv; struct xl_private *xl_priv=(struct xl_private *)dev->priv;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
struct sk_buff *skb, *skb2 ; struct sk_buff *skb, *skb2 ;
int frame_length = 0, copy_len = 0 ; int frame_length = 0, copy_len = 0 ;
int temp_ring_loc ; int temp_ring_loc ;
...@@ -999,7 +999,7 @@ static void xl_rx(struct net_device *dev) ...@@ -999,7 +999,7 @@ static void xl_rx(struct net_device *dev)
static void xl_reset(struct net_device *dev) static void xl_reset(struct net_device *dev)
{ {
struct xl_private *xl_priv=(struct xl_private *)dev->priv; struct xl_private *xl_priv=(struct xl_private *)dev->priv;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
unsigned long t; unsigned long t;
writew( GLOBAL_RESET, xl_mmio + MMIO_COMMAND ) ; writew( GLOBAL_RESET, xl_mmio + MMIO_COMMAND ) ;
...@@ -1046,7 +1046,7 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1046,7 +1046,7 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct net_device *dev = (struct net_device *)dev_id; struct net_device *dev = (struct net_device *)dev_id;
struct xl_private *xl_priv =(struct xl_private *)dev->priv; struct xl_private *xl_priv =(struct xl_private *)dev->priv;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u16 intstatus, macstatus ; u16 intstatus, macstatus ;
if (!dev) { if (!dev) {
...@@ -1234,7 +1234,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1234,7 +1234,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
static void xl_dn_comp(struct net_device *dev) static void xl_dn_comp(struct net_device *dev)
{ {
struct xl_private *xl_priv=(struct xl_private *)dev->priv; struct xl_private *xl_priv=(struct xl_private *)dev->priv;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
struct xl_tx_desc *txd ; struct xl_tx_desc *txd ;
...@@ -1270,7 +1270,7 @@ static void xl_dn_comp(struct net_device *dev) ...@@ -1270,7 +1270,7 @@ static void xl_dn_comp(struct net_device *dev)
static int xl_close(struct net_device *dev) static int xl_close(struct net_device *dev)
{ {
struct xl_private *xl_priv = (struct xl_private *) dev->priv ; struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
unsigned long t ; unsigned long t ;
netif_stop_queue(dev) ; netif_stop_queue(dev) ;
...@@ -1409,7 +1409,7 @@ static void xl_set_rx_mode(struct net_device *dev) ...@@ -1409,7 +1409,7 @@ static void xl_set_rx_mode(struct net_device *dev)
static void xl_srb_bh(struct net_device *dev) static void xl_srb_bh(struct net_device *dev)
{ {
struct xl_private *xl_priv = (struct xl_private *) dev->priv ; struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u8 srb_cmd, ret_code ; u8 srb_cmd, ret_code ;
int i ; int i ;
...@@ -1506,7 +1506,7 @@ static int xl_set_mac_address (struct net_device *dev, void *addr) ...@@ -1506,7 +1506,7 @@ static int xl_set_mac_address (struct net_device *dev, void *addr)
static void xl_arb_cmd(struct net_device *dev) static void xl_arb_cmd(struct net_device *dev)
{ {
struct xl_private *xl_priv = (struct xl_private *) dev->priv; struct xl_private *xl_priv = (struct xl_private *) dev->priv;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u8 arb_cmd ; u8 arb_cmd ;
u16 lan_status, lan_status_diff ; u16 lan_status, lan_status_diff ;
...@@ -1634,7 +1634,7 @@ static void xl_arb_cmd(struct net_device *dev) ...@@ -1634,7 +1634,7 @@ static void xl_arb_cmd(struct net_device *dev)
static void xl_asb_cmd(struct net_device *dev) static void xl_asb_cmd(struct net_device *dev)
{ {
struct xl_private *xl_priv = (struct xl_private *) dev->priv ; struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
if (xl_priv->asb_queued == 1) if (xl_priv->asb_queued == 1)
writel(ACK_INTERRUPT | LATCH_ACK | ASBFACK, xl_mmio + MMIO_COMMAND) ; writel(ACK_INTERRUPT | LATCH_ACK | ASBFACK, xl_mmio + MMIO_COMMAND) ;
...@@ -1665,7 +1665,7 @@ static void xl_asb_cmd(struct net_device *dev) ...@@ -1665,7 +1665,7 @@ static void xl_asb_cmd(struct net_device *dev)
static void xl_asb_bh(struct net_device *dev) static void xl_asb_bh(struct net_device *dev)
{ {
struct xl_private *xl_priv = (struct xl_private *) dev->priv ; struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
u8 ret_code ; u8 ret_code ;
writel(MMIO_BYTE_READ | 0xd0000 | xl_priv->asb | 2, xl_mmio + MMIO_MAC_ACCESS_CMD) ; writel(MMIO_BYTE_READ | 0xd0000 | xl_priv->asb | 2, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
...@@ -1693,7 +1693,7 @@ static void xl_asb_bh(struct net_device *dev) ...@@ -1693,7 +1693,7 @@ static void xl_asb_bh(struct net_device *dev)
static void xl_srb_cmd(struct net_device *dev, int srb_cmd) static void xl_srb_cmd(struct net_device *dev, int srb_cmd)
{ {
struct xl_private *xl_priv = (struct xl_private *) dev->priv ; struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
switch (srb_cmd) { switch (srb_cmd) {
case READ_LOG: case READ_LOG:
...@@ -1750,7 +1750,7 @@ static void xl_srb_cmd(struct net_device *dev, int srb_cmd) ...@@ -1750,7 +1750,7 @@ static void xl_srb_cmd(struct net_device *dev, int srb_cmd)
static void xl_wait_misr_flags(struct net_device *dev) static void xl_wait_misr_flags(struct net_device *dev)
{ {
struct xl_private *xl_priv = (struct xl_private *) dev->priv ; struct xl_private *xl_priv = (struct xl_private *) dev->priv ;
u8 * xl_mmio = xl_priv->xl_mmio ; u8 __iomem * xl_mmio = xl_priv->xl_mmio ;
int i ; int i ;
......
...@@ -263,7 +263,7 @@ struct xl_private { ...@@ -263,7 +263,7 @@ struct xl_private {
u16 arb; u16 arb;
u16 asb; u16 asb;
u8 *xl_mmio; u8 __iomem *xl_mmio;
char *xl_card_name; char *xl_card_name;
struct pci_dev *pdev ; struct pci_dev *pdev ;
......
...@@ -76,67 +76,54 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n) ...@@ -76,67 +76,54 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n)
#else /* UNSAFE_MEMCPY */ #else /* UNSAFE_MEMCPY */
static inline void copy_from_pc(void *to, const void *from, size_t n) static inline void copy_from_pc(void *to, void __iomem *from, size_t n)
{ {
size_t odd = (n & 1); __u16 *t = to;
n -= odd; __u16 __iomem *f = from;
while (n) { size_t odd = (n & 1);
u_short *t = to; for (n >>= 1; n; n--)
*t++ = __raw_readw(f++);
*t = __raw_readw(from); if (odd)
to = (void *)((long)to + 2); *(__u8 *)t = readb(f);
from = (const void *)((long)from + 2);
n -= 2;
}
if (odd)
*(u_char *)to = readb(from);
} }
static inline void copy_to_pc(void *to, const void *from, size_t n) static inline void copy_to_pc(void __iomem *to, const void *from, size_t n)
{ {
size_t odd = (n & 1); __u16 __iomem *t = to;
n -= odd; const __u16 *f = from;
while (n) { size_t odd = (n & 1);
__raw_writew(*(u_short *)from, to); for (n >>= 1; n ; n--)
to = (void *)((long)to + 2); __raw_writew(*f++, t++);
from = (const void *)((long)from + 2); if (odd)
n -= 2; writeb(*(__u8 *)f, t);
}
if (odd)
writeb(*(u_char *)from, to);
} }
static inline void copy_pc_to_user(void *to, const void *from, size_t n) static inline void copy_pc_to_user(void __user *to, void __iomem *from, size_t n)
{ {
size_t odd = (n & 1); __u16 __user *t = to;
n -= odd; __u16 __iomem *f = from;
while (n) { size_t odd = (n & 1);
put_user(__raw_readw(from), (short *)to); for (n >>= 1; n ; n--)
to = (void *)((long)to + 2); put_user(__raw_readw(f++), t++);
from = (const void *)((long)from + 2); if (odd)
n -= 2; put_user(readb(f), (char __user *)t);
}
if (odd)
put_user(readb(from), (char *)to);
} }
static inline void copy_user_to_pc(void *to, const void *from, size_t n) static inline void copy_user_to_pc(void __iomem *to, void __user *from, size_t n)
{ {
short s; __u16 __user *f = from;
char c; __u16 __iomem *t = to;
size_t odd = (n & 1); short s;
n -= odd; char c;
while (n) { size_t odd = (n & 1);
get_user(s, (short *)from); for (n >>= 1; n; n--) {
__raw_writew(s, to); get_user(s, f++);
to = (void *)((long)to + 2); __raw_writew(s, t++);
from = (const void *)((long)from + 2); }
n -= 2; if (odd) {
} get_user(c, (char __user *)f);
if (odd) { writeb(c, t);
get_user(c, (char *)from); }
writeb(c, to);
}
} }
#endif /* UNSAFE_MEMCPY */ #endif /* UNSAFE_MEMCPY */
......
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