Commit 598cb23f authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/garz/repo/netdev-2.6/acenic

into pobox.com:/garz/repo/net-drivers-2.6
parents 90babff0 3d4303d6
......@@ -443,7 +443,7 @@ MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C985/GA620 max number of receive descript
MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)");
static char version[] __initdata =
static char version[] __devinitdata =
"acenic.c: v0.92 08/05/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n"
" http://home.cern.ch/~jes/gige/acenic.html\n";
......@@ -538,7 +538,7 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev,
* addresses but who gives a damn.
*/
dev->base_addr = pci_resource_start(pdev, 0);
ap->regs = (struct ace_regs *)ioremap(dev->base_addr, 0x4000);
ap->regs = ioremap(dev->base_addr, 0x4000);
if (!ap->regs) {
printk(KERN_ERR "%s: Unable to map I/O register, "
"AceNIC %i will be disabled.\n",
......@@ -631,7 +631,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct ace_private *ap = netdev_priv(dev);
struct ace_regs *regs = ap->regs;
struct ace_regs __iomem *regs = ap->regs;
short i;
unregister_netdev(dev);
......@@ -884,7 +884,7 @@ static void ace_init_cleanup(struct net_device *dev)
/*
* Commands are considered to be slow.
*/
static inline void ace_issue_cmd(struct ace_regs *regs, struct cmd *cmd)
static inline void ace_issue_cmd(struct ace_regs __iomem *regs, struct cmd *cmd)
{
u32 idx;
......@@ -897,10 +897,10 @@ static inline void ace_issue_cmd(struct ace_regs *regs, struct cmd *cmd)
}
static int __init ace_init(struct net_device *dev)
static int __devinit ace_init(struct net_device *dev)
{
struct ace_private *ap;
struct ace_regs *regs;
struct ace_regs __iomem *regs;
struct ace_info *info = NULL;
struct pci_dev *pdev;
unsigned long myjif;
......@@ -1318,11 +1318,10 @@ static int __init ace_init(struct net_device *dev)
writel(TX_RING_BASE, &regs->WinBase);
if (ACE_IS_TIGON_I(ap)) {
ap->tx_ring = (struct tx_desc *)regs->Window;
for (i = 0; i < (TIGON_I_TX_RING_ENTRIES *
sizeof(struct tx_desc) / 4); i++) {
writel(0, (unsigned long)ap->tx_ring + i * 4);
}
ap->tx_ring = (struct tx_desc *) regs->Window;
for (i = 0; i < (TIGON_I_TX_RING_ENTRIES
* sizeof(struct tx_desc)) / sizeof(u32); i++)
writel(0, (void __iomem *)ap->tx_ring + i * 4);
set_aceaddr(&info->tx_ctrl.rngptr, TX_RING_BASE);
} else {
......@@ -1549,14 +1548,9 @@ static int __init ace_init(struct net_device *dev)
static void ace_set_rxtx_parms(struct net_device *dev, int jumbo)
{
struct ace_private *ap;
struct ace_regs *regs;
int board_idx;
ap = netdev_priv(dev);
regs = ap->regs;
board_idx = ap->board_idx;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
int board_idx = ap->board_idx;
if (board_idx >= 0) {
if (!jumbo) {
......@@ -1594,7 +1588,7 @@ static void ace_watchdog(struct net_device *data)
{
struct net_device *dev = data;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs *regs = ap->regs;
struct ace_regs __iomem *regs = ap->regs;
/*
* We haven't received a stats update event for more than 2.5
......@@ -1617,7 +1611,7 @@ static void ace_watchdog(struct net_device *data)
static void ace_tasklet(unsigned long dev)
{
struct ace_private *ap = ((struct net_device *)dev)->priv;
struct ace_private *ap = netdev_priv((struct net_device *)dev);
int cur_size;
cur_size = atomic_read(&ap->cur_rx_bufs);
......@@ -1675,10 +1669,9 @@ static void ace_dump_trace(struct ace_private *ap)
*/
static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
{
struct ace_regs *regs;
struct ace_regs __iomem *regs = ap->regs;
short i, idx;
regs = ap->regs;
prefetchw(&ap->cur_rx_bufs);
......@@ -1739,11 +1732,9 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
{
struct ace_regs *regs;
struct ace_regs __iomem *regs = ap->regs;
short i, idx;
regs = ap->regs;
prefetchw(&ap->cur_mini_bufs);
idx = ap->rx_mini_skbprd;
......@@ -1798,11 +1789,9 @@ static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
*/
static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs)
{
struct ace_regs *regs;
struct ace_regs __iomem *regs = ap->regs;
short i, idx;
regs = ap->regs;
idx = ap->rx_jumbo_skbprd;
for (i = 0; i < nr_bufs; i++) {
......@@ -2082,8 +2071,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
* the 12.3.x Firmware - my Tigon I NICs seem to disagree!
*/
if (ACE_IS_TIGON_I(ap)) {
struct ace_regs *regs = ap->regs;
writel(idx, &regs->RxRetCsm);
writel(idx, &ap->regs->RxRetCsm);
}
ap->cur_rx = idx;
......@@ -2163,16 +2151,13 @@ static inline void ace_tx_int(struct net_device *dev,
static irqreturn_t ace_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
{
struct ace_private *ap;
struct ace_regs *regs;
struct net_device *dev = (struct net_device *)dev_id;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
u32 idx;
u32 txcsm, rxretcsm, rxretprd;
u32 evtcsm, evtprd;
ap = netdev_priv(dev);
regs = ap->regs;
/*
* In case of PCI shared interrupts or spurious interrupts,
* we want to make sure it is actually our interrupt before
......@@ -2325,13 +2310,10 @@ static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
static int ace_open(struct net_device *dev)
{
struct ace_private *ap;
struct ace_regs *regs;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
struct cmd cmd;
ap = netdev_priv(dev);
regs = ap->regs;
if (!(ap->fw_running)) {
printk(KERN_WARNING "%s: Firmware not running!\n", dev->name);
return -EBUSY;
......@@ -2383,8 +2365,8 @@ static int ace_open(struct net_device *dev)
static int ace_close(struct net_device *dev)
{
struct ace_private *ap;
struct ace_regs *regs;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
struct cmd cmd;
unsigned long flags;
short i;
......@@ -2396,8 +2378,6 @@ static int ace_close(struct net_device *dev)
*/
netif_stop_queue(dev);
ap = netdev_priv(dev);
regs = ap->regs;
if (ap->promisc) {
cmd.evt = C_SET_PROMISC_MODE;
......@@ -2433,9 +2413,11 @@ static int ace_close(struct net_device *dev)
if (mapping) {
if (ACE_IS_TIGON_I(ap)) {
writel(0, &ap->tx_ring[i].addr.addrhi);
writel(0, &ap->tx_ring[i].addr.addrlo);
writel(0, &ap->tx_ring[i].flagsize);
struct tx_desc __iomem *tx
= (struct tx_desc __iomem *) &ap->tx_ring[i];
writel(0, &tx->addr.addrhi);
writel(0, &tx->addr.addrlo);
writel(0, &tx->flagsize);
} else
memset(ap->tx_ring + i, 0,
sizeof(struct tx_desc));
......@@ -2492,11 +2474,12 @@ ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr,
#endif
if (ACE_IS_TIGON_I(ap)) {
writel(addr >> 32, &desc->addr.addrhi);
writel(addr & 0xffffffff, &desc->addr.addrlo);
writel(flagsize, &desc->flagsize);
struct tx_desc __iomem *io = (struct tx_desc __iomem *) desc;
writel(addr >> 32, &io->addr.addrhi);
writel(addr & 0xffffffff, &io->addr.addrlo);
writel(flagsize, &io->flagsize);
#if ACENIC_DO_VLAN
writel(vlan_tag, &desc->vlanres);
writel(vlan_tag, &io->vlanres);
#endif
} else {
desc->addr.addrhi = addr >> 32;
......@@ -2512,9 +2495,10 @@ ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr,
static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ace_private *ap = netdev_priv(dev);
struct ace_regs *regs = ap->regs;
struct ace_regs __iomem *regs = ap->regs;
struct tx_desc *desc;
u32 idx, flagsize;
unsigned long maxjiff = jiffies + 3*HZ;
restart:
idx = ap->tx_prd;
......@@ -2522,10 +2506,7 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (tx_ring_full(ap, ap->tx_ret_csm, idx))
goto overflow;
#if MAX_SKB_FRAGS
if (!skb_shinfo(skb)->nr_frags)
#endif
{
if (!skb_shinfo(skb)->nr_frags) {
dma_addr_t mapping;
u32 vlan_tag = 0;
......@@ -2547,9 +2528,7 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
flagsize |= BD_FLG_COAL_NOW;
ace_load_tx_bd(ap, desc, mapping, flagsize, vlan_tag);
}
#if MAX_SKB_FRAGS
else {
} else {
dma_addr_t mapping;
u32 vlan_tag = 0;
int i, len = 0;
......@@ -2604,7 +2583,6 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
ace_load_tx_bd(ap, desc, mapping, flagsize, vlan_tag);
}
}
#endif
wmb();
ap->tx_prd = idx;
......@@ -2624,7 +2602,7 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
dev->trans_start = jiffies;
return 0;
return NETDEV_TX_OK;
overflow:
/*
......@@ -2643,15 +2621,22 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
* Alternative is to return with 1 not throttling queue. In this
* case loop becomes longer, no more useful effects.
*/
if (time_before(jiffies, maxjiff)) {
barrier();
cpu_relax();
goto restart;
}
/* The ring is stuck full. */
printk(KERN_WARNING "%s: Transmit ring stuck full\n", dev->name);
return NETDEV_TX_BUSY;
}
static int ace_change_mtu(struct net_device *dev, int new_mtu)
{
struct ace_private *ap = netdev_priv(dev);
struct ace_regs *regs = ap->regs;
struct ace_regs __iomem *regs = ap->regs;
if (new_mtu > ACE_JUMBO_MTU)
return -EINVAL;
......@@ -2688,7 +2673,7 @@ static int ace_change_mtu(struct net_device *dev, int new_mtu)
static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
struct ace_private *ap = netdev_priv(dev);
struct ace_regs *regs = ap->regs;
struct ace_regs __iomem *regs = ap->regs;
u32 link;
memset(ecmd, 0, sizeof(struct ethtool_cmd));
......@@ -2741,7 +2726,7 @@ static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
static int ace_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
struct ace_private *ap = netdev_priv(dev);
struct ace_regs *regs = ap->regs;
struct ace_regs __iomem *regs = ap->regs;
u32 link, speed;
link = readl(&regs->GigLnkState);
......@@ -2821,8 +2806,9 @@ static void ace_get_drvinfo(struct net_device *dev,
*/
static int ace_set_mac_addr(struct net_device *dev, void *p)
{
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
struct sockaddr *addr=p;
struct ace_regs *regs;
u8 *da;
struct cmd cmd;
......@@ -2833,7 +2819,6 @@ static int ace_set_mac_addr(struct net_device *dev, void *p)
da = (u8 *)dev->dev_addr;
regs = ((struct ace_private *)netdev_priv(dev))->regs;
writel(da[0] << 8 | da[1], &regs->MacAddrHi);
writel((da[2] << 24) | (da[3] << 16) | (da[4] << 8) | da[5],
&regs->MacAddrLo);
......@@ -2850,7 +2835,7 @@ static int ace_set_mac_addr(struct net_device *dev, void *p)
static void ace_set_multicast_list(struct net_device *dev)
{
struct ace_private *ap = netdev_priv(dev);
struct ace_regs *regs = ap->regs;
struct ace_regs __iomem *regs = ap->regs;
struct cmd cmd;
if ((dev->flags & IFF_ALLMULTI) && !(ap->mcast_all)) {
......@@ -2904,8 +2889,8 @@ static void ace_set_multicast_list(struct net_device *dev)
static struct net_device_stats *ace_get_stats(struct net_device *dev)
{
struct ace_private *ap = netdev_priv(dev);
struct ace_mac_stats *mac_stats =
(struct ace_mac_stats *)ap->regs->Stats;
struct ace_mac_stats __iomem *mac_stats =
(struct ace_mac_stats __iomem *)ap->regs->Stats;
ap->stats.rx_missed_errors = readl(&mac_stats->drop_space);
ap->stats.multicast = readl(&mac_stats->kept_mc);
......@@ -2915,10 +2900,10 @@ static struct net_device_stats *ace_get_stats(struct net_device *dev)
}
static void __init ace_copy(struct ace_regs *regs, void *src,
static void __devinit ace_copy(struct ace_regs __iomem *regs, void *src,
u32 dest, int size)
{
unsigned long tdest;
void __iomem *tdest;
u32 *wsrc;
short tsize, i;
......@@ -2928,7 +2913,7 @@ static void __init ace_copy(struct ace_regs *regs, void *src,
while (size > 0) {
tsize = min_t(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1),
min_t(u32, size, ACE_WINDOW_SIZE));
tdest = (unsigned long)&regs->Window +
tdest = (void __iomem *) &regs->Window +
(dest & (ACE_WINDOW_SIZE - 1));
writel(dest & ~(ACE_WINDOW_SIZE - 1), &regs->WinBase);
/*
......@@ -2948,9 +2933,9 @@ static void __init ace_copy(struct ace_regs *regs, void *src,
}
static void __init ace_clear(struct ace_regs *regs, u32 dest, int size)
static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int size)
{
unsigned long tdest;
void __iomem *tdest;
short tsize = 0, i;
if (size <= 0)
......@@ -2959,7 +2944,7 @@ static void __init ace_clear(struct ace_regs *regs, u32 dest, int size)
while (size > 0) {
tsize = min_t(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1),
min_t(u32, size, ACE_WINDOW_SIZE));
tdest = (unsigned long)&regs->Window +
tdest = (void __iomem *) &regs->Window +
(dest & (ACE_WINDOW_SIZE - 1));
writel(dest & ~(ACE_WINDOW_SIZE - 1), &regs->WinBase);
......@@ -2981,13 +2966,10 @@ static void __init ace_clear(struct ace_regs *regs, u32 dest, int size)
* This operation requires the NIC to be halted and is performed with
* interrupts disabled and with the spinlock hold.
*/
int __init ace_load_firmware(struct net_device *dev)
int __devinit ace_load_firmware(struct net_device *dev)
{
struct ace_private *ap;
struct ace_regs *regs;
ap = netdev_priv(dev);
regs = ap->regs;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
if (!(readl(&regs->CpuCtrl) & CPU_HALTED)) {
printk(KERN_ERR "%s: trying to download firmware while the "
......@@ -3035,7 +3017,7 @@ int __init ace_load_firmware(struct net_device *dev)
* Thanks to Stevarino Webinski for helping tracking down the bugs in the
* code i2c readout code by beta testing all my hacks.
*/
static void __init eeprom_start(struct ace_regs *regs)
static void __devinit eeprom_start(struct ace_regs __iomem *regs)
{
u32 local;
......@@ -3064,7 +3046,7 @@ static void __init eeprom_start(struct ace_regs *regs)
}
static void __init eeprom_prep(struct ace_regs *regs, u8 magic)
static void __devinit eeprom_prep(struct ace_regs __iomem *regs, u8 magic)
{
short i;
u32 local;
......@@ -3101,7 +3083,7 @@ static void __init eeprom_prep(struct ace_regs *regs, u8 magic)
}
static int __init eeprom_check_ack(struct ace_regs *regs)
static int __devinit eeprom_check_ack(struct ace_regs __iomem *regs)
{
int state;
u32 local;
......@@ -3129,7 +3111,7 @@ static int __init eeprom_check_ack(struct ace_regs *regs)
}
static void __init eeprom_stop(struct ace_regs *regs)
static void __devinit eeprom_stop(struct ace_regs __iomem *regs)
{
u32 local;
......@@ -3164,11 +3146,11 @@ static void __init eeprom_stop(struct ace_regs *regs)
/*
* Read a whole byte from the EEPROM.
*/
static int __init read_eeprom_byte(struct net_device *dev,
static int __devinit read_eeprom_byte(struct net_device *dev,
unsigned long offset)
{
struct ace_private *ap;
struct ace_regs *regs;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
unsigned long flags;
u32 local;
int result = 0;
......@@ -3180,9 +3162,6 @@ static int __init read_eeprom_byte(struct net_device *dev,
goto out;
}
ap = netdev_priv(dev);
regs = ap->regs;
/*
* Don't take interrupts on this CPU will bit banging
* the %#%#@$ I2C device
......
......@@ -10,11 +10,6 @@
*/
#define USE_TX_COAL_NOW 0
#ifndef MAX_SKB_FRAGS
#define MAX_SKB_FRAGS 0
#endif
/*
* Addressing:
*
......@@ -638,7 +633,7 @@ struct ace_skb
struct ace_private
{
struct ace_info *info;
struct ace_regs *regs; /* register base */
struct ace_regs __iomem *regs; /* register base */
struct ace_skb *skb;
dma_addr_t info_dma; /* 32/64 bit */
......@@ -712,13 +707,7 @@ static inline int tx_space (struct ace_private *ap, u32 csm, u32 prd)
}
#define tx_free(ap) tx_space((ap)->tx_ret_csm, (ap)->tx_prd, ap)
#if MAX_SKB_FRAGS
#define tx_ring_full(ap, csm, prd) (tx_space(ap, csm, prd) <= TX_RESERVED)
#else
#define tx_ring_full 0
#endif
static inline void set_aceaddr(aceaddr *aa, dma_addr_t addr)
{
......@@ -729,7 +718,7 @@ static inline void set_aceaddr(aceaddr *aa, dma_addr_t addr)
}
static inline void ace_set_txprd(struct ace_regs *regs,
static inline void ace_set_txprd(struct ace_regs __iomem *regs,
struct ace_private *ap, u32 value)
{
#ifdef INDEX_DEBUG
......@@ -750,8 +739,8 @@ static inline void ace_set_txprd(struct ace_regs *regs,
static inline void ace_mask_irq(struct net_device *dev)
{
struct ace_private *ap = dev->priv;
struct ace_regs *regs = ap->regs;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
if (ACE_IS_TIGON_I(ap))
writel(1, &regs->MaskInt);
......@@ -764,8 +753,8 @@ static inline void ace_mask_irq(struct net_device *dev)
static inline void ace_unmask_irq(struct net_device *dev)
{
struct ace_private *ap = dev->priv;
struct ace_regs *regs = ap->regs;
struct ace_private *ap = netdev_priv(dev);
struct ace_regs __iomem *regs = ap->regs;
if (ACE_IS_TIGON_I(ap))
writel(0, &regs->MaskInt);
......
......@@ -23,7 +23,7 @@
#define tigonFwRodata NULL
#else
/* Generated by genfw.c */
static u32 tigonFwText[(MAX_TEXT_LEN/4) + 1] __initdata = {
static u32 tigonFwText[(MAX_TEXT_LEN/4) + 1] __devinitdata = {
0x10000003,
0x0, 0xd, 0xd, 0x3c1d0001,
0x8fbd5c54, 0x3a0f021, 0x3c100000, 0x26104000,
......
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