Skip to content

Commit

Permalink
powerpc: Merge i8259.c into arch/powerpc/sysdev
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mackerras committed Oct 26, 2005
1 parent 25635c7 commit f9bd170
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 271 deletions.
10 changes: 10 additions & 0 deletions arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,13 @@ endchoice
config PPC_PSERIES
depends on PPC_MULTIPLATFORM && PPC64
bool " IBM pSeries & new (POWER5-based) iSeries"
select PPC_I8259
default y

config PPC_CHRP
bool " Common Hardware Reference Platform (CHRP) based machines"
depends on PPC_MULTIPLATFORM && PPC32
select PPC_I8259
select PPC_INDIRECT_PCI
default y

Expand All @@ -298,6 +300,7 @@ config PPC_PMAC64
config PPC_PREP
bool " PowerPC Reference Platform (PReP) based machines"
depends on PPC_MULTIPLATFORM && PPC32
select PPC_I8259
select PPC_INDIRECT_PCI
default y

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

config PPC_I8259
bool
default y if 85xx
default n

config PPC_INDIRECT_PCI
bool
depends on PCI
Expand Down Expand Up @@ -679,6 +688,7 @@ config MPC83xx_PCI2
config PCI_QSPAN
bool "QSpan PCI"
depends on !4xx && !CPM2 && 8xx
select PPC_I8259
help
Say Y here if you have a system based on a Motorola 8xx-series
embedded processor with a QSPAN PCI interface, otherwise say N.
Expand Down
5 changes: 5 additions & 0 deletions arch/powerpc/platforms/embedded6xx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ config EV64260

config LOPEC
bool "Motorola-LoPEC"
select PPC_I8259

config MVME5100
bool "Motorola-MVME5100"
select PPC_INDIRECT_PCI

config PPLUS
bool "Motorola-PowerPlus"
select PPC_I8259
select PPC_INDIRECT_PCI

config PRPMC750
Expand All @@ -67,12 +69,14 @@ config PRPMC800

config SANDPOINT
bool "Motorola-Sandpoint"
select PPC_I8259
help
Select SANDPOINT if configuring for a Motorola Sandpoint X3
(any flavor).

config RADSTONE_PPC7D
bool "Radstone Technology PPC7D board"
select PPC_I8259

config PAL4
bool "SBS-Palomar4"
Expand Down Expand Up @@ -307,6 +311,7 @@ config HARRIER_STORE_GATHERING
config MVME5100_IPMC761_PRESENT
bool "MVME5100 configured with an IPMC761"
depends on MVME5100
select PPC_I8259

config SPRUCE_BAUD_33M
bool "Spruce baud clock support"
Expand Down
19 changes: 4 additions & 15 deletions arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ extern int pSeries_machine_check_exception(struct pt_regs *regs);
static void pseries_shared_idle(void);
static void pseries_dedicated_idle(void);

static volatile void __iomem * chrp_int_ack_special;
struct mpic *pSeries_mpic;

void pSeries_show_cpuinfo(struct seq_file *m)
Expand Down Expand Up @@ -119,19 +118,11 @@ static void __init fwnmi_init(void)
fwnmi_active = 1;
}

static int pSeries_irq_cascade(struct pt_regs *regs, void *data)
{
if (chrp_int_ack_special)
return readb(chrp_int_ack_special);
else
return i8259_irq(regs);
}

static void __init pSeries_init_mpic(void)
{
unsigned int *addrp;
struct device_node *np;
int i;
unsigned long intack = 0;

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

/* Setup the legacy interrupts & controller */
for (i = 0; i < NUM_ISA_INTERRUPTS; i++)
irq_desc[i].handler = &i8259_pic;
i8259_init(0);
i8259_init(intack, 0);

/* Hook cascade to mpic */
mpic_setup_cascade(NUM_ISA_INTERRUPTS, pSeries_irq_cascade, NULL);
mpic_setup_cascade(NUM_ISA_INTERRUPTS, i8259_irq_cascade, NULL);
}

static void __init pSeries_setup_mpic(void)
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/sysdev/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
obj-$(CONFIG_MPIC) += mpic.o
obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
obj-$(CONFIG_PPC_I8259) += i8259.o
65 changes: 39 additions & 26 deletions arch/ppc/syslib/i8259.c → arch/powerpc/sysdev/i8259.c
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
/*
* i8259 interrupt controller driver.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/i8259.h>

static volatile unsigned char *pci_intack; /* RO, gives us the irq vector */
static volatile void __iomem *pci_intack; /* RO, gives us the irq vector */

unsigned char cached_8259[2] = { 0xff, 0xff };
static unsigned char cached_8259[2] = { 0xff, 0xff };
#define cached_A1 (cached_8259[0])
#define cached_21 (cached_8259[1])

static DEFINE_SPINLOCK(i8259_lock);

int i8259_pic_irq_offset;
static int i8259_pic_irq_offset;

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

spin_lock(&i8259_lock);

/* Either int-ack or poll for the IRQ */
if (pci_intack)
irq = *pci_intack;
irq = readb(pci_intack);
else {
/* Perform an interrupt acknowledge cycle on controller 1. */
outb(0x0C, 0x20); /* prepare for poll */
Expand Down Expand Up @@ -59,28 +66,31 @@ i8259_irq(struct pt_regs *regs)
}

spin_unlock(&i8259_lock);
return irq;
return irq + i8259_pic_irq_offset;
}

int i8259_irq_cascade(struct pt_regs *regs, void *unused)
{
return i8259_irq(regs);
}

static void i8259_mask_and_ack_irq(unsigned int irq_nr)
{
unsigned long flags;

spin_lock_irqsave(&i8259_lock, flags);
if ( irq_nr >= i8259_pic_irq_offset )
irq_nr -= i8259_pic_irq_offset;

irq_nr -= i8259_pic_irq_offset;
if (irq_nr > 7) {
cached_A1 |= 1 << (irq_nr-8);
inb(0xA1); /* DUMMY */
outb(cached_A1,0xA1);
outb(0x20,0xA0); /* Non-specific EOI */
outb(0x20,0x20); /* Non-specific EOI to cascade */
inb(0xA1); /* DUMMY */
outb(cached_A1, 0xA1);
outb(0x20, 0xA0); /* Non-specific EOI */
outb(0x20, 0x20); /* Non-specific EOI to cascade */
} else {
cached_21 |= 1 << irq_nr;
inb(0x21); /* DUMMY */
outb(cached_21,0x21);
outb(0x20,0x20); /* Non-specific EOI */
inb(0x21); /* DUMMY */
outb(cached_21, 0x21);
outb(0x20, 0x20); /* Non-specific EOI */
}
spin_unlock_irqrestore(&i8259_lock, flags);
}
Expand All @@ -96,9 +106,8 @@ static void i8259_mask_irq(unsigned int irq_nr)
unsigned long flags;

spin_lock_irqsave(&i8259_lock, flags);
if ( irq_nr >= i8259_pic_irq_offset )
irq_nr -= i8259_pic_irq_offset;
if ( irq_nr < 8 )
irq_nr -= i8259_pic_irq_offset;
if (irq_nr < 8)
cached_21 |= 1 << irq_nr;
else
cached_A1 |= 1 << (irq_nr-8);
Expand All @@ -111,9 +120,8 @@ static void i8259_unmask_irq(unsigned int irq_nr)
unsigned long flags;

spin_lock_irqsave(&i8259_lock, flags);
if ( irq_nr >= i8259_pic_irq_offset )
irq_nr -= i8259_pic_irq_offset;
if ( irq_nr < 8 )
irq_nr -= i8259_pic_irq_offset;
if (irq_nr < 8)
cached_21 &= ~(1 << irq_nr);
else
cached_A1 &= ~(1 << (irq_nr-8));
Expand Down Expand Up @@ -169,12 +177,14 @@ static struct irqaction i8259_irqaction = {
* intack_addr - PCI interrupt acknowledge (real) address which will return
* the active irq from the 8259
*/
void __init
i8259_init(long intack_addr)
void __init i8259_init(unsigned long intack_addr, int offset)
{
unsigned long flags;
int i;

spin_lock_irqsave(&i8259_lock, flags);
i8259_pic_irq_offset = offset;

/* init master interrupt controller */
outb(0x11, 0x20); /* Start init sequence */
outb(0x00, 0x21); /* Vector base */
Expand All @@ -198,11 +208,14 @@ i8259_init(long intack_addr)
spin_unlock_irqrestore(&i8259_lock, flags);

/* reserve our resources */
setup_irq( i8259_pic_irq_offset + 2, &i8259_irqaction);
setup_irq(offset + 2, &i8259_irqaction);
request_resource(&ioport_resource, &pic1_iores);
request_resource(&ioport_resource, &pic2_iores);
request_resource(&ioport_resource, &pic_edgectrl_iores);

if (intack_addr != 0)
pci_intack = ioremap(intack_addr, 1);

for (i = 0; i < NUM_ISA_INTERRUPTS; ++i)
irq_desc[offset + i].handler = &i8259_pic;
}
14 changes: 14 additions & 0 deletions arch/ppc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -589,13 +589,15 @@ config EV64260

config LOPEC
bool "Motorola-LoPEC"
select PPC_I8259

config MVME5100
bool "Motorola-MVME5100"
select PPC_INDIRECT_PCI

config PPLUS
bool "Motorola-PowerPlus"
select PPC_I8259
select PPC_INDIRECT_PCI

config PRPMC750
Expand All @@ -608,12 +610,14 @@ config PRPMC800

config SANDPOINT
bool "Motorola-Sandpoint"
select PPC_I8259
help
Select SANDPOINT if configuring for a Motorola Sandpoint X3
(any flavor).

config RADSTONE_PPC7D
bool "Radstone Technology PPC7D board"
select PPC_I8259

config PAL4
bool "SBS-Palomar4"
Expand Down Expand Up @@ -755,6 +759,7 @@ config CPM2
config PPC_CHRP
bool " Common Hardware Reference Platform (CHRP) based machines"
depends on PPC_MULTIPLATFORM
select PPC_I8259
select PPC_INDIRECT_PCI
default y

Expand All @@ -772,6 +777,7 @@ config PPC_PMAC64
config PPC_PREP
bool " PowerPC Reference Platform (PReP) based machines"
depends on PPC_MULTIPLATFORM
select PPC_I8259
select PPC_INDIRECT_PCI
default y

Expand Down Expand Up @@ -881,6 +887,7 @@ config HARRIER_STORE_GATHERING
config MVME5100_IPMC761_PRESENT
bool "MVME5100 configured with an IPMC761"
depends on MVME5100
select PPC_I8259

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

config PPC_I8259
bool
default y if 85xx
default n

config PPC_INDIRECT_PCI
bool
depends on PCI
Expand Down Expand Up @@ -1192,6 +1205,7 @@ config MPC83xx_PCI2
config PCI_QSPAN
bool "QSpan PCI"
depends on !4xx && !CPM2 && 8xx
select PPC_I8259
help
Say Y here if you have a system based on a Motorola 8xx-series
embedded processor with a QSPAN PCI interface, otherwise say N.
Expand Down
5 changes: 1 addition & 4 deletions arch/ppc/platforms/85xx/mpc85xx_cds_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ mpc85xx_cds_init_IRQ(void)
#ifdef CONFIG_PCI
openpic_hookup_cascade(PIRQ0A, "82c59 cascade", i8259_irq);

for (i = 0; i < NUM_8259_INTERRUPTS; i++)
irq_desc[i].handler = &i8259_pic;

i8259_init(0);
i8259_init(0, 0);
#endif

#ifdef CONFIG_CPM2
Expand Down
4 changes: 1 addition & 3 deletions arch/ppc/platforms/chrp_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,7 @@ void __init chrp_init_IRQ(void)
i8259_irq);

}
for (i = 0; i < NUM_8259_INTERRUPTS; i++)
irq_desc[i].handler = &i8259_pic;
i8259_init(chrp_int_ack);
i8259_init(chrp_int_ack, 0);

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

0 comments on commit f9bd170

Please sign in to comment.