Commit c45f812f authored by Matthew Whitehead's avatar Matthew Whitehead Committed by David S. Miller

8390 : Replace ei_debug with msg_enable/NETIF_MSG_* feature

Removed the shared ei_debug variable. Replaced it by adding u32 msg_enable to
the private struct ei_device. Now each 8390 ethernet instance has a per-device
logging variable.

Changed older style printk() calls to more canonical forms.

Tested on: ne, ne2k-pci, smc-ultra, and wd hardware.

V4.0
- Substituted pr_info() and pr_debug() for printk() KERN_INFO and KERN_DEBUG

V3.0
- Checked for cases where pr_cont() was most appropriate choice.
- Changed module parameter from 'debug' to 'msg_enable' because debug was
no longer the best description.

V2.0
- Changed netif_msg_(drv|probe|ifdown|rx_err|tx_err|tx_queued|intr|rx_status|hw)
to netif_(dbg|info|warn|err) where possible.
Signed-off-by: default avatarMatthew Whitehead <tedheadster@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e980569
...@@ -21,12 +21,6 @@ struct e8390_pkt_hdr { ...@@ -21,12 +21,6 @@ struct e8390_pkt_hdr {
unsigned short count; /* header + packet length in bytes */ unsigned short count; /* header + packet length in bytes */
}; };
#ifdef notdef
extern int ei_debug;
#else
#define ei_debug 1
#endif
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
void ei_poll(struct net_device *dev); void ei_poll(struct net_device *dev);
void eip_poll(struct net_device *dev); void eip_poll(struct net_device *dev);
...@@ -99,6 +93,7 @@ struct ei_device { ...@@ -99,6 +93,7 @@ struct ei_device {
u32 *reg_offset; /* Register mapping table */ u32 *reg_offset; /* Register mapping table */
spinlock_t page_lock; /* Page register locks */ spinlock_t page_lock; /* Page register locks */
unsigned long priv; /* Private field to store bus IDs etc. */ unsigned long priv; /* Private field to store bus IDs etc. */
u32 msg_enable; /* debug message level */
#ifdef AX88796_PLATFORM #ifdef AX88796_PLATFORM
unsigned char rxcr_base; /* default value for RXCR */ unsigned char rxcr_base; /* default value for RXCR */
#endif #endif
......
...@@ -116,9 +116,15 @@ static const char version[] = ...@@ -116,9 +116,15 @@ static const char version[] =
static int apne_owned; /* signal if card already owned */ static int apne_owned; /* signal if card already owned */
static u32 apne_msg_enable;
module_param_named(msg_enable, apne_msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
struct net_device * __init apne_probe(int unit) struct net_device * __init apne_probe(int unit)
{ {
struct net_device *dev; struct net_device *dev;
struct ei_device *ei_local;
#ifndef MANUAL_CONFIG #ifndef MANUAL_CONFIG
char tuple[8]; char tuple[8];
#endif #endif
...@@ -133,11 +139,11 @@ struct net_device * __init apne_probe(int unit) ...@@ -133,11 +139,11 @@ struct net_device * __init apne_probe(int unit)
if ( !(AMIGAHW_PRESENT(PCMCIA)) ) if ( !(AMIGAHW_PRESENT(PCMCIA)) )
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
printk("Looking for PCMCIA ethernet card : "); pr_info("Looking for PCMCIA ethernet card : ");
/* check if a card is inserted */ /* check if a card is inserted */
if (!(PCMCIA_INSERTED)) { if (!(PCMCIA_INSERTED)) {
printk("NO PCMCIA card inserted\n"); pr_cont("NO PCMCIA card inserted\n");
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
...@@ -148,6 +154,8 @@ struct net_device * __init apne_probe(int unit) ...@@ -148,6 +154,8 @@ struct net_device * __init apne_probe(int unit)
sprintf(dev->name, "eth%d", unit); sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev); netdev_boot_setup_check(dev);
} }
ei_local = netdev_priv(dev);
ei_local->msg_enable = apne_msg_enable;
/* disable pcmcia irq for readtuple */ /* disable pcmcia irq for readtuple */
pcmcia_disable_irq(); pcmcia_disable_irq();
...@@ -155,14 +163,14 @@ struct net_device * __init apne_probe(int unit) ...@@ -155,14 +163,14 @@ struct net_device * __init apne_probe(int unit)
#ifndef MANUAL_CONFIG #ifndef MANUAL_CONFIG
if ((pcmcia_copy_tuple(CISTPL_FUNCID, tuple, 8) < 3) || if ((pcmcia_copy_tuple(CISTPL_FUNCID, tuple, 8) < 3) ||
(tuple[2] != CISTPL_FUNCID_NETWORK)) { (tuple[2] != CISTPL_FUNCID_NETWORK)) {
printk("not an ethernet card\n"); pr_cont("not an ethernet card\n");
/* XXX: shouldn't we re-enable irq here? */ /* XXX: shouldn't we re-enable irq here? */
free_netdev(dev); free_netdev(dev);
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
#endif #endif
printk("ethernet PCMCIA card inserted\n"); pr_cont("ethernet PCMCIA card inserted\n");
if (!init_pcmcia()) { if (!init_pcmcia()) {
/* XXX: shouldn't we re-enable irq here? */ /* XXX: shouldn't we re-enable irq here? */
...@@ -204,11 +212,12 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) ...@@ -204,11 +212,12 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
int neX000, ctron; int neX000, ctron;
#endif #endif
static unsigned version_printed; static unsigned version_printed;
struct ei_device *ei_local = netdev_priv(dev);
if (ei_debug && version_printed++ == 0) if ((apne_msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
printk(version); netdev_info(dev, version);
printk("PCMCIA NE*000 ethercard probe"); netdev_info(dev, "PCMCIA NE*000 ethercard probe");
/* Reset card. Who knows what dain-bramaged state it was left in. */ /* Reset card. Who knows what dain-bramaged state it was left in. */
{ unsigned long reset_start_time = jiffies; { unsigned long reset_start_time = jiffies;
...@@ -217,7 +226,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) ...@@ -217,7 +226,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
if (time_after(jiffies, reset_start_time + 2*HZ/100)) { if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
printk(" not found (no reset ack).\n"); pr_cont(" not found (no reset ack).\n");
return -ENODEV; return -ENODEV;
} }
...@@ -288,7 +297,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) ...@@ -288,7 +297,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
start_page = 0x01; start_page = 0x01;
stop_page = (wordlength == 2) ? 0x40 : 0x20; stop_page = (wordlength == 2) ? 0x40 : 0x20;
} else { } else {
printk(" not found.\n"); pr_cont(" not found.\n");
return -ENXIO; return -ENXIO;
} }
...@@ -320,9 +329,9 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) ...@@ -320,9 +329,9 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
for (i = 0; i < ETH_ALEN; i++) for (i = 0; i < ETH_ALEN; i++)
dev->dev_addr[i] = SA_prom[i]; dev->dev_addr[i] = SA_prom[i];
printk(" %pM\n", dev->dev_addr); pr_cont(" %pM\n", dev->dev_addr);
printk("%s: %s found.\n", dev->name, name); netdev_info(dev, "%s found.\n", name);
ei_status.name = name; ei_status.name = name;
ei_status.tx_start_page = start_page; ei_status.tx_start_page = start_page;
...@@ -352,10 +361,11 @@ static void ...@@ -352,10 +361,11 @@ static void
apne_reset_8390(struct net_device *dev) apne_reset_8390(struct net_device *dev)
{ {
unsigned long reset_start_time = jiffies; unsigned long reset_start_time = jiffies;
struct ei_device *ei_local = netdev_priv(dev);
init_pcmcia(); init_pcmcia();
if (ei_debug > 1) printk("resetting the 8390 t=%ld...", jiffies); netif_dbg(ei_local, hw, dev, "resetting the 8390 t=%ld...\n", jiffies);
outb(inb(NE_BASE + NE_RESET), NE_BASE + NE_RESET); outb(inb(NE_BASE + NE_RESET), NE_BASE + NE_RESET);
...@@ -365,8 +375,8 @@ apne_reset_8390(struct net_device *dev) ...@@ -365,8 +375,8 @@ apne_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0)
if (time_after(jiffies, reset_start_time + 2*HZ/100)) { if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
printk("%s: ne_reset_8390() did not complete.\n", dev->name); netdev_err(dev, "ne_reset_8390() did not complete.\n");
break; break;
} }
outb(ENISR_RESET, NE_BASE + NE_EN0_ISR); /* Ack intr. */ outb(ENISR_RESET, NE_BASE + NE_EN0_ISR); /* Ack intr. */
} }
...@@ -386,9 +396,9 @@ apne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_pa ...@@ -386,9 +396,9 @@ apne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_pa
/* This *shouldn't* happen. If it does, it's the last thing you'll see */ /* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) { if (ei_status.dmaing) {
printk("%s: DMAing conflict in ne_get_8390_hdr " netdev_err(dev, "DMAing conflict in ne_get_8390_hdr "
"[DMAstat:%d][irqlock:%d][intr:%d].\n", "[DMAstat:%d][irqlock:%d][intr:%d].\n",
dev->name, ei_status.dmaing, ei_status.irqlock, dev->irq); ei_status.dmaing, ei_status.irqlock, dev->irq);
return; return;
} }
...@@ -433,9 +443,9 @@ apne_block_input(struct net_device *dev, int count, struct sk_buff *skb, int rin ...@@ -433,9 +443,9 @@ apne_block_input(struct net_device *dev, int count, struct sk_buff *skb, int rin
/* This *shouldn't* happen. If it does, it's the last thing you'll see */ /* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) { if (ei_status.dmaing) {
printk("%s: DMAing conflict in ne_block_input " netdev_err(dev, "DMAing conflict in ne_block_input "
"[DMAstat:%d][irqlock:%d][intr:%d].\n", "[DMAstat:%d][irqlock:%d][intr:%d].\n",
dev->name, ei_status.dmaing, ei_status.irqlock, dev->irq); ei_status.dmaing, ei_status.irqlock, dev->irq);
return; return;
} }
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
...@@ -481,9 +491,9 @@ apne_block_output(struct net_device *dev, int count, ...@@ -481,9 +491,9 @@ apne_block_output(struct net_device *dev, int count,
/* This *shouldn't* happen. If it does, it's the last thing you'll see */ /* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) { if (ei_status.dmaing) {
printk("%s: DMAing conflict in ne_block_output." netdev_err(dev, "DMAing conflict in ne_block_output."
"[DMAstat:%d][irqlock:%d][intr:%d]\n", "[DMAstat:%d][irqlock:%d][intr:%d]\n",
dev->name, ei_status.dmaing, ei_status.irqlock, dev->irq); ei_status.dmaing, ei_status.irqlock, dev->irq);
return; return;
} }
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
...@@ -513,7 +523,7 @@ apne_block_output(struct net_device *dev, int count, ...@@ -513,7 +523,7 @@ apne_block_output(struct net_device *dev, int count,
while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
printk("%s: timeout waiting for Tx RDC.\n", dev->name); netdev_warn(dev, "timeout waiting for Tx RDC.\n");
apne_reset_8390(dev); apne_reset_8390(dev);
NS8390_init(dev,1); NS8390_init(dev,1);
break; break;
...@@ -536,8 +546,8 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id) ...@@ -536,8 +546,8 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id)
pcmcia_ack_int(pcmcia_intreq); pcmcia_ack_int(pcmcia_intreq);
return IRQ_NONE; return IRQ_NONE;
} }
if (ei_debug > 3) if (apne_msg_enable & NETIF_MSG_INTR)
printk("pcmcia intreq = %x\n", pcmcia_intreq); pr_debug("pcmcia intreq = %x\n", pcmcia_intreq);
pcmcia_disable_irq(); /* to get rid of the sti() within ei_interrupt */ pcmcia_disable_irq(); /* to get rid of the sti() within ei_interrupt */
ei_interrupt(irq, dev_id); ei_interrupt(irq, dev_id);
pcmcia_ack_int(pcmcia_get_intreq()); pcmcia_ack_int(pcmcia_get_intreq());
......
...@@ -78,6 +78,8 @@ static unsigned char version[] = "ax88796.c: Copyright 2005,2007 Simtec Electron ...@@ -78,6 +78,8 @@ static unsigned char version[] = "ax88796.c: Copyright 2005,2007 Simtec Electron
#define AX_GPOC_PPDSET BIT(6) #define AX_GPOC_PPDSET BIT(6)
static u32 ax_msg_enable;
/* device private data */ /* device private data */
struct ax_device { struct ax_device {
...@@ -147,8 +149,7 @@ static void ax_reset_8390(struct net_device *dev) ...@@ -147,8 +149,7 @@ static void ax_reset_8390(struct net_device *dev)
unsigned long reset_start_time = jiffies; unsigned long reset_start_time = jiffies;
void __iomem *addr = (void __iomem *)dev->base_addr; void __iomem *addr = (void __iomem *)dev->base_addr;
if (ei_debug > 1) netif_dbg(ei_local, hw, dev, "resetting the 8390 t=%ld...\n", jiffies);
netdev_dbg(dev, "resetting the 8390 t=%ld\n", jiffies);
ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET); ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET);
...@@ -496,12 +497,28 @@ static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -496,12 +497,28 @@ static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return phy_ethtool_sset(phy_dev, cmd); return phy_ethtool_sset(phy_dev, cmd);
} }
static u32 ax_get_msglevel(struct net_device *dev)
{
struct ei_device *ei_local = netdev_priv(dev);
return ei_local->msg_enable;
}
static void ax_set_msglevel(struct net_device *dev, u32 v)
{
struct ei_device *ei_local = netdev_priv(dev);
ei_local->msg_enable = v;
}
static const struct ethtool_ops ax_ethtool_ops = { static const struct ethtool_ops ax_ethtool_ops = {
.get_drvinfo = ax_get_drvinfo, .get_drvinfo = ax_get_drvinfo,
.get_settings = ax_get_settings, .get_settings = ax_get_settings,
.set_settings = ax_set_settings, .set_settings = ax_set_settings,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.get_ts_info = ethtool_op_get_ts_info, .get_ts_info = ethtool_op_get_ts_info,
.get_msglevel = ax_get_msglevel,
.set_msglevel = ax_set_msglevel,
}; };
#ifdef CONFIG_AX88796_93CX6 #ifdef CONFIG_AX88796_93CX6
...@@ -763,6 +780,7 @@ static int ax_init_dev(struct net_device *dev) ...@@ -763,6 +780,7 @@ static int ax_init_dev(struct net_device *dev)
ei_local->block_output = &ax_block_output; ei_local->block_output = &ax_block_output;
ei_local->get_8390_hdr = &ax_get_8390_hdr; ei_local->get_8390_hdr = &ax_get_8390_hdr;
ei_local->priv = 0; ei_local->priv = 0;
ei_local->msg_enable = ax_msg_enable;
dev->netdev_ops = &ax_netdev_ops; dev->netdev_ops = &ax_netdev_ops;
dev->ethtool_ops = &ax_ethtool_ops; dev->ethtool_ops = &ax_ethtool_ops;
......
...@@ -105,6 +105,7 @@ static void AX88190_init(struct net_device *dev, int startp); ...@@ -105,6 +105,7 @@ static void AX88190_init(struct net_device *dev, int startp);
static int ax_open(struct net_device *dev); static int ax_open(struct net_device *dev);
static int ax_close(struct net_device *dev); static int ax_close(struct net_device *dev);
static irqreturn_t ax_interrupt(int irq, void *dev_id); static irqreturn_t ax_interrupt(int irq, void *dev_id);
static u32 axnet_msg_enable;
/*====================================================================*/ /*====================================================================*/
...@@ -152,6 +153,7 @@ static int axnet_probe(struct pcmcia_device *link) ...@@ -152,6 +153,7 @@ static int axnet_probe(struct pcmcia_device *link)
return -ENOMEM; return -ENOMEM;
ei_local = netdev_priv(dev); ei_local = netdev_priv(dev);
ei_local->msg_enable = axnet_msg_enable;
spin_lock_init(&ei_local->page_lock); spin_lock_init(&ei_local->page_lock);
info = PRIV(dev); info = PRIV(dev);
...@@ -650,11 +652,12 @@ static void block_input(struct net_device *dev, int count, ...@@ -650,11 +652,12 @@ static void block_input(struct net_device *dev, int count,
struct sk_buff *skb, int ring_offset) struct sk_buff *skb, int ring_offset)
{ {
unsigned int nic_base = dev->base_addr; unsigned int nic_base = dev->base_addr;
struct ei_device *ei_local = netdev_priv(dev);
int xfer_count = count; int xfer_count = count;
char *buf = skb->data; char *buf = skb->data;
if ((ei_debug > 4) && (count != 4)) if ((netif_msg_rx_status(ei_local)) && (count != 4))
pr_debug("%s: [bi=%d]\n", dev->name, count+4); netdev_dbg(dev, "[bi=%d]\n", count+4);
outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD);
...@@ -810,11 +813,6 @@ module_pcmcia_driver(axnet_cs_driver); ...@@ -810,11 +813,6 @@ module_pcmcia_driver(axnet_cs_driver);
#define ei_block_input (ei_local->block_input) #define ei_block_input (ei_local->block_input)
#define ei_get_8390_hdr (ei_local->get_8390_hdr) #define ei_get_8390_hdr (ei_local->get_8390_hdr)
/* use 0 for production, 1 for verification, >2 for debug */
#ifndef ei_debug
int ei_debug = 1;
#endif
/* Index to functions. */ /* Index to functions. */
static void ei_tx_intr(struct net_device *dev); static void ei_tx_intr(struct net_device *dev);
static void ei_tx_err(struct net_device *dev); static void ei_tx_err(struct net_device *dev);
...@@ -925,11 +923,10 @@ static void axnet_tx_timeout(struct net_device *dev) ...@@ -925,11 +923,10 @@ static void axnet_tx_timeout(struct net_device *dev)
isr = inb(e8390_base+EN0_ISR); isr = inb(e8390_base+EN0_ISR);
spin_unlock_irqrestore(&ei_local->page_lock, flags); spin_unlock_irqrestore(&ei_local->page_lock, flags);
netdev_printk(KERN_DEBUG, dev, netdev_dbg(dev, "Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n",
"Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n", (txsr & ENTSR_ABT) ? "excess collisions." :
(txsr & ENTSR_ABT) ? "excess collisions." : (isr) ? "lost interrupt?" : "cable problem?",
(isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar);
txsr, isr, tickssofar);
if (!isr && !dev->stats.tx_packets) if (!isr && !dev->stats.tx_packets)
{ {
...@@ -998,29 +995,30 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb, ...@@ -998,29 +995,30 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
{ {
output_page = ei_local->tx_start_page; output_page = ei_local->tx_start_page;
ei_local->tx1 = send_length; ei_local->tx1 = send_length;
if (ei_debug && ei_local->tx2 > 0) if ((netif_msg_tx_queued(ei_local)) &&
netdev_printk(KERN_DEBUG, dev, ei_local->tx2 > 0)
"idle transmitter tx2=%d, lasttx=%d, txing=%d\n", netdev_dbg(dev,
ei_local->tx2, ei_local->lasttx, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
ei_local->txing); ei_local->tx2, ei_local->lasttx,
ei_local->txing);
} }
else if (ei_local->tx2 == 0) else if (ei_local->tx2 == 0)
{ {
output_page = ei_local->tx_start_page + TX_PAGES/2; output_page = ei_local->tx_start_page + TX_PAGES/2;
ei_local->tx2 = send_length; ei_local->tx2 = send_length;
if (ei_debug && ei_local->tx1 > 0) if ((netif_msg_tx_queued(ei_local)) &&
netdev_printk(KERN_DEBUG, dev, ei_local->tx1 > 0)
"idle transmitter, tx1=%d, lasttx=%d, txing=%d\n", netdev_dbg(dev,
ei_local->tx1, ei_local->lasttx, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
ei_local->txing); ei_local->tx1, ei_local->lasttx,
ei_local->txing);
} }
else else
{ /* We should never get here. */ { /* We should never get here. */
if (ei_debug) netif_dbg(ei_local, tx_err, dev,
netdev_printk(KERN_DEBUG, dev, "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
"No Tx buffers free! tx1=%d tx2=%d last=%d\n", ei_local->tx1, ei_local->tx2,
ei_local->tx1, ei_local->tx2, ei_local->lasttx);
ei_local->lasttx);
ei_local->irqlock = 0; ei_local->irqlock = 0;
netif_stop_queue(dev); netif_stop_queue(dev);
outb_p(ENISR_ALL, e8390_base + EN0_IMR); outb_p(ENISR_ALL, e8390_base + EN0_IMR);
...@@ -1124,10 +1122,9 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) ...@@ -1124,10 +1122,9 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
spin_unlock_irqrestore(&ei_local->page_lock, flags); spin_unlock_irqrestore(&ei_local->page_lock, flags);
return IRQ_NONE; return IRQ_NONE;
} }
if (ei_debug > 3) netif_dbg(ei_local, intr, dev, "interrupt(isr=%#2.2x)\n",
netdev_printk(KERN_DEBUG, dev, "interrupt(isr=%#2.2x)\n", inb_p(e8390_base + EN0_ISR));
inb_p(e8390_base + EN0_ISR));
outb_p(0x00, e8390_base + EN0_ISR); outb_p(0x00, e8390_base + EN0_ISR);
ei_local->irqlock = 1; ei_local->irqlock = 1;
...@@ -1137,9 +1134,8 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) ...@@ -1137,9 +1134,8 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
++nr_serviced < MAX_SERVICE) ++nr_serviced < MAX_SERVICE)
{ {
if (!netif_running(dev) || (interrupts == 0xff)) { if (!netif_running(dev) || (interrupts == 0xff)) {
if (ei_debug > 1) netif_warn(ei_local, intr, dev,
netdev_warn(dev, "interrupt from stopped card\n");
"interrupt from stopped card\n");
outb_p(interrupts, e8390_base + EN0_ISR); outb_p(interrupts, e8390_base + EN0_ISR);
interrupts = 0; interrupts = 0;
break; break;
...@@ -1175,14 +1171,15 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) ...@@ -1175,14 +1171,15 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
} }
} }
if (interrupts && ei_debug > 3) if (interrupts && (netif_msg_intr(ei_local)))
{ {
handled = 1; handled = 1;
if (nr_serviced >= MAX_SERVICE) if (nr_serviced >= MAX_SERVICE)
{ {
/* 0xFF is valid for a card removal */ /* 0xFF is valid for a card removal */
if(interrupts!=0xFF) if (interrupts != 0xFF)
netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n", netdev_warn(dev,
"Too much work at interrupt, status %#2.2x\n",
interrupts); interrupts);
outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */ outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */
} else { } else {
...@@ -1221,8 +1218,7 @@ static void ei_tx_err(struct net_device *dev) ...@@ -1221,8 +1218,7 @@ static void ei_tx_err(struct net_device *dev)
unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU); unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);
#ifdef VERBOSE_ERROR_DUMP #ifdef VERBOSE_ERROR_DUMP
netdev_printk(KERN_DEBUG, dev, netdev_dbg(dev, "transmitter error (%#2x):", txsr);
"transmitter error (%#2x):", txsr);
if (txsr & ENTSR_ABT) if (txsr & ENTSR_ABT)
pr_cont(" excess-collisions"); pr_cont(" excess-collisions");
if (txsr & ENTSR_ND) if (txsr & ENTSR_ND)
...@@ -1287,9 +1283,9 @@ static void ei_tx_intr(struct net_device *dev) ...@@ -1287,9 +1283,9 @@ static void ei_tx_intr(struct net_device *dev)
else if (ei_local->tx2 < 0) else if (ei_local->tx2 < 0)
{ {
if (ei_local->lasttx != 2 && ei_local->lasttx != -2) if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
netdev_info(dev, "%s: bogus last_tx_buffer %d, tx2=%d\n", netdev_err(dev, "%s: bogus last_tx_buffer %d, tx2=%d\n",
ei_local->name, ei_local->lasttx, ei_local->name, ei_local->lasttx,
ei_local->tx2); ei_local->tx2);
ei_local->tx2 = 0; ei_local->tx2 = 0;
if (ei_local->tx1 > 0) if (ei_local->tx1 > 0)
{ {
...@@ -1366,9 +1362,11 @@ static void ei_receive(struct net_device *dev) ...@@ -1366,9 +1362,11 @@ static void ei_receive(struct net_device *dev)
Keep quiet if it looks like a card removal. One problem here Keep quiet if it looks like a card removal. One problem here
is that some clones crash in roughly the same way. is that some clones crash in roughly the same way.
*/ */
if (ei_debug > 0 && this_frame != ei_local->current_page && (this_frame!=0x0 || rxing_page!=0xFF)) if ((netif_msg_rx_err(ei_local)) &&
netdev_err(dev, "mismatched read page pointers %2x vs %2x\n", this_frame != ei_local->current_page &&
this_frame, ei_local->current_page); (this_frame != 0x0 || rxing_page != 0xFF))
netdev_err(dev, "mismatched read page pointers %2x vs %2x\n",
this_frame, ei_local->current_page);
if (this_frame == rxing_page) /* Read all the frames? */ if (this_frame == rxing_page) /* Read all the frames? */
break; /* Done for now */ break; /* Done for now */
...@@ -1383,11 +1381,10 @@ static void ei_receive(struct net_device *dev) ...@@ -1383,11 +1381,10 @@ static void ei_receive(struct net_device *dev)
if (pkt_len < 60 || pkt_len > 1518) if (pkt_len < 60 || pkt_len > 1518)
{ {
if (ei_debug) netif_err(ei_local, rx_err, dev,
netdev_printk(KERN_DEBUG, dev, "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
"bogus packet size: %d, status=%#2x nxpg=%#2x\n", rx_frame.count, rx_frame.status,
rx_frame.count, rx_frame.status, rx_frame.next);
rx_frame.next);
dev->stats.rx_errors++; dev->stats.rx_errors++;
dev->stats.rx_length_errors++; dev->stats.rx_length_errors++;
} }
...@@ -1398,10 +1395,9 @@ static void ei_receive(struct net_device *dev) ...@@ -1398,10 +1395,9 @@ static void ei_receive(struct net_device *dev)
skb = netdev_alloc_skb(dev, pkt_len + 2); skb = netdev_alloc_skb(dev, pkt_len + 2);
if (skb == NULL) if (skb == NULL)
{ {
if (ei_debug > 1) netif_err(ei_local, rx_err, dev,
netdev_printk(KERN_DEBUG, dev, "Couldn't allocate a sk_buff of size %d\n",
"Couldn't allocate a sk_buff of size %d\n", pkt_len);
pkt_len);
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
break; break;
} }
...@@ -1420,11 +1416,10 @@ static void ei_receive(struct net_device *dev) ...@@ -1420,11 +1416,10 @@ static void ei_receive(struct net_device *dev)
} }
else else
{ {
if (ei_debug) netif_err(ei_local, rx_err, dev,
netdev_printk(KERN_DEBUG, dev, "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
"bogus packet: status=%#2x nxpg=%#2x size=%d\n", rx_frame.status, rx_frame.next,
rx_frame.status, rx_frame.next, rx_frame.count);
rx_frame.count);
dev->stats.rx_errors++; dev->stats.rx_errors++;
/* NB: The NIC counts CRC, frame and missed errors. */ /* NB: The NIC counts CRC, frame and missed errors. */
if (pkt_stat & ENRSR_FO) if (pkt_stat & ENRSR_FO)
...@@ -1461,6 +1456,7 @@ static void ei_rx_overrun(struct net_device *dev) ...@@ -1461,6 +1456,7 @@ static void ei_rx_overrun(struct net_device *dev)
axnet_dev_t *info = PRIV(dev); axnet_dev_t *info = PRIV(dev);
long e8390_base = dev->base_addr; long e8390_base = dev->base_addr;
unsigned char was_txing, must_resend = 0; unsigned char was_txing, must_resend = 0;
struct ei_device *ei_local = netdev_priv(dev);
/* /*
* Record whether a Tx was in progress and then issue the * Record whether a Tx was in progress and then issue the
...@@ -1468,9 +1464,8 @@ static void ei_rx_overrun(struct net_device *dev) ...@@ -1468,9 +1464,8 @@ static void ei_rx_overrun(struct net_device *dev)
*/ */
was_txing = inb_p(e8390_base+E8390_CMD) & E8390_TRANS; was_txing = inb_p(e8390_base+E8390_CMD) & E8390_TRANS;
outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
if (ei_debug > 1) netif_dbg(ei_local, rx_err, dev, "Receiver overrun\n");
netdev_printk(KERN_DEBUG, dev, "Receiver overrun\n");
dev->stats.rx_over_errors++; dev->stats.rx_over_errors++;
/* /*
......
...@@ -56,9 +56,6 @@ ...@@ -56,9 +56,6 @@
#define ei_inb_p(_p) readb((void __iomem *)_p) #define ei_inb_p(_p) readb((void __iomem *)_p)
#define ei_outb_p(_v,_p) writeb(_v,(void __iomem *)_p) #define ei_outb_p(_v,_p) writeb(_v,(void __iomem *)_p)
#define NET_DEBUG 0
#define DEBUG_INIT 2
#define DRV_NAME "etherh" #define DRV_NAME "etherh"
#define DRV_VERSION "1.11" #define DRV_VERSION "1.11"
...@@ -67,7 +64,7 @@ static char version[] __initdata = ...@@ -67,7 +64,7 @@ static char version[] __initdata =
#include "lib8390.c" #include "lib8390.c"
static unsigned int net_debug = NET_DEBUG; static u32 etherh_msg_enable;
struct etherh_priv { struct etherh_priv {
void __iomem *ioc_fast; void __iomem *ioc_fast;
...@@ -317,9 +314,9 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf ...@@ -317,9 +314,9 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
void __iomem *dma_base, *addr; void __iomem *dma_base, *addr;
if (ei_local->dmaing) { if (ei_local->dmaing) {
printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: " netdev_err(dev, "DMAing conflict in etherh_block_input: "
" DMAstat %d irqlock %d\n", dev->name, " DMAstat %d irqlock %d\n",
ei_local->dmaing, ei_local->irqlock); ei_local->dmaing, ei_local->irqlock);
return; return;
} }
...@@ -361,8 +358,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf ...@@ -361,8 +358,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0) while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0)
if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
printk(KERN_ERR "%s: timeout waiting for TX RDC\n", netdev_warn(dev, "timeout waiting for TX RDC\n");
dev->name);
etherh_reset (dev); etherh_reset (dev);
__NS8390_init (dev, 1); __NS8390_init (dev, 1);
break; break;
...@@ -383,9 +379,9 @@ etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int ...@@ -383,9 +379,9 @@ etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int
void __iomem *dma_base, *addr; void __iomem *dma_base, *addr;
if (ei_local->dmaing) { if (ei_local->dmaing) {
printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: " netdev_err(dev, "DMAing conflict in etherh_block_input: "
" DMAstat %d irqlock %d\n", dev->name, " DMAstat %d irqlock %d\n",
ei_local->dmaing, ei_local->irqlock); ei_local->dmaing, ei_local->irqlock);
return; return;
} }
...@@ -423,9 +419,9 @@ etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_p ...@@ -423,9 +419,9 @@ etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_p
void __iomem *dma_base, *addr; void __iomem *dma_base, *addr;
if (ei_local->dmaing) { if (ei_local->dmaing) {
printk(KERN_ERR "%s: DMAing conflict in etherh_get_header: " netdev_err(dev, "DMAing conflict in etherh_get_header: "
" DMAstat %d irqlock %d\n", dev->name, " DMAstat %d irqlock %d\n",
ei_local->dmaing, ei_local->irqlock); ei_local->dmaing, ei_local->irqlock);
return; return;
} }
...@@ -513,8 +509,8 @@ static void __init etherh_banner(void) ...@@ -513,8 +509,8 @@ static void __init etherh_banner(void)
{ {
static int version_printed; static int version_printed;
if (net_debug && version_printed++ == 0) if ((etherh_msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
printk(KERN_INFO "%s", version); pr_info("%s", version);
} }
/* /*
...@@ -625,11 +621,27 @@ static int etherh_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -625,11 +621,27 @@ static int etherh_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return 0; return 0;
} }
static u32 etherh_get_msglevel(struct net_device *dev)
{
struct ei_device *ei_local = netdev_priv(dev);
return ei_local->msg_enable;
}
static void etherh_set_msglevel(struct net_device *dev, u32 v)
{
struct ei_device *ei_local = netdev_priv(dev);
ei_local->msg_enable = v;
}
static const struct ethtool_ops etherh_ethtool_ops = { static const struct ethtool_ops etherh_ethtool_ops = {
.get_settings = etherh_get_settings, .get_settings = etherh_get_settings,
.set_settings = etherh_set_settings, .set_settings = etherh_set_settings,
.get_drvinfo = etherh_get_drvinfo, .get_drvinfo = etherh_get_drvinfo,
.get_ts_info = ethtool_op_get_ts_info, .get_ts_info = ethtool_op_get_ts_info,
.get_msglevel = etherh_get_msglevel,
.set_msglevel = etherh_set_msglevel,
}; };
static const struct net_device_ops etherh_netdev_ops = { static const struct net_device_ops etherh_netdev_ops = {
...@@ -746,6 +758,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -746,6 +758,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
ei_local->block_output = etherh_block_output; ei_local->block_output = etherh_block_output;
ei_local->get_8390_hdr = etherh_get_header; ei_local->get_8390_hdr = etherh_get_header;
ei_local->interface_num = 0; ei_local->interface_num = 0;
ei_local->msg_enable = etherh_msg_enable;
etherh_reset(dev); etherh_reset(dev);
__NS8390_init(dev, 0); __NS8390_init(dev, 0);
...@@ -754,8 +767,8 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -754,8 +767,8 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
if (ret) if (ret)
goto free; goto free;
printk(KERN_INFO "%s: %s in slot %d, %pM\n", netdev_info(dev, "%s in slot %d, %pM\n",
dev->name, data->name, ec->slot_no, dev->dev_addr); data->name, ec->slot_no, dev->dev_addr);
ecard_set_drvdata(ec, dev); ecard_set_drvdata(ec, dev);
......
...@@ -66,6 +66,7 @@ static void hydra_block_input(struct net_device *dev, int count, ...@@ -66,6 +66,7 @@ static void hydra_block_input(struct net_device *dev, int count,
static void hydra_block_output(struct net_device *dev, int count, static void hydra_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page); const unsigned char *buf, int start_page);
static void hydra_remove_one(struct zorro_dev *z); static void hydra_remove_one(struct zorro_dev *z);
static u32 hydra_msg_enable;
static struct zorro_device_id hydra_zorro_tbl[] = { static struct zorro_device_id hydra_zorro_tbl[] = {
{ ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET }, { ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET },
...@@ -119,6 +120,7 @@ static int hydra_init(struct zorro_dev *z) ...@@ -119,6 +120,7 @@ static int hydra_init(struct zorro_dev *z)
int start_page, stop_page; int start_page, stop_page;
int j; int j;
int err; int err;
struct ei_device *ei_local;
static u32 hydra_offsets[16] = { static u32 hydra_offsets[16] = {
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
...@@ -137,6 +139,8 @@ static int hydra_init(struct zorro_dev *z) ...@@ -137,6 +139,8 @@ static int hydra_init(struct zorro_dev *z)
start_page = NESM_START_PG; start_page = NESM_START_PG;
stop_page = NESM_STOP_PG; stop_page = NESM_STOP_PG;
ei_local = netdev_priv(dev);
ei_local->msg_enable = hydra_msg_enable;
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
dev->irq = IRQ_AMIGA_PORTS; dev->irq = IRQ_AMIGA_PORTS;
...@@ -187,15 +191,16 @@ static int hydra_open(struct net_device *dev) ...@@ -187,15 +191,16 @@ static int hydra_open(struct net_device *dev)
static int hydra_close(struct net_device *dev) static int hydra_close(struct net_device *dev)
{ {
if (ei_debug > 1) struct ei_device *ei_local = netdev_priv(dev);
printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name);
netif_dbg(ei_local, ifdown, dev, "Shutting down ethercard.\n");
__ei_close(dev); __ei_close(dev);
return 0; return 0;
} }
static void hydra_reset_8390(struct net_device *dev) static void hydra_reset_8390(struct net_device *dev)
{ {
printk(KERN_INFO "Hydra hw reset not there\n"); netdev_info(dev, "Hydra hw reset not there\n");
} }
static void hydra_get_8390_hdr(struct net_device *dev, static void hydra_get_8390_hdr(struct net_device *dev,
......
...@@ -99,11 +99,6 @@ ...@@ -99,11 +99,6 @@
#define ei_block_input (ei_local->block_input) #define ei_block_input (ei_local->block_input)
#define ei_get_8390_hdr (ei_local->get_8390_hdr) #define ei_get_8390_hdr (ei_local->get_8390_hdr)
/* use 0 for production, 1 for verification, >2 for debug */
#ifndef ei_debug
int ei_debug = 1;
#endif
/* Index to functions. */ /* Index to functions. */
static void ei_tx_intr(struct net_device *dev); static void ei_tx_intr(struct net_device *dev);
static void ei_tx_err(struct net_device *dev); static void ei_tx_err(struct net_device *dev);
...@@ -116,6 +111,11 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length, ...@@ -116,6 +111,11 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
static void do_set_multicast_list(struct net_device *dev); static void do_set_multicast_list(struct net_device *dev);
static void __NS8390_init(struct net_device *dev, int startp); static void __NS8390_init(struct net_device *dev, int startp);
static unsigned version_printed;
static u32 msg_enable;
module_param(msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
/* /*
* SMP and the 8390 setup. * SMP and the 8390 setup.
* *
...@@ -345,19 +345,23 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb, ...@@ -345,19 +345,23 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
if (ei_local->tx1 == 0) { if (ei_local->tx1 == 0) {
output_page = ei_local->tx_start_page; output_page = ei_local->tx_start_page;
ei_local->tx1 = send_length; ei_local->tx1 = send_length;
if (ei_debug && ei_local->tx2 > 0) if ((netif_msg_tx_queued(ei_local)) &&
netdev_dbg(dev, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n", ei_local->tx2 > 0)
netdev_dbg(dev,
"idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
ei_local->tx2, ei_local->lasttx, ei_local->txing); ei_local->tx2, ei_local->lasttx, ei_local->txing);
} else if (ei_local->tx2 == 0) { } else if (ei_local->tx2 == 0) {
output_page = ei_local->tx_start_page + TX_PAGES/2; output_page = ei_local->tx_start_page + TX_PAGES/2;
ei_local->tx2 = send_length; ei_local->tx2 = send_length;
if (ei_debug && ei_local->tx1 > 0) if ((netif_msg_tx_queued(ei_local)) &&
netdev_dbg(dev, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n", ei_local->tx1 > 0)
netdev_dbg(dev,
"idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
ei_local->tx1, ei_local->lasttx, ei_local->txing); ei_local->tx1, ei_local->lasttx, ei_local->txing);
} else { /* We should never get here. */ } else { /* We should never get here. */
if (ei_debug) netif_dbg(ei_local, tx_err, dev,
netdev_dbg(dev, "No Tx buffers free! tx1=%d tx2=%d last=%d\n", "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
ei_local->tx1, ei_local->tx2, ei_local->lasttx); ei_local->tx1, ei_local->tx2, ei_local->lasttx);
ei_local->irqlock = 0; ei_local->irqlock = 0;
netif_stop_queue(dev); netif_stop_queue(dev);
ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR); ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR);
...@@ -388,7 +392,7 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb, ...@@ -388,7 +392,7 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
} else } else
ei_local->txqueue++; ei_local->txqueue++;
if (ei_local->tx1 && ei_local->tx2) if (ei_local->tx1 && ei_local->tx2)
netif_stop_queue(dev); netif_stop_queue(dev);
else else
netif_start_queue(dev); netif_start_queue(dev);
...@@ -445,9 +449,8 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id) ...@@ -445,9 +449,8 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
/* Change to page 0 and read the intr status reg. */ /* Change to page 0 and read the intr status reg. */
ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD); ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
if (ei_debug > 3) netif_dbg(ei_local, intr, dev, "interrupt(isr=%#2.2x)\n",
netdev_dbg(dev, "interrupt(isr=%#2.2x)\n", ei_inb_p(e8390_base + EN0_ISR));
ei_inb_p(e8390_base + EN0_ISR));
/* !!Assumption!! -- we stay in page 0. Don't break this. */ /* !!Assumption!! -- we stay in page 0. Don't break this. */
while ((interrupts = ei_inb_p(e8390_base + EN0_ISR)) != 0 && while ((interrupts = ei_inb_p(e8390_base + EN0_ISR)) != 0 &&
...@@ -485,7 +488,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id) ...@@ -485,7 +488,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD); ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
} }
if (interrupts && ei_debug) { if (interrupts && (netif_msg_intr(ei_local))) {
ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD); ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
if (nr_serviced >= MAX_SERVICE) { if (nr_serviced >= MAX_SERVICE) {
/* 0xFF is valid for a card removal */ /* 0xFF is valid for a card removal */
...@@ -676,10 +679,11 @@ static void ei_receive(struct net_device *dev) ...@@ -676,10 +679,11 @@ static void ei_receive(struct net_device *dev)
Keep quiet if it looks like a card removal. One problem here Keep quiet if it looks like a card removal. One problem here
is that some clones crash in roughly the same way. is that some clones crash in roughly the same way.
*/ */
if (ei_debug > 0 && if ((netif_msg_rx_status(ei_local)) &&
this_frame != ei_local->current_page && this_frame != ei_local->current_page &&
(this_frame != 0x0 || rxing_page != 0xFF)) (this_frame != 0x0 || rxing_page != 0xFF))
netdev_err(dev, "mismatched read page pointers %2x vs %2x\n", netdev_err(dev,
"mismatched read page pointers %2x vs %2x\n",
this_frame, ei_local->current_page); this_frame, ei_local->current_page);
if (this_frame == rxing_page) /* Read all the frames? */ if (this_frame == rxing_page) /* Read all the frames? */
...@@ -707,10 +711,10 @@ static void ei_receive(struct net_device *dev) ...@@ -707,10 +711,10 @@ static void ei_receive(struct net_device *dev)
} }
if (pkt_len < 60 || pkt_len > 1518) { if (pkt_len < 60 || pkt_len > 1518) {
if (ei_debug) netif_dbg(ei_local, rx_status, dev,
netdev_dbg(dev, "bogus packet size: %d, status=%#2x nxpg=%#2x\n", "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
rx_frame.count, rx_frame.status, rx_frame.count, rx_frame.status,
rx_frame.next); rx_frame.next);
dev->stats.rx_errors++; dev->stats.rx_errors++;
dev->stats.rx_length_errors++; dev->stats.rx_length_errors++;
} else if ((pkt_stat & 0x0F) == ENRSR_RXOK) { } else if ((pkt_stat & 0x0F) == ENRSR_RXOK) {
...@@ -718,9 +722,9 @@ static void ei_receive(struct net_device *dev) ...@@ -718,9 +722,9 @@ static void ei_receive(struct net_device *dev)
skb = netdev_alloc_skb(dev, pkt_len + 2); skb = netdev_alloc_skb(dev, pkt_len + 2);
if (skb == NULL) { if (skb == NULL) {
if (ei_debug > 1) netif_err(ei_local, rx_err, dev,
netdev_dbg(dev, "Couldn't allocate a sk_buff of size %d\n", "Couldn't allocate a sk_buff of size %d\n",
pkt_len); pkt_len);
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
break; break;
} else { } else {
...@@ -736,10 +740,10 @@ static void ei_receive(struct net_device *dev) ...@@ -736,10 +740,10 @@ static void ei_receive(struct net_device *dev)
dev->stats.multicast++; dev->stats.multicast++;
} }
} else { } else {
if (ei_debug) netif_err(ei_local, rx_err, dev,
netdev_dbg(dev, "bogus packet: status=%#2x nxpg=%#2x size=%d\n", "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
rx_frame.status, rx_frame.next, rx_frame.status, rx_frame.next,
rx_frame.count); rx_frame.count);
dev->stats.rx_errors++; dev->stats.rx_errors++;
/* NB: The NIC counts CRC, frame and missed errors. */ /* NB: The NIC counts CRC, frame and missed errors. */
if (pkt_stat & ENRSR_FO) if (pkt_stat & ENRSR_FO)
...@@ -789,8 +793,7 @@ static void ei_rx_overrun(struct net_device *dev) ...@@ -789,8 +793,7 @@ static void ei_rx_overrun(struct net_device *dev)
was_txing = ei_inb_p(e8390_base+E8390_CMD) & E8390_TRANS; was_txing = ei_inb_p(e8390_base+E8390_CMD) & E8390_TRANS;
ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
if (ei_debug > 1) netif_dbg(ei_local, rx_err, dev, "Receiver overrun\n");
netdev_dbg(dev, "Receiver overrun\n");
dev->stats.rx_over_errors++; dev->stats.rx_over_errors++;
/* /*
...@@ -965,8 +968,9 @@ static void __ei_set_multicast_list(struct net_device *dev) ...@@ -965,8 +968,9 @@ static void __ei_set_multicast_list(struct net_device *dev)
static void ethdev_setup(struct net_device *dev) static void ethdev_setup(struct net_device *dev)
{ {
struct ei_device *ei_local = netdev_priv(dev); struct ei_device *ei_local = netdev_priv(dev);
if (ei_debug > 1)
printk(version); if ((msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
pr_info("%s", version);
ether_setup(dev); ether_setup(dev);
...@@ -1035,9 +1039,10 @@ static void __NS8390_init(struct net_device *dev, int startp) ...@@ -1035,9 +1039,10 @@ static void __NS8390_init(struct net_device *dev, int startp)
ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */ ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i)); ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
if (ei_debug > 1 && if ((netif_msg_probe(ei_local)) &&
ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i)) != dev->dev_addr[i]) ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i)) != dev->dev_addr[i])
netdev_err(dev, "Hw. address read/write mismap %d\n", i); netdev_err(dev,
"Hw. address read/write mismap %d\n", i);
} }
ei_outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG); ei_outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);
......
...@@ -167,6 +167,7 @@ static void slow_sane_block_output(struct net_device *dev, int count, ...@@ -167,6 +167,7 @@ static void slow_sane_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page); const unsigned char *buf, int start_page);
static void word_memcpy_tocard(unsigned long tp, const void *fp, int count); static void word_memcpy_tocard(unsigned long tp, const void *fp, int count);
static void word_memcpy_fromcard(void *tp, unsigned long fp, int count); static void word_memcpy_fromcard(void *tp, unsigned long fp, int count);
static u32 mac8390_msg_enable;
static enum mac8390_type __init mac8390_ident(struct nubus_dev *dev) static enum mac8390_type __init mac8390_ident(struct nubus_dev *dev)
{ {
...@@ -402,6 +403,7 @@ struct net_device * __init mac8390_probe(int unit) ...@@ -402,6 +403,7 @@ struct net_device * __init mac8390_probe(int unit)
struct net_device *dev; struct net_device *dev;
struct nubus_dev *ndev = NULL; struct nubus_dev *ndev = NULL;
int err = -ENODEV; int err = -ENODEV;
struct ei_device *ei_local;
static unsigned int slots; static unsigned int slots;
...@@ -440,6 +442,10 @@ struct net_device * __init mac8390_probe(int unit) ...@@ -440,6 +442,10 @@ struct net_device * __init mac8390_probe(int unit)
if (!ndev) if (!ndev)
goto out; goto out;
ei_local = netdev_priv(dev);
ei_local->msg_enable = mac8390_msg_enable;
err = register_netdev(dev); err = register_netdev(dev);
if (err) if (err)
goto out; goto out;
...@@ -660,19 +666,22 @@ static int mac8390_close(struct net_device *dev) ...@@ -660,19 +666,22 @@ static int mac8390_close(struct net_device *dev)
static void mac8390_no_reset(struct net_device *dev) static void mac8390_no_reset(struct net_device *dev)
{ {
struct ei_device *ei_local = netdev_priv(dev);
ei_status.txing = 0; ei_status.txing = 0;
if (ei_debug > 1) netif_info(ei_local, hw, dev, "reset not supported\n");
pr_info("reset not supported\n");
} }
static void interlan_reset(struct net_device *dev) static void interlan_reset(struct net_device *dev)
{ {
unsigned char *target = nubus_slot_addr(IRQ2SLOT(dev->irq)); unsigned char *target = nubus_slot_addr(IRQ2SLOT(dev->irq));
if (ei_debug > 1) struct ei_device *ei_local = netdev_priv(dev);
pr_info("Need to reset the NS8390 t=%lu...", jiffies);
netif_info(ei_local, hw, dev, "Need to reset the NS8390 t=%lu...",
jiffies);
ei_status.txing = 0; ei_status.txing = 0;
target[0xC0000] = 0; target[0xC0000] = 0;
if (ei_debug > 1) if (netif_msg_hw(ei_local))
pr_cont("reset complete\n"); pr_cont("reset complete\n");
} }
......
...@@ -39,6 +39,7 @@ static const char version[] = ...@@ -39,6 +39,7 @@ static const char version[] =
#define NESM_START_PG 0x40 /* First page of TX buffer */ #define NESM_START_PG 0x40 /* First page of TX buffer */
#define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */ #define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */
static u32 mcf8390_msg_enable;
#ifdef NE2000_ODDOFFSET #ifdef NE2000_ODDOFFSET
/* /*
...@@ -153,9 +154,9 @@ static void mcf8390_reset_8390(struct net_device *dev) ...@@ -153,9 +154,9 @@ static void mcf8390_reset_8390(struct net_device *dev)
{ {
unsigned long reset_start_time = jiffies; unsigned long reset_start_time = jiffies;
u32 addr = dev->base_addr; u32 addr = dev->base_addr;
struct ei_device *ei_local = netdev_priv(dev);
if (ei_debug > 1) netif_dbg(ei_local, hw, dev, "resetting the 8390 t=%ld...\n", jiffies);
netdev_dbg(dev, "resetting the 8390 t=%ld...\n", jiffies);
ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET); ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET);
...@@ -288,7 +289,7 @@ static void mcf8390_block_output(struct net_device *dev, int count, ...@@ -288,7 +289,7 @@ static void mcf8390_block_output(struct net_device *dev, int count,
dma_start = jiffies; dma_start = jiffies;
while ((ei_inb(addr + NE_EN0_ISR) & ENISR_RDC) == 0) { while ((ei_inb(addr + NE_EN0_ISR) & ENISR_RDC) == 0) {
if (time_after(jiffies, dma_start + 2 * HZ / 100)) { /* 20ms */ if (time_after(jiffies, dma_start + 2 * HZ / 100)) { /* 20ms */
netdev_err(dev, "timeout waiting for Tx RDC\n"); netdev_warn(dev, "timeout waiting for Tx RDC\n");
mcf8390_reset_8390(dev); mcf8390_reset_8390(dev);
__NS8390_init(dev, 1); __NS8390_init(dev, 1);
break; break;
...@@ -437,6 +438,7 @@ static int mcf8390_probe(struct platform_device *pdev) ...@@ -437,6 +438,7 @@ static int mcf8390_probe(struct platform_device *pdev)
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
platform_set_drvdata(pdev, dev); platform_set_drvdata(pdev, dev);
ei_local = netdev_priv(dev); ei_local = netdev_priv(dev);
ei_local->msg_enable = mcf8390_msg_enable;
dev->irq = irq->start; dev->irq = irq->start;
dev->base_addr = mem->start; dev->base_addr = mem->start;
......
This diff is collapsed.
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
/* The user-configurable values. /* The user-configurable values.
These may be modified when a driver module is loaded.*/ These may be modified when a driver module is loaded.*/
static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
#define MAX_UNITS 8 /* More are supported, limit only on options */ #define MAX_UNITS 8 /* More are supported, limit only on options */
/* Used to pass the full-duplex flag, etc. */ /* Used to pass the full-duplex flag, etc. */
static int full_duplex[MAX_UNITS]; static int full_duplex[MAX_UNITS];
...@@ -60,6 +58,8 @@ static int options[MAX_UNITS]; ...@@ -60,6 +58,8 @@ static int options[MAX_UNITS];
#include "8390.h" #include "8390.h"
static u32 ne2k_msg_enable;
/* These identify the driver base version and may not be removed. */ /* These identify the driver base version and may not be removed. */
static const char version[] = static const char version[] =
KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE
...@@ -76,10 +76,10 @@ MODULE_AUTHOR("Donald Becker / Paul Gortmaker"); ...@@ -76,10 +76,10 @@ MODULE_AUTHOR("Donald Becker / Paul Gortmaker");
MODULE_DESCRIPTION("PCI NE2000 clone driver"); MODULE_DESCRIPTION("PCI NE2000 clone driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(debug, int, 0); module_param_named(msg_enable, ne2k_msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
module_param_array(options, int, NULL, 0); module_param_array(options, int, NULL, 0);
module_param_array(full_duplex, int, NULL, 0); module_param_array(full_duplex, int, NULL, 0);
MODULE_PARM_DESC(debug, "debug level (1-2)"); MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
MODULE_PARM_DESC(options, "Bit 5: full duplex"); MODULE_PARM_DESC(options, "Bit 5: full duplex");
MODULE_PARM_DESC(full_duplex, "full duplex setting(s) (1)"); MODULE_PARM_DESC(full_duplex, "full duplex setting(s) (1)");
...@@ -226,6 +226,7 @@ static int ne2k_pci_init_one(struct pci_dev *pdev, ...@@ -226,6 +226,7 @@ static int ne2k_pci_init_one(struct pci_dev *pdev,
static unsigned int fnd_cnt; static unsigned int fnd_cnt;
long ioaddr; long ioaddr;
int flags = pci_clone_list[chip_idx].flags; int flags = pci_clone_list[chip_idx].flags;
struct ei_device *ei_local;
/* when built into the kernel, we only print version if device is found */ /* when built into the kernel, we only print version if device is found */
#ifndef MODULE #ifndef MODULE
...@@ -280,6 +281,8 @@ static int ne2k_pci_init_one(struct pci_dev *pdev, ...@@ -280,6 +281,8 @@ static int ne2k_pci_init_one(struct pci_dev *pdev,
goto err_out_free_res; goto err_out_free_res;
} }
dev->netdev_ops = &ne2k_netdev_ops; dev->netdev_ops = &ne2k_netdev_ops;
ei_local = netdev_priv(dev);
ei_local->msg_enable = ne2k_msg_enable;
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
...@@ -379,9 +382,9 @@ static int ne2k_pci_init_one(struct pci_dev *pdev, ...@@ -379,9 +382,9 @@ static int ne2k_pci_init_one(struct pci_dev *pdev,
if (i) if (i)
goto err_out_free_netdev; goto err_out_free_netdev;
printk("%s: %s found at %#lx, IRQ %d, %pM.\n", netdev_info(dev, "%s found at %#lx, IRQ %d, %pM.\n",
dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq, pci_clone_list[chip_idx].name, ioaddr, dev->irq,
dev->dev_addr); dev->dev_addr);
return 0; return 0;
...@@ -450,9 +453,10 @@ static int ne2k_pci_close(struct net_device *dev) ...@@ -450,9 +453,10 @@ static int ne2k_pci_close(struct net_device *dev)
static void ne2k_pci_reset_8390(struct net_device *dev) static void ne2k_pci_reset_8390(struct net_device *dev)
{ {
unsigned long reset_start_time = jiffies; unsigned long reset_start_time = jiffies;
struct ei_device *ei_local = netdev_priv(dev);
if (debug > 1) printk("%s: Resetting the 8390 t=%ld...", netif_dbg(ei_local, hw, dev, "resetting the 8390 t=%ld...\n",
dev->name, jiffies); jiffies);
outb(inb(NE_BASE + NE_RESET), NE_BASE + NE_RESET); outb(inb(NE_BASE + NE_RESET), NE_BASE + NE_RESET);
...@@ -462,7 +466,7 @@ static void ne2k_pci_reset_8390(struct net_device *dev) ...@@ -462,7 +466,7 @@ static void ne2k_pci_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((inb(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) while ((inb(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
if (jiffies - reset_start_time > 2) { if (jiffies - reset_start_time > 2) {
printk("%s: ne2k_pci_reset_8390() did not complete.\n", dev->name); netdev_err(dev, "ne2k_pci_reset_8390() did not complete.\n");
break; break;
} }
outb(ENISR_RESET, NE_BASE + EN0_ISR); /* Ack intr. */ outb(ENISR_RESET, NE_BASE + EN0_ISR); /* Ack intr. */
...@@ -479,9 +483,9 @@ static void ne2k_pci_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr * ...@@ -479,9 +483,9 @@ static void ne2k_pci_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *
/* This *shouldn't* happen. If it does, it's the last thing you'll see */ /* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) { if (ei_status.dmaing) {
printk("%s: DMAing conflict in ne2k_pci_get_8390_hdr " netdev_err(dev, "DMAing conflict in ne2k_pci_get_8390_hdr "
"[DMAstat:%d][irqlock:%d].\n", "[DMAstat:%d][irqlock:%d].\n",
dev->name, ei_status.dmaing, ei_status.irqlock); ei_status.dmaing, ei_status.irqlock);
return; return;
} }
...@@ -517,9 +521,9 @@ static void ne2k_pci_block_input(struct net_device *dev, int count, ...@@ -517,9 +521,9 @@ static void ne2k_pci_block_input(struct net_device *dev, int count,
/* This *shouldn't* happen. If it does, it's the last thing you'll see */ /* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) { if (ei_status.dmaing) {
printk("%s: DMAing conflict in ne2k_pci_block_input " netdev_err(dev, "DMAing conflict in ne2k_pci_block_input "
"[DMAstat:%d][irqlock:%d].\n", "[DMAstat:%d][irqlock:%d].\n",
dev->name, ei_status.dmaing, ei_status.irqlock); ei_status.dmaing, ei_status.irqlock);
return; return;
} }
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
...@@ -572,9 +576,9 @@ static void ne2k_pci_block_output(struct net_device *dev, int count, ...@@ -572,9 +576,9 @@ static void ne2k_pci_block_output(struct net_device *dev, int count,
/* This *shouldn't* happen. If it does, it's the last thing you'll see */ /* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) { if (ei_status.dmaing) {
printk("%s: DMAing conflict in ne2k_pci_block_output." netdev_err(dev, "DMAing conflict in ne2k_pci_block_output."
"[DMAstat:%d][irqlock:%d]\n", "[DMAstat:%d][irqlock:%d]\n",
dev->name, ei_status.dmaing, ei_status.irqlock); ei_status.dmaing, ei_status.irqlock);
return; return;
} }
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
...@@ -619,7 +623,7 @@ static void ne2k_pci_block_output(struct net_device *dev, int count, ...@@ -619,7 +623,7 @@ static void ne2k_pci_block_output(struct net_device *dev, int count,
while ((inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) while ((inb(nic_base + EN0_ISR) & ENISR_RDC) == 0)
if (jiffies - dma_start > 2) { /* Avoid clock roll-over. */ if (jiffies - dma_start > 2) { /* Avoid clock roll-over. */
printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); netdev_warn(dev, "timeout waiting for Tx RDC.\n");
ne2k_pci_reset_8390(dev); ne2k_pci_reset_8390(dev);
NS8390_init(dev,1); NS8390_init(dev,1);
break; break;
...@@ -640,8 +644,24 @@ static void ne2k_pci_get_drvinfo(struct net_device *dev, ...@@ -640,8 +644,24 @@ static void ne2k_pci_get_drvinfo(struct net_device *dev,
strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info)); strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info));
} }
static u32 ne2k_pci_get_msglevel(struct net_device *dev)
{
struct ei_device *ei_local = netdev_priv(dev);
return ei_local->msg_enable;
}
static void ne2k_pci_set_msglevel(struct net_device *dev, u32 v)
{
struct ei_device *ei_local = netdev_priv(dev);
ei_local->msg_enable = v;
}
static const struct ethtool_ops ne2k_pci_ethtool_ops = { static const struct ethtool_ops ne2k_pci_ethtool_ops = {
.get_drvinfo = ne2k_pci_get_drvinfo, .get_drvinfo = ne2k_pci_get_drvinfo,
.get_msglevel = ne2k_pci_get_msglevel,
.set_msglevel = ne2k_pci_set_msglevel,
}; };
static void ne2k_pci_remove_one(struct pci_dev *pdev) static void ne2k_pci_remove_one(struct pci_dev *pdev)
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#define PCNET_RDC_TIMEOUT (2*HZ/100) /* Max wait in jiffies for Tx RDC */ #define PCNET_RDC_TIMEOUT (2*HZ/100) /* Max wait in jiffies for Tx RDC */
static const char *if_names[] = { "auto", "10baseT", "10base2"}; static const char *if_names[] = { "auto", "10baseT", "10base2"};
static u32 pcnet_msg_enable;
/*====================================================================*/ /*====================================================================*/
...@@ -558,6 +558,7 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -558,6 +558,7 @@ static int pcnet_config(struct pcmcia_device *link)
int start_pg, stop_pg, cm_offset; int start_pg, stop_pg, cm_offset;
int has_shmem = 0; int has_shmem = 0;
hw_info_t *local_hw_info; hw_info_t *local_hw_info;
struct ei_device *ei_local;
dev_dbg(&link->dev, "pcnet_config\n"); dev_dbg(&link->dev, "pcnet_config\n");
...@@ -607,6 +608,8 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -607,6 +608,8 @@ static int pcnet_config(struct pcmcia_device *link)
mii_phy_probe(dev); mii_phy_probe(dev);
SET_NETDEV_DEV(dev, &link->dev); SET_NETDEV_DEV(dev, &link->dev);
ei_local = netdev_priv(dev);
ei_local->msg_enable = pcnet_msg_enable;
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
pr_notice("register_netdev() failed\n"); pr_notice("register_netdev() failed\n");
...@@ -616,7 +619,7 @@ static int pcnet_config(struct pcmcia_device *link) ...@@ -616,7 +619,7 @@ static int pcnet_config(struct pcmcia_device *link)
if (info->flags & (IS_DL10019|IS_DL10022)) { if (info->flags & (IS_DL10019|IS_DL10022)) {
u_char id = inb(dev->base_addr + 0x1a); u_char id = inb(dev->base_addr + 0x1a);
netdev_info(dev, "NE2000 (DL100%d rev %02x): ", netdev_info(dev, "NE2000 (DL100%d rev %02x): ",
(info->flags & IS_DL10022) ? 22 : 19, id); (info->flags & IS_DL10022) ? 22 : 19, id);
if (info->pna_phy) if (info->pna_phy)
pr_cont("PNA, "); pr_cont("PNA, ");
} else { } else {
...@@ -1063,9 +1066,9 @@ static void ei_watchdog(u_long arg) ...@@ -1063,9 +1066,9 @@ static void ei_watchdog(u_long arg)
if (info->phy_id == info->eth_phy) { if (info->phy_id == info->eth_phy) {
if (p) if (p)
netdev_info(dev, "autonegotiation complete: " netdev_info(dev, "autonegotiation complete: "
"%sbaseT-%cD selected\n", "%sbaseT-%cD selected\n",
((p & 0x0180) ? "100" : "10"), ((p & 0x0180) ? "100" : "10"),
((p & 0x0140) ? 'F' : 'H')); ((p & 0x0140) ? 'F' : 'H'));
else else
netdev_info(dev, "link partner did not autonegotiate\n"); netdev_info(dev, "link partner did not autonegotiate\n");
} }
...@@ -1081,7 +1084,7 @@ static void ei_watchdog(u_long arg) ...@@ -1081,7 +1084,7 @@ static void ei_watchdog(u_long arg)
mdio_write(mii_addr, info->phy_id, 0, 0x0400); mdio_write(mii_addr, info->phy_id, 0, 0x0400);
info->phy_id ^= info->pna_phy ^ info->eth_phy; info->phy_id ^= info->pna_phy ^ info->eth_phy;
netdev_info(dev, "switched to %s transceiver\n", netdev_info(dev, "switched to %s transceiver\n",
(info->phy_id == info->eth_phy) ? "ethernet" : "PNA"); (info->phy_id == info->eth_phy) ? "ethernet" : "PNA");
mdio_write(mii_addr, info->phy_id, 0, mdio_write(mii_addr, info->phy_id, 0,
(info->phy_id == info->eth_phy) ? 0x1000 : 0); (info->phy_id == info->eth_phy) ? 0x1000 : 0);
info->link_status = 0; info->link_status = 0;
...@@ -1128,9 +1131,9 @@ static void dma_get_8390_hdr(struct net_device *dev, ...@@ -1128,9 +1131,9 @@ static void dma_get_8390_hdr(struct net_device *dev,
unsigned int nic_base = dev->base_addr; unsigned int nic_base = dev->base_addr;
if (ei_status.dmaing) { if (ei_status.dmaing) {
netdev_notice(dev, "DMAing conflict in dma_block_input." netdev_err(dev, "DMAing conflict in dma_block_input."
"[DMAstat:%1x][irqlock:%1x]\n", "[DMAstat:%1x][irqlock:%1x]\n",
ei_status.dmaing, ei_status.irqlock); ei_status.dmaing, ei_status.irqlock);
return; return;
} }
...@@ -1159,13 +1162,14 @@ static void dma_block_input(struct net_device *dev, int count, ...@@ -1159,13 +1162,14 @@ static void dma_block_input(struct net_device *dev, int count,
unsigned int nic_base = dev->base_addr; unsigned int nic_base = dev->base_addr;
int xfer_count = count; int xfer_count = count;
char *buf = skb->data; char *buf = skb->data;
struct ei_device *ei_local = netdev_priv(dev);
if ((ei_debug > 4) && (count != 4)) if ((netif_msg_rx_status(ei_local)) && (count != 4))
netdev_dbg(dev, "[bi=%d]\n", count+4); netdev_dbg(dev, "[bi=%d]\n", count+4);
if (ei_status.dmaing) { if (ei_status.dmaing) {
netdev_notice(dev, "DMAing conflict in dma_block_input." netdev_err(dev, "DMAing conflict in dma_block_input."
"[DMAstat:%1x][irqlock:%1x]\n", "[DMAstat:%1x][irqlock:%1x]\n",
ei_status.dmaing, ei_status.irqlock); ei_status.dmaing, ei_status.irqlock);
return; return;
} }
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
...@@ -1183,7 +1187,8 @@ static void dma_block_input(struct net_device *dev, int count, ...@@ -1183,7 +1187,8 @@ static void dma_block_input(struct net_device *dev, int count,
/* This was for the ALPHA version only, but enough people have been /* This was for the ALPHA version only, but enough people have been
encountering problems that it is still here. */ encountering problems that it is still here. */
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
if (ei_debug > 4) { /* DMA termination address check... */ /* DMA termination address check... */
if (netif_msg_rx_status(ei_local)) {
int addr, tries = 20; int addr, tries = 20;
do { do {
/* DON'T check for 'inb_p(EN0_ISR) & ENISR_RDC' here /* DON'T check for 'inb_p(EN0_ISR) & ENISR_RDC' here
...@@ -1196,8 +1201,8 @@ static void dma_block_input(struct net_device *dev, int count, ...@@ -1196,8 +1201,8 @@ static void dma_block_input(struct net_device *dev, int count,
} while (--tries > 0); } while (--tries > 0);
if (tries <= 0) if (tries <= 0)
netdev_notice(dev, "RX transfer address mismatch," netdev_notice(dev, "RX transfer address mismatch,"
"%#4.4x (expected) vs. %#4.4x (actual).\n", "%#4.4x (expected) vs. %#4.4x (actual).\n",
ring_offset + xfer_count, addr); ring_offset + xfer_count, addr);
} }
#endif #endif
outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
...@@ -1213,12 +1218,12 @@ static void dma_block_output(struct net_device *dev, int count, ...@@ -1213,12 +1218,12 @@ static void dma_block_output(struct net_device *dev, int count,
pcnet_dev_t *info = PRIV(dev); pcnet_dev_t *info = PRIV(dev);
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
int retries = 0; int retries = 0;
struct ei_device *ei_local = netdev_priv(dev);
#endif #endif
u_long dma_start; u_long dma_start;
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
if (ei_debug > 4) netif_dbg(ei_local, tx_queued, dev, "[bo=%d]\n", count);
netdev_dbg(dev, "[bo=%d]\n", count);
#endif #endif
/* Round the count up for word writes. Do we need to do this? /* Round the count up for word writes. Do we need to do this?
...@@ -1227,9 +1232,9 @@ static void dma_block_output(struct net_device *dev, int count, ...@@ -1227,9 +1232,9 @@ static void dma_block_output(struct net_device *dev, int count,
if (count & 0x01) if (count & 0x01)
count++; count++;
if (ei_status.dmaing) { if (ei_status.dmaing) {
netdev_notice(dev, "DMAing conflict in dma_block_output." netdev_err(dev, "DMAing conflict in dma_block_output."
"[DMAstat:%1x][irqlock:%1x]\n", "[DMAstat:%1x][irqlock:%1x]\n",
ei_status.dmaing, ei_status.irqlock); ei_status.dmaing, ei_status.irqlock);
return; return;
} }
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
...@@ -1256,7 +1261,8 @@ static void dma_block_output(struct net_device *dev, int count, ...@@ -1256,7 +1261,8 @@ static void dma_block_output(struct net_device *dev, int count,
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
/* This was for the ALPHA version only, but enough people have been /* This was for the ALPHA version only, but enough people have been
encountering problems that it is still here. */ encountering problems that it is still here. */
if (ei_debug > 4) { /* DMA termination address check... */ /* DMA termination address check... */
if (netif_msg_tx_queued(ei_local)) {
int addr, tries = 20; int addr, tries = 20;
do { do {
int high = inb_p(nic_base + EN0_RSARHI); int high = inb_p(nic_base + EN0_RSARHI);
...@@ -1267,8 +1273,8 @@ static void dma_block_output(struct net_device *dev, int count, ...@@ -1267,8 +1273,8 @@ static void dma_block_output(struct net_device *dev, int count,
} while (--tries > 0); } while (--tries > 0);
if (tries <= 0) { if (tries <= 0) {
netdev_notice(dev, "Tx packet transfer address mismatch," netdev_notice(dev, "Tx packet transfer address mismatch,"
"%#4.4x (expected) vs. %#4.4x (actual).\n", "%#4.4x (expected) vs. %#4.4x (actual).\n",
(start_page << 8) + count, addr); (start_page << 8) + count, addr);
if (retries++ == 0) if (retries++ == 0)
goto retry; goto retry;
} }
...@@ -1277,10 +1283,10 @@ static void dma_block_output(struct net_device *dev, int count, ...@@ -1277,10 +1283,10 @@ static void dma_block_output(struct net_device *dev, int count,
while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0)
if (time_after(jiffies, dma_start + PCNET_RDC_TIMEOUT)) { if (time_after(jiffies, dma_start + PCNET_RDC_TIMEOUT)) {
netdev_notice(dev, "timeout waiting for Tx RDC.\n"); netdev_warn(dev, "timeout waiting for Tx RDC.\n");
pcnet_reset_8390(dev); pcnet_reset_8390(dev);
NS8390_init(dev, 1); NS8390_init(dev, 1);
break; break;
} }
outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
......
...@@ -111,6 +111,7 @@ static struct isapnp_device_id ultra_device_ids[] __initdata = { ...@@ -111,6 +111,7 @@ static struct isapnp_device_id ultra_device_ids[] __initdata = {
MODULE_DEVICE_TABLE(isapnp, ultra_device_ids); MODULE_DEVICE_TABLE(isapnp, ultra_device_ids);
#endif #endif
static u32 ultra_msg_enable;
#define START_PG 0x00 /* First page of TX buffer */ #define START_PG 0x00 /* First page of TX buffer */
...@@ -211,6 +212,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) ...@@ -211,6 +212,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
unsigned char num_pages, irqreg, addr, piomode; unsigned char num_pages, irqreg, addr, piomode;
unsigned char idreg = inb(ioaddr + 7); unsigned char idreg = inb(ioaddr + 7);
unsigned char reg4 = inb(ioaddr + 4) & 0x7f; unsigned char reg4 = inb(ioaddr + 4) & 0x7f;
struct ei_device *ei_local = netdev_priv(dev);
if (!request_region(ioaddr, ULTRA_IO_EXTENT, DRV_NAME)) if (!request_region(ioaddr, ULTRA_IO_EXTENT, DRV_NAME))
return -EBUSY; return -EBUSY;
...@@ -232,16 +234,16 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) ...@@ -232,16 +234,16 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
goto out; goto out;
} }
if (ei_debug && version_printed++ == 0) if ((ultra_msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
printk(version); netdev_info(dev, version);
model_name = (idreg & 0xF0) == 0x20 ? "SMC Ultra" : "SMC EtherEZ"; model_name = (idreg & 0xF0) == 0x20 ? "SMC Ultra" : "SMC EtherEZ";
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev->dev_addr[i] = inb(ioaddr + 8 + i); dev->dev_addr[i] = inb(ioaddr + 8 + i);
printk("%s: %s at %#3x, %pM", dev->name, model_name, netdev_info(dev, "%s at %#3x, %pM", model_name,
ioaddr, dev->dev_addr); ioaddr, dev->dev_addr);
/* Switch from the station address to the alternate register set and /* Switch from the station address to the alternate register set and
read the useful registers there. */ read the useful registers there. */
...@@ -265,7 +267,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) ...@@ -265,7 +267,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
irq = irqmap[((irqreg & 0x40) >> 4) + ((irqreg & 0x0c) >> 2)]; irq = irqmap[((irqreg & 0x40) >> 4) + ((irqreg & 0x0c) >> 2)];
if (irq == 0) { if (irq == 0) {
printk(", failed to detect IRQ line.\n"); pr_cont(", failed to detect IRQ line.\n");
retval = -EAGAIN; retval = -EAGAIN;
goto out; goto out;
} }
...@@ -296,7 +298,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) ...@@ -296,7 +298,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
ei_status.mem = ioremap(dev->mem_start, (ei_status.stop_page - START_PG)*256); ei_status.mem = ioremap(dev->mem_start, (ei_status.stop_page - START_PG)*256);
if (!ei_status.mem) { if (!ei_status.mem) {
printk(", failed to ioremap.\n"); pr_cont(", failed to ioremap.\n");
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
...@@ -304,14 +306,15 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) ...@@ -304,14 +306,15 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
dev->mem_end = dev->mem_start + (ei_status.stop_page - START_PG)*256; dev->mem_end = dev->mem_start + (ei_status.stop_page - START_PG)*256;
if (piomode) { if (piomode) {
printk(",%s IRQ %d programmed-I/O mode.\n", pr_cont(", %s IRQ %d programmed-I/O mode.\n",
eeprom_irq ? "EEPROM" : "assigned ", dev->irq); eeprom_irq ? "EEPROM" : "assigned ", dev->irq);
ei_status.block_input = &ultra_pio_input; ei_status.block_input = &ultra_pio_input;
ei_status.block_output = &ultra_pio_output; ei_status.block_output = &ultra_pio_output;
ei_status.get_8390_hdr = &ultra_pio_get_hdr; ei_status.get_8390_hdr = &ultra_pio_get_hdr;
} else { } else {
printk(",%s IRQ %d memory %#lx-%#lx.\n", eeprom_irq ? "" : "assigned ", pr_cont(", %s IRQ %d memory %#lx-%#lx.\n",
dev->irq, dev->mem_start, dev->mem_end-1); eeprom_irq ? "" : "assigned ", dev->irq, dev->mem_start,
dev->mem_end-1);
ei_status.block_input = &ultra_block_input; ei_status.block_input = &ultra_block_input;
ei_status.block_output = &ultra_block_output; ei_status.block_output = &ultra_block_output;
ei_status.get_8390_hdr = &ultra_get_8390_hdr; ei_status.get_8390_hdr = &ultra_get_8390_hdr;
...@@ -320,6 +323,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) ...@@ -320,6 +323,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
dev->netdev_ops = &ultra_netdev_ops; dev->netdev_ops = &ultra_netdev_ops;
NS8390_init(dev, 0); NS8390_init(dev, 0);
ei_local->msg_enable = ultra_msg_enable;
retval = register_netdev(dev); retval = register_netdev(dev);
if (retval) if (retval)
...@@ -356,12 +360,15 @@ static int __init ultra_probe_isapnp(struct net_device *dev) ...@@ -356,12 +360,15 @@ static int __init ultra_probe_isapnp(struct net_device *dev)
/* found it */ /* found it */
dev->base_addr = pnp_port_start(idev, 0); dev->base_addr = pnp_port_start(idev, 0);
dev->irq = pnp_irq(idev, 0); dev->irq = pnp_irq(idev, 0);
printk(KERN_INFO "smc-ultra.c: ISAPnP reports %s at i/o %#lx, irq %d.\n", netdev_info(dev,
(char *) ultra_device_ids[i].driver_data, "smc-ultra.c: ISAPnP reports %s at i/o %#lx, irq %d.\n",
dev->base_addr, dev->irq); (char *) ultra_device_ids[i].driver_data,
dev->base_addr, dev->irq);
if (ultra_probe1(dev, dev->base_addr) != 0) { /* Shouldn't happen. */ if (ultra_probe1(dev, dev->base_addr) != 0) { /* Shouldn't happen. */
printk(KERN_ERR "smc-ultra.c: Probe of ISAPnP card at %#lx failed.\n", dev->base_addr); netdev_err(dev,
pnp_device_detach(idev); "smc-ultra.c: Probe of ISAPnP card at %#lx failed.\n",
dev->base_addr);
pnp_device_detach(idev);
return -ENXIO; return -ENXIO;
} }
ei_status.priv = (unsigned long)idev; ei_status.priv = (unsigned long)idev;
...@@ -412,9 +419,10 @@ static void ...@@ -412,9 +419,10 @@ static void
ultra_reset_8390(struct net_device *dev) ultra_reset_8390(struct net_device *dev)
{ {
int cmd_port = dev->base_addr - ULTRA_NIC_OFFSET; /* ASIC base addr */ int cmd_port = dev->base_addr - ULTRA_NIC_OFFSET; /* ASIC base addr */
struct ei_device *ei_local = netdev_priv(dev);
outb(ULTRA_RESET, cmd_port); outb(ULTRA_RESET, cmd_port);
if (ei_debug > 1) printk("resetting Ultra, t=%ld...", jiffies); netif_dbg(ei_local, hw, dev, "resetting Ultra, t=%ld...\n", jiffies);
ei_status.txing = 0; ei_status.txing = 0;
outb(0x00, cmd_port); /* Disable shared memory for safety. */ outb(0x00, cmd_port); /* Disable shared memory for safety. */
...@@ -424,7 +432,7 @@ ultra_reset_8390(struct net_device *dev) ...@@ -424,7 +432,7 @@ ultra_reset_8390(struct net_device *dev)
else else
outb(0x01, cmd_port + 6); /* Enable interrupts and memory. */ outb(0x01, cmd_port + 6); /* Enable interrupts and memory. */
if (ei_debug > 1) printk("reset done\n"); netif_dbg(ei_local, hw, dev, "reset done\n");
} }
/* Grab the 8390 specific header. Similar to the block_input routine, but /* Grab the 8390 specific header. Similar to the block_input routine, but
...@@ -530,11 +538,11 @@ static int ...@@ -530,11 +538,11 @@ static int
ultra_close_card(struct net_device *dev) ultra_close_card(struct net_device *dev)
{ {
int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET; /* CMDREG */ int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET; /* CMDREG */
struct ei_device *ei_local = netdev_priv(dev);
netif_stop_queue(dev); netif_stop_queue(dev);
if (ei_debug > 1) netif_dbg(ei_local, ifdown, dev, "Shutting down ethercard.\n");
printk("%s: Shutting down ethercard.\n", dev->name);
outb(0x00, ioaddr + 6); /* Disable interrupts. */ outb(0x00, ioaddr + 6); /* Disable interrupts. */
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
...@@ -556,8 +564,10 @@ static int irq[MAX_ULTRA_CARDS]; ...@@ -556,8 +564,10 @@ static int irq[MAX_ULTRA_CARDS];
module_param_array(io, int, NULL, 0); module_param_array(io, int, NULL, 0);
module_param_array(irq, int, NULL, 0); module_param_array(irq, int, NULL, 0);
module_param_named(msg_enable, ultra_msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
MODULE_PARM_DESC(io, "I/O base address(es)"); MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
MODULE_DESCRIPTION("SMC Ultra/EtherEZ ISA/PnP Ethernet driver"); MODULE_DESCRIPTION("SMC Ultra/EtherEZ ISA/PnP Ethernet driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -69,6 +69,11 @@ static void stnic_block_output (struct net_device *dev, int count, ...@@ -69,6 +69,11 @@ static void stnic_block_output (struct net_device *dev, int count,
static void stnic_init (struct net_device *dev); static void stnic_init (struct net_device *dev);
static u32 stnic_msg_enable;
module_param_named(msg_enable, stnic_msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
/* SH7750 specific read/write io. */ /* SH7750 specific read/write io. */
static inline void static inline void
STNIC_DELAY (void) STNIC_DELAY (void)
...@@ -100,6 +105,7 @@ static int __init stnic_probe(void) ...@@ -100,6 +105,7 @@ static int __init stnic_probe(void)
{ {
struct net_device *dev; struct net_device *dev;
int i, err; int i, err;
struct ei_device *ei_local;
/* If we are not running on a SolutionEngine, give up now */ /* If we are not running on a SolutionEngine, give up now */
if (! MACH_SE) if (! MACH_SE)
...@@ -125,10 +131,10 @@ static int __init stnic_probe(void) ...@@ -125,10 +131,10 @@ static int __init stnic_probe(void)
share and the board will usually be enabled. */ share and the board will usually be enabled. */
err = request_irq (dev->irq, ei_interrupt, 0, DRV_NAME, dev); err = request_irq (dev->irq, ei_interrupt, 0, DRV_NAME, dev);
if (err) { if (err) {
printk (KERN_EMERG " unable to get IRQ %d.\n", dev->irq); netdev_emerg(dev, " unable to get IRQ %d.\n", dev->irq);
free_netdev(dev); free_netdev(dev);
return err; return err;
} }
ei_status.name = dev->name; ei_status.name = dev->name;
ei_status.word16 = 1; ei_status.word16 = 1;
...@@ -147,6 +153,8 @@ static int __init stnic_probe(void) ...@@ -147,6 +153,8 @@ static int __init stnic_probe(void)
ei_status.block_output = &stnic_block_output; ei_status.block_output = &stnic_block_output;
stnic_init (dev); stnic_init (dev);
ei_local = netdev_priv(dev);
ei_local->msg_enable = stnic_msg_enable;
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
...@@ -156,7 +164,7 @@ static int __init stnic_probe(void) ...@@ -156,7 +164,7 @@ static int __init stnic_probe(void)
} }
stnic_dev = dev; stnic_dev = dev;
printk (KERN_INFO "NS ST-NIC 83902A\n"); netdev_info(dev, "NS ST-NIC 83902A\n");
return 0; return 0;
} }
...@@ -164,10 +172,11 @@ static int __init stnic_probe(void) ...@@ -164,10 +172,11 @@ static int __init stnic_probe(void)
static void static void
stnic_reset (struct net_device *dev) stnic_reset (struct net_device *dev)
{ {
struct ei_device *ei_local = netdev_priv(dev);
*(vhalf *) PA_83902_RST = 0; *(vhalf *) PA_83902_RST = 0;
udelay (5); udelay (5);
if (ei_debug > 1) netif_warn(ei_local, hw, dev, "8390 reset done (%ld).\n", jiffies);
printk (KERN_WARNING "8390 reset done (%ld).\n", jiffies);
*(vhalf *) PA_83902_RST = ~0; *(vhalf *) PA_83902_RST = ~0;
udelay (5); udelay (5);
} }
...@@ -176,6 +185,8 @@ static void ...@@ -176,6 +185,8 @@ static void
stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr, stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr,
int ring_page) int ring_page)
{ {
struct ei_device *ei_local = netdev_priv(dev);
half buf[2]; half buf[2];
STNIC_WRITE (PG0_RSAR0, 0); STNIC_WRITE (PG0_RSAR0, 0);
...@@ -196,8 +207,7 @@ stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr, ...@@ -196,8 +207,7 @@ stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr,
hdr->count = ((buf[1] >> 8) & 0xff) | (buf[1] << 8); hdr->count = ((buf[1] >> 8) & 0xff) | (buf[1] << 8);
#endif #endif
if (ei_debug > 1) netif_dbg(ei_local, probe, dev, "ring %x status %02x next %02x count %04x.\n",
printk (KERN_DEBUG "ring %x status %02x next %02x count %04x.\n",
ring_page, hdr->status, hdr->next, hdr->count); ring_page, hdr->status, hdr->next, hdr->count);
STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA); STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA);
......
...@@ -60,6 +60,7 @@ static void wd_block_output(struct net_device *dev, int count, ...@@ -60,6 +60,7 @@ static void wd_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page); const unsigned char *buf, int start_page);
static int wd_close(struct net_device *dev); static int wd_close(struct net_device *dev);
static u32 wd_msg_enable;
#define WD_START_PG 0x00 /* First page of TX buffer */ #define WD_START_PG 0x00 /* First page of TX buffer */
#define WD03_STOP_PG 0x20 /* Last page +1 of RX ring */ #define WD03_STOP_PG 0x20 /* Last page +1 of RX ring */
...@@ -170,6 +171,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -170,6 +171,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
int word16 = 0; /* 0 = 8 bit, 1 = 16 bit */ int word16 = 0; /* 0 = 8 bit, 1 = 16 bit */
const char *model_name; const char *model_name;
static unsigned version_printed; static unsigned version_printed;
struct ei_device *ei_local = netdev_priv(dev);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
checksum += inb(ioaddr + 8 + i); checksum += inb(ioaddr + 8 + i);
...@@ -180,19 +182,19 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -180,19 +182,19 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
/* Check for semi-valid mem_start/end values if supplied. */ /* Check for semi-valid mem_start/end values if supplied. */
if ((dev->mem_start % 0x2000) || (dev->mem_end % 0x2000)) { if ((dev->mem_start % 0x2000) || (dev->mem_end % 0x2000)) {
printk(KERN_WARNING "wd.c: user supplied mem_start or mem_end not on 8kB boundary - ignored.\n"); netdev_warn(dev,
"wd.c: user supplied mem_start or mem_end not on 8kB boundary - ignored.\n");
dev->mem_start = 0; dev->mem_start = 0;
dev->mem_end = 0; dev->mem_end = 0;
} }
if (ei_debug && version_printed++ == 0) if ((wd_msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
printk(version); netdev_info(dev, version);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev->dev_addr[i] = inb(ioaddr + 8 + i); dev->dev_addr[i] = inb(ioaddr + 8 + i);
printk("%s: WD80x3 at %#3x, %pM", netdev_info(dev, "WD80x3 at %#3x, %pM", ioaddr, dev->dev_addr);
dev->name, ioaddr, dev->dev_addr);
/* The following PureData probe code was contributed by /* The following PureData probe code was contributed by
Mike Jagdis <jaggy@purplet.demon.co.uk>. Puredata does software Mike Jagdis <jaggy@purplet.demon.co.uk>. Puredata does software
...@@ -244,8 +246,9 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -244,8 +246,9 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
} }
#ifndef final_version #ifndef final_version
if ( !ancient && (inb(ioaddr+1) & 0x01) != (word16 & 0x01)) if ( !ancient && (inb(ioaddr+1) & 0x01) != (word16 & 0x01))
printk("\nWD80?3: Bus width conflict, %d (probe) != %d (reg report).", pr_cont("\nWD80?3: Bus width conflict, %d (probe) != %d (reg report).",
word16 ? 16 : 8, (inb(ioaddr+1) & 0x01) ? 16 : 8); word16 ? 16 : 8,
(inb(ioaddr+1) & 0x01) ? 16 : 8);
#endif #endif
} }
...@@ -259,7 +262,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -259,7 +262,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
if (reg0 == 0xff || reg0 == 0) { if (reg0 == 0xff || reg0 == 0) {
/* Future plan: this could check a few likely locations first. */ /* Future plan: this could check a few likely locations first. */
dev->mem_start = 0xd0000; dev->mem_start = 0xd0000;
printk(" assigning address %#lx", dev->mem_start); pr_cont(" assigning address %#lx", dev->mem_start);
} else { } else {
int high_addr_bits = inb(ioaddr+WD_CMDREG5) & 0x1f; int high_addr_bits = inb(ioaddr+WD_CMDREG5) & 0x1f;
/* Some boards don't have the register 5 -- it returns 0xff. */ /* Some boards don't have the register 5 -- it returns 0xff. */
...@@ -297,8 +300,8 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -297,8 +300,8 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
outb_p(0x00, nic_addr+EN0_IMR); /* Mask all intrs. again. */ outb_p(0x00, nic_addr+EN0_IMR); /* Mask all intrs. again. */
if (ei_debug > 2) if (netif_msg_drv(ei_local))
printk(" autoirq is %d", dev->irq); pr_cont(" autoirq is %d", dev->irq);
if (dev->irq < 2) if (dev->irq < 2)
dev->irq = word16 ? 10 : 5; dev->irq = word16 ? 10 : 5;
} else } else
...@@ -310,7 +313,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -310,7 +313,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
share and the board will usually be enabled. */ share and the board will usually be enabled. */
i = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); i = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev);
if (i) { if (i) {
printk (" unable to get IRQ %d.\n", dev->irq); pr_cont(" unable to get IRQ %d.\n", dev->irq);
return i; return i;
} }
...@@ -338,8 +341,8 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -338,8 +341,8 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
return -ENOMEM; return -ENOMEM;
} }
printk(" %s, IRQ %d, shared memory at %#lx-%#lx.\n", pr_cont(" %s, IRQ %d, shared memory at %#lx-%#lx.\n",
model_name, dev->irq, dev->mem_start, dev->mem_end-1); model_name, dev->irq, dev->mem_start, dev->mem_end-1);
ei_status.reset_8390 = wd_reset_8390; ei_status.reset_8390 = wd_reset_8390;
ei_status.block_input = wd_block_input; ei_status.block_input = wd_block_input;
...@@ -348,6 +351,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) ...@@ -348,6 +351,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
dev->netdev_ops = &wd_netdev_ops; dev->netdev_ops = &wd_netdev_ops;
NS8390_init(dev, 0); NS8390_init(dev, 0);
ei_local->msg_enable = wd_msg_enable;
#if 1 #if 1
/* Enable interrupt generation on softconfig cards -- M.U */ /* Enable interrupt generation on softconfig cards -- M.U */
...@@ -385,9 +389,11 @@ static void ...@@ -385,9 +389,11 @@ static void
wd_reset_8390(struct net_device *dev) wd_reset_8390(struct net_device *dev)
{ {
int wd_cmd_port = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */ int wd_cmd_port = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
struct ei_device *ei_local = netdev_priv(dev);
outb(WD_RESET, wd_cmd_port); outb(WD_RESET, wd_cmd_port);
if (ei_debug > 1) printk("resetting the WD80x3 t=%lu...", jiffies); netif_dbg(ei_local, hw, dev, "resetting the WD80x3 t=%lu...\n",
jiffies);
ei_status.txing = 0; ei_status.txing = 0;
/* Set up the ASIC registers, just in case something changed them. */ /* Set up the ASIC registers, just in case something changed them. */
...@@ -395,7 +401,7 @@ wd_reset_8390(struct net_device *dev) ...@@ -395,7 +401,7 @@ wd_reset_8390(struct net_device *dev)
if (ei_status.word16) if (ei_status.word16)
outb(NIC16 | ((dev->mem_start>>19) & 0x1f), wd_cmd_port+WD_CMDREG5); outb(NIC16 | ((dev->mem_start>>19) & 0x1f), wd_cmd_port+WD_CMDREG5);
if (ei_debug > 1) printk("reset done\n"); netif_dbg(ei_local, hw, dev, "reset done\n");
} }
/* Grab the 8390 specific header. Similar to the block_input routine, but /* Grab the 8390 specific header. Similar to the block_input routine, but
...@@ -474,9 +480,9 @@ static int ...@@ -474,9 +480,9 @@ static int
wd_close(struct net_device *dev) wd_close(struct net_device *dev)
{ {
int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */ int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
struct ei_device *ei_local = netdev_priv(dev);
if (ei_debug > 1) netif_dbg(ei_local, ifdown, dev, "Shutting down ethercard.\n");
printk("%s: Shutting down ethercard.\n", dev->name);
ei_close(dev); ei_close(dev);
/* Change from 16-bit to 8-bit shared memory so reboot works. */ /* Change from 16-bit to 8-bit shared memory so reboot works. */
...@@ -502,10 +508,12 @@ module_param_array(io, int, NULL, 0); ...@@ -502,10 +508,12 @@ module_param_array(io, int, NULL, 0);
module_param_array(irq, int, NULL, 0); module_param_array(irq, int, NULL, 0);
module_param_array(mem, int, NULL, 0); module_param_array(mem, int, NULL, 0);
module_param_array(mem_end, int, NULL, 0); module_param_array(mem_end, int, NULL, 0);
module_param_named(msg_enable, wd_msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
MODULE_PARM_DESC(io, "I/O base address(es)"); MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (ignored for PureData boards)"); MODULE_PARM_DESC(irq, "IRQ number(s) (ignored for PureData boards)");
MODULE_PARM_DESC(mem, "memory base address(es)(ignored for PureData boards)"); MODULE_PARM_DESC(mem, "memory base address(es)(ignored for PureData boards)");
MODULE_PARM_DESC(mem_end, "memory end address(es)"); MODULE_PARM_DESC(mem_end, "memory end address(es)");
MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
MODULE_DESCRIPTION("ISA Western Digital wd8003/wd8013 ; SMC Elite, Elite16 ethernet driver"); MODULE_DESCRIPTION("ISA Western Digital wd8003/wd8013 ; SMC Elite, Elite16 ethernet driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
static const char version[] = static const char version[] =
"8390.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
static u32 zorro8390_msg_enable;
#include "lib8390.c" #include "lib8390.c"
#define DRV_NAME "zorro8390" #define DRV_NAME "zorro8390"
...@@ -86,9 +88,9 @@ static struct card_info { ...@@ -86,9 +88,9 @@ static struct card_info {
static void zorro8390_reset_8390(struct net_device *dev) static void zorro8390_reset_8390(struct net_device *dev)
{ {
unsigned long reset_start_time = jiffies; unsigned long reset_start_time = jiffies;
struct ei_device *ei_local = netdev_priv(dev);
if (ei_debug > 1) netif_dbg(ei_local, hw, dev, "resetting - t=%ld...\n", jiffies);
netdev_dbg(dev, "resetting - t=%ld...\n", jiffies);
z_writeb(z_readb(NE_BASE + NE_RESET), NE_BASE + NE_RESET); z_writeb(z_readb(NE_BASE + NE_RESET), NE_BASE + NE_RESET);
...@@ -119,8 +121,9 @@ static void zorro8390_get_8390_hdr(struct net_device *dev, ...@@ -119,8 +121,9 @@ static void zorro8390_get_8390_hdr(struct net_device *dev,
* If it does, it's the last thing you'll see * If it does, it's the last thing you'll see
*/ */
if (ei_status.dmaing) { if (ei_status.dmaing) {
netdev_err(dev, "%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n", netdev_warn(dev,
__func__, ei_status.dmaing, ei_status.irqlock); "%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n",
__func__, ei_status.dmaing, ei_status.irqlock);
return; return;
} }
...@@ -230,7 +233,7 @@ static void zorro8390_block_output(struct net_device *dev, int count, ...@@ -230,7 +233,7 @@ static void zorro8390_block_output(struct net_device *dev, int count,
while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
if (time_after(jiffies, dma_start + 2 * HZ / 100)) { if (time_after(jiffies, dma_start + 2 * HZ / 100)) {
/* 20ms */ /* 20ms */
netdev_err(dev, "timeout waiting for Tx RDC\n"); netdev_warn(dev, "timeout waiting for Tx RDC\n");
zorro8390_reset_8390(dev); zorro8390_reset_8390(dev);
__NS8390_init(dev, 1); __NS8390_init(dev, 1);
break; break;
...@@ -248,8 +251,9 @@ static int zorro8390_open(struct net_device *dev) ...@@ -248,8 +251,9 @@ static int zorro8390_open(struct net_device *dev)
static int zorro8390_close(struct net_device *dev) static int zorro8390_close(struct net_device *dev)
{ {
if (ei_debug > 1) struct ei_device *ei_local = netdev_priv(dev);
netdev_dbg(dev, "Shutting down ethercard\n");
netif_dbg(ei_local, ifdown, dev, "Shutting down ethercard\n");
__ei_close(dev); __ei_close(dev);
return 0; return 0;
} }
...@@ -293,6 +297,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board, ...@@ -293,6 +297,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board,
int err; int err;
unsigned char SA_prom[32]; unsigned char SA_prom[32];
int start_page, stop_page; int start_page, stop_page;
struct ei_device *ei_local = netdev_priv(dev);
static u32 zorro8390_offsets[16] = { static u32 zorro8390_offsets[16] = {
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
...@@ -383,6 +388,9 @@ static int zorro8390_init(struct net_device *dev, unsigned long board, ...@@ -383,6 +388,9 @@ static int zorro8390_init(struct net_device *dev, unsigned long board,
dev->netdev_ops = &zorro8390_netdev_ops; dev->netdev_ops = &zorro8390_netdev_ops;
__NS8390_init(dev, 0); __NS8390_init(dev, 0);
ei_local->msg_enable = zorro8390_msg_enable;
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
free_irq(IRQ_AMIGA_PORTS, dev); free_irq(IRQ_AMIGA_PORTS, dev);
......
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