diff options
| -rw-r--r-- | arch/m68k/sun3/config.c | 8 | ||||
| -rw-r--r-- | arch/m68k/sun3/sun3ints.c | 208 | ||||
| -rw-r--r-- | arch/m68k/sun3x/config.c | 7 | ||||
| -rw-r--r-- | include/asm-m68k/sun3ints.h | 22 |
4 files changed, 32 insertions, 213 deletions
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c index f1ca0dfbaa67..553c304aa2c5 100644 --- a/arch/m68k/sun3/config.c +++ b/arch/m68k/sun3/config.c | |||
| @@ -36,7 +36,6 @@ extern char _text, _end; | |||
| 36 | char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; | 36 | char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; |
| 37 | 37 | ||
| 38 | extern unsigned long sun3_gettimeoffset(void); | 38 | extern unsigned long sun3_gettimeoffset(void); |
| 39 | extern int show_sun3_interrupts (struct seq_file *, void *); | ||
| 40 | extern void sun3_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); | 39 | extern void sun3_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); |
| 41 | extern void sun3_get_model (char* model); | 40 | extern void sun3_get_model (char* model); |
| 42 | extern void idprom_init (void); | 41 | extern void idprom_init (void); |
| @@ -147,13 +146,6 @@ void __init config_sun3(void) | |||
| 147 | 146 | ||
| 148 | mach_sched_init = sun3_sched_init; | 147 | mach_sched_init = sun3_sched_init; |
| 149 | mach_init_IRQ = sun3_init_IRQ; | 148 | mach_init_IRQ = sun3_init_IRQ; |
| 150 | mach_default_handler = &sun3_default_handler; | ||
| 151 | mach_request_irq = sun3_request_irq; | ||
| 152 | mach_free_irq = sun3_free_irq; | ||
| 153 | enable_irq = sun3_enable_irq; | ||
| 154 | disable_irq = sun3_disable_irq; | ||
| 155 | mach_process_int = sun3_process_int; | ||
| 156 | mach_get_irq_list = show_sun3_interrupts; | ||
| 157 | mach_reset = sun3_reboot; | 149 | mach_reset = sun3_reboot; |
| 158 | mach_gettimeoffset = sun3_gettimeoffset; | 150 | mach_gettimeoffset = sun3_gettimeoffset; |
| 159 | mach_get_model = sun3_get_model; | 151 | mach_get_model = sun3_get_model; |
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c index e62a033cd493..0912435e9e90 100644 --- a/arch/m68k/sun3/sun3ints.c +++ b/arch/m68k/sun3/sun3ints.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
| 20 | 20 | ||
| 21 | extern void sun3_leds (unsigned char); | 21 | extern void sun3_leds (unsigned char); |
| 22 | static irqreturn_t sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp); | ||
| 23 | 22 | ||
| 24 | void sun3_disable_interrupts(void) | 23 | void sun3_disable_interrupts(void) |
| 25 | { | 24 | { |
| @@ -40,48 +39,30 @@ int led_pattern[8] = { | |||
| 40 | 39 | ||
| 41 | volatile unsigned char* sun3_intreg; | 40 | volatile unsigned char* sun3_intreg; |
| 42 | 41 | ||
| 43 | void sun3_insert_irq(irq_node_t **list, irq_node_t *node) | ||
| 44 | { | ||
| 45 | } | ||
| 46 | |||
| 47 | void sun3_delete_irq(irq_node_t **list, void *dev_id) | ||
| 48 | { | ||
| 49 | } | ||
| 50 | |||
| 51 | void sun3_enable_irq(unsigned int irq) | 42 | void sun3_enable_irq(unsigned int irq) |
| 52 | { | 43 | { |
| 53 | *sun3_intreg |= (1<<irq); | 44 | *sun3_intreg |= (1 << irq); |
| 54 | } | 45 | } |
| 55 | 46 | ||
| 56 | void sun3_disable_irq(unsigned int irq) | 47 | void sun3_disable_irq(unsigned int irq) |
| 57 | { | 48 | { |
| 58 | *sun3_intreg &= ~(1<<irq); | 49 | *sun3_intreg &= ~(1 << irq); |
| 59 | } | ||
| 60 | |||
| 61 | inline void sun3_do_irq(int irq, struct pt_regs *fp) | ||
| 62 | { | ||
| 63 | kstat_cpu(0).irqs[SYS_IRQS + irq]++; | ||
| 64 | *sun3_intreg &= ~(1<<irq); | ||
| 65 | *sun3_intreg |= (1<<irq); | ||
| 66 | } | 50 | } |
| 67 | 51 | ||
| 68 | static irqreturn_t sun3_int7(int irq, void *dev_id, struct pt_regs *fp) | 52 | static irqreturn_t sun3_int7(int irq, void *dev_id, struct pt_regs *fp) |
| 69 | { | 53 | { |
| 70 | sun3_do_irq(irq,fp); | 54 | *sun3_intreg |= (1 << irq); |
| 71 | if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 2000)) | 55 | if (!(kstat_cpu(0).irqs[irq] % 2000)) |
| 72 | sun3_leds(led_pattern[(kstat_cpu(0).irqs[SYS_IRQS+irq]%16000) | 56 | sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 16000) / 2000]); |
| 73 | /2000]); | ||
| 74 | return IRQ_HANDLED; | 57 | return IRQ_HANDLED; |
| 75 | } | 58 | } |
| 76 | 59 | ||
| 77 | static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp) | 60 | static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp) |
| 78 | { | 61 | { |
| 79 | kstat_cpu(0).irqs[SYS_IRQS + irq]++; | ||
| 80 | #ifdef CONFIG_SUN3 | 62 | #ifdef CONFIG_SUN3 |
| 81 | intersil_clear(); | 63 | intersil_clear(); |
| 82 | #endif | 64 | #endif |
| 83 | *sun3_intreg &= ~(1<<irq); | 65 | *sun3_intreg |= (1 << irq); |
| 84 | *sun3_intreg |= (1<<irq); | ||
| 85 | #ifdef CONFIG_SUN3 | 66 | #ifdef CONFIG_SUN3 |
| 86 | intersil_clear(); | 67 | intersil_clear(); |
| 87 | #endif | 68 | #endif |
| @@ -89,65 +70,8 @@ static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp) | |||
| 89 | #ifndef CONFIG_SMP | 70 | #ifndef CONFIG_SMP |
| 90 | update_process_times(user_mode(fp)); | 71 | update_process_times(user_mode(fp)); |
| 91 | #endif | 72 | #endif |
| 92 | if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 20)) | 73 | if (!(kstat_cpu(0).irqs[irq] % 20)) |
| 93 | sun3_leds(led_pattern[(kstat_cpu(0).irqs[SYS_IRQS+irq]%160) | 74 | sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]); |
| 94 | /20]); | ||
| 95 | return IRQ_HANDLED; | ||
| 96 | } | ||
| 97 | |||
| 98 | /* handle requested ints, excepting 5 and 7, which always do the same | ||
| 99 | thing */ | ||
| 100 | irqreturn_t (*sun3_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { | ||
| 101 | [0] = sun3_inthandle, | ||
| 102 | [1] = sun3_inthandle, | ||
| 103 | [2] = sun3_inthandle, | ||
| 104 | [3] = sun3_inthandle, | ||
| 105 | [4] = sun3_inthandle, | ||
| 106 | [5] = sun3_int5, | ||
| 107 | [6] = sun3_inthandle, | ||
| 108 | [7] = sun3_int7 | ||
| 109 | }; | ||
| 110 | |||
| 111 | static const char *dev_names[SYS_IRQS] = { | ||
| 112 | [5] = "timer", | ||
| 113 | [7] = "int7 handler" | ||
| 114 | }; | ||
| 115 | static void *dev_ids[SYS_IRQS]; | ||
| 116 | static irqreturn_t (*sun3_inthandler[SYS_IRQS])(int, void *, struct pt_regs *) = { | ||
| 117 | [5] = sun3_int5, | ||
| 118 | [7] = sun3_int7 | ||
| 119 | }; | ||
| 120 | static irqreturn_t (*sun3_vechandler[SUN3_INT_VECS])(int, void *, struct pt_regs *); | ||
| 121 | static void *vec_ids[SUN3_INT_VECS]; | ||
| 122 | static const char *vec_names[SUN3_INT_VECS]; | ||
| 123 | static int vec_ints[SUN3_INT_VECS]; | ||
| 124 | |||
| 125 | |||
| 126 | int show_sun3_interrupts(struct seq_file *p, void *v) | ||
| 127 | { | ||
| 128 | int i; | ||
| 129 | |||
| 130 | for(i = 0; i < (SUN3_INT_VECS-1); i++) { | ||
| 131 | if(sun3_vechandler[i] != NULL) { | ||
| 132 | seq_printf(p, "vec %3d: %10u %s\n", i+64, | ||
| 133 | vec_ints[i], | ||
| 134 | (vec_names[i]) ? vec_names[i] : | ||
| 135 | "sun3_vechandler"); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | |||
| 142 | static irqreturn_t sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp) | ||
| 143 | { | ||
| 144 | if(sun3_inthandler[irq] == NULL) | ||
| 145 | panic ("bad interrupt %d received (id %p)\n",irq, dev_id); | ||
| 146 | |||
| 147 | kstat_cpu(0).irqs[SYS_IRQS + irq]++; | ||
| 148 | *sun3_intreg &= ~(1<<irq); | ||
| 149 | |||
| 150 | sun3_inthandler[irq](irq, dev_ids[irq], fp); | ||
| 151 | return IRQ_HANDLED; | 75 | return IRQ_HANDLED; |
| 152 | } | 76 | } |
| 153 | 77 | ||
| @@ -157,109 +81,31 @@ static irqreturn_t sun3_vec255(int irq, void *dev_id, struct pt_regs *fp) | |||
| 157 | return IRQ_HANDLED; | 81 | return IRQ_HANDLED; |
| 158 | } | 82 | } |
| 159 | 83 | ||
| 160 | void sun3_init_IRQ(void) | 84 | static void sun3_inthandle(unsigned int irq, struct pt_regs *fp) |
| 161 | { | 85 | { |
| 162 | int i; | 86 | *sun3_intreg &= ~(1 << irq); |
| 163 | |||
| 164 | *sun3_intreg = 1; | ||
| 165 | |||
| 166 | for(i = 0; i < SYS_IRQS; i++) | ||
| 167 | { | ||
| 168 | if(dev_names[i]) | ||
| 169 | cpu_request_irq(i, sun3_default_handler[i], 0, | ||
| 170 | dev_names[i], NULL); | ||
| 171 | } | ||
| 172 | |||
| 173 | for(i = 0; i < 192; i++) | ||
| 174 | sun3_vechandler[i] = NULL; | ||
| 175 | |||
| 176 | sun3_vechandler[191] = sun3_vec255; | ||
| 177 | } | ||
| 178 | |||
| 179 | int sun3_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
| 180 | unsigned long flags, const char *devname, void *dev_id) | ||
| 181 | { | ||
| 182 | |||
| 183 | if(irq < SYS_IRQS) { | ||
| 184 | if(sun3_inthandler[irq] != NULL) { | ||
| 185 | printk("sun3_request_irq: request for irq %d -- already taken!\n", irq); | ||
| 186 | return 1; | ||
| 187 | } | ||
| 188 | |||
| 189 | sun3_inthandler[irq] = handler; | ||
| 190 | dev_ids[irq] = dev_id; | ||
| 191 | dev_names[irq] = devname; | ||
| 192 | |||
| 193 | /* setting devname would be nice */ | ||
| 194 | cpu_request_irq(irq, sun3_default_handler[irq], 0, devname, | ||
| 195 | NULL); | ||
| 196 | |||
| 197 | return 0; | ||
| 198 | } else { | ||
| 199 | if((irq >= 64) && (irq <= 255)) { | ||
| 200 | int vec; | ||
| 201 | |||
| 202 | vec = irq - 64; | ||
| 203 | if(sun3_vechandler[vec] != NULL) { | ||
| 204 | printk("sun3_request_irq: request for vec %d -- already taken!\n", irq); | ||
| 205 | return 1; | ||
| 206 | } | ||
| 207 | |||
| 208 | sun3_vechandler[vec] = handler; | ||
| 209 | vec_ids[vec] = dev_id; | ||
| 210 | vec_names[vec] = devname; | ||
| 211 | vec_ints[vec] = 0; | ||
| 212 | |||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | } | ||
| 216 | |||
| 217 | printk("sun3_request_irq: invalid irq %d\n", irq); | ||
| 218 | return 1; | ||
| 219 | 87 | ||
| 88 | m68k_handle_int(irq, fp); | ||
| 220 | } | 89 | } |
| 221 | 90 | ||
| 222 | void sun3_free_irq(unsigned int irq, void *dev_id) | 91 | static struct irq_controller sun3_irq_controller = { |
| 223 | { | 92 | .name = "sun3", |
| 224 | 93 | .lock = SPIN_LOCK_UNLOCKED, | |
| 225 | if(irq < SYS_IRQS) { | 94 | .startup = m68k_irq_startup, |
| 226 | if(sun3_inthandler[irq] == NULL) | 95 | .shutdown = m68k_irq_shutdown, |
| 227 | panic("sun3_free_int: attempt to free unused irq %d\n", irq); | 96 | .enable = sun3_enable_irq, |
| 228 | if(dev_ids[irq] != dev_id) | 97 | .disable = sun3_disable_irq, |
| 229 | panic("sun3_free_int: incorrect dev_id for irq %d\n", irq); | 98 | }; |
| 230 | |||
| 231 | sun3_inthandler[irq] = NULL; | ||
| 232 | return; | ||
| 233 | } else if((irq >= 64) && (irq <= 255)) { | ||
| 234 | int vec; | ||
| 235 | |||
| 236 | vec = irq - 64; | ||
| 237 | if(sun3_vechandler[vec] == NULL) | ||
| 238 | panic("sun3_free_int: attempt to free unused vector %d\n", irq); | ||
| 239 | if(vec_ids[irq] != dev_id) | ||
| 240 | panic("sun3_free_int: incorrect dev_id for vec %d\n", irq); | ||
| 241 | |||
| 242 | sun3_vechandler[vec] = NULL; | ||
| 243 | return; | ||
| 244 | } else { | ||
| 245 | panic("sun3_free_irq: invalid irq %d\n", irq); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | 99 | ||
| 249 | irqreturn_t sun3_process_int(int irq, struct pt_regs *regs) | 100 | void sun3_init_IRQ(void) |
| 250 | { | 101 | { |
| 102 | *sun3_intreg = 1; | ||
| 251 | 103 | ||
| 252 | if((irq >= 64) && (irq <= 255)) { | 104 | m68k_setup_auto_interrupt(sun3_inthandle); |
| 253 | int vec; | 105 | m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7); |
| 254 | 106 | m68k_setup_user_interrupt(VEC_USER, 192, NULL); | |
| 255 | vec = irq - 64; | ||
| 256 | if(sun3_vechandler[vec] == NULL) | ||
| 257 | panic ("bad interrupt vector %d received\n",irq); | ||
| 258 | 107 | ||
| 259 | vec_ints[vec]++; | 108 | request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL); |
| 260 | return sun3_vechandler[vec](irq, vec_ids[vec], regs); | 109 | request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL); |
| 261 | } else { | 110 | request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL); |
| 262 | panic("sun3_process_int: unable to handle interrupt vector %d\n", | ||
| 263 | irq); | ||
| 264 | } | ||
| 265 | } | 111 | } |
diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c index 0920f5d33606..52fb17408869 100644 --- a/arch/m68k/sun3x/config.c +++ b/arch/m68k/sun3x/config.c | |||
| @@ -52,17 +52,10 @@ void __init config_sun3x(void) | |||
| 52 | 52 | ||
| 53 | sun3x_prom_init(); | 53 | sun3x_prom_init(); |
| 54 | 54 | ||
| 55 | mach_get_irq_list = show_sun3_interrupts; | ||
| 56 | mach_max_dma_address = 0xffffffff; /* we can DMA anywhere, whee */ | 55 | mach_max_dma_address = 0xffffffff; /* we can DMA anywhere, whee */ |
| 57 | 56 | ||
| 58 | mach_default_handler = &sun3_default_handler; | ||
| 59 | mach_sched_init = sun3x_sched_init; | 57 | mach_sched_init = sun3x_sched_init; |
| 60 | mach_init_IRQ = sun3_init_IRQ; | 58 | mach_init_IRQ = sun3_init_IRQ; |
| 61 | enable_irq = sun3_enable_irq; | ||
| 62 | disable_irq = sun3_disable_irq; | ||
| 63 | mach_request_irq = sun3_request_irq; | ||
| 64 | mach_free_irq = sun3_free_irq; | ||
| 65 | mach_process_int = sun3_process_int; | ||
| 66 | 59 | ||
| 67 | mach_gettimeoffset = sun3x_gettimeoffset; | 60 | mach_gettimeoffset = sun3x_gettimeoffset; |
| 68 | mach_reset = sun3x_reboot; | 61 | mach_reset = sun3x_reboot; |
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h index bd038fccb64b..de91fa071b99 100644 --- a/include/asm-m68k/sun3ints.h +++ b/include/asm-m68k/sun3ints.h | |||
| @@ -12,37 +12,25 @@ | |||
| 12 | #define SUN3INTS_H | 12 | #define SUN3INTS_H |
| 13 | 13 | ||
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/sched.h> | ||
| 17 | #include <linux/kernel_stat.h> | ||
| 18 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
| 19 | #include <linux/seq_file.h> | ||
| 20 | #include <asm/segment.h> | ||
| 21 | #include <asm/intersil.h> | 16 | #include <asm/intersil.h> |
| 22 | #include <asm/oplib.h> | 17 | #include <asm/oplib.h> |
| 18 | #include <asm/traps.h> | ||
| 23 | 19 | ||
| 24 | #define SUN3_INT_VECS 192 | 20 | #define SUN3_INT_VECS 192 |
| 25 | 21 | ||
| 26 | void sun3_enable_irq(unsigned int irq); | 22 | void sun3_enable_irq(unsigned int irq); |
| 27 | void sun3_disable_irq(unsigned int irq); | 23 | void sun3_disable_irq(unsigned int irq); |
| 28 | int sun3_request_irq(unsigned int irq, | ||
| 29 | irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
| 30 | unsigned long flags, const char *devname, void *dev_id | ||
| 31 | ); | ||
| 32 | extern void sun3_init_IRQ (void); | 24 | extern void sun3_init_IRQ (void); |
| 33 | extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *); | ||
| 34 | extern void sun3_free_irq (unsigned int irq, void *dev_id); | ||
| 35 | extern void sun3_enable_interrupts (void); | 25 | extern void sun3_enable_interrupts (void); |
| 36 | extern void sun3_disable_interrupts (void); | 26 | extern void sun3_disable_interrupts (void); |
| 37 | extern int show_sun3_interrupts(struct seq_file *, void *); | ||
| 38 | extern irqreturn_t sun3_process_int(int, struct pt_regs *); | ||
| 39 | extern volatile unsigned char* sun3_intreg; | 27 | extern volatile unsigned char* sun3_intreg; |
| 40 | 28 | ||
| 41 | /* master list of VME vectors -- don't fuck with this */ | 29 | /* master list of VME vectors -- don't fuck with this */ |
| 42 | #define SUN3_VEC_FLOPPY 0x40 | 30 | #define SUN3_VEC_FLOPPY (IRQ_USER+0) |
| 43 | #define SUN3_VEC_VMESCSI0 0x40 | 31 | #define SUN3_VEC_VMESCSI0 (IRQ_USER+0) |
| 44 | #define SUN3_VEC_VMESCSI1 0x41 | 32 | #define SUN3_VEC_VMESCSI1 (IRQ_USER+1) |
| 45 | #define SUN3_VEC_CG 0xA8 | 33 | #define SUN3_VEC_CG (IRQ_USER+104) |
| 46 | 34 | ||
| 47 | 35 | ||
| 48 | #endif /* SUN3INTS_H */ | 36 | #endif /* SUN3INTS_H */ |
