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
This diff is collapsed.
......@@ -52,6 +52,7 @@ struct ei_device {
void (*block_input)(struct net_device *, int, struct sk_buff *, int);
unsigned long rmem_start;
unsigned long rmem_end;
void __iomem *mem;
unsigned char mcfilter[8];
unsigned open:1;
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)
/* Someday free_irq may be in ac_close_card() */
free_irq(dev->irq, dev);
release_region(dev->base_addr, AC_IO_EXTENT);
if (ei_status.reg0)
iounmap((void *)dev->mem_start);
iounmap(ei_status.mem);
}
#ifndef MODULE
......@@ -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
* 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 */
if (dev->mem_start < virt_to_phys(high_memory)) {
printk(KERN_CRIT "ac3200.c: Card RAM overlaps with normal memory!!!\n");
printk(KERN_CRIT "ac3200.c: Use EISA SCU to set card memory below 1MB,\n");
printk(KERN_CRIT "ac3200.c: or to an address above 0x%lx.\n", virt_to_phys(high_memory));
printk(KERN_CRIT "ac3200.c: Driver NOT installed.\n");
retval = -EINVAL;
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);
ei_status.mem = ioremap(dev->mem_start, AC_STOP_PG*0x100);
if (!ei_status.mem) {
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;
}
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_end = ei_status.rmem_end = dev->mem_start
+ (AC_STOP_PG - AC_START_PG)*256;
dev->mem_start = (unsigned long)ei_status.mem;
dev->mem_end = dev->mem_start + (AC_STOP_PG - AC_START_PG)*256;
ei_status.name = "AC3200";
ei_status.tx_start_page = AC_START_PG;
......@@ -324,8 +313,8 @@ static void ac_reset_8390(struct net_device *dev)
static void
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);
isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
void __iomem *hdr_start = ei_status.mem + ((ring_page - AC_START_PG)<<8);
memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
}
/* 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
static void ac_block_input(struct net_device *dev, int count, struct sk_buff *skb,
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. */
int semi_count = ei_status.rmem_end - xfer_start;
isa_memcpy_fromio(skb->data, xfer_start, semi_count);
int semi_count = AC_STOP_PG*256 - ring_offset;
memcpy_fromio(skb->data, 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, start, count, 0);
}
}
static void ac_block_output(struct net_device *dev, int count,
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)
......
......@@ -463,11 +463,11 @@ struct depca_private {
} depca_bus; /* type of bus */
struct depca_init init_block; /* Shadow Initialization block */
/* CPU address space fields */
struct depca_rx_desc *rx_ring; /* Pointer to start of RX descriptor ring */
struct depca_tx_desc *tx_ring; /* Pointer to start of TX descriptor ring */
void *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 *sh_mem; /* CPU mapped virt address of device RAM */
struct depca_rx_desc __iomem *rx_ring; /* Pointer to start of RX descriptor ring */
struct depca_tx_desc __iomem *tx_ring; /* Pointer to start of TX descriptor ring */
void __iomem *rx_buff[NUM_RX_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 __iomem *sh_mem; /* CPU mapped virt address of device RAM */
u_long mem_start; /* Bus address of device RAM (before remap) */
u_long mem_len; /* device memory size */
/* Device address space fields */
......@@ -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) */
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;
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;
offset += (sizeof(struct depca_tx_desc) * NUM_TX_DESC);
......@@ -1649,7 +1649,7 @@ static int __devexit depca_device_remove (struct device *device)
static int __init DepcaSignature(char *name, u_long base_addr)
{
u_int i, j, k;
void *ptr;
void __iomem *ptr;
char tmpstr[16];
u_long prom_addr = base_addr + 0xc000;
u_long mem_addr = base_addr + 0x8000; /* 32KB */
......@@ -1876,17 +1876,17 @@ static void depca_dbg_open(struct net_device *dev)
printk("Descriptor addresses (CPU):\nRX: ");
for (i = 0; i < lp->rxRingMask; i++) {
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: ");
for (i = 0; i < lp->txRingMask; i++) {
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: ");
for (i = 0; i < lp->rxRingMask; i++) {
if (i < 3) {
......
......@@ -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_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 )
{
/* 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)
static void cleanup_card(struct net_device *dev)
{
/* NB: e21_close() handles free_irq */
iounmap(ei_status.mem);
release_region(dev->base_addr, E21_IO_EXTENT);
}
......@@ -257,6 +258,13 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
if (dev->mem_start == 0)
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
/* 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. */
......@@ -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;
char *shared_mem = (char *)dev->mem_start;
char __iomem *shared_mem = ei_status.mem;
mem_on(ioaddr, shared_mem, ring_page);
......@@ -352,12 +360,12 @@ static void
e21_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
{
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));
/* 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);
}
......@@ -367,7 +375,7 @@ e21_block_output(struct net_device *dev, int count, const unsigned char *buf,
int start_page)
{
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
bits specifying the starting page. */
......
......@@ -149,8 +149,7 @@ static void cleanup_card(struct net_device *dev)
{
free_irq(dev->irq, dev);
release_region(dev->base_addr, LNE390_IO_EXTENT);
if (ei_status.reg0)
iounmap((void *)dev->mem_start);
iounmap(ei_status.mem);
}
#ifndef MODULE
......@@ -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
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 */
if (dev->mem_start < virt_to_phys(high_memory)) {
printk(KERN_CRIT "lne390.c: Card RAM overlaps with normal memory!!!\n");
printk(KERN_CRIT "lne390.c: Use EISA SCU to set card memory below 1MB,\n");
printk(KERN_CRIT "lne390.c: or to an address above 0x%lx.\n", virt_to_phys(high_memory));
printk(KERN_CRIT "lne390.c: Driver NOT installed.\n");
ret = -EINVAL;
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);
ei_status.mem = ioremap(dev->mem_start, LNE390_STOP_PG*0x100);
if (!ei_status.mem) {
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;
}
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
+ (LNE390_STOP_PG - LNE390_START_PG)*256;
ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
dev->mem_start = (unsigned long)ei_status.mem;
dev->mem_end = dev->mem_start + (LNE390_STOP_PG - LNE390_START_PG)*256;
/* The 8390 offset is zero for the LNE390 */
dev->base_addr = ioaddr;
......@@ -352,8 +341,8 @@ static void lne390_reset_8390(struct net_device *dev)
static void
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);
isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
void __iomem *hdr_start = ei_status.mem + ((ring_page - LNE390_START_PG)<<8);
memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
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_
static void lne390_block_input(struct net_device *dev, int count, struct sk_buff *skb,
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. */
int semi_count = ei_status.rmem_end - xfer_start;
isa_memcpy_fromio(skb->data, xfer_start, semi_count);
int semi_count = (LNE390_STOP_PG<<8) - 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<<8), count);
} else {
/* 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,
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 */
isa_memcpy_toio(shmem, buf, count);
memcpy_toio(shmem, buf, count);
}
static int lne390_open(struct net_device *dev)
......
......@@ -174,18 +174,17 @@ static int __init ne3210_eisa_probe (struct device *device)
printk("%dkB memory at physical address %#lx\n",
NE3210_STOP_PG/4, phys_mem);
dev->mem_start = (unsigned long)ioremap(phys_mem, NE3210_STOP_PG*0x100);
if (dev->mem_start == 0) {
ei_status.mem = ioremap(phys_mem, NE3210_STOP_PG*0x100);
if (!ei_status.mem) {
printk(KERN_ERR "ne3210.c: Unable to remap card memory !!\n");
printk(KERN_ERR "ne3210.c: Driver NOT installed.\n");
retval = -EAGAIN;
goto out4;
}
printk("ne3210.c: remapped %dkB card memory to virtual address %#lx\n",
NE3210_STOP_PG/4, dev->mem_start);
dev->mem_end = ei_status.rmem_end = dev->mem_start
+ (NE3210_STOP_PG - NE3210_START_PG)*256;
ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
printk("ne3210.c: remapped %dkB card memory to virtual address %p\n",
NE3210_STOP_PG/4, ei_status.mem);
dev->mem_start = (unsigned long)ei_status.mem;
dev->mem_end = dev->mem_start + (NE3210_STOP_PG - NE3210_START_PG)*256;
/* The 8390 offset is zero for the NE3210 */
dev->base_addr = ioaddr;
......@@ -219,7 +218,7 @@ static int __init ne3210_eisa_probe (struct device *device)
return 0;
out5:
iounmap((void *)dev->mem_start);
iounmap(ei_status.mem);
out4:
release_mem_region (phys_mem, NE3210_STOP_PG*0x100);
out3:
......@@ -240,7 +239,7 @@ static int __devexit ne3210_eisa_remove (struct device *device)
unsigned long ioaddr = to_eisa_device (device)->base_addr;
unregister_netdev (dev);
iounmap((void *)dev->mem_start);
iounmap(ei_status.mem);
release_mem_region (ei_status.priv, NE3210_STOP_PG*0x100);
free_irq (dev->irq, dev);
release_region (ioaddr + NE3210_CFG1, NE3210_CFG_EXTENT);
......@@ -288,7 +287,7 @@ static void ne3210_reset_8390(struct net_device *dev)
static void
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));
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_
static void ne3210_block_input(struct net_device *dev, int count, struct sk_buff *skb,
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. */
int semi_count = ei_status.rmem_end - xfer_start;
memcpy_fromio(skb->data, xfer_start, semi_count);
int semi_count = NE3210_STOP_PG*256 - ring_offset;
memcpy_fromio(skb->data, start, 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 {
/* 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,
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 */
memcpy_toio(shmem, buf, count);
......
......@@ -623,7 +623,7 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
{
win_req_t req;
memreq_t mem;
u_char *base;
u_char __iomem *base;
int i, j;
/* Allocate a small memory window */
......@@ -676,7 +676,7 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
{
win_req_t req;
memreq_t mem;
u_char *base;
u_char __iomem *base;
int i, j;
struct net_device *dev = link->priv;
ioaddr_t ioaddr;
......
......@@ -227,7 +227,7 @@ typedef struct pcnet_dev_t {
dev_link_t link;
dev_node_t node;
u_int flags;
caddr_t base;
void __iomem *base;
struct timer_list watchdog;
int stale, fast_poll;
u_char phy_id;
......@@ -352,7 +352,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
struct net_device *dev = link->priv;
win_req_t req;
memreq_t mem;
u_char *base, *virt;
u_char __iomem *base, *virt;
int i, j;
/* Allocate a small memory window */
......@@ -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;
if (c <= 0)
......@@ -1508,9 +1509,10 @@ static void copyin(u_char *dest, u_char *src, int c)
*((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;
if (c <= 0)
......@@ -1531,10 +1533,11 @@ static void shmem_get_8390_hdr(struct net_device *dev,
struct e8390_pkt_hdr *hdr,
int ring_page)
{
void *xfer_start = (void *)(ei_status.rmem_start + (ring_page << 8)
- (ei_status.rx_start_page << 8));
void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<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 */
hdr->count = le16_to_cpu(hdr->count);
}
......@@ -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,
struct sk_buff *skb, int ring_offset)
{
void *xfer_start = (void *)(ei_status.rmem_start + ring_offset
- (ei_status.rx_start_page << 8));
void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8)
+ ring_offset
- (ei_status.rx_start_page << 8);
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. */
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);
buf += semi_count;
ring_offset = ei_status.rx_start_page << 8;
xfer_start = (void *)ei_status.rmem_start;
xfer_start = ei_status.mem + (TX_PAGES<<8);
count -= semi_count;
}
copyin(buf, xfer_start, 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,
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;
copyout(shmem, buf, count);
}
......@@ -1617,8 +1620,8 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
goto failed;
}
dev->mem_start = (u_long)info->base + offset;
ei_status.rmem_start = dev->mem_start + (TX_PAGES<<8);
ei_status.mem = info->base + offset;
dev->mem_start = (u_long)ei_status.mem;
dev->mem_end = ei_status.rmem_end = (u_long)info->base + req.Size;
ei_status.tx_start_page = start_pg;
......
......@@ -120,7 +120,7 @@ struct smc_private {
dev_node_t node;
struct sk_buff *saved_skb;
int packets_waiting;
caddr_t base;
void __iomem *base;
u_short cfg;
struct timer_list media;
int watchdog, tx_err;
......
......@@ -365,7 +365,7 @@ typedef struct local_info_t {
int dingo; /* a CEM56 type card */
int new_mii; /* has full 10baseT/100baseT MII */
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 */
const char *manf_str;
} local_info_t;
......
......@@ -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_tx_desc *txd ;
u8 *xl_mmio = xl_priv->xl_mmio ;
u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
int i ;
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)
struct xl_private *xl_priv = (struct xl_private *)dev->priv ;
struct xl_rx_desc *rxd ;
u8 *xl_mmio = xl_priv->xl_mmio ;
u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
int i ;
printk("rx_ring_tail: %d \n", xl_priv->rx_ring_tail) ;
......@@ -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)
{
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 */
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)
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 ;
u8 *xl_mmio = xl_priv->xl_mmio ;
u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
/* Wait for EEProm to not be busy */
writel(IO_WORD_READ | EECONTROL, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
......@@ -386,7 +386,7 @@ static int __init xl_init(struct net_device *dev)
static int xl_hw_reset(struct net_device *dev)
{
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 ;
u16 i ;
u16 result_16 ;
......@@ -569,7 +569,7 @@ static int xl_hw_reset(struct net_device *dev)
static int xl_open(struct net_device *dev)
{
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 ;
u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
int open_err ;
......@@ -727,7 +727,7 @@ static int xl_open(struct net_device *dev)
static int xl_open_hw(struct net_device *dev)
{
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 ;
char ver_str[33];
int open_err ;
......@@ -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)
{
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 ;
int frame_length = 0, copy_len = 0 ;
int temp_ring_loc ;
......@@ -999,7 +999,7 @@ static void xl_rx(struct net_device *dev)
static void xl_reset(struct net_device *dev)
{
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;
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)
{
struct net_device *dev = (struct net_device *)dev_id;
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 ;
if (!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)
{
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 ;
......@@ -1270,7 +1270,7 @@ static void xl_dn_comp(struct net_device *dev)
static int xl_close(struct net_device *dev)
{
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 ;
netif_stop_queue(dev) ;
......@@ -1409,7 +1409,7 @@ static void xl_set_rx_mode(struct net_device *dev)
static void xl_srb_bh(struct net_device *dev)
{
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 ;
int i ;
......@@ -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)
{
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 ;
u16 lan_status, lan_status_diff ;
......@@ -1634,7 +1634,7 @@ static void xl_arb_cmd(struct net_device *dev)
static void xl_asb_cmd(struct net_device *dev)
{
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)
writel(ACK_INTERRUPT | LATCH_ACK | ASBFACK, xl_mmio + MMIO_COMMAND) ;
......@@ -1665,7 +1665,7 @@ static void xl_asb_cmd(struct net_device *dev)
static void xl_asb_bh(struct net_device *dev)
{
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 ;
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)
static void xl_srb_cmd(struct net_device *dev, int srb_cmd)
{
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) {
case READ_LOG:
......@@ -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)
{
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 ;
......
......@@ -263,7 +263,7 @@ struct xl_private {
u16 arb;
u16 asb;
u8 *xl_mmio;
u8 __iomem *xl_mmio;
char *xl_card_name;
struct pci_dev *pdev ;
......
......@@ -76,67 +76,54 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n)
#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);
n -= odd;
while (n) {
u_short *t = to;
*t = __raw_readw(from);
to = (void *)((long)to + 2);
from = (const void *)((long)from + 2);
n -= 2;
}
if (odd)
*(u_char *)to = readb(from);
__u16 *t = to;
__u16 __iomem *f = from;
size_t odd = (n & 1);
for (n >>= 1; n; n--)
*t++ = __raw_readw(f++);
if (odd)
*(__u8 *)t = readb(f);
}
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);
n -= odd;
while (n) {
__raw_writew(*(u_short *)from, to);
to = (void *)((long)to + 2);
from = (const void *)((long)from + 2);
n -= 2;
}
if (odd)
writeb(*(u_char *)from, to);
__u16 __iomem *t = to;
const __u16 *f = from;
size_t odd = (n & 1);
for (n >>= 1; n ; n--)
__raw_writew(*f++, t++);
if (odd)
writeb(*(__u8 *)f, t);
}
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);
n -= odd;
while (n) {
put_user(__raw_readw(from), (short *)to);
to = (void *)((long)to + 2);
from = (const void *)((long)from + 2);
n -= 2;
}
if (odd)
put_user(readb(from), (char *)to);
__u16 __user *t = to;
__u16 __iomem *f = from;
size_t odd = (n & 1);
for (n >>= 1; n ; n--)
put_user(__raw_readw(f++), t++);
if (odd)
put_user(readb(f), (char __user *)t);
}
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;
char c;
size_t odd = (n & 1);
n -= odd;
while (n) {
get_user(s, (short *)from);
__raw_writew(s, to);
to = (void *)((long)to + 2);
from = (const void *)((long)from + 2);
n -= 2;
}
if (odd) {
get_user(c, (char *)from);
writeb(c, to);
}
__u16 __user *f = from;
__u16 __iomem *t = to;
short s;
char c;
size_t odd = (n & 1);
for (n >>= 1; n; n--) {
get_user(s, f++);
__raw_writew(s, t++);
}
if (odd) {
get_user(c, (char __user *)f);
writeb(c, t);
}
}
#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