aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2008-04-01 02:42:25 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-18 01:36:10 -0400
commit032ace7e17f141a5cf350e4ec0c5bf4f5faf1c49 (patch)
tree82d99053475876e8b53a6ad44127d05e10e96b39 /arch
parent47b9d9bddf1877187d965f4dd4d7d454d8cdb50c (diff)
[POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
The code in xics.c to setup the i8259 cascaded irq handler is not really xics specific, so move it into setup.c - we will clean this up further in a subsequent patch. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/pseries/setup.c53
-rw-r--r--arch/powerpc/platforms/pseries/xics.c48
-rw-r--r--arch/powerpc/platforms/pseries/xics.h3
3 files changed, 52 insertions, 52 deletions
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fccca89ee04e..bef4f683285d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -124,6 +124,51 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
124 desc->chip->eoi(irq); 124 desc->chip->eoi(irq);
125} 125}
126 126
127static void __init xics_setup_8259_cascade(void)
128{
129 struct device_node *np, *old, *found = NULL;
130 int cascade, naddr;
131 const u32 *addrp;
132 unsigned long intack = 0;
133
134 for_each_node_by_type(np, "interrupt-controller")
135 if (of_device_is_compatible(np, "chrp,iic")) {
136 found = np;
137 break;
138 }
139 if (found == NULL) {
140 printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
141 return;
142 }
143 cascade = irq_of_parse_and_map(found, 0);
144 if (cascade == NO_IRQ) {
145 printk(KERN_ERR "xics: failed to map cascade interrupt");
146 return;
147 }
148 pr_debug("xics: cascade mapped to irq %d\n", cascade);
149
150 for (old = of_node_get(found); old != NULL ; old = np) {
151 np = of_get_parent(old);
152 of_node_put(old);
153 if (np == NULL)
154 break;
155 if (strcmp(np->name, "pci") != 0)
156 continue;
157 addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
158 if (addrp == NULL)
159 continue;
160 naddr = of_n_addr_cells(np);
161 intack = addrp[naddr-1];
162 if (naddr > 1)
163 intack |= ((unsigned long)addrp[naddr-2]) << 32;
164 }
165 if (intack)
166 printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
167 i8259_init(found, intack);
168 of_node_put(found);
169 set_irq_chained_handler(cascade, pseries_8259_cascade);
170}
171
127static void __init pseries_mpic_init_IRQ(void) 172static void __init pseries_mpic_init_IRQ(void)
128{ 173{
129 struct device_node *np, *old, *cascade = NULL; 174 struct device_node *np, *old, *cascade = NULL;
@@ -203,6 +248,12 @@ static void __init pseries_mpic_init_IRQ(void)
203 set_irq_chained_handler(cascade_irq, pseries_8259_cascade); 248 set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
204} 249}
205 250
251static void __init pseries_xics_init_IRQ(void)
252{
253 xics_init_IRQ();
254 xics_setup_8259_cascade();
255}
256
206static void pseries_lpar_enable_pmcs(void) 257static void pseries_lpar_enable_pmcs(void)
207{ 258{
208 unsigned long set, reset; 259 unsigned long set, reset;
@@ -232,7 +283,7 @@ static void __init pseries_discover_pic(void)
232 smp_init_pseries_mpic(); 283 smp_init_pseries_mpic();
233 return; 284 return;
234 } else if (strstr(typep, "ppc-xicp")) { 285 } else if (strstr(typep, "ppc-xicp")) {
235 ppc_md.init_IRQ = xics_init_IRQ; 286 ppc_md.init_IRQ = pseries_xics_init_IRQ;
236 setup_kexec_cpu_down_xics(); 287 setup_kexec_cpu_down_xics();
237 smp_init_pseries_xics(); 288 smp_init_pseries_xics();
238 return; 289 return;
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index a977f200db89..c3f05d4aff4d 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -655,52 +655,6 @@ static void __init xics_init_one_node(struct device_node *np,
655 } 655 }
656} 656}
657 657
658
659static void __init xics_setup_8259_cascade(void)
660{
661 struct device_node *np, *old, *found = NULL;
662 int cascade, naddr;
663 const u32 *addrp;
664 unsigned long intack = 0;
665
666 for_each_node_by_type(np, "interrupt-controller")
667 if (of_device_is_compatible(np, "chrp,iic")) {
668 found = np;
669 break;
670 }
671 if (found == NULL) {
672 printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
673 return;
674 }
675 cascade = irq_of_parse_and_map(found, 0);
676 if (cascade == NO_IRQ) {
677 printk(KERN_ERR "xics: failed to map cascade interrupt");
678 return;
679 }
680 pr_debug("xics: cascade mapped to irq %d\n", cascade);
681
682 for (old = of_node_get(found); old != NULL ; old = np) {
683 np = of_get_parent(old);
684 of_node_put(old);
685 if (np == NULL)
686 break;
687 if (strcmp(np->name, "pci") != 0)
688 continue;
689 addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
690 if (addrp == NULL)
691 continue;
692 naddr = of_n_addr_cells(np);
693 intack = addrp[naddr-1];
694 if (naddr > 1)
695 intack |= ((unsigned long)addrp[naddr-2]) << 32;
696 }
697 if (intack)
698 printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
699 i8259_init(found, intack);
700 of_node_put(found);
701 set_irq_chained_handler(cascade, pseries_8259_cascade);
702}
703
704void __init xics_init_IRQ(void) 658void __init xics_init_IRQ(void)
705{ 659{
706 struct device_node *np; 660 struct device_node *np;
@@ -733,8 +687,6 @@ void __init xics_init_IRQ(void)
733 687
734 xics_setup_cpu(); 688 xics_setup_cpu();
735 689
736 xics_setup_8259_cascade();
737
738 ppc64_boot_msg(0x21, "XICS Done"); 690 ppc64_boot_msg(0x21, "XICS Done");
739} 691}
740 692
diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h
index c26bcff47b6d..1c5321ae8f2f 100644
--- a/arch/powerpc/platforms/pseries/xics.h
+++ b/arch/powerpc/platforms/pseries/xics.h
@@ -28,7 +28,4 @@ struct xics_ipi_struct {
28 28
29extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; 29extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
30 30
31struct irq_desc;
32extern void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc);
33
34#endif /* _POWERPC_KERNEL_XICS_H */ 31#endif /* _POWERPC_KERNEL_XICS_H */