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)
skblen = skb->len;
save_flags(flags);
cli();
local_irq_save(flags);
if (!TX_BUFFS_AVAIL){
restore_flags(flags);
local_irq_restore(flags);
return -1;
}
......@@ -616,7 +615,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
dev->trans_start = jiffies;
dev_kfree_skb (skb);
restore_flags(flags);
local_irq_restore(flags);
return status;
}
......
......@@ -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);
#endif
save_flags(flags);
cli();
local_irq_save(flags);
entry = priv->cur_tx % TX_RING_SIZE;
......@@ -662,7 +661,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev);
priv->tx_full = 1;
}
restore_flags(flags);
local_irq_restore(flags);
return 0;
}
......@@ -765,13 +764,12 @@ static struct net_device_stats *ariadne_get_stats(struct net_device *dev)
short saved_addr;
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
saved_addr = lance->RAP;
lance->RAP = CSR112; /* Missed Frame Count */
priv->stats.rx_missed_errors = swapw(lance->RDP);
lance->RAP = saved_addr;
restore_flags(flags);
local_irq_restore(flags);
return &priv->stats;
}
......
......@@ -235,8 +235,7 @@ get_frame(unsigned long paddr, int odd) {
unsigned long flags;
DISABLE_IRQ();
save_flags(flags);
cli();
local_irq_save(flags);
dma_wd.dma_mode_status = 0x9a;
dma_wd.dma_mode_status = 0x19a;
......@@ -247,7 +246,7 @@ get_frame(unsigned long paddr, int odd) {
dma_wd.dma_md = (unsigned char)paddr;
paddr >>= 8;
dma_wd.dma_hi = (unsigned char)paddr;
restore_flags(flags);
local_irq_restore(flags);
c = sendcmd(0,0x00,NODE_ADR | C_READ); /* CMD: READ */
if( c < 128 ) goto rend;
......@@ -284,8 +283,7 @@ hardware_send_packet(unsigned long paddr, int cnt) {
unsigned long flags;
DISABLE_IRQ();
save_flags(flags);
cli();
local_irq_save(flags);
dma_wd.dma_mode_status = 0x19a;
dma_wd.dma_mode_status = 0x9a;
......@@ -297,7 +295,7 @@ hardware_send_packet(unsigned long paddr, int cnt) {
dma_wd.dma_hi = (unsigned char)paddr;
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(1,0x100,cnt&0xff);
......@@ -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
* done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
*/
save_flags(flags);
cli();
local_irq_save(flags);
if (stdma_islocked()) {
restore_flags(flags);
local_irq_restore(flags);
lp->stats.tx_errors++;
}
else {
......@@ -451,7 +448,7 @@ bionet_send_packet(struct sk_buff *skb, struct net_device *dev) {
int stat;
stdma_lock(bionet_intr, NULL);
restore_flags(flags);
local_irq_restore(flags);
if( !STRAM_ADDR(buf+length-1) ) {
memcpy(nic_packet->buffer, skb->data, length);
buf = (unsigned long)&((struct nic_pkt_s *)phys_nic_packet)->buffer;
......@@ -504,20 +501,19 @@ bionet_poll_rx(struct net_device *dev) {
int pkt_len, status;
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
/* ++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
* 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
* registers. */
if (stdma_islocked()) {
restore_flags(flags);
local_irq_restore(flags);
return;
}
stdma_lock(bionet_intr, NULL);
DISABLE_IRQ();
restore_flags(flags);
local_irq_restore(flags);
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) {
/* Block a timer-based transmit from overlapping. This could better be
* done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
*/
save_flags(flags);
cli();
local_irq_save(flags);
if (stdma_islocked()) {
restore_flags(flags);
local_irq_restore(flags);
lp->stats.tx_errors++;
}
else {
......@@ -717,7 +716,7 @@ pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev) {
stdma_lock(pamsnet_intr, NULL);
DISABLE_IRQ();
restore_flags(flags);
local_irq_restore(flags);
if( !STRAM_ADDR(buf+length-1) ) {
memcpy(nic_packet->buffer, skb->data, length);
buf = (unsigned long)phys_nic_packet;
......@@ -749,20 +748,19 @@ pamsnet_poll_rx(struct net_device *dev) {
struct sk_buff *skb;
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
/* ++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
* 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
* registers. */
if (stdma_islocked()) {
restore_flags(flags);
local_irq_restore(flags);
return;
}
stdma_lock(pamsnet_intr, NULL);
DISABLE_IRQ();
restore_flags(flags);
local_irq_restore(flags);
boguscount = testpkt(lance_target);
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
long flags;
long *vbr, save_berr;
save_flags(flags);
cli();
local_irq_save(flags);
__asm__ __volatile__ ( "movec %/vbr,%0" : "=r" (vbr) : );
save_berr = vbr[2];
......@@ -440,7 +439,7 @@ static int __init addr_accessible( volatile void *regp, int wordflag, int writef
);
vbr[2] = save_berr;
restore_flags(flags);
local_irq_restore(flags);
return( ret );
}
......
......@@ -194,7 +194,7 @@ int __init mac8390_memsize(unsigned long membase)
unsigned long flags;
int i, j;
save_flags(flags); cli();
local_irq_save(flags);
/* Check up to 32K in 4K increments */
for (i = 0; i < 8; i++) {
volatile unsigned short *m = (unsigned short *) (membase + (i * 0x1000));
......@@ -217,7 +217,7 @@ int __init mac8390_memsize(unsigned long membase)
break;
}
}
restore_flags(flags);
local_irq_restore(flags);
/* in any case, we stopped once we tried one block too many,
or once we reached 32K */
return i * 0x1000;
......
......@@ -52,7 +52,8 @@
Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 11/01/2001
check kmalloc and release the allocated memory on failure in
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 =
......@@ -199,11 +200,10 @@ int __init mac89x0_probe(struct net_device *dev)
unsigned long flags;
int card_present;
save_flags(flags);
cli();
local_irq_save(flags);
card_present = hwreg_present((void*) ioaddr+4)
&& hwreg_present((void*) ioaddr + DATA_PORT);
restore_flags(flags);
local_irq_restore(flags);
if (!card_present)
return -ENODEV;
......@@ -397,8 +397,7 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
/* keep the upload from being interrupted, since we
ask the chip to start transmitting before the
whole packet has been completely uploaded. */
save_flags(flags);
cli();
local_irq_save(flags);
/* initiate a transmit sequence */
writereg(dev, PP_TxCMD, lp->send_cmd);
......@@ -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) {
/* Gasp! It hasn't. But that shouldn't happen since
we're waiting for TxOk, so return 1 and requeue this packet. */
restore_flags(flags);
local_irq_restore(flags);
return 1;
}
/* Write the contents of the packet */
memcpy_toio(dev->mem_start + PP_TxFrame, skb->data, skb->len+1);
restore_flags(flags);
local_irq_restore(flags);
dev->trans_start = jiffies;
}
dev_kfree_skb (skb);
......@@ -568,12 +567,11 @@ net_get_stats(struct net_device *dev)
struct net_local *lp = (struct net_local *)dev->priv;
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
/* Update the statistics from the device registers. */
lp->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6);
lp->stats.collisions += (readreg(dev, PP_TxCol) >> 6);
restore_flags(flags);
local_irq_restore(flags);
return &lp->stats;
}
......
......@@ -256,8 +256,7 @@ static int mace_set_address(struct net_device *dev, void *addr)
unsigned long flags;
u8 maccc;
save_flags(flags);
cli();
local_irq_save(flags);
maccc = mb->maccc;
......@@ -270,7 +269,7 @@ static int mace_set_address(struct net_device *dev, void *addr)
}
mb->maccc = maccc;
restore_flags(flags);
local_irq_restore(flags);
return 0;
}
......
......@@ -332,10 +332,9 @@ int __init mac_onboard_sonic_probe(struct net_device* dev)
unsigned long flags;
int card_present;
save_flags(flags);
cli();
local_irq_save(flags);
card_present = hwreg_present((void*)ONBOARD_SONIC_REGISTERS);
restore_flags(flags);
local_irq_restore(flags);
if (!card_present) {
printk("none.\n");
......
......@@ -1078,12 +1078,11 @@ static int sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)
{
unsigned long flags;
save_flags(flags);
cli();
local_irq_save(flags);
if(p->xmit_count != p->xmit_last)
netif_wake_queue(dev);
p->lock = 0;
restore_flags(flags);
local_irq_restore(flags);
}
dev_kfree_skb(skb);
#endif
......
......@@ -574,7 +574,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
#endif
/* 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... */
save_and_cli(flags);
local_irq_save(flags);
/* Mask to ring buffer boundary. */
entry = lp->new_tx;
......@@ -610,7 +610,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
TMD1_OWN_HOST)
netif_start_queue(dev);
restore_flags(flags);
local_irq_restore(flags);
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