Commit 83c8571a authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k net local_irq*() updates

Convert m68k net drivers to new local_irq*() framework:
  - Amiga A2065 and Ariadne Ethernet
  - Atari Bionet-100 and Pamsnet ACSI Ethernet
  - Atari LANCE Ethernet
  - Mac NC8390, CS89x0, MACE, and Sonic Ethernet
  - Sun-3 i82586 and Sun-3/3x LANCE Ethernet
parent 706c27d2
...@@ -571,11 +571,10 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -571,11 +571,10 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
skblen = skb->len; skblen = skb->len;
save_flags(flags); local_irq_save(flags);
cli();
if (!TX_BUFFS_AVAIL){ if (!TX_BUFFS_AVAIL){
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
...@@ -616,7 +615,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -616,7 +615,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
dev->trans_start = jiffies; dev->trans_start = jiffies;
dev_kfree_skb (skb); dev_kfree_skb (skb);
restore_flags(flags); local_irq_restore(flags);
return status; return status;
} }
......
...@@ -604,8 +604,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -604,8 +604,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev)
printk(" data 0x%08x len %d\n", (int)skb->data, (int)skb->len); printk(" data 0x%08x len %d\n", (int)skb->data, (int)skb->len);
#endif #endif
save_flags(flags); local_irq_save(flags);
cli();
entry = priv->cur_tx % TX_RING_SIZE; entry = priv->cur_tx % TX_RING_SIZE;
...@@ -662,7 +661,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -662,7 +661,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
priv->tx_full = 1; priv->tx_full = 1;
} }
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -765,13 +764,12 @@ static struct net_device_stats *ariadne_get_stats(struct net_device *dev) ...@@ -765,13 +764,12 @@ static struct net_device_stats *ariadne_get_stats(struct net_device *dev)
short saved_addr; short saved_addr;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
saved_addr = lance->RAP; saved_addr = lance->RAP;
lance->RAP = CSR112; /* Missed Frame Count */ lance->RAP = CSR112; /* Missed Frame Count */
priv->stats.rx_missed_errors = swapw(lance->RDP); priv->stats.rx_missed_errors = swapw(lance->RDP);
lance->RAP = saved_addr; lance->RAP = saved_addr;
restore_flags(flags); local_irq_restore(flags);
return &priv->stats; return &priv->stats;
} }
......
...@@ -235,8 +235,7 @@ get_frame(unsigned long paddr, int odd) { ...@@ -235,8 +235,7 @@ get_frame(unsigned long paddr, int odd) {
unsigned long flags; unsigned long flags;
DISABLE_IRQ(); DISABLE_IRQ();
save_flags(flags); local_irq_save(flags);
cli();
dma_wd.dma_mode_status = 0x9a; dma_wd.dma_mode_status = 0x9a;
dma_wd.dma_mode_status = 0x19a; dma_wd.dma_mode_status = 0x19a;
...@@ -247,7 +246,7 @@ get_frame(unsigned long paddr, int odd) { ...@@ -247,7 +246,7 @@ get_frame(unsigned long paddr, int odd) {
dma_wd.dma_md = (unsigned char)paddr; dma_wd.dma_md = (unsigned char)paddr;
paddr >>= 8; paddr >>= 8;
dma_wd.dma_hi = (unsigned char)paddr; dma_wd.dma_hi = (unsigned char)paddr;
restore_flags(flags); local_irq_restore(flags);
c = sendcmd(0,0x00,NODE_ADR | C_READ); /* CMD: READ */ c = sendcmd(0,0x00,NODE_ADR | C_READ); /* CMD: READ */
if( c < 128 ) goto rend; if( c < 128 ) goto rend;
...@@ -284,8 +283,7 @@ hardware_send_packet(unsigned long paddr, int cnt) { ...@@ -284,8 +283,7 @@ hardware_send_packet(unsigned long paddr, int cnt) {
unsigned long flags; unsigned long flags;
DISABLE_IRQ(); DISABLE_IRQ();
save_flags(flags); local_irq_save(flags);
cli();
dma_wd.dma_mode_status = 0x19a; dma_wd.dma_mode_status = 0x19a;
dma_wd.dma_mode_status = 0x9a; dma_wd.dma_mode_status = 0x9a;
...@@ -297,7 +295,7 @@ hardware_send_packet(unsigned long paddr, int cnt) { ...@@ -297,7 +295,7 @@ hardware_send_packet(unsigned long paddr, int cnt) {
dma_wd.dma_hi = (unsigned char)paddr; dma_wd.dma_hi = (unsigned char)paddr;
dma_wd.fdc_acces_seccount = 0x4; /* sector count */ dma_wd.fdc_acces_seccount = 0x4; /* sector count */
restore_flags(flags); local_irq_restore(flags);
c = sendcmd(0,0x100,NODE_ADR | C_WRITE); /* CMD: WRITE */ c = sendcmd(0,0x100,NODE_ADR | C_WRITE); /* CMD: WRITE */
c = sendcmd(1,0x100,cnt&0xff); c = sendcmd(1,0x100,cnt&0xff);
...@@ -438,11 +436,10 @@ bionet_send_packet(struct sk_buff *skb, struct net_device *dev) { ...@@ -438,11 +436,10 @@ bionet_send_packet(struct sk_buff *skb, struct net_device *dev) {
/* Block a timer-based transmit from overlapping. This could better be /* Block a timer-based transmit from overlapping. This could better be
* done with atomic_swap(1, dev->tbusy), but set_bit() works as well. * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
if (stdma_islocked()) { if (stdma_islocked()) {
restore_flags(flags); local_irq_restore(flags);
lp->stats.tx_errors++; lp->stats.tx_errors++;
} }
else { else {
...@@ -451,7 +448,7 @@ bionet_send_packet(struct sk_buff *skb, struct net_device *dev) { ...@@ -451,7 +448,7 @@ bionet_send_packet(struct sk_buff *skb, struct net_device *dev) {
int stat; int stat;
stdma_lock(bionet_intr, NULL); stdma_lock(bionet_intr, NULL);
restore_flags(flags); local_irq_restore(flags);
if( !STRAM_ADDR(buf+length-1) ) { if( !STRAM_ADDR(buf+length-1) ) {
memcpy(nic_packet->buffer, skb->data, length); memcpy(nic_packet->buffer, skb->data, length);
buf = (unsigned long)&((struct nic_pkt_s *)phys_nic_packet)->buffer; buf = (unsigned long)&((struct nic_pkt_s *)phys_nic_packet)->buffer;
...@@ -504,20 +501,19 @@ bionet_poll_rx(struct net_device *dev) { ...@@ -504,20 +501,19 @@ bionet_poll_rx(struct net_device *dev) {
int pkt_len, status; int pkt_len, status;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
/* ++roman: Take care at locking the ST-DMA... This must be done with ints /* ++roman: Take care at locking the ST-DMA... This must be done with ints
* off, since otherwise an int could slip in between the question and the * off, since otherwise an int could slip in between the question and the
* locking itself, and then we'd go to sleep... And locking itself is * locking itself, and then we'd go to sleep... And locking itself is
* necessary to keep the floppy_change timer from working with ST-DMA * necessary to keep the floppy_change timer from working with ST-DMA
* registers. */ * registers. */
if (stdma_islocked()) { if (stdma_islocked()) {
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
stdma_lock(bionet_intr, NULL); stdma_lock(bionet_intr, NULL);
DISABLE_IRQ(); DISABLE_IRQ();
restore_flags(flags); local_irq_restore(flags);
if( lp->poll_time < MAX_POLL_TIME ) lp->poll_time++; if( lp->poll_time < MAX_POLL_TIME ) lp->poll_time++;
......
...@@ -702,11 +702,10 @@ pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev) { ...@@ -702,11 +702,10 @@ pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev) {
/* Block a timer-based transmit from overlapping. This could better be /* Block a timer-based transmit from overlapping. This could better be
* done with atomic_swap(1, dev->tbusy), but set_bit() works as well. * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
if (stdma_islocked()) { if (stdma_islocked()) {
restore_flags(flags); local_irq_restore(flags);
lp->stats.tx_errors++; lp->stats.tx_errors++;
} }
else { else {
...@@ -717,7 +716,7 @@ pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev) { ...@@ -717,7 +716,7 @@ pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev) {
stdma_lock(pamsnet_intr, NULL); stdma_lock(pamsnet_intr, NULL);
DISABLE_IRQ(); DISABLE_IRQ();
restore_flags(flags); local_irq_restore(flags);
if( !STRAM_ADDR(buf+length-1) ) { if( !STRAM_ADDR(buf+length-1) ) {
memcpy(nic_packet->buffer, skb->data, length); memcpy(nic_packet->buffer, skb->data, length);
buf = (unsigned long)phys_nic_packet; buf = (unsigned long)phys_nic_packet;
...@@ -749,20 +748,19 @@ pamsnet_poll_rx(struct net_device *dev) { ...@@ -749,20 +748,19 @@ pamsnet_poll_rx(struct net_device *dev) {
struct sk_buff *skb; struct sk_buff *skb;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
/* ++roman: Take care at locking the ST-DMA... This must be done with ints /* ++roman: Take care at locking the ST-DMA... This must be done with ints
* off, since otherwise an int could slip in between the question and the * off, since otherwise an int could slip in between the question and the
* locking itself, and then we'd go to sleep... And locking itself is * locking itself, and then we'd go to sleep... And locking itself is
* necessary to keep the floppy_change timer from working with ST-DMA * necessary to keep the floppy_change timer from working with ST-DMA
* registers. */ * registers. */
if (stdma_islocked()) { if (stdma_islocked()) {
restore_flags(flags); local_irq_restore(flags);
return; return;
} }
stdma_lock(pamsnet_intr, NULL); stdma_lock(pamsnet_intr, NULL);
DISABLE_IRQ(); DISABLE_IRQ();
restore_flags(flags); local_irq_restore(flags);
boguscount = testpkt(lance_target); boguscount = testpkt(lance_target);
if( lp->poll_time < MAX_POLL_TIME ) lp->poll_time++; if( lp->poll_time < MAX_POLL_TIME ) lp->poll_time++;
......
...@@ -402,8 +402,7 @@ static int __init addr_accessible( volatile void *regp, int wordflag, int writef ...@@ -402,8 +402,7 @@ static int __init addr_accessible( volatile void *regp, int wordflag, int writef
long flags; long flags;
long *vbr, save_berr; long *vbr, save_berr;
save_flags(flags); local_irq_save(flags);
cli();
__asm__ __volatile__ ( "movec %/vbr,%0" : "=r" (vbr) : ); __asm__ __volatile__ ( "movec %/vbr,%0" : "=r" (vbr) : );
save_berr = vbr[2]; save_berr = vbr[2];
...@@ -440,7 +439,7 @@ static int __init addr_accessible( volatile void *regp, int wordflag, int writef ...@@ -440,7 +439,7 @@ static int __init addr_accessible( volatile void *regp, int wordflag, int writef
); );
vbr[2] = save_berr; vbr[2] = save_berr;
restore_flags(flags); local_irq_restore(flags);
return( ret ); return( ret );
} }
......
...@@ -194,7 +194,7 @@ int __init mac8390_memsize(unsigned long membase) ...@@ -194,7 +194,7 @@ int __init mac8390_memsize(unsigned long membase)
unsigned long flags; unsigned long flags;
int i, j; int i, j;
save_flags(flags); cli(); local_irq_save(flags);
/* Check up to 32K in 4K increments */ /* Check up to 32K in 4K increments */
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
volatile unsigned short *m = (unsigned short *) (membase + (i * 0x1000)); volatile unsigned short *m = (unsigned short *) (membase + (i * 0x1000));
...@@ -217,7 +217,7 @@ int __init mac8390_memsize(unsigned long membase) ...@@ -217,7 +217,7 @@ int __init mac8390_memsize(unsigned long membase)
break; break;
} }
} }
restore_flags(flags); local_irq_restore(flags);
/* in any case, we stopped once we tried one block too many, /* in any case, we stopped once we tried one block too many,
or once we reached 32K */ or once we reached 32K */
return i * 0x1000; return i * 0x1000;
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 11/01/2001 Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 11/01/2001
check kmalloc and release the allocated memory on failure in check kmalloc and release the allocated memory on failure in
mac89x0_probe and in init_module mac89x0_probe and in init_module
use save_flags/restore_flags in net_get_stat, not just cli/sti use local_irq_{save,restore}(flags) in net_get_stat, not just
local_irq_{dis,en}able()
*/ */
static char *version = static char *version =
...@@ -199,11 +200,10 @@ int __init mac89x0_probe(struct net_device *dev) ...@@ -199,11 +200,10 @@ int __init mac89x0_probe(struct net_device *dev)
unsigned long flags; unsigned long flags;
int card_present; int card_present;
save_flags(flags); local_irq_save(flags);
cli();
card_present = hwreg_present((void*) ioaddr+4) card_present = hwreg_present((void*) ioaddr+4)
&& hwreg_present((void*) ioaddr + DATA_PORT); && hwreg_present((void*) ioaddr + DATA_PORT);
restore_flags(flags); local_irq_restore(flags);
if (!card_present) if (!card_present)
return -ENODEV; return -ENODEV;
...@@ -397,8 +397,7 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -397,8 +397,7 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
/* keep the upload from being interrupted, since we /* keep the upload from being interrupted, since we
ask the chip to start transmitting before the ask the chip to start transmitting before the
whole packet has been completely uploaded. */ whole packet has been completely uploaded. */
save_flags(flags); local_irq_save(flags);
cli();
/* initiate a transmit sequence */ /* initiate a transmit sequence */
writereg(dev, PP_TxCMD, lp->send_cmd); writereg(dev, PP_TxCMD, lp->send_cmd);
...@@ -408,14 +407,14 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -408,14 +407,14 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
if ((readreg(dev, PP_BusST) & READY_FOR_TX_NOW) == 0) { if ((readreg(dev, PP_BusST) & READY_FOR_TX_NOW) == 0) {
/* Gasp! It hasn't. But that shouldn't happen since /* Gasp! It hasn't. But that shouldn't happen since
we're waiting for TxOk, so return 1 and requeue this packet. */ we're waiting for TxOk, so return 1 and requeue this packet. */
restore_flags(flags); local_irq_restore(flags);
return 1; return 1;
} }
/* Write the contents of the packet */ /* Write the contents of the packet */
memcpy_toio(dev->mem_start + PP_TxFrame, skb->data, skb->len+1); memcpy_toio(dev->mem_start + PP_TxFrame, skb->data, skb->len+1);
restore_flags(flags); local_irq_restore(flags);
dev->trans_start = jiffies; dev->trans_start = jiffies;
} }
dev_kfree_skb (skb); dev_kfree_skb (skb);
...@@ -568,12 +567,11 @@ net_get_stats(struct net_device *dev) ...@@ -568,12 +567,11 @@ net_get_stats(struct net_device *dev)
struct net_local *lp = (struct net_local *)dev->priv; struct net_local *lp = (struct net_local *)dev->priv;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
/* Update the statistics from the device registers. */ /* Update the statistics from the device registers. */
lp->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6); lp->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6);
lp->stats.collisions += (readreg(dev, PP_TxCol) >> 6); lp->stats.collisions += (readreg(dev, PP_TxCol) >> 6);
restore_flags(flags); local_irq_restore(flags);
return &lp->stats; return &lp->stats;
} }
......
...@@ -256,8 +256,7 @@ static int mace_set_address(struct net_device *dev, void *addr) ...@@ -256,8 +256,7 @@ static int mace_set_address(struct net_device *dev, void *addr)
unsigned long flags; unsigned long flags;
u8 maccc; u8 maccc;
save_flags(flags); local_irq_save(flags);
cli();
maccc = mb->maccc; maccc = mb->maccc;
...@@ -270,7 +269,7 @@ static int mace_set_address(struct net_device *dev, void *addr) ...@@ -270,7 +269,7 @@ static int mace_set_address(struct net_device *dev, void *addr)
} }
mb->maccc = maccc; mb->maccc = maccc;
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
......
...@@ -332,10 +332,9 @@ int __init mac_onboard_sonic_probe(struct net_device* dev) ...@@ -332,10 +332,9 @@ int __init mac_onboard_sonic_probe(struct net_device* dev)
unsigned long flags; unsigned long flags;
int card_present; int card_present;
save_flags(flags); local_irq_save(flags);
cli();
card_present = hwreg_present((void*)ONBOARD_SONIC_REGISTERS); card_present = hwreg_present((void*)ONBOARD_SONIC_REGISTERS);
restore_flags(flags); local_irq_restore(flags);
if (!card_present) { if (!card_present) {
printk("none.\n"); printk("none.\n");
......
...@@ -1078,12 +1078,11 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -1078,12 +1078,11 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
{ {
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
if(p->xmit_count != p->xmit_last) if(p->xmit_count != p->xmit_last)
netif_wake_queue(dev); netif_wake_queue(dev);
p->lock = 0; p->lock = 0;
restore_flags(flags); local_irq_restore(flags);
} }
dev_kfree_skb(skb); dev_kfree_skb(skb);
#endif #endif
......
...@@ -574,7 +574,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) ...@@ -574,7 +574,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
#endif #endif
/* We're not prepared for the int until the last flags are set/reset. /* We're not prepared for the int until the last flags are set/reset.
* And the int may happen already after setting the OWN_CHIP... */ * And the int may happen already after setting the OWN_CHIP... */
save_and_cli(flags); local_irq_save(flags);
/* Mask to ring buffer boundary. */ /* Mask to ring buffer boundary. */
entry = lp->new_tx; entry = lp->new_tx;
...@@ -610,7 +610,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) ...@@ -610,7 +610,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
TMD1_OWN_HOST) TMD1_OWN_HOST)
netif_start_queue(dev); netif_start_queue(dev);
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
......
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