Commit fd49bf48 authored by Sam Ravnborg's avatar Sam Ravnborg Committed by David S. Miller

sparc32: irq_32.c cleanup

- drop filename in file header
- drop unused includes
- add KERN_* to printk
- fix spaces => tabs
- add spaces after reserved words
- drop all externs, they are now in header files
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 70044df4
/* /*
* arch/sparc/kernel/irq.c: Interrupt request handling routines. On the * Interrupt request handling routines. On the
* Sparc the IRQs are basically 'cast in stone' * Sparc the IRQs are basically 'cast in stone'
* and you are supposed to probe the prom's device * and you are supposed to probe the prom's device
* node trees to find out who's got which IRQ. * node trees to find out who's got which IRQ.
...@@ -11,40 +11,10 @@ ...@@ -11,40 +11,10 @@
* Copyright (C) 1998-2000 Anton Blanchard (anton@samba.org) * Copyright (C) 1998-2000 Anton Blanchard (anton@samba.org)
*/ */
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/linkage.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/signal.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/delay.h>
#include <linux/threads.h>
#include <linux/spinlock.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <asm/ptrace.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/psr.h>
#include <asm/smp.h>
#include <asm/vaddrs.h>
#include <asm/timer.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
#include <asm/traps.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
#include <asm/pcic.h> #include <asm/pcic.h>
#include <asm/cacheflush.h>
#include <asm/irq_regs.h>
#include <asm/leon.h> #include <asm/leon.h>
#include "kernel.h" #include "kernel.h"
...@@ -57,6 +27,7 @@ ...@@ -57,6 +27,7 @@
#define SMP_NOP2 #define SMP_NOP2
#define SMP_NOP3 #define SMP_NOP3
#endif /* SMP */ #endif /* SMP */
unsigned long arch_local_irq_save(void) unsigned long arch_local_irq_save(void)
{ {
unsigned long retval; unsigned long retval;
...@@ -135,8 +106,7 @@ static void irq_panic(void) ...@@ -135,8 +106,7 @@ static void irq_panic(void)
prom_halt(); prom_halt();
} }
void (*sparc_init_timers)(irq_handler_t ) = void (*sparc_init_timers)(irq_handler_t) = (void (*)(irq_handler_t))irq_panic;
(void (*)(irq_handler_t )) irq_panic;
/* /*
* Dave Redman (djhr@tadpole.co.uk) * Dave Redman (djhr@tadpole.co.uk)
...@@ -166,18 +136,16 @@ DEFINE_SPINLOCK(irq_action_lock); ...@@ -166,18 +136,16 @@ DEFINE_SPINLOCK(irq_action_lock);
int show_interrupts(struct seq_file *p, void *v) int show_interrupts(struct seq_file *p, void *v)
{ {
int i = *(loff_t *) v; int i = *(loff_t *)v;
struct irqaction * action; struct irqaction *action;
unsigned long flags; unsigned long flags;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
int j; int j;
#endif #endif
if (sparc_cpu_model == sun4d) { if (sparc_cpu_model == sun4d)
extern int show_sun4d_interrupts(struct seq_file *, void *);
return show_sun4d_interrupts(p, v); return show_sun4d_interrupts(p, v);
}
spin_lock_irqsave(&irq_action_lock, flags); spin_lock_irqsave(&irq_action_lock, flags);
if (i < NR_IRQS) { if (i < NR_IRQS) {
action = sparc_irq[i].action; action = sparc_irq[i].action;
...@@ -195,7 +163,7 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -195,7 +163,7 @@ int show_interrupts(struct seq_file *p, void *v)
seq_printf(p, " %c %s", seq_printf(p, " %c %s",
(action->flags & IRQF_DISABLED) ? '+' : ' ', (action->flags & IRQF_DISABLED) ? '+' : ' ',
action->name); action->name);
for (action=action->next; action; action = action->next) { for (action = action->next; action; action = action->next) {
seq_printf(p, ",%s %s", seq_printf(p, ",%s %s",
(action->flags & IRQF_DISABLED) ? " +" : "", (action->flags & IRQF_DISABLED) ? " +" : "",
action->name); action->name);
...@@ -209,20 +177,18 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -209,20 +177,18 @@ int show_interrupts(struct seq_file *p, void *v)
void free_irq(unsigned int irq, void *dev_id) void free_irq(unsigned int irq, void *dev_id)
{ {
struct irqaction * action; struct irqaction *action;
struct irqaction **actionp; struct irqaction **actionp;
unsigned long flags; unsigned long flags;
unsigned int cpu_irq; unsigned int cpu_irq;
if (sparc_cpu_model == sun4d) { if (sparc_cpu_model == sun4d) {
extern void sun4d_free_irq(unsigned int, void *);
sun4d_free_irq(irq, dev_id); sun4d_free_irq(irq, dev_id);
return; return;
} }
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
if (cpu_irq > 14) { /* 14 irq levels on the sparc */ if (cpu_irq > 14) { /* 14 irq levels on the sparc */
printk("Trying to free bogus IRQ %d\n", irq); printk(KERN_ERR "Trying to free bogus IRQ %d\n", irq);
return; return;
} }
...@@ -232,7 +198,7 @@ void free_irq(unsigned int irq, void *dev_id) ...@@ -232,7 +198,7 @@ void free_irq(unsigned int irq, void *dev_id)
action = *actionp; action = *actionp;
if (!action->handler) { if (!action->handler) {
printk("Trying to free free IRQ%d\n",irq); printk(KERN_ERR "Trying to free free IRQ%d\n", irq);
goto out_unlock; goto out_unlock;
} }
if (dev_id) { if (dev_id) {
...@@ -242,19 +208,21 @@ void free_irq(unsigned int irq, void *dev_id) ...@@ -242,19 +208,21 @@ void free_irq(unsigned int irq, void *dev_id)
actionp = &action->next; actionp = &action->next;
} }
if (!action) { if (!action) {
printk("Trying to free free shared IRQ%d\n",irq); printk(KERN_ERR "Trying to free free shared IRQ%d\n",
irq);
goto out_unlock; goto out_unlock;
} }
} else if (action->flags & IRQF_SHARED) { } else if (action->flags & IRQF_SHARED) {
printk("Trying to free shared IRQ%d with NULL device ID\n", irq); printk(KERN_ERR "Trying to free shared IRQ%d with NULL device ID\n",
irq);
goto out_unlock; goto out_unlock;
} }
if (action->flags & SA_STATIC_ALLOC) if (action->flags & SA_STATIC_ALLOC) {
{ /*
/* This interrupt is marked as specially allocated * This interrupt is marked as specially allocated
* so it is a bad idea to free it. * so it is a bad idea to free it.
*/ */
printk("Attempt to free statically allocated IRQ%d (%s)\n", printk(KERN_ERR "Attempt to free statically allocated IRQ%d (%s)\n",
irq, action->name); irq, action->name);
goto out_unlock; goto out_unlock;
} }
...@@ -275,7 +243,6 @@ void free_irq(unsigned int irq, void *dev_id) ...@@ -275,7 +243,6 @@ void free_irq(unsigned int irq, void *dev_id)
out_unlock: out_unlock:
spin_unlock_irqrestore(&irq_action_lock, flags); spin_unlock_irqrestore(&irq_action_lock, flags);
} }
EXPORT_SYMBOL(free_irq); EXPORT_SYMBOL(free_irq);
/* /*
...@@ -297,44 +264,41 @@ void synchronize_irq(unsigned int irq) ...@@ -297,44 +264,41 @@ void synchronize_irq(unsigned int irq)
EXPORT_SYMBOL(synchronize_irq); EXPORT_SYMBOL(synchronize_irq);
#endif /* SMP */ #endif /* SMP */
void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs) void unexpected_irq(int irq, void *dev_id, struct pt_regs *regs)
{ {
int i; int i;
struct irqaction * action; struct irqaction *action;
unsigned int cpu_irq; unsigned int cpu_irq;
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
action = sparc_irq[cpu_irq].action; action = sparc_irq[cpu_irq].action;
printk("IO device interrupt, irq = %d\n", irq); printk(KERN_ERR "IO device interrupt, irq = %d\n", irq);
printk("PC = %08lx NPC = %08lx FP=%08lx\n", regs->pc, printk(KERN_ERR "PC = %08lx NPC = %08lx FP=%08lx\n", regs->pc,
regs->npc, regs->u_regs[14]); regs->npc, regs->u_regs[14]);
if (action) { if (action) {
printk("Expecting: "); printk(KERN_ERR "Expecting: ");
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (action->handler) if (action->handler)
printk("[%s:%d:0x%x] ", action->name, printk(KERN_CONT "[%s:%d:0x%x] ", action->name,
(int) i, (unsigned int) action->handler); i, (unsigned int)action->handler);
} }
printk("AIEEE\n"); printk(KERN_ERR "AIEEE\n");
panic("bogus interrupt received"); panic("bogus interrupt received");
} }
void handler_irq(int pil, struct pt_regs * regs) void handler_irq(int pil, struct pt_regs *regs)
{ {
struct pt_regs *old_regs; struct pt_regs *old_regs;
struct irqaction * action; struct irqaction *action;
int cpu = smp_processor_id(); int cpu = smp_processor_id();
#ifdef CONFIG_SMP
extern void smp4m_irq_rotate(int cpu);
#endif
old_regs = set_irq_regs(regs); old_regs = set_irq_regs(regs);
irq_enter(); irq_enter();
disable_pil_irq(pil); disable_pil_irq(pil);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* Only rotate on lower priority IRQs (scsi, ethernet, etc.). */ /* Only rotate on lower priority IRQs (scsi, ethernet, etc.). */
if((sparc_cpu_model==sun4m) && (pil < 10)) if ((sparc_cpu_model==sun4m) && (pil < 10))
smp4m_irq_rotate(cpu); smp4m_irq_rotate(cpu);
#endif #endif
action = sparc_irq[pil].action; action = sparc_irq[pil].action;
...@@ -354,7 +318,8 @@ void handler_irq(int pil, struct pt_regs * regs) ...@@ -354,7 +318,8 @@ void handler_irq(int pil, struct pt_regs * regs)
#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE) #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
/* Fast IRQs on the Sparc can only have one routine attached to them, /*
* Fast IRQs on the Sparc can only have one routine attached to them,
* thus no sharing possible. * thus no sharing possible.
*/ */
static int request_fast_irq(unsigned int irq, static int request_fast_irq(unsigned int irq,
...@@ -367,15 +332,13 @@ static int request_fast_irq(unsigned int irq, ...@@ -367,15 +332,13 @@ static int request_fast_irq(unsigned int irq,
int ret; int ret;
#if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON #if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON
struct tt_entry *trap_table; struct tt_entry *trap_table;
extern struct tt_entry trapbase_cpu1, trapbase_cpu2, trapbase_cpu3;
#endif #endif
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
if(cpu_irq > 14) { if (cpu_irq > 14) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
if(!handler) { if (!handler) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -383,33 +346,32 @@ static int request_fast_irq(unsigned int irq, ...@@ -383,33 +346,32 @@ static int request_fast_irq(unsigned int irq,
spin_lock_irqsave(&irq_action_lock, flags); spin_lock_irqsave(&irq_action_lock, flags);
action = sparc_irq[cpu_irq].action; action = sparc_irq[cpu_irq].action;
if(action) { if (action) {
if(action->flags & IRQF_SHARED) if (action->flags & IRQF_SHARED)
panic("Trying to register fast irq when already shared.\n"); panic("Trying to register fast irq when already shared.\n");
if(irqflags & IRQF_SHARED) if (irqflags & IRQF_SHARED)
panic("Trying to register fast irq as shared.\n"); panic("Trying to register fast irq as shared.\n");
/* Anyway, someone already owns it so cannot be made fast. */ /* Anyway, someone already owns it so cannot be made fast. */
printk("request_fast_irq: Trying to register yet already owned.\n"); printk(KERN_ERR "request_fast_irq: Trying to register yet already owned.\n");
ret = -EBUSY; ret = -EBUSY;
goto out_unlock; goto out_unlock;
} }
/* If this is flagged as statically allocated then we use our /*
* If this is flagged as statically allocated then we use our
* private struct which is never freed. * private struct which is never freed.
*/ */
if (irqflags & SA_STATIC_ALLOC) { if (irqflags & SA_STATIC_ALLOC) {
if (static_irq_count < MAX_STATIC_ALLOC) if (static_irq_count < MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count++]; action = &static_irqaction[static_irq_count++];
else else
printk("Fast IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", printk(KERN_ERR "Fast IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
irq, devname); irq, devname);
} }
if (action == NULL) if (action == NULL)
action = kmalloc(sizeof(struct irqaction), action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
GFP_ATOMIC);
if (!action) { if (!action) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_unlock; goto out_unlock;
...@@ -426,9 +388,12 @@ static int request_fast_irq(unsigned int irq, ...@@ -426,9 +388,12 @@ static int request_fast_irq(unsigned int irq,
INSTANTIATE(sparc_ttable) INSTANTIATE(sparc_ttable)
#if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON #if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON
trap_table = &trapbase_cpu1; INSTANTIATE(trap_table) trap_table = &trapbase_cpu1;
trap_table = &trapbase_cpu2; INSTANTIATE(trap_table) INSTANTIATE(trap_table)
trap_table = &trapbase_cpu3; INSTANTIATE(trap_table) trap_table = &trapbase_cpu2;
INSTANTIATE(trap_table)
trap_table = &trapbase_cpu3;
INSTANTIATE(trap_table)
#endif #endif
#undef INSTANTIATE #undef INSTANTIATE
/* /*
...@@ -454,7 +419,8 @@ static int request_fast_irq(unsigned int irq, ...@@ -454,7 +419,8 @@ static int request_fast_irq(unsigned int irq,
return ret; return ret;
} }
/* These variables are used to access state from the assembler /*
* These variables are used to access state from the assembler
* interrupt handler, floppy_hardint, so we cannot put these in * interrupt handler, floppy_hardint, so we cannot put these in
* the floppy driver image because that would not work in the * the floppy driver image because that would not work in the
* modular case. * modular case.
...@@ -477,8 +443,6 @@ EXPORT_SYMBOL(pdma_base); ...@@ -477,8 +443,6 @@ EXPORT_SYMBOL(pdma_base);
unsigned long pdma_areasize; unsigned long pdma_areasize;
EXPORT_SYMBOL(pdma_areasize); EXPORT_SYMBOL(pdma_areasize);
extern void floppy_hardint(void);
static irq_handler_t floppy_irq_handler; static irq_handler_t floppy_irq_handler;
void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
...@@ -494,9 +458,11 @@ void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -494,9 +458,11 @@ void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
irq_exit(); irq_exit();
enable_pil_irq(irq); enable_pil_irq(irq);
set_irq_regs(old_regs); set_irq_regs(old_regs);
// XXX Eek, it's totally changed with preempt_count() and such /*
// if (softirq_pending(cpu)) * XXX Eek, it's totally changed with preempt_count() and such
// do_softirq(); * if (softirq_pending(cpu))
* do_softirq();
*/
} }
int sparc_floppy_request_irq(int irq, unsigned long flags, int sparc_floppy_request_irq(int irq, unsigned long flags,
...@@ -511,21 +477,18 @@ EXPORT_SYMBOL(sparc_floppy_request_irq); ...@@ -511,21 +477,18 @@ EXPORT_SYMBOL(sparc_floppy_request_irq);
int request_irq(unsigned int irq, int request_irq(unsigned int irq,
irq_handler_t handler, irq_handler_t handler,
unsigned long irqflags, const char * devname, void *dev_id) unsigned long irqflags, const char *devname, void *dev_id)
{ {
struct irqaction * action, **actionp; struct irqaction *action, **actionp;
unsigned long flags; unsigned long flags;
unsigned int cpu_irq; unsigned int cpu_irq;
int ret; int ret;
if (sparc_cpu_model == sun4d) { if (sparc_cpu_model == sun4d)
extern int sun4d_request_irq(unsigned int,
irq_handler_t ,
unsigned long, const char *, void *);
return sun4d_request_irq(irq, handler, irqflags, devname, dev_id); return sun4d_request_irq(irq, handler, irqflags, devname, dev_id);
}
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
if(cpu_irq > 14) { if (cpu_irq > 14) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -544,7 +507,8 @@ int request_irq(unsigned int irq, ...@@ -544,7 +507,8 @@ int request_irq(unsigned int irq,
goto out_unlock; goto out_unlock;
} }
if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) { if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) {
printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq); printk(KERN_ERR "Attempt to mix fast and slow interrupts on IRQ%d denied\n",
irq);
ret = -EBUSY; ret = -EBUSY;
goto out_unlock; goto out_unlock;
} }
...@@ -559,13 +523,11 @@ int request_irq(unsigned int irq, ...@@ -559,13 +523,11 @@ int request_irq(unsigned int irq,
if (static_irq_count < MAX_STATIC_ALLOC) if (static_irq_count < MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count++]; action = &static_irqaction[static_irq_count++];
else else
printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname); printk(KERN_ERR "Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
irq, devname);
} }
if (action == NULL) if (action == NULL)
action = kmalloc(sizeof(struct irqaction), action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
GFP_ATOMIC);
if (!action) { if (!action) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_unlock; goto out_unlock;
...@@ -587,7 +549,6 @@ int request_irq(unsigned int irq, ...@@ -587,7 +549,6 @@ int request_irq(unsigned int irq,
out: out:
return ret; return ret;
} }
EXPORT_SYMBOL(request_irq); EXPORT_SYMBOL(request_irq);
void disable_irq_nosync(unsigned int irq) void disable_irq_nosync(unsigned int irq)
...@@ -606,24 +567,22 @@ void enable_irq(unsigned int irq) ...@@ -606,24 +567,22 @@ void enable_irq(unsigned int irq)
{ {
__enable_irq(irq); __enable_irq(irq);
} }
EXPORT_SYMBOL(enable_irq); EXPORT_SYMBOL(enable_irq);
/* We really don't need these at all on the Sparc. We only have /*
* We really don't need these at all on the Sparc. We only have
* stubs here because they are exported to modules. * stubs here because they are exported to modules.
*/ */
unsigned long probe_irq_on(void) unsigned long probe_irq_on(void)
{ {
return 0; return 0;
} }
EXPORT_SYMBOL(probe_irq_on); EXPORT_SYMBOL(probe_irq_on);
int probe_irq_off(unsigned long mask) int probe_irq_off(unsigned long mask)
{ {
return 0; return 0;
} }
EXPORT_SYMBOL(probe_irq_off); EXPORT_SYMBOL(probe_irq_off);
/* djhr /* djhr
...@@ -636,11 +595,7 @@ EXPORT_SYMBOL(probe_irq_off); ...@@ -636,11 +595,7 @@ EXPORT_SYMBOL(probe_irq_off);
void __init init_IRQ(void) void __init init_IRQ(void)
{ {
extern void sun4c_init_IRQ( void ); switch (sparc_cpu_model) {
extern void sun4m_init_IRQ( void );
extern void sun4d_init_IRQ( void );
switch(sparc_cpu_model) {
case sun4c: case sun4c:
case sun4: case sun4:
sun4c_init_IRQ(); sun4c_init_IRQ();
......
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