38
38
#include <asm/rtlx.h>
39
39
40
40
static unsigned long _msc01_biu_base ;
41
- static unsigned int ipi_map [NR_CPUS ];
42
41
43
42
static DEFINE_RAW_SPINLOCK (mips_irq_lock );
44
43
45
- #ifdef CONFIG_MIPS_GIC_IPI
46
- DECLARE_BITMAP (ipi_ints , GIC_NUM_INTRS );
47
- #endif
48
-
49
44
static inline int mips_pcibios_iack (void )
50
45
{
51
46
int irq ;
@@ -127,24 +122,10 @@ static void malta_hw0_irqdispatch(void)
127
122
#endif
128
123
}
129
124
130
- static void malta_ipi_irqdispatch ( void )
125
+ static irqreturn_t i8259_handler ( int irq , void * dev_id )
131
126
{
132
- #ifdef CONFIG_MIPS_GIC_IPI
133
- unsigned long irq ;
134
- DECLARE_BITMAP (pending , GIC_NUM_INTRS );
135
-
136
- gic_get_int_mask (pending , ipi_ints );
137
-
138
- irq = find_first_bit (pending , GIC_NUM_INTRS );
139
-
140
- while (irq < GIC_NUM_INTRS ) {
141
- do_IRQ (MIPS_GIC_IRQ_BASE + irq );
142
-
143
- irq = find_next_bit (pending , GIC_NUM_INTRS , irq + 1 );
144
- }
145
- #endif
146
- if (gic_compare_int ())
147
- do_IRQ (MIPS_GIC_IRQ_BASE );
127
+ malta_hw0_irqdispatch ();
128
+ return IRQ_HANDLED ;
148
129
}
149
130
150
131
static void corehi_irqdispatch (void )
@@ -203,6 +184,12 @@ static void corehi_irqdispatch(void)
203
184
die ("CoreHi interrupt" , regs );
204
185
}
205
186
187
+ static irqreturn_t corehi_handler (int irq , void * dev_id )
188
+ {
189
+ corehi_irqdispatch ();
190
+ return IRQ_HANDLED ;
191
+ }
192
+
206
193
static inline int clz (unsigned long x )
207
194
{
208
195
__asm__(
@@ -286,10 +273,9 @@ asmlinkage void plat_irq_dispatch(void)
286
273
287
274
irq = irq_ffs (pending );
288
275
289
- if (irq == MIPSCPU_INT_I8259A )
290
- malta_hw0_irqdispatch ();
291
- else if (gic_present && ((1 << irq ) & ipi_map [smp_processor_id ()]))
292
- malta_ipi_irqdispatch ();
276
+ /* HACK: GIC doesn't properly dispatch local interrupts yet */
277
+ if (gic_present && irq == MIPSCPU_INT_GIC && gic_compare_int ())
278
+ do_IRQ (MIPS_GIC_IRQ_BASE );
293
279
else
294
280
do_IRQ (MIPS_CPU_IRQ_BASE + irq );
295
281
}
@@ -312,13 +298,6 @@ static void ipi_call_dispatch(void)
312
298
do_IRQ (MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ );
313
299
}
314
300
315
- #endif /* CONFIG_MIPS_MT_SMP */
316
-
317
- #ifdef CONFIG_MIPS_GIC_IPI
318
-
319
- #define GIC_MIPS_CPU_IPI_RESCHED_IRQ 3
320
- #define GIC_MIPS_CPU_IPI_CALL_IRQ 4
321
-
322
301
static irqreturn_t ipi_resched_interrupt (int irq , void * dev_id )
323
302
{
324
303
#ifdef CONFIG_MIPS_VPE_APSP_API_CMP
@@ -349,31 +328,16 @@ static struct irqaction irq_call = {
349
328
.flags = IRQF_PERCPU ,
350
329
.name = "IPI_call"
351
330
};
352
- #endif /* CONFIG_MIPS_GIC_IPI */
353
-
354
- static int gic_resched_int_base ;
355
- static int gic_call_int_base ;
356
- #define GIC_RESCHED_INT (cpu ) (gic_resched_int_base+(cpu))
357
- #define GIC_CALL_INT (cpu ) (gic_call_int_base+(cpu))
358
-
359
- unsigned int plat_ipi_call_int_xlate (unsigned int cpu )
360
- {
361
- return GIC_CALL_INT (cpu );
362
- }
363
-
364
- unsigned int plat_ipi_resched_int_xlate (unsigned int cpu )
365
- {
366
- return GIC_RESCHED_INT (cpu );
367
- }
331
+ #endif /* CONFIG_MIPS_MT_SMP */
368
332
369
333
static struct irqaction i8259irq = {
370
- .handler = no_action ,
334
+ .handler = i8259_handler ,
371
335
.name = "XT-PIC cascade" ,
372
336
.flags = IRQF_NO_THREAD ,
373
337
};
374
338
375
339
static struct irqaction corehi_irqaction = {
376
- .handler = no_action ,
340
+ .handler = corehi_handler ,
377
341
.name = "CoreHi" ,
378
342
.flags = IRQF_NO_THREAD ,
379
343
};
@@ -399,60 +363,6 @@ static msc_irqmap_t msc_eicirqmap[] __initdata = {
399
363
400
364
static int msc_nr_eicirqs __initdata = ARRAY_SIZE (msc_eicirqmap );
401
365
402
- /*
403
- * This GIC specific tabular array defines the association between External
404
- * Interrupts and CPUs/Core Interrupts. The nature of the External
405
- * Interrupts is also defined here - polarity/trigger.
406
- */
407
-
408
- #define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
409
- #define X GIC_UNUSED
410
-
411
- static struct gic_intr_map gic_intr_map [GIC_NUM_INTRS ] = {
412
- { X , X , X , X , 0 },
413
- { X , X , X , X , 0 },
414
- { X , X , X , X , 0 },
415
- { 0 , GIC_CPU_INT0 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
416
- { 0 , GIC_CPU_INT1 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
417
- { 0 , GIC_CPU_INT2 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
418
- { 0 , GIC_CPU_INT3 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
419
- { 0 , GIC_CPU_INT4 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
420
- { 0 , GIC_CPU_INT3 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
421
- { 0 , GIC_CPU_INT3 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
422
- { X , X , X , X , 0 },
423
- { X , X , X , X , 0 },
424
- { 0 , GIC_CPU_INT3 , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
425
- { 0 , GIC_CPU_NMI , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
426
- { 0 , GIC_CPU_NMI , GIC_POL_POS , GIC_TRIG_LEVEL , GIC_FLAG_TRANSPARENT },
427
- { X , X , X , X , 0 },
428
- /* The remainder of this table is initialised by fill_ipi_map */
429
- };
430
- #undef X
431
-
432
- #ifdef CONFIG_MIPS_GIC_IPI
433
- static void __init fill_ipi_map1 (int baseintr , int cpu , int cpupin )
434
- {
435
- int intr = baseintr + cpu ;
436
- gic_intr_map [intr ].cpunum = cpu ;
437
- gic_intr_map [intr ].pin = cpupin ;
438
- gic_intr_map [intr ].polarity = GIC_POL_POS ;
439
- gic_intr_map [intr ].trigtype = GIC_TRIG_EDGE ;
440
- gic_intr_map [intr ].flags = 0 ;
441
- ipi_map [cpu ] |= (1 << (cpupin + 2 ));
442
- bitmap_set (ipi_ints , intr , 1 );
443
- }
444
-
445
- static void __init fill_ipi_map (void )
446
- {
447
- int cpu ;
448
-
449
- for (cpu = 0 ; cpu < nr_cpu_ids ; cpu ++ ) {
450
- fill_ipi_map1 (gic_resched_int_base , cpu , GIC_CPU_INT1 );
451
- fill_ipi_map1 (gic_call_int_base , cpu , GIC_CPU_INT2 );
452
- }
453
- }
454
- #endif
455
-
456
366
void __init arch_init_ipiirq (int irq , struct irqaction * action )
457
367
{
458
368
setup_irq (irq , action );
@@ -461,6 +371,8 @@ void __init arch_init_ipiirq(int irq, struct irqaction *action)
461
371
462
372
void __init arch_init_irq (void )
463
373
{
374
+ int corehi_irq , i8259_irq ;
375
+
464
376
init_i8259_irqs ();
465
377
466
378
if (!cpu_has_veic )
@@ -507,63 +419,20 @@ void __init arch_init_irq(void)
507
419
msc_nr_irqs );
508
420
}
509
421
510
- if (cpu_has_veic ) {
511
- set_vi_handler (MSC01E_INT_I8259A , malta_hw0_irqdispatch );
512
- set_vi_handler (MSC01E_INT_COREHI , corehi_irqdispatch );
513
- setup_irq (MSC01E_INT_BASE + MSC01E_INT_I8259A , & i8259irq );
514
- setup_irq (MSC01E_INT_BASE + MSC01E_INT_COREHI , & corehi_irqaction );
515
- } else if (cpu_has_vint ) {
516
- set_vi_handler (MIPSCPU_INT_I8259A , malta_hw0_irqdispatch );
517
- set_vi_handler (MIPSCPU_INT_COREHI , corehi_irqdispatch );
518
- setup_irq (MIPS_CPU_IRQ_BASE + MIPSCPU_INT_I8259A , & i8259irq );
519
- setup_irq (MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI ,
520
- & corehi_irqaction );
521
- } else {
522
- setup_irq (MIPS_CPU_IRQ_BASE + MIPSCPU_INT_I8259A , & i8259irq );
523
- setup_irq (MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI ,
524
- & corehi_irqaction );
525
- }
526
-
527
422
if (gic_present ) {
528
- /* FIXME */
529
423
int i ;
530
- #if defined(CONFIG_MIPS_GIC_IPI )
531
- gic_call_int_base = GIC_NUM_INTRS -
532
- (NR_CPUS - nr_cpu_ids ) * 2 - nr_cpu_ids ;
533
- gic_resched_int_base = gic_call_int_base - nr_cpu_ids ;
534
- fill_ipi_map ();
535
- #endif
536
- gic_init (GIC_BASE_ADDR , GIC_ADDRSPACE_SZ , gic_intr_map ,
537
- ARRAY_SIZE (gic_intr_map ), MIPS_GIC_IRQ_BASE );
424
+
425
+ gic_init (GIC_BASE_ADDR , GIC_ADDRSPACE_SZ , MIPSCPU_INT_GIC ,
426
+ MIPS_GIC_IRQ_BASE );
538
427
if (!mips_cm_present ()) {
539
428
/* Enable the GIC */
540
429
i = REG (_msc01_biu_base , MSC01_SC_CFG );
541
430
REG (_msc01_biu_base , MSC01_SC_CFG ) =
542
431
(i | (0x1 << MSC01_SC_CFG_GICENA_SHF ));
543
432
pr_debug ("GIC Enabled\n" );
544
433
}
545
- #if defined(CONFIG_MIPS_GIC_IPI )
546
- /* set up ipi interrupts */
547
- if (cpu_has_vint ) {
548
- set_vi_handler (MIPSCPU_INT_IPI0 , malta_ipi_irqdispatch );
549
- set_vi_handler (MIPSCPU_INT_IPI1 , malta_ipi_irqdispatch );
550
- }
551
- /* Argh.. this really needs sorting out.. */
552
- pr_info ("CPU%d: status register was %08x\n" ,
553
- smp_processor_id (), read_c0_status ());
554
- write_c0_status (read_c0_status () | STATUSF_IP3 | STATUSF_IP4 );
555
- pr_info ("CPU%d: status register now %08x\n" ,
556
- smp_processor_id (), read_c0_status ());
557
- write_c0_status (0x1100dc00 );
558
- pr_info ("CPU%d: status register frc %08x\n" ,
559
- smp_processor_id (), read_c0_status ());
560
- for (i = 0 ; i < nr_cpu_ids ; i ++ ) {
561
- arch_init_ipiirq (MIPS_GIC_IRQ_BASE +
562
- GIC_RESCHED_INT (i ), & irq_resched );
563
- arch_init_ipiirq (MIPS_GIC_IRQ_BASE +
564
- GIC_CALL_INT (i ), & irq_call );
565
- }
566
- #endif
434
+ i8259_irq = MIPS_GIC_IRQ_BASE + GIC_INT_I8259A ;
435
+ corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI ;
567
436
} else {
568
437
#if defined(CONFIG_MIPS_MT_SMP )
569
438
/* set up ipi interrupts */
@@ -587,7 +456,21 @@ void __init arch_init_irq(void)
587
456
arch_init_ipiirq (cpu_ipi_resched_irq , & irq_resched );
588
457
arch_init_ipiirq (cpu_ipi_call_irq , & irq_call );
589
458
#endif
459
+ if (cpu_has_veic ) {
460
+ set_vi_handler (MSC01E_INT_I8259A ,
461
+ malta_hw0_irqdispatch );
462
+ set_vi_handler (MSC01E_INT_COREHI ,
463
+ corehi_irqdispatch );
464
+ i8259_irq = MSC01E_INT_BASE + MSC01E_INT_I8259A ;
465
+ corehi_irq = MSC01E_INT_BASE + MSC01E_INT_COREHI ;
466
+ } else {
467
+ i8259_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_I8259A ;
468
+ corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI ;
469
+ }
590
470
}
471
+
472
+ setup_irq (i8259_irq , & i8259irq );
473
+ setup_irq (corehi_irq , & corehi_irqaction );
591
474
}
592
475
593
476
void malta_be_init (void )
0 commit comments