Skip to content

Commit f9bd170

Browse files
committed
powerpc: Merge i8259.c into arch/powerpc/sysdev
This changes the parameters for i8259_init so that it takes two parameters: a physical address for generating an interrupt acknowledge cycle, and an interrupt number offset. i8259_init now sets the irq_desc[] for its interrupts; all the callers were doing this, and that code is gone now. This also defines a CONFIG_PPC_I8259 symbol to select i8259.o for inclusion, and makes the platforms that need it select that symbol. Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 25635c7 commit f9bd170

19 files changed

Lines changed: 99 additions & 271 deletions

File tree

‎arch/powerpc/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,13 @@ endchoice
275275
config PPC_PSERIES
276276
depends on PPC_MULTIPLATFORM && PPC64
277277
bool " IBM pSeries & new (POWER5-based) iSeries"
278+
select PPC_I8259
278279
default y
279280

280281
config PPC_CHRP
281282
bool " Common Hardware Reference Platform (CHRP) based machines"
282283
depends on PPC_MULTIPLATFORM && PPC32
284+
select PPC_I8259
283285
select PPC_INDIRECT_PCI
284286
default y
285287

@@ -298,6 +300,7 @@ config PPC_PMAC64
298300
config PPC_PREP
299301
bool " PowerPC Reference Platform (PReP) based machines"
300302
depends on PPC_MULTIPLATFORM && PPC32
303+
select PPC_I8259
301304
select PPC_INDIRECT_PCI
302305
default y
303306

@@ -628,6 +631,7 @@ menu "Bus options"
628631
config ISA
629632
bool "Support for ISA-bus hardware"
630633
depends on PPC_PREP || PPC_CHRP
634+
select PPC_I8259
631635
help
632636
Find out whether you have ISA slots on your motherboard. ISA is the
633637
name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -640,6 +644,11 @@ config GENERIC_ISA_DMA
640644
depends on PPC64 || POWER4 || 6xx && !CPM2
641645
default y
642646

647+
config PPC_I8259
648+
bool
649+
default y if 85xx
650+
default n
651+
643652
config PPC_INDIRECT_PCI
644653
bool
645654
depends on PCI
@@ -679,6 +688,7 @@ config MPC83xx_PCI2
679688
config PCI_QSPAN
680689
bool "QSpan PCI"
681690
depends on !4xx && !CPM2 && 8xx
691+
select PPC_I8259
682692
help
683693
Say Y here if you have a system based on a Motorola 8xx-series
684694
embedded processor with a QSPAN PCI interface, otherwise say N.

‎arch/powerpc/platforms/embedded6xx/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ config EV64260
4848

4949
config LOPEC
5050
bool "Motorola-LoPEC"
51+
select PPC_I8259
5152

5253
config MVME5100
5354
bool "Motorola-MVME5100"
5455
select PPC_INDIRECT_PCI
5556

5657
config PPLUS
5758
bool "Motorola-PowerPlus"
59+
select PPC_I8259
5860
select PPC_INDIRECT_PCI
5961

6062
config PRPMC750
@@ -67,12 +69,14 @@ config PRPMC800
6769

6870
config SANDPOINT
6971
bool "Motorola-Sandpoint"
72+
select PPC_I8259
7073
help
7174
Select SANDPOINT if configuring for a Motorola Sandpoint X3
7275
(any flavor).
7376

7477
config RADSTONE_PPC7D
7578
bool "Radstone Technology PPC7D board"
79+
select PPC_I8259
7680

7781
config PAL4
7882
bool "SBS-Palomar4"
@@ -307,6 +311,7 @@ config HARRIER_STORE_GATHERING
307311
config MVME5100_IPMC761_PRESENT
308312
bool "MVME5100 configured with an IPMC761"
309313
depends on MVME5100
314+
select PPC_I8259
310315

311316
config SPRUCE_BAUD_33M
312317
bool "Spruce baud clock support"

‎arch/powerpc/platforms/pseries/setup.c‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ extern int pSeries_machine_check_exception(struct pt_regs *regs);
8787
static void pseries_shared_idle(void);
8888
static void pseries_dedicated_idle(void);
8989

90-
static volatile void __iomem * chrp_int_ack_special;
9190
struct mpic *pSeries_mpic;
9291

9392
void pSeries_show_cpuinfo(struct seq_file *m)
@@ -119,19 +118,11 @@ static void __init fwnmi_init(void)
119118
fwnmi_active = 1;
120119
}
121120

122-
static int pSeries_irq_cascade(struct pt_regs *regs, void *data)
123-
{
124-
if (chrp_int_ack_special)
125-
return readb(chrp_int_ack_special);
126-
else
127-
return i8259_irq(regs);
128-
}
129-
130121
static void __init pSeries_init_mpic(void)
131122
{
132123
unsigned int *addrp;
133124
struct device_node *np;
134-
int i;
125+
unsigned long intack = 0;
135126

136127
/* All ISUs are setup, complete initialization */
137128
mpic_init(pSeries_mpic);
@@ -142,16 +133,14 @@ static void __init pSeries_init_mpic(void)
142133
get_property(np, "8259-interrupt-acknowledge", NULL)))
143134
printk(KERN_ERR "Cannot find pci to get ack address\n");
144135
else
145-
chrp_int_ack_special = ioremap(addrp[prom_n_addr_cells(np)-1], 1);
136+
intack = addrp[prom_n_addr_cells(np)-1];
146137
of_node_put(np);
147138

148139
/* Setup the legacy interrupts & controller */
149-
for (i = 0; i < NUM_ISA_INTERRUPTS; i++)
150-
irq_desc[i].handler = &i8259_pic;
151-
i8259_init(0);
140+
i8259_init(intack, 0);
152141

153142
/* Hook cascade to mpic */
154-
mpic_setup_cascade(NUM_ISA_INTERRUPTS, pSeries_irq_cascade, NULL);
143+
mpic_setup_cascade(NUM_ISA_INTERRUPTS, i8259_irq_cascade, NULL);
155144
}
156145

157146
static void __init pSeries_setup_mpic(void)

‎arch/powerpc/sysdev/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
obj-$(CONFIG_MPIC) += mpic.o
22
obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
3+
obj-$(CONFIG_PPC_I8259) += i8259.o
Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
1+
/*
2+
* i8259 interrupt controller driver.
3+
*
4+
* This program is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU General Public License
6+
* as published by the Free Software Foundation; either version
7+
* 2 of the License, or (at your option) any later version.
8+
*/
19
#include <linux/init.h>
210
#include <linux/ioport.h>
311
#include <linux/interrupt.h>
412
#include <asm/io.h>
513
#include <asm/i8259.h>
614

7-
static volatile unsigned char *pci_intack; /* RO, gives us the irq vector */
15+
static volatile void __iomem *pci_intack; /* RO, gives us the irq vector */
816

9-
unsigned char cached_8259[2] = { 0xff, 0xff };
17+
static unsigned char cached_8259[2] = { 0xff, 0xff };
1018
#define cached_A1 (cached_8259[0])
1119
#define cached_21 (cached_8259[1])
1220

1321
static DEFINE_SPINLOCK(i8259_lock);
1422

15-
int i8259_pic_irq_offset;
23+
static int i8259_pic_irq_offset;
1624

1725
/*
1826
* Acknowledge the IRQ using either the PCI host bridge's interrupt
1927
* acknowledge feature or poll. How i8259_init() is called determines
2028
* which is called. It should be noted that polling is broken on some
2129
* IBM and Motorola PReP boxes so we must use the int-ack feature on them.
2230
*/
23-
int
24-
i8259_irq(struct pt_regs *regs)
31+
int i8259_irq(struct pt_regs *regs)
2532
{
2633
int irq;
2734

2835
spin_lock(&i8259_lock);
2936

3037
/* Either int-ack or poll for the IRQ */
3138
if (pci_intack)
32-
irq = *pci_intack;
39+
irq = readb(pci_intack);
3340
else {
3441
/* Perform an interrupt acknowledge cycle on controller 1. */
3542
outb(0x0C, 0x20); /* prepare for poll */
@@ -59,28 +66,31 @@ i8259_irq(struct pt_regs *regs)
5966
}
6067

6168
spin_unlock(&i8259_lock);
62-
return irq;
69+
return irq + i8259_pic_irq_offset;
70+
}
71+
72+
int i8259_irq_cascade(struct pt_regs *regs, void *unused)
73+
{
74+
return i8259_irq(regs);
6375
}
6476

6577
static void i8259_mask_and_ack_irq(unsigned int irq_nr)
6678
{
6779
unsigned long flags;
6880

6981
spin_lock_irqsave(&i8259_lock, flags);
70-
if ( irq_nr >= i8259_pic_irq_offset )
71-
irq_nr -= i8259_pic_irq_offset;
72-
82+
irq_nr -= i8259_pic_irq_offset;
7383
if (irq_nr > 7) {
7484
cached_A1 |= 1 << (irq_nr-8);
75-
inb(0xA1); /* DUMMY */
76-
outb(cached_A1,0xA1);
77-
outb(0x20,0xA0); /* Non-specific EOI */
78-
outb(0x20,0x20); /* Non-specific EOI to cascade */
85+
inb(0xA1); /* DUMMY */
86+
outb(cached_A1, 0xA1);
87+
outb(0x20, 0xA0); /* Non-specific EOI */
88+
outb(0x20, 0x20); /* Non-specific EOI to cascade */
7989
} else {
8090
cached_21 |= 1 << irq_nr;
81-
inb(0x21); /* DUMMY */
82-
outb(cached_21,0x21);
83-
outb(0x20,0x20); /* Non-specific EOI */
91+
inb(0x21); /* DUMMY */
92+
outb(cached_21, 0x21);
93+
outb(0x20, 0x20); /* Non-specific EOI */
8494
}
8595
spin_unlock_irqrestore(&i8259_lock, flags);
8696
}
@@ -96,9 +106,8 @@ static void i8259_mask_irq(unsigned int irq_nr)
96106
unsigned long flags;
97107

98108
spin_lock_irqsave(&i8259_lock, flags);
99-
if ( irq_nr >= i8259_pic_irq_offset )
100-
irq_nr -= i8259_pic_irq_offset;
101-
if ( irq_nr < 8 )
109+
irq_nr -= i8259_pic_irq_offset;
110+
if (irq_nr < 8)
102111
cached_21 |= 1 << irq_nr;
103112
else
104113
cached_A1 |= 1 << (irq_nr-8);
@@ -111,9 +120,8 @@ static void i8259_unmask_irq(unsigned int irq_nr)
111120
unsigned long flags;
112121

113122
spin_lock_irqsave(&i8259_lock, flags);
114-
if ( irq_nr >= i8259_pic_irq_offset )
115-
irq_nr -= i8259_pic_irq_offset;
116-
if ( irq_nr < 8 )
123+
irq_nr -= i8259_pic_irq_offset;
124+
if (irq_nr < 8)
117125
cached_21 &= ~(1 << irq_nr);
118126
else
119127
cached_A1 &= ~(1 << (irq_nr-8));
@@ -169,12 +177,14 @@ static struct irqaction i8259_irqaction = {
169177
* intack_addr - PCI interrupt acknowledge (real) address which will return
170178
* the active irq from the 8259
171179
*/
172-
void __init
173-
i8259_init(long intack_addr)
180+
void __init i8259_init(unsigned long intack_addr, int offset)
174181
{
175182
unsigned long flags;
183+
int i;
176184

177185
spin_lock_irqsave(&i8259_lock, flags);
186+
i8259_pic_irq_offset = offset;
187+
178188
/* init master interrupt controller */
179189
outb(0x11, 0x20); /* Start init sequence */
180190
outb(0x00, 0x21); /* Vector base */
@@ -198,11 +208,14 @@ i8259_init(long intack_addr)
198208
spin_unlock_irqrestore(&i8259_lock, flags);
199209

200210
/* reserve our resources */
201-
setup_irq( i8259_pic_irq_offset + 2, &i8259_irqaction);
211+
setup_irq(offset + 2, &i8259_irqaction);
202212
request_resource(&ioport_resource, &pic1_iores);
203213
request_resource(&ioport_resource, &pic2_iores);
204214
request_resource(&ioport_resource, &pic_edgectrl_iores);
205215

206216
if (intack_addr != 0)
207217
pci_intack = ioremap(intack_addr, 1);
218+
219+
for (i = 0; i < NUM_ISA_INTERRUPTS; ++i)
220+
irq_desc[offset + i].handler = &i8259_pic;
208221
}

‎arch/ppc/Kconfig‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,15 @@ config EV64260
589589

590590
config LOPEC
591591
bool "Motorola-LoPEC"
592+
select PPC_I8259
592593

593594
config MVME5100
594595
bool "Motorola-MVME5100"
595596
select PPC_INDIRECT_PCI
596597

597598
config PPLUS
598599
bool "Motorola-PowerPlus"
600+
select PPC_I8259
599601
select PPC_INDIRECT_PCI
600602

601603
config PRPMC750
@@ -608,12 +610,14 @@ config PRPMC800
608610

609611
config SANDPOINT
610612
bool "Motorola-Sandpoint"
613+
select PPC_I8259
611614
help
612615
Select SANDPOINT if configuring for a Motorola Sandpoint X3
613616
(any flavor).
614617

615618
config RADSTONE_PPC7D
616619
bool "Radstone Technology PPC7D board"
620+
select PPC_I8259
617621

618622
config PAL4
619623
bool "SBS-Palomar4"
@@ -755,6 +759,7 @@ config CPM2
755759
config PPC_CHRP
756760
bool " Common Hardware Reference Platform (CHRP) based machines"
757761
depends on PPC_MULTIPLATFORM
762+
select PPC_I8259
758763
select PPC_INDIRECT_PCI
759764
default y
760765

@@ -772,6 +777,7 @@ config PPC_PMAC64
772777
config PPC_PREP
773778
bool " PowerPC Reference Platform (PReP) based machines"
774779
depends on PPC_MULTIPLATFORM
780+
select PPC_I8259
775781
select PPC_INDIRECT_PCI
776782
default y
777783

@@ -881,6 +887,7 @@ config HARRIER_STORE_GATHERING
881887
config MVME5100_IPMC761_PRESENT
882888
bool "MVME5100 configured with an IPMC761"
883889
depends on MVME5100
890+
select PPC_I8259
884891

885892
config SPRUCE_BAUD_33M
886893
bool "Spruce baud clock support"
@@ -1138,6 +1145,7 @@ menu "Bus options"
11381145
config ISA
11391146
bool "Support for ISA-bus hardware"
11401147
depends on PPC_PREP || PPC_CHRP
1148+
select PPC_I8259
11411149
help
11421150
Find out whether you have ISA slots on your motherboard. ISA is the
11431151
name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -1150,6 +1158,11 @@ config GENERIC_ISA_DMA
11501158
depends on POWER3 || POWER4 || 6xx && !CPM2
11511159
default y
11521160

1161+
config PPC_I8259
1162+
bool
1163+
default y if 85xx
1164+
default n
1165+
11531166
config PPC_INDIRECT_PCI
11541167
bool
11551168
depends on PCI
@@ -1192,6 +1205,7 @@ config MPC83xx_PCI2
11921205
config PCI_QSPAN
11931206
bool "QSpan PCI"
11941207
depends on !4xx && !CPM2 && 8xx
1208+
select PPC_I8259
11951209
help
11961210
Say Y here if you have a system based on a Motorola 8xx-series
11971211
embedded processor with a QSPAN PCI interface, otherwise say N.

‎arch/ppc/platforms/85xx/mpc85xx_cds_common.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,7 @@ mpc85xx_cds_init_IRQ(void)
173173
#ifdef CONFIG_PCI
174174
openpic_hookup_cascade(PIRQ0A, "82c59 cascade", i8259_irq);
175175

176-
for (i = 0; i < NUM_8259_INTERRUPTS; i++)
177-
irq_desc[i].handler = &i8259_pic;
178-
179-
i8259_init(0);
176+
i8259_init(0, 0);
180177
#endif
181178

182179
#ifdef CONFIG_CPM2

‎arch/ppc/platforms/chrp_setup.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,7 @@ void __init chrp_init_IRQ(void)
436436
i8259_irq);
437437

438438
}
439-
for (i = 0; i < NUM_8259_INTERRUPTS; i++)
440-
irq_desc[i].handler = &i8259_pic;
441-
i8259_init(chrp_int_ack);
439+
i8259_init(chrp_int_ack, 0);
442440

443441
#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
444442
/* see if there is a keyboard in the device tree

0 commit comments

Comments
 (0)