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

[PATCH] M68k IRQ API updates [7/20]

M68k Macintosh: Update to the new irq API (from Roman Zippel and me) [7/20]
parent 1eb0139e
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
int baboon_present,baboon_active; int baboon_present,baboon_active;
volatile struct baboon *baboon; volatile struct baboon *baboon;
void baboon_irq(int, void *, struct pt_regs *); irqreturn_t baboon_irq(int, void *, struct pt_regs *);
#if 0 #if 0
extern int macide_ack_intr(struct ata_channel *); extern int macide_ack_intr(struct ata_channel *);
...@@ -64,7 +64,7 @@ void __init baboon_register_interrupts(void) ...@@ -64,7 +64,7 @@ void __init baboon_register_interrupts(void)
* Baboon interrupt handler. This works a lot like a VIA. * Baboon interrupt handler. This works a lot like a VIA.
*/ */
void baboon_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t baboon_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int irq_bit,i; int irq_bit,i;
unsigned char events; unsigned char events;
...@@ -75,7 +75,8 @@ void baboon_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -75,7 +75,8 @@ void baboon_irq(int irq, void *dev_id, struct pt_regs *regs)
(uint) baboon->mb_status, baboon_active); (uint) baboon->mb_status, baboon_active);
#endif #endif
if (!(events = baboon->mb_ifr & 0x07)) return; if (!(events = baboon->mb_ifr & 0x07))
return IRQ_NONE;
for (i = 0, irq_bit = 1 ; i < 3 ; i++, irq_bit <<= 1) { for (i = 0, irq_bit = 1 ; i < 3 ; i++, irq_bit <<= 1) {
if (events & irq_bit/* & baboon_active*/) { if (events & irq_bit/* & baboon_active*/) {
...@@ -90,6 +91,7 @@ void baboon_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -90,6 +91,7 @@ void baboon_irq(int irq, void *dev_id, struct pt_regs *regs)
/* for now we need to smash all interrupts */ /* for now we need to smash all interrupts */
baboon->mb_ifr &= ~events; baboon->mb_ifr &= ~events;
#endif #endif
return IRQ_HANDLED;
} }
void baboon_irq_enable(int irq) { void baboon_irq_enable(int irq) {
......
...@@ -72,7 +72,7 @@ extern int show_mac_interrupts(struct seq_file *, void *); ...@@ -72,7 +72,7 @@ extern int show_mac_interrupts(struct seq_file *, void *);
extern void iop_preinit(void); extern void iop_preinit(void);
extern void iop_init(void); extern void iop_init(void);
extern void via_init(void); extern void via_init(void);
extern void via_init_clock(void (*func)(int, void *, struct pt_regs *)); extern void via_init_clock(irqreturn_t (*func)(int, void *, struct pt_regs *));
extern void via_flush_cache(void); extern void via_flush_cache(void);
extern void oss_init(void); extern void oss_init(void);
extern void psc_init(void); extern void psc_init(void);
...@@ -94,7 +94,7 @@ void mac_bang(int irq, void *vector, struct pt_regs *p) ...@@ -94,7 +94,7 @@ void mac_bang(int irq, void *vector, struct pt_regs *p)
mac_reset(); mac_reset();
} }
static void mac_sched_init(void (*vector)(int, void *, struct pt_regs *)) static void mac_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *))
{ {
via_init_clock(vector); via_init_clock(vector);
} }
...@@ -106,9 +106,9 @@ void mac_waitbut (void) ...@@ -106,9 +106,9 @@ void mac_waitbut (void)
} }
#endif #endif
extern void mac_default_handler(int, void *, struct pt_regs *); extern irqreturn_t mac_default_handler(int, void *, struct pt_regs *);
void (*mac_handlers[8])(int, void *, struct pt_regs *)= irqreturn_t (*mac_handlers[8])(int, void *, struct pt_regs *)=
{ {
mac_default_handler, mac_default_handler,
mac_default_handler, mac_default_handler,
......
...@@ -153,7 +153,7 @@ static struct iop_msg iop_msg_pool[NUM_IOP_MSGS]; ...@@ -153,7 +153,7 @@ static struct iop_msg iop_msg_pool[NUM_IOP_MSGS];
static struct iop_msg *iop_send_queue[NUM_IOPS][NUM_IOP_CHAN]; static struct iop_msg *iop_send_queue[NUM_IOPS][NUM_IOP_CHAN];
static struct listener iop_listeners[NUM_IOPS][NUM_IOP_CHAN]; static struct listener iop_listeners[NUM_IOPS][NUM_IOP_CHAN];
void iop_ism_irq(int, void *, struct pt_regs *); irqreturn_t iop_ism_irq(int, void *, struct pt_regs *);
extern void oss_irq_enable(int); extern void oss_irq_enable(int);
...@@ -585,7 +585,7 @@ __u8 *iop_compare_code(uint iop_num, __u8 *code_start, ...@@ -585,7 +585,7 @@ __u8 *iop_compare_code(uint iop_num, __u8 *code_start,
* Handle an ISM IOP interrupt * Handle an ISM IOP interrupt
*/ */
void iop_ism_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t iop_ism_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
uint iop_num = (uint) dev_id; uint iop_num = (uint) dev_id;
volatile struct mac_iop *iop = iop_base[iop_num]; volatile struct mac_iop *iop = iop_base[iop_num];
...@@ -636,7 +636,7 @@ void iop_ism_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -636,7 +636,7 @@ void iop_ism_irq(int irq, void *dev_id, struct pt_regs *regs)
printk("\n"); printk("\n");
#endif #endif
} }
return IRQ_HANDLED;
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
...@@ -217,10 +217,9 @@ static void scc_irq_disable(int); ...@@ -217,10 +217,9 @@ static void scc_irq_disable(int);
* console_loglevel determines NMI handler function * console_loglevel determines NMI handler function
*/ */
extern void mac_bang(int, void *, struct pt_regs *); extern irqreturn_t mac_bang(int, void *, struct pt_regs *);
irqreturn_t mac_nmi_handler(int, void *, struct pt_regs *);
void mac_nmi_handler(int, void *, struct pt_regs *); irqreturn_t mac_debug_handler(int, void *, struct pt_regs *);
void mac_debug_handler(int, void *, struct pt_regs *);
/* #define DEBUG_MACINTS */ /* #define DEBUG_MACINTS */
...@@ -499,7 +498,7 @@ int mac_irq_pending( unsigned int irq ) ...@@ -499,7 +498,7 @@ int mac_irq_pending( unsigned int irq )
*/ */
int mac_request_irq(unsigned int irq, int mac_request_irq(unsigned int irq,
void (*handler)(int, void *, struct pt_regs *), irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id) unsigned long flags, const char *devname, void *dev_id)
{ {
irq_node_t *node; irq_node_t *node;
...@@ -647,18 +646,19 @@ void mac_default_handler(int irq, void *dev_id, struct pt_regs *regs) ...@@ -647,18 +646,19 @@ void mac_default_handler(int irq, void *dev_id, struct pt_regs *regs)
static int num_debug[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; static int num_debug[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
void mac_debug_handler(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t mac_debug_handler(int irq, void *dev_id, struct pt_regs *regs)
{ {
if (num_debug[irq] < 10) { if (num_debug[irq] < 10) {
printk("DEBUG: Unexpected IRQ %d\n", irq); printk("DEBUG: Unexpected IRQ %d\n", irq);
num_debug[irq]++; num_debug[irq]++;
} }
return IRQ_HANDLED;
} }
static int in_nmi = 0; static int in_nmi = 0;
static volatile int nmi_hold = 0; static volatile int nmi_hold = 0;
void mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp) irqreturn_t mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp)
{ {
int i; int i;
/* /*
...@@ -703,6 +703,7 @@ void mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp) ...@@ -703,6 +703,7 @@ void mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp)
#endif #endif
} }
in_nmi--; in_nmi--;
return IRQ_HANDLED;
} }
/* /*
......
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
int oss_present; int oss_present;
volatile struct mac_oss *oss; volatile struct mac_oss *oss;
void oss_irq(int, void *, struct pt_regs *); irqreturn_t oss_irq(int, void *, struct pt_regs *);
void oss_nubus_irq(int, void *, struct pt_regs *); irqreturn_t oss_nubus_irq(int, void *, struct pt_regs *);
extern void via1_irq(int, void *, struct pt_regs *); extern irqreturn_t via1_irq(int, void *, struct pt_regs *);
extern void mac_scc_dispatch(int, void *, struct pt_regs *); extern irqreturn_t mac_scc_dispatch(int, void *, struct pt_regs *);
/* /*
* Initialize the OSS * Initialize the OSS
...@@ -92,12 +92,13 @@ void __init oss_nubus_init(void) ...@@ -92,12 +92,13 @@ void __init oss_nubus_init(void)
* and SCSI; everything else is routed to its own autovector IRQ. * and SCSI; everything else is routed to its own autovector IRQ.
*/ */
void oss_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t oss_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int events; int events;
events = oss->irq_pending & (OSS_IP_SOUND|OSS_IP_SCSI); events = oss->irq_pending & (OSS_IP_SOUND|OSS_IP_SCSI);
if (!events) return; if (!events)
return IRQ_NONE;
#ifdef DEBUG_IRQS #ifdef DEBUG_IRQS
if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) { if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) {
...@@ -118,6 +119,7 @@ void oss_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -118,6 +119,7 @@ void oss_irq(int irq, void *dev_id, struct pt_regs *regs)
} else { } else {
/* FIXME: error check here? */ /* FIXME: error check here? */
} }
return IRQ_HANDLED;
} }
/* /*
...@@ -126,12 +128,13 @@ void oss_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -126,12 +128,13 @@ void oss_irq(int irq, void *dev_id, struct pt_regs *regs)
* Unlike the VIA/RBV this is on its own autovector interrupt level. * Unlike the VIA/RBV this is on its own autovector interrupt level.
*/ */
void oss_nubus_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t oss_nubus_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int events, irq_bit, i; int events, irq_bit, i;
events = oss->irq_pending & OSS_IP_NUBUS; events = oss->irq_pending & OSS_IP_NUBUS;
if (!events) return; if (!events)
return IRQ_NONE;
#ifdef DEBUG_NUBUS_INT #ifdef DEBUG_NUBUS_INT
if (console_loglevel > 7) { if (console_loglevel > 7) {
...@@ -148,6 +151,7 @@ void oss_nubus_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -148,6 +151,7 @@ void oss_nubus_irq(int irq, void *dev_id, struct pt_regs *regs)
oss->irq_level[i] = OSS_IRQLEV_NUBUS; oss->irq_level[i] = OSS_IRQLEV_NUBUS;
} }
} }
return IRQ_HANDLED;
} }
/* /*
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
int psc_present; int psc_present;
volatile __u8 *psc; volatile __u8 *psc;
void psc_irq(int, void *, struct pt_regs *); irqreturn_t psc_irq(int, void *, struct pt_regs *);
/* /*
* Debugging dump, used in various places to see what's going on. * Debugging dump, used in various places to see what's going on.
...@@ -131,7 +131,7 @@ void __init psc_register_interrupts(void) ...@@ -131,7 +131,7 @@ void __init psc_register_interrupts(void)
* PSC interrupt handler. It's a lot like the VIA interrupt handler. * PSC interrupt handler. It's a lot like the VIA interrupt handler.
*/ */
void psc_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t psc_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int pIFR = pIFRbase + ((int) dev_id); int pIFR = pIFRbase + ((int) dev_id);
int pIER = pIERbase + ((int) dev_id); int pIER = pIERbase + ((int) dev_id);
...@@ -147,7 +147,8 @@ void psc_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -147,7 +147,8 @@ void psc_irq(int irq, void *dev_id, struct pt_regs *regs)
#endif #endif
events = psc_read_byte(pIFR) & psc_read_byte(pIER) & 0xF; events = psc_read_byte(pIFR) & psc_read_byte(pIER) & 0xF;
if (!events) return; if (!events)
return IRQ_NONE;
for (i = 0, irq_bit = 1 ; i < 4 ; i++, irq_bit <<= 1) { for (i = 0, irq_bit = 1 ; i < 4 ; i++, irq_bit <<= 1) {
if (events & irq_bit) { if (events & irq_bit) {
...@@ -157,6 +158,7 @@ void psc_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -157,6 +158,7 @@ void psc_irq(int irq, void *dev_id, struct pt_regs *regs)
psc_write_byte(pIER, irq_bit | 0x80); psc_write_byte(pIER, irq_bit | 0x80);
} }
} }
return IRQ_HANDLED;
} }
void psc_irq_enable(int irq) { void psc_irq_enable(int irq) {
......
...@@ -65,15 +65,15 @@ static int gIER,gIFR,gBufA,gBufB; ...@@ -65,15 +65,15 @@ static int gIER,gIFR,gBufA,gBufB;
static int nubus_active = 0; static int nubus_active = 0;
void via_debug_dump(void); void via_debug_dump(void);
void via1_irq(int, void *, struct pt_regs *); irqreturn_t via1_irq(int, void *, struct pt_regs *);
void via2_irq(int, void *, struct pt_regs *); irqreturn_t via2_irq(int, void *, struct pt_regs *);
void via_nubus_irq(int, void *, struct pt_regs *); irqreturn_t via_nubus_irq(int, void *, struct pt_regs *);
void via_irq_enable(int irq); void via_irq_enable(int irq);
void via_irq_disable(int irq); void via_irq_disable(int irq);
void via_irq_clear(int irq); void via_irq_clear(int irq);
extern void mac_bang(int, void *, struct pt_regs *); extern irqreturn_t mac_bang(int, void *, struct pt_regs *);
extern void mac_scc_dispatch(int, void *, struct pt_regs *); extern irqreturn_t mac_scc_dispatch(int, void *, struct pt_regs *);
extern int oss_present; extern int oss_present;
/* /*
...@@ -243,7 +243,7 @@ void __init via_init(void) ...@@ -243,7 +243,7 @@ void __init via_init(void)
* Start the 100 Hz clock * Start the 100 Hz clock
*/ */
void __init via_init_clock(void (*func)(int, void *, struct pt_regs *)) void __init via_init_clock(irqreturn_t (*func)(int, void *, struct pt_regs *))
{ {
via1[vACR] |= 0x40; via1[vACR] |= 0x40;
via1[vT1LL] = MAC_CLOCK_LOW; via1[vT1LL] = MAC_CLOCK_LOW;
...@@ -423,13 +423,14 @@ void __init via_nubus_init(void) ...@@ -423,13 +423,14 @@ void __init via_nubus_init(void)
* the machspec interrupt number after clearing the interrupt. * the machspec interrupt number after clearing the interrupt.
*/ */
void via1_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t via1_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int irq_bit, i; int irq_bit, i;
unsigned char events, mask; unsigned char events, mask;
mask = via1[vIER] & 0x7F; mask = via1[vIER] & 0x7F;
if (!(events = via1[vIFR] & mask)) return; if (!(events = via1[vIFR] & mask))
return IRQ_NONE;
for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1)
if (events & irq_bit) { if (events & irq_bit) {
...@@ -453,15 +454,17 @@ void via1_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -453,15 +454,17 @@ void via1_irq(int irq, void *dev_id, struct pt_regs *regs)
via_irq_enable(IRQ_MAC_NUBUS); via_irq_enable(IRQ_MAC_NUBUS);
} }
#endif #endif
return IRQ_HANDLED;
} }
void via2_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t via2_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int irq_bit, i; int irq_bit, i;
unsigned char events, mask; unsigned char events, mask;
mask = via2[gIER] & 0x7F; mask = via2[gIER] & 0x7F;
if (!(events = via2[gIFR] & mask)) return; if (!(events = via2[gIFR] & mask))
return IRQ_NONE;
for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1)
if (events & irq_bit) { if (events & irq_bit) {
...@@ -470,6 +473,7 @@ void via2_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -470,6 +473,7 @@ void via2_irq(int irq, void *dev_id, struct pt_regs *regs)
via2[gIFR] = irq_bit | rbv_clear; via2[gIFR] = irq_bit | rbv_clear;
via2[gIER] = irq_bit | 0x80; via2[gIER] = irq_bit | 0x80;
} }
return IRQ_HANDLED;
} }
/* /*
...@@ -477,12 +481,13 @@ void via2_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -477,12 +481,13 @@ void via2_irq(int irq, void *dev_id, struct pt_regs *regs)
* VIA2 dispatcher as a fast interrupt handler. * VIA2 dispatcher as a fast interrupt handler.
*/ */
void via_nubus_irq(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t via_nubus_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int irq_bit, i; int irq_bit, i;
unsigned char events; unsigned char events;
if (!(events = ~via2[gBufA] & nubus_active)) return; if (!(events = ~via2[gBufA] & nubus_active))
return IRQ_NONE;
for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) { for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) {
if (events & irq_bit) { if (events & irq_bit) {
...@@ -491,6 +496,7 @@ void via_nubus_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -491,6 +496,7 @@ void via_nubus_irq(int irq, void *dev_id, struct pt_regs *regs)
via_irq_enable(NUBUS_SOURCE_BASE + i); via_irq_enable(NUBUS_SOURCE_BASE + i);
} }
} }
return IRQ_HANDLED;
} }
void via_irq_enable(int irq) { void via_irq_enable(int irq) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __ASM_MACINTOSH_H #define __ASM_MACINTOSH_H
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/interrupt.h>
/* /*
* Apple Macintoshisms * Apple Macintoshisms
...@@ -10,7 +11,7 @@ ...@@ -10,7 +11,7 @@
extern void mac_reset(void); extern void mac_reset(void);
extern void mac_poweroff(void); extern void mac_poweroff(void);
extern void mac_init_IRQ(void); extern void mac_init_IRQ(void);
extern int mac_request_irq (unsigned int, void (*)(int, void *, extern int mac_request_irq (unsigned int, irqreturn_t (*)(int, void *,
struct pt_regs *), struct pt_regs *),
unsigned long, const char *, void *); unsigned long, const char *, void *);
extern void mac_free_irq(unsigned int, void *); extern void mac_free_irq(unsigned int, void *);
......
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