Commit f95ae0b0 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] Mac/m68k core local_irq*() updates

Convert core Mac/m68k code to new local_irq*() framework
parent 45450bff
......@@ -181,11 +181,10 @@ int __init mac_parse_bootinfo(const struct bi_record *record)
static void mac_cache_card_flush(int writeback)
{
unsigned long cpu_flags;
save_flags(cpu_flags);
cli();
unsigned long flags;
local_irq_save(flags);
via_flush_cache();
restore_flags(cpu_flags);
local_irq_restore(flags);
}
void __init config_mac(void)
......
......@@ -212,20 +212,19 @@ static int iop_alive(volatile struct mac_iop *iop)
static struct iop_msg *iop_alloc_msg(void)
{
int i;
ulong cpu_flags;
unsigned long flags;
save_flags(cpu_flags);
cli();
local_irq_save(flags);
for (i = 0 ; i < NUM_IOP_MSGS ; i++) {
if (iop_msg_pool[i].status == IOP_MSGSTATUS_UNUSED) {
iop_msg_pool[i].status = IOP_MSGSTATUS_WAITING;
restore_flags(cpu_flags);
local_irq_restore(flags);
return &iop_msg_pool[i];
}
}
restore_flags(cpu_flags);
local_irq_restore(flags);
return NULL;
}
......
......@@ -187,8 +187,7 @@ void mac_mksound( unsigned int freq, unsigned int length )
return;
}
save_flags( flags );
cli();
local_irq_save(flags);
del_timer( &mac_sound_timer );
......@@ -210,7 +209,7 @@ void mac_mksound( unsigned int freq, unsigned int length )
mac_sound_timer.expires = jiffies + length;
add_timer( &mac_sound_timer );
restore_flags( flags );
local_irq_restore(flags);
}
/*
......@@ -240,8 +239,7 @@ static void mac_quadra_start_bell( unsigned int freq, unsigned int length, unsig
mac_bell_phasepersample = ( freq * sizeof( mac_asc_wave_tab ) ) / mac_asc_samplespersec;
/* this is reasonably big for small frequencies */
save_flags( flags );
cli();
local_irq_save(flags);
/* set the volume */
mac_asc_regs[ 0x806 ] = volume;
......@@ -263,7 +261,7 @@ static void mac_quadra_start_bell( unsigned int freq, unsigned int length, unsig
mac_sound_timer.expires = jiffies + 1;
add_timer( &mac_sound_timer );
restore_flags( flags );
local_irq_restore(flags);
}
/*
......@@ -283,8 +281,7 @@ static void mac_quadra_ring_bell( unsigned long ignored )
* ...and the possibility to use a real sample (a boingy noise, maybe...)
*/
save_flags( flags );
cli();
local_irq_save(flags);
del_timer( &mac_sound_timer );
......@@ -301,7 +298,7 @@ static void mac_quadra_ring_bell( unsigned long ignored )
else
mac_asc_regs[ 0x801 ] = 0;
restore_flags( flags );
local_irq_restore(flags);
}
/*
......
......@@ -276,15 +276,14 @@ void mac_init_IRQ(void)
static inline void mac_insert_irq(irq_node_t **list, irq_node_t *node)
{
unsigned long cpu_flags;
unsigned long flags;
irq_node_t *cur;
if (!node->dev_id)
printk("%s: Warning: dev_id of %s is zero\n",
__FUNCTION__, node->devname);
save_flags(cpu_flags);
cli();
local_irq_save(flags);
cur = *list;
......@@ -309,27 +308,26 @@ static inline void mac_insert_irq(irq_node_t **list, irq_node_t *node)
node->next = cur;
*list = node;
restore_flags(cpu_flags);
local_irq_restore(flags);
}
static inline void mac_delete_irq(irq_node_t **list, void *dev_id)
{
unsigned long cpu_flags;
unsigned long flags;
irq_node_t *node;
save_flags(cpu_flags);
cli();
local_irq_save(flags);
for (node = *list; node; list = &node->next, node = *list) {
if (node->dev_id == dev_id) {
*list = node->next;
/* Mark it as free. */
node->handler = NULL;
restore_flags(cpu_flags);
local_irq_restore(flags);
return;
}
}
restore_flags(cpu_flags);
local_irq_restore(flags);
printk ("%s: tried to remove invalid irq\n", __FUNCTION__);
}
......@@ -343,7 +341,7 @@ static inline void mac_delete_irq(irq_node_t **list, void *dev_id)
void mac_do_irq_list(int irq, struct pt_regs *fp)
{
irq_node_t *node, *slow_nodes;
unsigned long cpu_flags;
unsigned long flags;
kstat_cpu(0).irqs[irq]++;
......@@ -360,8 +358,8 @@ void mac_do_irq_list(int irq, struct pt_regs *fp)
node = node->next)
node->handler(irq, node->dev_id, fp);
if (!node) return;
save_flags(cpu_flags);
restore_flags((cpu_flags & ~0x0700) | (fp->sr & 0x0700));
local_save_flags(flags);
local_irq_restore((flags & ~0x0700) | (fp->sr & 0x0700));
/* if slow handlers exists, serve them now */
slow_nodes = node;
for (; node; node = node->next) {
......@@ -735,15 +733,15 @@ void mac_scc_dispatch(int irq, void *dev_id, struct pt_regs *regs)
{
volatile unsigned char *scc = (unsigned char *) mac_bi_data.sccbase + 2;
unsigned char reg;
unsigned long cpu_flags;
unsigned long flags;
/* Read RR3 from the chip. Always do this on channel A */
/* This must be an atomic operation so disable irqs. */
save_flags(cpu_flags); cli();
local_irq_save(flags);
*scc = 3;
reg = *scc;
restore_flags(cpu_flags);
local_irq_restore(flags);
/* Now dispatch. Bits 0-2 are for channel B and */
/* bits 3-5 are for channel A. We can safely */
......
......@@ -165,11 +165,10 @@ static void via_pram_writebyte(__u8 data)
static void via_pram_command(int command, __u8 *data)
{
unsigned long cpu_flags;
unsigned long flags;
int is_read;
save_flags(cpu_flags);
cli();
local_irq_save(flags);
/* Enable the RTC and make sure the strobe line is high */
......@@ -193,7 +192,7 @@ static void via_pram_command(int command, __u8 *data)
via1[vBufB] |= VIA1B_vRTCEnb;
restore_flags(cpu_flags);
local_irq_restore(flags);
}
static __u8 via_read_pram(int offset)
......@@ -405,7 +404,7 @@ void mac_poweroff(void)
pmu_shutdown();
#endif
}
sti();
local_irq_enable();
printk("It is now safe to turn off your Macintosh.\n");
while(1);
}
......@@ -413,7 +412,7 @@ void mac_poweroff(void)
void mac_reset(void)
{
if (macintosh_config->adb_type == MAC_ADB_II) {
unsigned long cpu_flags;
unsigned long flags;
/* need ROMBASE in booter */
/* indeed, plus need to MAP THE ROM !! */
......@@ -429,12 +428,11 @@ void mac_reset(void)
* MSch: Machines known to crash on ROM reset ...
*/
} else {
save_flags(cpu_flags);
cli();
local_irq_save(flags);
rom_reset();
restore_flags(cpu_flags);
local_irq_restore(flags);
}
#ifdef CONFIG_ADB_CUDA
} else if (macintosh_config->adb_type == MAC_ADB_CUDA) {
......@@ -459,7 +457,7 @@ void mac_reset(void)
unsigned long virt = (unsigned long) mac_reset;
unsigned long phys = virt_to_phys(mac_reset);
unsigned long offset = phys-virt;
cli(); /* lets not screw this up, ok? */
local_irq_disable(); /* lets not screw this up, ok? */
__asm__ __volatile__(".chip 68030\n\t"
"pmove %0,%/tt0\n\t"
".chip 68k"
......@@ -495,7 +493,7 @@ void mac_reset(void)
}
/* should never get here */
sti();
local_irq_enable();
printk ("Restart failed. Please restart manually.\n");
while(1);
}
......
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