Lines Matching refs:mpic
51 static struct mpic *mpics;
52 static struct mpic *mpic_primary;
145 #define MPIC_INFO(name) mpic->hw_set[MPIC_IDX_##name]
153 static inline unsigned int mpic_processor_id(struct mpic *mpic) in mpic_processor_id() argument
157 if (!(mpic->flags & MPIC_SECONDARY)) in mpic_processor_id()
205 static inline u32 _mpic_ipi_read(struct mpic *mpic, unsigned int ipi) in _mpic_ipi_read() argument
207 enum mpic_reg_type type = mpic->reg_type; in _mpic_ipi_read()
211 if ((mpic->flags & MPIC_BROKEN_IPI) && type == mpic_access_mmio_le) in _mpic_ipi_read()
213 return _mpic_read(type, &mpic->gregs, offset); in _mpic_ipi_read()
216 static inline void _mpic_ipi_write(struct mpic *mpic, unsigned int ipi, u32 value) in _mpic_ipi_write() argument
221 _mpic_write(mpic->reg_type, &mpic->gregs, offset, value); in _mpic_ipi_write()
224 static inline u32 _mpic_tm_read(struct mpic *mpic, unsigned int tm) in _mpic_tm_read() argument
232 return _mpic_read(mpic->reg_type, &mpic->tmregs, offset); in _mpic_tm_read()
235 static inline void _mpic_tm_write(struct mpic *mpic, unsigned int tm, u32 value) in _mpic_tm_write() argument
243 _mpic_write(mpic->reg_type, &mpic->tmregs, offset, value); in _mpic_tm_write()
246 static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg) in _mpic_cpu_read() argument
248 unsigned int cpu = mpic_processor_id(mpic); in _mpic_cpu_read()
250 return _mpic_read(mpic->reg_type, &mpic->cpuregs[cpu], reg); in _mpic_cpu_read()
253 static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value) in _mpic_cpu_write() argument
255 unsigned int cpu = mpic_processor_id(mpic); in _mpic_cpu_write()
257 _mpic_write(mpic->reg_type, &mpic->cpuregs[cpu], reg, value); in _mpic_cpu_write()
260 static inline u32 _mpic_irq_read(struct mpic *mpic, unsigned int src_no, unsigned int reg) in _mpic_irq_read() argument
262 unsigned int isu = src_no >> mpic->isu_shift; in _mpic_irq_read()
263 unsigned int idx = src_no & mpic->isu_mask; in _mpic_irq_read()
266 val = _mpic_read(mpic->reg_type, &mpic->isus[isu], in _mpic_irq_read()
271 mpic->isu_reg0_shadow[src_no]; in _mpic_irq_read()
276 static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no, in _mpic_irq_write() argument
279 unsigned int isu = src_no >> mpic->isu_shift; in _mpic_irq_write()
280 unsigned int idx = src_no & mpic->isu_mask; in _mpic_irq_write()
282 _mpic_write(mpic->reg_type, &mpic->isus[isu], in _mpic_irq_write()
287 mpic->isu_reg0_shadow[src_no] = in _mpic_irq_write()
292 #define mpic_read(b,r) _mpic_read(mpic->reg_type,&(b),(r))
293 #define mpic_write(b,r,v) _mpic_write(mpic->reg_type,&(b),(r),(v))
294 #define mpic_ipi_read(i) _mpic_ipi_read(mpic,(i))
295 #define mpic_ipi_write(i,v) _mpic_ipi_write(mpic,(i),(v))
296 #define mpic_tm_read(i) _mpic_tm_read(mpic,(i))
297 #define mpic_tm_write(i,v) _mpic_tm_write(mpic,(i),(v))
298 #define mpic_cpu_read(i) _mpic_cpu_read(mpic,(i))
299 #define mpic_cpu_write(i,v) _mpic_cpu_write(mpic,(i),(v))
300 #define mpic_irq_read(s,r) _mpic_irq_read(mpic,(s),(r))
301 #define mpic_irq_write(s,r,v) _mpic_irq_write(mpic,(s),(r),(v))
309 static void _mpic_map_mmio(struct mpic *mpic, phys_addr_t phys_addr, in _mpic_map_mmio() argument
318 static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb, in _mpic_map_dcr() argument
321 phys_addr_t phys_addr = dcr_resource_start(mpic->node, 0); in _mpic_map_dcr()
322 rb->dhost = dcr_map(mpic->node, phys_addr + offset, size); in _mpic_map_dcr()
326 static inline void mpic_map(struct mpic *mpic, in mpic_map() argument
330 if (mpic->flags & MPIC_USES_DCR) in mpic_map()
331 _mpic_map_dcr(mpic, rb, offset, size); in mpic_map()
333 _mpic_map_mmio(mpic, phys_addr, rb, offset, size); in mpic_map()
344 static void __init mpic_test_broken_ipi(struct mpic *mpic) in mpic_test_broken_ipi() argument
348 mpic_write(mpic->gregs, MPIC_INFO(GREG_IPI_VECTOR_PRI_0), MPIC_VECPRI_MASK); in mpic_test_broken_ipi()
349 r = mpic_read(mpic->gregs, MPIC_INFO(GREG_IPI_VECTOR_PRI_0)); in mpic_test_broken_ipi()
353 mpic->flags |= MPIC_BROKEN_IPI; in mpic_test_broken_ipi()
362 static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source) in mpic_is_ht_interrupt() argument
364 if (source >= 128 || !mpic->fixups) in mpic_is_ht_interrupt()
366 return mpic->fixups[source].base != NULL; in mpic_is_ht_interrupt()
370 static inline void mpic_ht_end_irq(struct mpic *mpic, unsigned int source) in mpic_ht_end_irq() argument
372 struct mpic_irq_fixup *fixup = &mpic->fixups[source]; in mpic_ht_end_irq()
379 raw_spin_lock(&mpic->fixup_lock); in mpic_ht_end_irq()
382 raw_spin_unlock(&mpic->fixup_lock); in mpic_ht_end_irq()
386 static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source, in mpic_startup_ht_interrupt() argument
389 struct mpic_irq_fixup *fixup = &mpic->fixups[source]; in mpic_startup_ht_interrupt()
398 raw_spin_lock_irqsave(&mpic->fixup_lock, flags); in mpic_startup_ht_interrupt()
406 raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags); in mpic_startup_ht_interrupt()
411 mpic->save_data[source].fixup_data = tmp | 1; in mpic_startup_ht_interrupt()
415 static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source) in mpic_shutdown_ht_interrupt() argument
417 struct mpic_irq_fixup *fixup = &mpic->fixups[source]; in mpic_shutdown_ht_interrupt()
427 raw_spin_lock_irqsave(&mpic->fixup_lock, flags); in mpic_shutdown_ht_interrupt()
432 raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags); in mpic_shutdown_ht_interrupt()
437 mpic->save_data[source].fixup_data = tmp & ~1; in mpic_shutdown_ht_interrupt()
442 static void __init mpic_scan_ht_msi(struct mpic *mpic, u8 __iomem *devbase, in mpic_scan_ht_msi() argument
478 static void __init mpic_scan_ht_msi(struct mpic *mpic, u8 __iomem *devbase, in mpic_scan_ht_msi() argument
485 static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase, in mpic_scan_ht_pic() argument
521 mpic->fixups[irq].index = i; in mpic_scan_ht_pic()
522 mpic->fixups[irq].base = base; in mpic_scan_ht_pic()
525 mpic->fixups[irq].applebase = devbase + 0x60; in mpic_scan_ht_pic()
527 mpic->fixups[irq].applebase = NULL; in mpic_scan_ht_pic()
529 mpic->fixups[irq].data = readl(base + 4) | 0x80000000; in mpic_scan_ht_pic()
534 static void __init mpic_scan_ht_pics(struct mpic *mpic) in mpic_scan_ht_pics() argument
542 mpic->fixups = kzalloc(128 * sizeof(*mpic->fixups), GFP_KERNEL); in mpic_scan_ht_pics()
543 BUG_ON(mpic->fixups == NULL); in mpic_scan_ht_pics()
546 raw_spin_lock_init(&mpic->fixup_lock); in mpic_scan_ht_pics()
574 mpic_scan_ht_pic(mpic, devbase, devfn, l); in mpic_scan_ht_pics()
575 mpic_scan_ht_msi(mpic, devbase, devfn); in mpic_scan_ht_pics()
586 static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source) in mpic_is_ht_interrupt() argument
591 static void __init mpic_scan_ht_pics(struct mpic *mpic) in mpic_scan_ht_pics() argument
598 static struct mpic *mpic_find(unsigned int irq) in mpic_find()
607 static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int src) in mpic_is_ipi() argument
609 return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]); in mpic_is_ipi()
613 static unsigned int mpic_is_tm(struct mpic *mpic, unsigned int src) in mpic_is_tm() argument
615 return (src >= mpic->timer_vecs[0] && src <= mpic->timer_vecs[7]); in mpic_is_tm()
631 static inline struct mpic * mpic_from_ipi(struct irq_data *d) in mpic_from_ipi()
638 static inline struct mpic * mpic_from_irq(unsigned int irq) in mpic_from_irq()
644 static inline struct mpic * mpic_from_irq_data(struct irq_data *d) in mpic_from_irq_data()
650 static inline void mpic_eoi(struct mpic *mpic) in mpic_eoi() argument
664 struct mpic *mpic = mpic_from_irq_data(d); in mpic_unmask_irq() local
667 DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, d->irq, src); in mpic_unmask_irq()
685 struct mpic *mpic = mpic_from_irq_data(d); in mpic_mask_irq() local
688 DBG("%s: disable_irq: %d (src %d)\n", mpic->name, d->irq, src); in mpic_mask_irq()
706 struct mpic *mpic = mpic_from_irq_data(d); in mpic_end_irq() local
709 DBG("%s: end_irq: %d\n", mpic->name, d->irq); in mpic_end_irq()
716 mpic_eoi(mpic); in mpic_end_irq()
723 struct mpic *mpic = mpic_from_irq_data(d); in mpic_unmask_ht_irq() local
729 mpic_ht_end_irq(mpic, src); in mpic_unmask_ht_irq()
734 struct mpic *mpic = mpic_from_irq_data(d); in mpic_startup_ht_irq() local
738 mpic_startup_ht_interrupt(mpic, src, irqd_is_level_type(d)); in mpic_startup_ht_irq()
745 struct mpic *mpic = mpic_from_irq_data(d); in mpic_shutdown_ht_irq() local
748 mpic_shutdown_ht_interrupt(mpic, src); in mpic_shutdown_ht_irq()
754 struct mpic *mpic = mpic_from_irq_data(d); in mpic_end_ht_irq() local
758 DBG("%s: end_irq: %d\n", mpic->name, d->irq); in mpic_end_ht_irq()
766 mpic_ht_end_irq(mpic, src); in mpic_end_ht_irq()
767 mpic_eoi(mpic); in mpic_end_ht_irq()
775 struct mpic *mpic = mpic_from_ipi(d); in mpic_unmask_ipi() local
776 unsigned int src = virq_to_hw(d->irq) - mpic->ipi_vecs[0]; in mpic_unmask_ipi()
778 DBG("%s: enable_ipi: %d (ipi %d)\n", mpic->name, d->irq, src); in mpic_unmask_ipi()
789 struct mpic *mpic = mpic_from_ipi(d); in mpic_end_ipi() local
796 mpic_eoi(mpic); in mpic_end_ipi()
803 struct mpic *mpic = mpic_from_irq_data(d); in mpic_unmask_tm() local
804 unsigned int src = virq_to_hw(d->irq) - mpic->timer_vecs[0]; in mpic_unmask_tm()
806 DBG("%s: enable_tm: %d (tm %d)\n", mpic->name, d->irq, src); in mpic_unmask_tm()
813 struct mpic *mpic = mpic_from_irq_data(d); in mpic_mask_tm() local
814 unsigned int src = virq_to_hw(d->irq) - mpic->timer_vecs[0]; in mpic_mask_tm()
823 struct mpic *mpic = mpic_from_irq_data(d); in mpic_set_affinity() local
826 if (mpic->flags & MPIC_SINGLE_DEST_CPU) { in mpic_set_affinity()
842 static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int type) in mpic_type_to_vecpri() argument
865 struct mpic *mpic = mpic_from_irq_data(d); in mpic_set_irq_type() local
870 mpic, d->irq, src, flow_type); in mpic_set_irq_type()
872 if (src >= mpic->num_sources) in mpic_set_irq_type()
908 if (mpic_is_ht_interrupt(mpic, src)) in mpic_set_irq_type()
912 vecpri = mpic_type_to_vecpri(mpic, flow_type); in mpic_set_irq_type()
925 struct mpic *mpic = mpic_from_irq(virq); in mpic_set_vector() local
930 mpic, virq, src, vector); in mpic_set_vector()
932 if (src >= mpic->num_sources) in mpic_set_vector()
943 struct mpic *mpic = mpic_from_irq(virq); in mpic_set_destination() local
947 mpic, virq, src, cpuid); in mpic_set_destination()
949 if (src >= mpic->num_sources) in mpic_set_destination()
997 struct mpic *mpic = h->host_data; in mpic_host_map() local
1002 if (hw == mpic->spurious_vec) in mpic_host_map()
1004 if (mpic->protected && test_bit(hw, mpic->protected)) in mpic_host_map()
1008 else if (hw >= mpic->ipi_vecs[0]) { in mpic_host_map()
1009 WARN_ON(mpic->flags & MPIC_SECONDARY); in mpic_host_map()
1012 irq_set_chip_data(virq, mpic); in mpic_host_map()
1013 irq_set_chip_and_handler(virq, &mpic->hc_ipi, in mpic_host_map()
1019 if (hw >= mpic->timer_vecs[0] && hw <= mpic->timer_vecs[7]) { in mpic_host_map()
1020 WARN_ON(mpic->flags & MPIC_SECONDARY); in mpic_host_map()
1023 irq_set_chip_data(virq, mpic); in mpic_host_map()
1024 irq_set_chip_and_handler(virq, &mpic->hc_tm, in mpic_host_map()
1029 if (hw >= mpic->num_sources) in mpic_host_map()
1032 mpic_msi_reserve_hwirq(mpic, hw); in mpic_host_map()
1035 chip = &mpic->hc_irq; in mpic_host_map()
1039 if (mpic_is_ht_interrupt(mpic, hw)) in mpic_host_map()
1040 chip = &mpic->hc_ht_irq; in mpic_host_map()
1045 irq_set_chip_data(virq, mpic); in mpic_host_map()
1055 if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) { in mpic_host_map()
1057 mpic_set_destination(virq, mpic_processor_id(mpic)); in mpic_host_map()
1069 struct mpic *mpic = h->host_data; in mpic_host_xlate() local
1078 if (intsize >= 4 && (mpic->flags & MPIC_FSL)) { in mpic_host_xlate()
1091 if (intspec[0] >= ARRAY_SIZE(mpic->ipi_vecs)) in mpic_host_xlate()
1094 *out_hwirq = mpic->ipi_vecs[intspec[0]]; in mpic_host_xlate()
1097 if (intspec[0] >= ARRAY_SIZE(mpic->timer_vecs)) in mpic_host_xlate()
1100 *out_hwirq = mpic->timer_vecs[intspec[0]]; in mpic_host_xlate()
1138 struct mpic *mpic = irq_desc_get_handler_data(desc); in mpic_cascade() local
1141 BUG_ON(!(mpic->flags & MPIC_SECONDARY)); in mpic_cascade()
1143 virq = mpic_get_one_irq(mpic); in mpic_cascade()
1160 struct mpic * __init mpic_alloc(struct device_node *node, in mpic_alloc()
1168 struct mpic *mpic; in mpic_alloc() local
1216 mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL); in mpic_alloc()
1217 if (mpic == NULL) in mpic_alloc()
1220 mpic->name = name; in mpic_alloc()
1221 mpic->node = node; in mpic_alloc()
1222 mpic->paddr = phys_addr; in mpic_alloc()
1223 mpic->flags = flags; in mpic_alloc()
1225 mpic->hc_irq = mpic_irq_chip; in mpic_alloc()
1226 mpic->hc_irq.name = name; in mpic_alloc()
1227 if (!(mpic->flags & MPIC_SECONDARY)) in mpic_alloc()
1228 mpic->hc_irq.irq_set_affinity = mpic_set_affinity; in mpic_alloc()
1230 mpic->hc_ht_irq = mpic_irq_ht_chip; in mpic_alloc()
1231 mpic->hc_ht_irq.name = name; in mpic_alloc()
1232 if (!(mpic->flags & MPIC_SECONDARY)) in mpic_alloc()
1233 mpic->hc_ht_irq.irq_set_affinity = mpic_set_affinity; in mpic_alloc()
1237 mpic->hc_ipi = mpic_ipi_chip; in mpic_alloc()
1238 mpic->hc_ipi.name = name; in mpic_alloc()
1241 mpic->hc_tm = mpic_tm_chip; in mpic_alloc()
1242 mpic->hc_tm.name = name; in mpic_alloc()
1244 mpic->num_sources = 0; /* so far */ in mpic_alloc()
1246 if (mpic->flags & MPIC_LARGE_VECTORS) in mpic_alloc()
1251 mpic->timer_vecs[0] = intvec_top - 12; in mpic_alloc()
1252 mpic->timer_vecs[1] = intvec_top - 11; in mpic_alloc()
1253 mpic->timer_vecs[2] = intvec_top - 10; in mpic_alloc()
1254 mpic->timer_vecs[3] = intvec_top - 9; in mpic_alloc()
1255 mpic->timer_vecs[4] = intvec_top - 8; in mpic_alloc()
1256 mpic->timer_vecs[5] = intvec_top - 7; in mpic_alloc()
1257 mpic->timer_vecs[6] = intvec_top - 6; in mpic_alloc()
1258 mpic->timer_vecs[7] = intvec_top - 5; in mpic_alloc()
1259 mpic->ipi_vecs[0] = intvec_top - 4; in mpic_alloc()
1260 mpic->ipi_vecs[1] = intvec_top - 3; in mpic_alloc()
1261 mpic->ipi_vecs[2] = intvec_top - 2; in mpic_alloc()
1262 mpic->ipi_vecs[3] = intvec_top - 1; in mpic_alloc()
1263 mpic->spurious_vec = intvec_top; in mpic_alloc()
1266 psrc = of_get_property(mpic->node, "protected-sources", &psize); in mpic_alloc()
1270 mpic->protected = kzalloc(mapsize*sizeof(long), GFP_KERNEL); in mpic_alloc()
1271 BUG_ON(mpic->protected == NULL); in mpic_alloc()
1275 __set_bit(psrc[i], mpic->protected); in mpic_alloc()
1280 mpic->hw_set = mpic_infos[MPIC_GET_REGSET(mpic->flags)]; in mpic_alloc()
1284 if (mpic->flags & MPIC_BIG_ENDIAN) in mpic_alloc()
1285 mpic->reg_type = mpic_access_mmio_be; in mpic_alloc()
1287 mpic->reg_type = mpic_access_mmio_le; in mpic_alloc()
1294 if (mpic->flags & MPIC_USES_DCR) in mpic_alloc()
1295 mpic->reg_type = mpic_access_dcr; in mpic_alloc()
1297 BUG_ON(mpic->flags & MPIC_USES_DCR); in mpic_alloc()
1301 mpic_map(mpic, mpic->paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000); in mpic_alloc()
1302 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); in mpic_alloc()
1309 if (!(mpic->flags & MPIC_NO_RESET)) { in mpic_alloc()
1311 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), in mpic_alloc()
1312 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) in mpic_alloc()
1314 while( mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) in mpic_alloc()
1320 if (mpic->flags & MPIC_ENABLE_COREINT) in mpic_alloc()
1321 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), in mpic_alloc()
1322 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) in mpic_alloc()
1325 if (mpic->flags & MPIC_ENABLE_MCK) in mpic_alloc()
1326 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), in mpic_alloc()
1327 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) in mpic_alloc()
1340 mpic_map(mpic, mpic->paddr, &mpic->cpuregs[cpu], in mpic_alloc()
1349 greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0)); in mpic_alloc()
1361 of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq); in mpic_alloc()
1368 mpic->num_sources = isu_size; in mpic_alloc()
1369 mpic_map(mpic, mpic->paddr, &mpic->isus[0], in mpic_alloc()
1374 mpic->isu_size = isu_size; in mpic_alloc()
1375 mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); in mpic_alloc()
1376 mpic->isu_mask = (1 << mpic->isu_shift) - 1; in mpic_alloc()
1378 mpic->irqhost = irq_domain_add_linear(mpic->node, in mpic_alloc()
1380 &mpic_host_ops, mpic); in mpic_alloc()
1386 if (mpic->irqhost == NULL) in mpic_alloc()
1406 name, vers, (unsigned long long)mpic->paddr, num_possible_cpus()); in mpic_alloc()
1408 mpic->isu_size, mpic->isu_shift, mpic->isu_mask); in mpic_alloc()
1410 mpic->next = mpics; in mpic_alloc()
1411 mpics = mpic; in mpic_alloc()
1413 if (!(mpic->flags & MPIC_SECONDARY)) { in mpic_alloc()
1414 mpic_primary = mpic; in mpic_alloc()
1415 irq_set_default_host(mpic->irqhost); in mpic_alloc()
1418 return mpic; in mpic_alloc()
1425 void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, in mpic_assign_isu() argument
1428 unsigned int isu_first = isu_num * mpic->isu_size; in mpic_assign_isu()
1432 mpic_map(mpic, in mpic_assign_isu()
1433 paddr, &mpic->isus[isu_num], 0, in mpic_assign_isu()
1434 MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); in mpic_assign_isu()
1436 if ((isu_first + mpic->isu_size) > mpic->num_sources) in mpic_assign_isu()
1437 mpic->num_sources = isu_first + mpic->isu_size; in mpic_assign_isu()
1440 void __init mpic_init(struct mpic *mpic) in mpic_init() argument
1444 BUG_ON(mpic->num_sources == 0); in mpic_init()
1446 printk(KERN_INFO "mpic: Initializing for %d sources\n", mpic->num_sources); in mpic_init()
1453 mpic_write(mpic->tmregs, in mpic_init()
1457 mpic_write(mpic->tmregs, in mpic_init()
1462 (mpic->timer_vecs[0] + i)); in mpic_init()
1466 mpic_test_broken_ipi(mpic); in mpic_init()
1471 (mpic->ipi_vecs[0] + i)); in mpic_init()
1475 DBG("MPIC flags: %x\n", mpic->flags); in mpic_init()
1476 if ((mpic->flags & MPIC_U3_HT_IRQS) && !(mpic->flags & MPIC_SECONDARY)) { in mpic_init()
1477 mpic_scan_ht_pics(mpic); in mpic_init()
1478 mpic_u3msi_init(mpic); in mpic_init()
1481 mpic_pasemi_msi_init(mpic); in mpic_init()
1483 cpu = mpic_processor_id(mpic); in mpic_init()
1485 if (!(mpic->flags & MPIC_NO_RESET)) { in mpic_init()
1486 for (i = 0; i < mpic->num_sources; i++) { in mpic_init()
1492 if (mpic->protected && test_bit(i, mpic->protected)) in mpic_init()
1501 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec); in mpic_init()
1504 if (!(mpic->flags & MPIC_NO_PTHROU_DIS)) in mpic_init()
1505 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), in mpic_init()
1506 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) in mpic_init()
1509 if (mpic->flags & MPIC_NO_BIAS) in mpic_init()
1510 mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), in mpic_init()
1511 mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) in mpic_init()
1519 mpic->save_data = kmalloc(mpic->num_sources * sizeof(*mpic->save_data), in mpic_init()
1521 BUG_ON(mpic->save_data == NULL); in mpic_init()
1525 if (mpic->flags & MPIC_SECONDARY) { in mpic_init()
1526 int virq = irq_of_parse_and_map(mpic->node, 0); in mpic_init()
1529 mpic->node->full_name, virq); in mpic_init()
1530 irq_set_handler_data(virq, mpic); in mpic_init()
1536 void __init mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio) in mpic_set_clk_ratio() argument
1540 v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); in mpic_set_clk_ratio()
1543 mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); in mpic_set_clk_ratio()
1546 void __init mpic_set_serial_int(struct mpic *mpic, int enable) in mpic_set_serial_int() argument
1552 v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); in mpic_set_serial_int()
1557 mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); in mpic_set_serial_int()
1563 struct mpic *mpic = mpic_find(irq); in mpic_irq_set_priority() local
1568 if (!mpic) in mpic_irq_set_priority()
1572 if (mpic_is_ipi(mpic, src)) { in mpic_irq_set_priority()
1573 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & in mpic_irq_set_priority()
1575 mpic_ipi_write(src - mpic->ipi_vecs[0], in mpic_irq_set_priority()
1577 } else if (mpic_is_tm(mpic, src)) { in mpic_irq_set_priority()
1578 reg = mpic_tm_read(src - mpic->timer_vecs[0]) & in mpic_irq_set_priority()
1580 mpic_tm_write(src - mpic->timer_vecs[0], in mpic_irq_set_priority()
1594 struct mpic *mpic = mpic_primary; in mpic_setup_this_cpu() local
1599 BUG_ON(mpic == NULL); in mpic_setup_this_cpu()
1601 DBG("%s: setup_this_cpu(%d)\n", mpic->name, hard_smp_processor_id()); in mpic_setup_this_cpu()
1611 for (i = 0; i < mpic->num_sources ; i++) in mpic_setup_this_cpu()
1625 struct mpic *mpic = mpic_primary; in mpic_cpu_get_priority() local
1632 struct mpic *mpic = mpic_primary; in mpic_cpu_set_priority() local
1640 struct mpic *mpic = mpic_primary; in mpic_teardown_this_cpu() local
1645 BUG_ON(mpic == NULL); in mpic_teardown_this_cpu()
1647 DBG("%s: teardown_this_cpu(%d)\n", mpic->name, hard_smp_processor_id()); in mpic_teardown_this_cpu()
1651 for (i = 0; i < mpic->num_sources ; i++) in mpic_teardown_this_cpu()
1660 mpic_eoi(mpic); in mpic_teardown_this_cpu()
1666 static unsigned int _mpic_get_one_irq(struct mpic *mpic, int reg) in _mpic_get_one_irq() argument
1672 DBG("%s: get_one_irq(reg 0x%x): %d\n", mpic->name, reg, src); in _mpic_get_one_irq()
1674 if (unlikely(src == mpic->spurious_vec)) { in _mpic_get_one_irq()
1675 if (mpic->flags & MPIC_SPV_EOI) in _mpic_get_one_irq()
1676 mpic_eoi(mpic); in _mpic_get_one_irq()
1679 if (unlikely(mpic->protected && test_bit(src, mpic->protected))) { in _mpic_get_one_irq()
1681 mpic->name, (int)src); in _mpic_get_one_irq()
1682 mpic_eoi(mpic); in _mpic_get_one_irq()
1686 return irq_linear_revmap(mpic->irqhost, src); in _mpic_get_one_irq()
1689 unsigned int mpic_get_one_irq(struct mpic *mpic) in mpic_get_one_irq() argument
1691 return _mpic_get_one_irq(mpic, MPIC_INFO(CPU_INTACK)); in mpic_get_one_irq()
1696 struct mpic *mpic = mpic_primary; in mpic_get_irq() local
1698 BUG_ON(mpic == NULL); in mpic_get_irq()
1700 return mpic_get_one_irq(mpic); in mpic_get_irq()
1706 struct mpic *mpic = mpic_primary; in mpic_get_coreint_irq() local
1709 BUG_ON(mpic == NULL); in mpic_get_coreint_irq()
1713 if (unlikely(src == mpic->spurious_vec)) { in mpic_get_coreint_irq()
1714 if (mpic->flags & MPIC_SPV_EOI) in mpic_get_coreint_irq()
1715 mpic_eoi(mpic); in mpic_get_coreint_irq()
1718 if (unlikely(mpic->protected && test_bit(src, mpic->protected))) { in mpic_get_coreint_irq()
1720 mpic->name, (int)src); in mpic_get_coreint_irq()
1724 return irq_linear_revmap(mpic->irqhost, src); in mpic_get_coreint_irq()
1732 struct mpic *mpic = mpic_primary; in mpic_get_mcirq() local
1734 BUG_ON(mpic == NULL); in mpic_get_mcirq()
1736 return _mpic_get_one_irq(mpic, MPIC_INFO(CPU_MCACK)); in mpic_get_mcirq()
1742 struct mpic *mpic = mpic_primary; in mpic_request_ipis() local
1744 BUG_ON(mpic == NULL); in mpic_request_ipis()
1749 unsigned int vipi = irq_create_mapping(mpic->irqhost, in mpic_request_ipis()
1750 mpic->ipi_vecs[0] + i); in mpic_request_ipis()
1761 struct mpic *mpic = mpic_primary; in smp_mpic_message_pass() local
1764 BUG_ON(mpic == NULL); in smp_mpic_message_pass()
1774 DBG("%s: send_ipi(ipi_no: %d)\n", mpic->name, msg); in smp_mpic_message_pass()
1806 struct mpic *mpic = mpic_primary; in mpic_reset_core() local
1812 pir = mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT)); in mpic_reset_core()
1814 mpic_write(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT), pir); in mpic_reset_core()
1815 mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT)); in mpic_reset_core()
1819 mpic_write(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT), pir); in mpic_reset_core()
1820 mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT)); in mpic_reset_core()
1824 if (mpic->flags & MPIC_FSL) { in mpic_reset_core()
1826 _mpic_write(mpic->reg_type, &mpic->cpuregs[cpuid], in mpic_reset_core()
1834 static void mpic_suspend_one(struct mpic *mpic) in mpic_suspend_one() argument
1838 for (i = 0; i < mpic->num_sources; i++) { in mpic_suspend_one()
1839 mpic->save_data[i].vecprio = in mpic_suspend_one()
1841 mpic->save_data[i].dest = in mpic_suspend_one()
1848 struct mpic *mpic = mpics; in mpic_suspend() local
1850 while (mpic) { in mpic_suspend()
1851 mpic_suspend_one(mpic); in mpic_suspend()
1852 mpic = mpic->next; in mpic_suspend()
1858 static void mpic_resume_one(struct mpic *mpic) in mpic_resume_one() argument
1862 for (i = 0; i < mpic->num_sources; i++) { in mpic_resume_one()
1864 mpic->save_data[i].vecprio); in mpic_resume_one()
1866 mpic->save_data[i].dest); in mpic_resume_one()
1869 if (mpic->fixups) { in mpic_resume_one()
1870 struct mpic_irq_fixup *fixup = &mpic->fixups[i]; in mpic_resume_one()
1874 if ((mpic->save_data[i].fixup_data & 1) == 0) in mpic_resume_one()
1880 writel(mpic->save_data[i].fixup_data & ~1, in mpic_resume_one()
1890 struct mpic *mpic = mpics; in mpic_resume() local
1892 while (mpic) { in mpic_resume()
1893 mpic_resume_one(mpic); in mpic_resume()
1894 mpic = mpic->next; in mpic_resume()