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