Commit 661e5f8d authored by Jeff Garzik's avatar Jeff Garzik

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

into pobox.com:/garz/repo/net-drivers-2.6
parents 1568cc8f b4a8e614
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
struct bmac_data { struct bmac_data {
/* volatile struct bmac *bmac; */ /* volatile struct bmac *bmac; */
struct sk_buff_head *queue; struct sk_buff_head *queue;
volatile struct dbdma_regs *tx_dma; volatile struct dbdma_regs __iomem *tx_dma;
int tx_dma_intr; int tx_dma_intr;
volatile struct dbdma_regs *rx_dma; volatile struct dbdma_regs __iomem *rx_dma;
int rx_dma_intr; int rx_dma_intr;
volatile struct dbdma_cmd *tx_cmds; /* xmit dma command list */ volatile struct dbdma_cmd *tx_cmds; /* xmit dma command list */
volatile struct dbdma_cmd *rx_cmds; /* recv dma command list */ volatile struct dbdma_cmd *rx_cmds; /* recv dma command list */
...@@ -165,35 +165,35 @@ static void bmac_start(struct net_device *dev); ...@@ -165,35 +165,35 @@ static void bmac_start(struct net_device *dev);
#define DBDMA_CLEAR(x) ( (x) << 16) #define DBDMA_CLEAR(x) ( (x) << 16)
static inline void static inline void
dbdma_st32(volatile unsigned long *a, unsigned long x) dbdma_st32(volatile __u32 __iomem *a, unsigned long x)
{ {
__asm__ volatile( "stwbrx %0,0,%1" : : "r" (x), "r" (a) : "memory"); __asm__ volatile( "stwbrx %0,0,%1" : : "r" (x), "r" (a) : "memory");
return; return;
} }
static inline unsigned long static inline unsigned long
dbdma_ld32(volatile unsigned long *a) dbdma_ld32(volatile __u32 __iomem *a)
{ {
unsigned long swap; __u32 swap;
__asm__ volatile ("lwbrx %0,0,%1" : "=r" (swap) : "r" (a)); __asm__ volatile ("lwbrx %0,0,%1" : "=r" (swap) : "r" (a));
return swap; return swap;
} }
static void static void
dbdma_continue(volatile struct dbdma_regs *dmap) dbdma_continue(volatile struct dbdma_regs __iomem *dmap)
{ {
dbdma_st32((volatile unsigned long *)&dmap->control, dbdma_st32(&dmap->control,
DBDMA_SET(RUN|WAKE) | DBDMA_CLEAR(PAUSE|DEAD)); DBDMA_SET(RUN|WAKE) | DBDMA_CLEAR(PAUSE|DEAD));
eieio(); eieio();
} }
static void static void
dbdma_reset(volatile struct dbdma_regs *dmap) dbdma_reset(volatile struct dbdma_regs __iomem *dmap)
{ {
dbdma_st32((volatile unsigned long *)&dmap->control, dbdma_st32(&dmap->control,
DBDMA_CLEAR(ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)); DBDMA_CLEAR(ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN));
eieio(); eieio();
while (dbdma_ld32((volatile unsigned long *)&dmap->status) & RUN) while (dbdma_ld32(&dmap->status) & RUN)
eieio(); eieio();
} }
...@@ -213,22 +213,22 @@ dbdma_setcmd(volatile struct dbdma_cmd *cp, ...@@ -213,22 +213,22 @@ dbdma_setcmd(volatile struct dbdma_cmd *cp,
static inline static inline
void bmwrite(struct net_device *dev, unsigned long reg_offset, unsigned data ) void bmwrite(struct net_device *dev, unsigned long reg_offset, unsigned data )
{ {
out_le16((void *)dev->base_addr + reg_offset, data); out_le16((void __iomem *)dev->base_addr + reg_offset, data);
} }
static inline static inline
volatile unsigned short bmread(struct net_device *dev, unsigned long reg_offset ) volatile unsigned short bmread(struct net_device *dev, unsigned long reg_offset )
{ {
return in_le16((void *)dev->base_addr + reg_offset); return in_le16((void __iomem *)dev->base_addr + reg_offset);
} }
static void static void
bmac_enable_and_reset_chip(struct net_device *dev) bmac_enable_and_reset_chip(struct net_device *dev)
{ {
struct bmac_data *bp = netdev_priv(dev); struct bmac_data *bp = netdev_priv(dev);
volatile struct dbdma_regs *rd = bp->rx_dma; volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
volatile struct dbdma_regs *td = bp->tx_dma; volatile struct dbdma_regs __iomem *td = bp->tx_dma;
if (rd) if (rd)
dbdma_reset(rd); dbdma_reset(rd);
...@@ -406,7 +406,7 @@ static void ...@@ -406,7 +406,7 @@ static void
bmac_start_chip(struct net_device *dev) bmac_start_chip(struct net_device *dev)
{ {
struct bmac_data *bp = netdev_priv(dev); struct bmac_data *bp = netdev_priv(dev);
volatile struct dbdma_regs *rd = bp->rx_dma; volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
unsigned short oldConfig; unsigned short oldConfig;
/* enable rx dma channel */ /* enable rx dma channel */
...@@ -476,8 +476,8 @@ static int bmac_suspend(struct macio_dev *mdev, u32 state) ...@@ -476,8 +476,8 @@ static int bmac_suspend(struct macio_dev *mdev, u32 state)
bp->sleeping = 1; bp->sleeping = 1;
spin_unlock_irqrestore(&bp->lock, flags); spin_unlock_irqrestore(&bp->lock, flags);
if (bp->opened) { if (bp->opened) {
volatile struct dbdma_regs *rd = bp->rx_dma; volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
volatile struct dbdma_regs *td = bp->tx_dma; volatile struct dbdma_regs __iomem *td = bp->tx_dma;
config = bmread(dev, RXCFG); config = bmread(dev, RXCFG);
bmwrite(dev, RXCFG, (config & ~RxMACEnable)); bmwrite(dev, RXCFG, (config & ~RxMACEnable));
...@@ -602,7 +602,7 @@ bitrev(unsigned char b) ...@@ -602,7 +602,7 @@ bitrev(unsigned char b)
static void static void
bmac_init_tx_ring(struct bmac_data *bp) bmac_init_tx_ring(struct bmac_data *bp)
{ {
volatile struct dbdma_regs *td = bp->tx_dma; volatile struct dbdma_regs __iomem *td = bp->tx_dma;
memset((char *)bp->tx_cmds, 0, (N_TX_RING+1) * sizeof(struct dbdma_cmd)); memset((char *)bp->tx_cmds, 0, (N_TX_RING+1) * sizeof(struct dbdma_cmd));
...@@ -623,7 +623,7 @@ bmac_init_tx_ring(struct bmac_data *bp) ...@@ -623,7 +623,7 @@ bmac_init_tx_ring(struct bmac_data *bp)
static int static int
bmac_init_rx_ring(struct bmac_data *bp) bmac_init_rx_ring(struct bmac_data *bp)
{ {
volatile struct dbdma_regs *rd = bp->rx_dma; volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
int i; int i;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -657,7 +657,7 @@ bmac_init_rx_ring(struct bmac_data *bp) ...@@ -657,7 +657,7 @@ bmac_init_rx_ring(struct bmac_data *bp)
static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev) static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev)
{ {
struct bmac_data *bp = netdev_priv(dev); struct bmac_data *bp = netdev_priv(dev);
volatile struct dbdma_regs *td = bp->tx_dma; volatile struct dbdma_regs __iomem *td = bp->tx_dma;
int i; int i;
/* see if there's a free slot in the tx ring */ /* see if there's a free slot in the tx ring */
...@@ -693,7 +693,7 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -693,7 +693,7 @@ static irqreturn_t bmac_rxdma_intr(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 bmac_data *bp = netdev_priv(dev); struct bmac_data *bp = netdev_priv(dev);
volatile struct dbdma_regs *rd = bp->rx_dma; volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
volatile struct dbdma_cmd *cp; volatile struct dbdma_cmd *cp;
int i, nb, stat; int i, nb, stat;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -1331,13 +1331,11 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *m ...@@ -1331,13 +1331,11 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *m
goto err_out_iounmap; goto err_out_iounmap;
bp->is_bmac_plus = is_bmac_plus; bp->is_bmac_plus = is_bmac_plus;
bp->tx_dma = (volatile struct dbdma_regs *) bp->tx_dma = ioremap(macio_resource_start(mdev, 1), macio_resource_len(mdev, 1));
ioremap(macio_resource_start(mdev, 1), macio_resource_len(mdev, 1));
if (!bp->tx_dma) if (!bp->tx_dma)
goto err_out_iounmap; goto err_out_iounmap;
bp->tx_dma_intr = macio_irq(mdev, 1); bp->tx_dma_intr = macio_irq(mdev, 1);
bp->rx_dma = (volatile struct dbdma_regs *) bp->rx_dma = ioremap(macio_resource_start(mdev, 2), macio_resource_len(mdev, 2));
ioremap(macio_resource_start(mdev, 2), macio_resource_len(mdev, 2));
if (!bp->rx_dma) if (!bp->rx_dma)
goto err_out_iounmap_tx; goto err_out_iounmap_tx;
bp->rx_dma_intr = macio_irq(mdev, 2); bp->rx_dma_intr = macio_irq(mdev, 2);
...@@ -1392,11 +1390,11 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *m ...@@ -1392,11 +1390,11 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *m
err_out_irq0: err_out_irq0:
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
err_out_iounmap_rx: err_out_iounmap_rx:
iounmap((void *)bp->rx_dma); iounmap(bp->rx_dma);
err_out_iounmap_tx: err_out_iounmap_tx:
iounmap((void *)bp->tx_dma); iounmap(bp->tx_dma);
err_out_iounmap: err_out_iounmap:
iounmap((void *)dev->base_addr); iounmap((void __iomem *)dev->base_addr);
out_release: out_release:
macio_release_resources(mdev); macio_release_resources(mdev);
out_free: out_free:
...@@ -1421,8 +1419,8 @@ static int bmac_open(struct net_device *dev) ...@@ -1421,8 +1419,8 @@ static int bmac_open(struct net_device *dev)
static int bmac_close(struct net_device *dev) static int bmac_close(struct net_device *dev)
{ {
struct bmac_data *bp = netdev_priv(dev); struct bmac_data *bp = netdev_priv(dev);
volatile struct dbdma_regs *rd = bp->rx_dma; volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
volatile struct dbdma_regs *td = bp->tx_dma; volatile struct dbdma_regs __iomem *td = bp->tx_dma;
unsigned short config; unsigned short config;
int i; int i;
...@@ -1505,8 +1503,8 @@ static void bmac_tx_timeout(unsigned long data) ...@@ -1505,8 +1503,8 @@ static void bmac_tx_timeout(unsigned long data)
{ {
struct net_device *dev = (struct net_device *) data; struct net_device *dev = (struct net_device *) data;
struct bmac_data *bp = netdev_priv(dev); struct bmac_data *bp = netdev_priv(dev);
volatile struct dbdma_regs *td = bp->tx_dma; volatile struct dbdma_regs __iomem *td = bp->tx_dma;
volatile struct dbdma_regs *rd = bp->rx_dma; volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
volatile struct dbdma_cmd *cp; volatile struct dbdma_cmd *cp;
unsigned long flags; unsigned long flags;
unsigned short config, oldConfig; unsigned short config, oldConfig;
...@@ -1638,9 +1636,9 @@ static int __devexit bmac_remove(struct macio_dev *mdev) ...@@ -1638,9 +1636,9 @@ static int __devexit bmac_remove(struct macio_dev *mdev)
free_irq(bp->tx_dma_intr, dev); free_irq(bp->tx_dma_intr, dev);
free_irq(bp->rx_dma_intr, dev); free_irq(bp->rx_dma_intr, dev);
iounmap((void *)dev->base_addr); iounmap((void __iomem *)dev->base_addr);
iounmap((void *)bp->tx_dma); iounmap(bp->tx_dma);
iounmap((void *)bp->rx_dma); iounmap(bp->rx_dma);
macio_release_resources(mdev); macio_release_resources(mdev);
......
...@@ -512,6 +512,7 @@ struct hamachi_private { ...@@ -512,6 +512,7 @@ struct hamachi_private {
u32 rx_int_var, tx_int_var; /* interrupt control variables */ u32 rx_int_var, tx_int_var; /* interrupt control variables */
u32 option; /* Hold on to a copy of the options */ u32 option; /* Hold on to a copy of the options */
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
void __iomem *base;
}; };
MODULE_AUTHOR("Donald Becker <becker@scyld.com>, Eric Kasten <kasten@nscl.msu.edu>, Keith Underwood <keithu@parl.clemson.edu>"); MODULE_AUTHOR("Donald Becker <becker@scyld.com>, Eric Kasten <kasten@nscl.msu.edu>, Keith Underwood <keithu@parl.clemson.edu>");
...@@ -549,7 +550,7 @@ MODULE_PARM_DESC(options, "GNIC-II Bits 0-3: media type, bits 4-6: as force32, b ...@@ -549,7 +550,7 @@ MODULE_PARM_DESC(options, "GNIC-II Bits 0-3: media type, bits 4-6: as force32, b
MODULE_PARM_DESC(full_duplex, "GNIC-II full duplex setting(s) (1)"); MODULE_PARM_DESC(full_duplex, "GNIC-II full duplex setting(s) (1)");
MODULE_PARM_DESC(force32, "GNIC-II: Bit 0: 32 bit PCI, bit 1: disable parity, bit 2: 64 bit PCI (all boards)"); MODULE_PARM_DESC(force32, "GNIC-II: Bit 0: 32 bit PCI, bit 1: disable parity, bit 2: 64 bit PCI (all boards)");
static int read_eeprom(long ioaddr, int location); static int read_eeprom(void __iomem *ioaddr, int location);
static int mdio_read(struct net_device *dev, int phy_id, int location); static int mdio_read(struct net_device *dev, int phy_id, int location);
static void mdio_write(struct net_device *dev, int phy_id, int location, int value); static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
static int hamachi_open(struct net_device *dev); static int hamachi_open(struct net_device *dev);
...@@ -575,7 +576,8 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, ...@@ -575,7 +576,8 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
int option, i, rx_int_var, tx_int_var, boguscnt; int option, i, rx_int_var, tx_int_var, boguscnt;
int chip_id = ent->driver_data; int chip_id = ent->driver_data;
int irq; int irq;
long ioaddr; void __iomem *ioaddr;
unsigned long base;
static int card_idx; static int card_idx;
struct net_device *dev; struct net_device *dev;
void *ring_space; void *ring_space;
...@@ -594,9 +596,9 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, ...@@ -594,9 +596,9 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
goto err_out; goto err_out;
} }
ioaddr = pci_resource_start(pdev, 0); base = pci_resource_start(pdev, 0);
#ifdef __alpha__ /* Really "64 bit addrs" */ #ifdef __alpha__ /* Really "64 bit addrs" */
ioaddr |= (pci_resource_start(pdev, 1) << 32); base |= (pci_resource_start(pdev, 1) << 32);
#endif #endif
pci_set_master(pdev); pci_set_master(pdev);
...@@ -605,7 +607,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, ...@@ -605,7 +607,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
if (i) return i; if (i) return i;
irq = pdev->irq; irq = pdev->irq;
ioaddr = (long) ioremap(ioaddr, 0x400); ioaddr = ioremap(base, 0x400);
if (!ioaddr) if (!ioaddr)
goto err_out_release; goto err_out_release;
...@@ -678,7 +680,8 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, ...@@ -678,7 +680,8 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
i = readb(ioaddr + PCIClkMeas); i = readb(ioaddr + PCIClkMeas);
} }
dev->base_addr = ioaddr; hmp->base = ioaddr;
dev->base_addr = (unsigned long)ioaddr;
dev->irq = irq; dev->irq = irq;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
...@@ -741,7 +744,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, ...@@ -741,7 +744,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
goto err_out_unmap_rx; goto err_out_unmap_rx;
} }
printk(KERN_INFO "%s: %s type %x at 0x%lx, ", printk(KERN_INFO "%s: %s type %x at %p, ",
dev->name, chip_tbl[chip_id].name, readl(ioaddr + ChipRev), dev->name, chip_tbl[chip_id].name, readl(ioaddr + ChipRev),
ioaddr); ioaddr);
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
...@@ -790,14 +793,14 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, ...@@ -790,14 +793,14 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
err_out_cleardev: err_out_cleardev:
free_netdev (dev); free_netdev (dev);
err_out_iounmap: err_out_iounmap:
iounmap((char *)ioaddr); iounmap(ioaddr);
err_out_release: err_out_release:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
return ret; return ret;
} }
static int __devinit read_eeprom(long ioaddr, int location) static int __devinit read_eeprom(void __iomem *ioaddr, int location)
{ {
int bogus_cnt = 1000; int bogus_cnt = 1000;
...@@ -819,7 +822,8 @@ static int __devinit read_eeprom(long ioaddr, int location) ...@@ -819,7 +822,8 @@ static int __devinit read_eeprom(long ioaddr, int location)
static int mdio_read(struct net_device *dev, int phy_id, int location) static int mdio_read(struct net_device *dev, int phy_id, int location)
{ {
long ioaddr = dev->base_addr; struct hamachi_private *hmp = netdev_priv(dev);
void __iomem *ioaddr = hmp->base;
int i; int i;
/* We should check busy first - per docs -KDU */ /* We should check busy first - per docs -KDU */
...@@ -836,7 +840,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int location) ...@@ -836,7 +840,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
static void mdio_write(struct net_device *dev, int phy_id, int location, int value) static void mdio_write(struct net_device *dev, int phy_id, int location, int value)
{ {
long ioaddr = dev->base_addr; struct hamachi_private *hmp = netdev_priv(dev);
void __iomem *ioaddr = hmp->base;
int i; int i;
/* We should check busy first - per docs -KDU */ /* We should check busy first - per docs -KDU */
...@@ -857,7 +862,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val ...@@ -857,7 +862,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
static int hamachi_open(struct net_device *dev) static int hamachi_open(struct net_device *dev)
{ {
struct hamachi_private *hmp = netdev_priv(dev); struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr; void __iomem *ioaddr = hmp->base;
int i; int i;
u32 rx_int_var, tx_int_var; u32 rx_int_var, tx_int_var;
u16 fifo_info; u16 fifo_info;
...@@ -987,7 +992,7 @@ static int hamachi_open(struct net_device *dev) ...@@ -987,7 +992,7 @@ static int hamachi_open(struct net_device *dev)
writew(0x001D, ioaddr + RxDMACtrl); writew(0x001D, ioaddr + RxDMACtrl);
writew(0x001D, ioaddr + TxDMACtrl); writew(0x001D, ioaddr + TxDMACtrl);
#endif #endif
writew(0x0001, dev->base_addr + RxCmd); writew(0x0001, ioaddr + RxCmd);
if (hamachi_debug > 2) { if (hamachi_debug > 2) {
printk(KERN_DEBUG "%s: Done hamachi_open(), status: Rx %x Tx %x.\n", printk(KERN_DEBUG "%s: Done hamachi_open(), status: Rx %x Tx %x.\n",
...@@ -1038,7 +1043,7 @@ static void hamachi_timer(unsigned long data) ...@@ -1038,7 +1043,7 @@ static void hamachi_timer(unsigned long data)
{ {
struct net_device *dev = (struct net_device *)data; struct net_device *dev = (struct net_device *)data;
struct hamachi_private *hmp = netdev_priv(dev); struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr; void __iomem *ioaddr = hmp->base;
int next_tick = 10*HZ; int next_tick = 10*HZ;
if (hamachi_debug > 2) { if (hamachi_debug > 2) {
...@@ -1063,7 +1068,7 @@ static void hamachi_tx_timeout(struct net_device *dev) ...@@ -1063,7 +1068,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
{ {
int i; int i;
struct hamachi_private *hmp = netdev_priv(dev); struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr; void __iomem *ioaddr = hmp->base;
printk(KERN_WARNING "%s: Hamachi transmit timed out, status %8.8x," printk(KERN_WARNING "%s: Hamachi transmit timed out, status %8.8x,"
" resetting...\n", dev->name, (int)readw(ioaddr + TxStatus)); " resetting...\n", dev->name, (int)readw(ioaddr + TxStatus));
...@@ -1115,7 +1120,7 @@ static void hamachi_tx_timeout(struct net_device *dev) ...@@ -1115,7 +1120,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
} }
udelay(60); /* Sleep 60 us just for safety sake */ udelay(60); /* Sleep 60 us just for safety sake */
writew(0x0002, dev->base_addr + RxCmd); /* STOP Rx */ writew(0x0002, ioaddr + RxCmd); /* STOP Rx */
writeb(0x01, ioaddr + ChipReset); /* Reinit the hardware */ writeb(0x01, ioaddr + ChipReset); /* Reinit the hardware */
...@@ -1157,9 +1162,9 @@ static void hamachi_tx_timeout(struct net_device *dev) ...@@ -1157,9 +1162,9 @@ static void hamachi_tx_timeout(struct net_device *dev)
hmp->stats.tx_errors++; hmp->stats.tx_errors++;
/* Restart the chip's Tx/Rx processes . */ /* Restart the chip's Tx/Rx processes . */
writew(0x0002, dev->base_addr + TxCmd); /* STOP Tx */ writew(0x0002, ioaddr + TxCmd); /* STOP Tx */
writew(0x0001, dev->base_addr + TxCmd); /* START Tx */ writew(0x0001, ioaddr + TxCmd); /* START Tx */
writew(0x0001, dev->base_addr + RxCmd); /* START Rx */ writew(0x0001, ioaddr + RxCmd); /* START Rx */
netif_wake_queue(dev); netif_wake_queue(dev);
} }
...@@ -1275,9 +1280,9 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1275,9 +1280,9 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Wake the potentially-idle transmit channel. */ /* Wake the potentially-idle transmit channel. */
/* If we don't need to read status, DON'T -KDU */ /* If we don't need to read status, DON'T -KDU */
status=readw(dev->base_addr + TxStatus); status=readw(hmp->base + TxStatus);
if( !(status & 0x0001) || (status & 0x0002)) if( !(status & 0x0001) || (status & 0x0002))
writew(0x0001, dev->base_addr + TxCmd); writew(0x0001, hmp->base + TxCmd);
return 1; return 1;
} }
...@@ -1343,9 +1348,9 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1343,9 +1348,9 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Wake the potentially-idle transmit channel. */ /* Wake the potentially-idle transmit channel. */
/* If we don't need to read status, DON'T -KDU */ /* If we don't need to read status, DON'T -KDU */
status=readw(dev->base_addr + TxStatus); status=readw(hmp->base + TxStatus);
if( !(status & 0x0001) || (status & 0x0002)) if( !(status & 0x0001) || (status & 0x0002))
writew(0x0001, dev->base_addr + TxCmd); writew(0x0001, hmp->base + TxCmd);
/* Immediately before returning, let's clear as many entries as we can. */ /* Immediately before returning, let's clear as many entries as we can. */
hamachi_tx(dev); hamachi_tx(dev);
...@@ -1376,8 +1381,9 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1376,8 +1381,9 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *rgs)
{ {
struct net_device *dev = dev_instance; struct net_device *dev = dev_instance;
struct hamachi_private *hmp; struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr, boguscnt = max_interrupt_work; void __iomem *ioaddr = hmp->base;
long boguscnt = max_interrupt_work;
int handled = 0; int handled = 0;
#ifndef final_version /* Can never occur. */ #ifndef final_version /* Can never occur. */
...@@ -1387,8 +1393,6 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs ...@@ -1387,8 +1393,6 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs
} }
#endif #endif
ioaddr = dev->base_addr;
hmp = netdev_priv(dev);
spin_lock(&hmp->lock); spin_lock(&hmp->lock);
do { do {
...@@ -1687,8 +1691,8 @@ static int hamachi_rx(struct net_device *dev) ...@@ -1687,8 +1691,8 @@ static int hamachi_rx(struct net_device *dev)
/* Restart Rx engine if stopped. */ /* Restart Rx engine if stopped. */
/* If we don't need to check status, don't. -KDU */ /* If we don't need to check status, don't. -KDU */
if (readw(dev->base_addr + RxStatus) & 0x0002) if (readw(hmp->base + RxStatus) & 0x0002)
writew(0x0001, dev->base_addr + RxCmd); writew(0x0001, hmp->base + RxCmd);
return 0; return 0;
} }
...@@ -1697,8 +1701,8 @@ static int hamachi_rx(struct net_device *dev) ...@@ -1697,8 +1701,8 @@ static int hamachi_rx(struct net_device *dev)
than just errors. */ than just errors. */
static void hamachi_error(struct net_device *dev, int intr_status) static void hamachi_error(struct net_device *dev, int intr_status)
{ {
long ioaddr = dev->base_addr;
struct hamachi_private *hmp = netdev_priv(dev); struct hamachi_private *hmp = netdev_priv(dev);
void __iomem *ioaddr = hmp->base;
if (intr_status & (LinkChange|NegotiationChange)) { if (intr_status & (LinkChange|NegotiationChange)) {
if (hamachi_debug > 1) if (hamachi_debug > 1)
...@@ -1731,8 +1735,8 @@ static void hamachi_error(struct net_device *dev, int intr_status) ...@@ -1731,8 +1735,8 @@ static void hamachi_error(struct net_device *dev, int intr_status)
static int hamachi_close(struct net_device *dev) static int hamachi_close(struct net_device *dev)
{ {
long ioaddr = dev->base_addr;
struct hamachi_private *hmp = netdev_priv(dev); struct hamachi_private *hmp = netdev_priv(dev);
void __iomem *ioaddr = hmp->base;
struct sk_buff *skb; struct sk_buff *skb;
int i; int i;
...@@ -1817,8 +1821,8 @@ static int hamachi_close(struct net_device *dev) ...@@ -1817,8 +1821,8 @@ static int hamachi_close(struct net_device *dev)
static struct net_device_stats *hamachi_get_stats(struct net_device *dev) static struct net_device_stats *hamachi_get_stats(struct net_device *dev)
{ {
long ioaddr = dev->base_addr;
struct hamachi_private *hmp = netdev_priv(dev); struct hamachi_private *hmp = netdev_priv(dev);
void __iomem *ioaddr = hmp->base;
/* We should lock this segment of code for SMP eventually, although /* We should lock this segment of code for SMP eventually, although
the vulnerability window is very small and statistics are the vulnerability window is very small and statistics are
...@@ -1845,7 +1849,8 @@ static struct net_device_stats *hamachi_get_stats(struct net_device *dev) ...@@ -1845,7 +1849,8 @@ static struct net_device_stats *hamachi_get_stats(struct net_device *dev)
static void set_rx_mode(struct net_device *dev) static void set_rx_mode(struct net_device *dev)
{ {
long ioaddr = dev->base_addr; struct hamachi_private *hmp = netdev_priv(dev);
void __iomem *ioaddr = hmp->base;
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
/* Unconditionally log net taps. */ /* Unconditionally log net taps. */
...@@ -1950,11 +1955,11 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1950,11 +1955,11 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
*/ */
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
writel(d[0], dev->base_addr + TxIntrCtrl); writel(d[0], np->base + TxIntrCtrl);
writel(d[1], dev->base_addr + RxIntrCtrl); writel(d[1], np->base + RxIntrCtrl);
printk(KERN_NOTICE "%s: tx %08x, rx %08x intr\n", dev->name, printk(KERN_NOTICE "%s: tx %08x, rx %08x intr\n", dev->name,
(u32) readl(dev->base_addr + TxIntrCtrl), (u32) readl(np->base + TxIntrCtrl),
(u32) readl(dev->base_addr + RxIntrCtrl)); (u32) readl(np->base + RxIntrCtrl));
rc = 0; rc = 0;
} }
...@@ -1980,7 +1985,7 @@ static void __devexit hamachi_remove_one (struct pci_dev *pdev) ...@@ -1980,7 +1985,7 @@ static void __devexit hamachi_remove_one (struct pci_dev *pdev)
pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring, pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring,
hmp->tx_ring_dma); hmp->tx_ring_dma);
unregister_netdev(dev); unregister_netdev(dev);
iounmap((char *)dev->base_addr); iounmap(hmp->base);
free_netdev(dev); free_netdev(dev);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
......
...@@ -118,7 +118,7 @@ static void myri_enable_irq(void __iomem *lp, void __iomem *cregs) ...@@ -118,7 +118,7 @@ static void myri_enable_irq(void __iomem *lp, void __iomem *cregs)
static inline void bang_the_chip(struct myri_eth *mp) static inline void bang_the_chip(struct myri_eth *mp)
{ {
struct myri_shmem *shmem = mp->shmem; struct myri_shmem __iomem *shmem = mp->shmem;
void __iomem *cregs = mp->cregs; void __iomem *cregs = mp->cregs;
sbus_writel(1, &shmem->send); sbus_writel(1, &shmem->send);
...@@ -127,9 +127,9 @@ static inline void bang_the_chip(struct myri_eth *mp) ...@@ -127,9 +127,9 @@ static inline void bang_the_chip(struct myri_eth *mp)
static int myri_do_handshake(struct myri_eth *mp) static int myri_do_handshake(struct myri_eth *mp)
{ {
struct myri_shmem *shmem = mp->shmem; struct myri_shmem __iomem *shmem = mp->shmem;
void __iomem *cregs = mp->cregs; void __iomem *cregs = mp->cregs;
struct myri_channel *chan = &shmem->channel; struct myri_channel __iomem *chan = &shmem->channel;
int tick = 0; int tick = 0;
DET(("myri_do_handshake: ")); DET(("myri_do_handshake: "));
...@@ -427,7 +427,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) ...@@ -427,7 +427,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev)
u32 csum = sbus_readl(&rxdack->csum); u32 csum = sbus_readl(&rxdack->csum);
int len = sbus_readl(&rxdack->myri_scatters[0].len); int len = sbus_readl(&rxdack->myri_scatters[0].len);
int index = sbus_readl(&rxdack->ctx); int index = sbus_readl(&rxdack->ctx);
struct myri_rxd __iomem *rxd = &rq->myri_rxd[rq->tail]; struct myri_rxd __iomem *rxd = &rq->myri_rxd[sbus_readl(&rq->tail)];
struct sk_buff *skb = mp->rx_skbs[index]; struct sk_buff *skb = mp->rx_skbs[index];
/* Ack it. */ /* Ack it. */
...@@ -546,7 +546,7 @@ static irqreturn_t myri_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -546,7 +546,7 @@ static irqreturn_t myri_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 myri_eth *mp = (struct myri_eth *) dev->priv; struct myri_eth *mp = (struct myri_eth *) dev->priv;
void __iomem *lregs = mp->lregs; void __iomem *lregs = mp->lregs;
struct myri_channel *chan = &mp->shmem->channel; struct myri_channel __iomem *chan = &mp->shmem->channel;
unsigned long flags; unsigned long flags;
u32 status; u32 status;
int handled = 0; int handled = 0;
......
This diff is collapsed.
...@@ -583,7 +583,7 @@ typedef struct mac_info { ...@@ -583,7 +583,7 @@ typedef struct mac_info {
/* tx side stuff */ /* tx side stuff */
/* logical pointer of start of each Tx FIFO */ /* logical pointer of start of each Tx FIFO */
TxFIFO_element_t *tx_FIFO_start[MAX_TX_FIFOS]; TxFIFO_element_t __iomem *tx_FIFO_start[MAX_TX_FIFOS];
/* Current offset within tx_FIFO_start, where driver would write new Tx frame*/ /* Current offset within tx_FIFO_start, where driver would write new Tx frame*/
tx_curr_put_info_t tx_curr_put_info[MAX_TX_FIFOS]; tx_curr_put_info_t tx_curr_put_info[MAX_TX_FIFOS];
...@@ -623,8 +623,8 @@ typedef struct s2io_nic { ...@@ -623,8 +623,8 @@ typedef struct s2io_nic {
macaddr_t pre_mac_addr[MAX_MAC_SUPPORTED]; macaddr_t pre_mac_addr[MAX_MAC_SUPPORTED];
struct net_device_stats stats; struct net_device_stats stats;
caddr_t bar0; void __iomem *bar0;
caddr_t bar1; void __iomem *bar1;
struct config_param config; struct config_param config;
mac_info_t mac_control; mac_info_t mac_control;
int high_dma_flag; int high_dma_flag;
...@@ -736,10 +736,9 @@ typedef struct s2io_nic { ...@@ -736,10 +736,9 @@ typedef struct s2io_nic {
/* OS related system calls */ /* OS related system calls */
#ifndef readq #ifndef readq
static inline u64 readq(void *addr) static inline u64 readq(void __iomem *addr)
{ {
u64 ret = 0; u64 ret = readl(addr + 4);
ret = readl(addr + 4);
ret <<= 32; ret <<= 32;
ret |= readl(addr); ret |= readl(addr);
...@@ -748,7 +747,7 @@ static inline u64 readq(void *addr) ...@@ -748,7 +747,7 @@ static inline u64 readq(void *addr)
#endif #endif
#ifndef writeq #ifndef writeq
static inline void writeq(u64 val, void *addr) static inline void writeq(u64 val, void __iomem *addr)
{ {
writel((u32) (val), addr); writel((u32) (val), addr);
writel((u32) (val >> 32), (addr + 4)); writel((u32) (val >> 32), (addr + 4));
...@@ -762,7 +761,7 @@ static inline void writeq(u64 val, void *addr) ...@@ -762,7 +761,7 @@ static inline void writeq(u64 val, void *addr)
*/ */
#define UF 1 #define UF 1
#define LF 2 #define LF 2
static inline void SPECIAL_REG_WRITE(u64 val, void *addr, int order) static inline void SPECIAL_REG_WRITE(u64 val, void __iomem *addr, int order)
{ {
if (order == LF) { if (order == LF) {
writel((u32) (val), addr); writel((u32) (val), addr);
......
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