diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-06-18 14:06:27 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-06-18 14:06:27 +0000 |
commit | c757ee90aefd19aff23dfb5e938e8e1e8576dbd4 (patch) | |
tree | 28ab8d6b3802ae7f1a631f84f71839a5baa6a137 /sys/powerpc/mpc85xx | |
parent | f26dfb440a0d48a874435768ee94475ddbe496a2 (diff) | |
download | FreeBSD-src-c757ee90aefd19aff23dfb5e938e8e1e8576dbd4.zip FreeBSD-src-c757ee90aefd19aff23dfb5e938e8e1e8576dbd4.tar.gz |
Provide for multiple, cascaded PICs on PowerPC systems, and extend the
OFW interrupt map interface to also return the device's interrupt parent.
MFC after: 8.1-RELEASE
Diffstat (limited to 'sys/powerpc/mpc85xx')
-rw-r--r-- | sys/powerpc/mpc85xx/atpic.c | 16 | ||||
-rw-r--r-- | sys/powerpc/mpc85xx/isa.c | 9 | ||||
-rw-r--r-- | sys/powerpc/mpc85xx/ocpbus.c | 42 | ||||
-rw-r--r-- | sys/powerpc/mpc85xx/ocpbus.h | 8 | ||||
-rw-r--r-- | sys/powerpc/mpc85xx/opic.c | 10 | ||||
-rw-r--r-- | sys/powerpc/mpc85xx/pci_ocp.c | 2 |
6 files changed, 58 insertions, 29 deletions
diff --git a/sys/powerpc/mpc85xx/atpic.c b/sys/powerpc/mpc85xx/atpic.c index f8d1318..4a4f5f1 100644 --- a/sys/powerpc/mpc85xx/atpic.c +++ b/sys/powerpc/mpc85xx/atpic.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/intr.h> #include <machine/intr_machdep.h> +#include <machine/ocpbus.h> #include <machine/pio.h> #include <powerpc/mpc85xx/ocpbus.h> @@ -79,6 +80,9 @@ static void atpic_eoi(device_t, u_int); static void atpic_ipi(device_t, u_int); static void atpic_mask(device_t, u_int); static void atpic_unmask(device_t, u_int); +static uint32_t atpic_id (device_t dev); + +static device_t pic8259; static device_method_t atpic_isa_methods[] = { /* Device interface */ @@ -94,6 +98,7 @@ static device_method_t atpic_isa_methods[] = { DEVMETHOD(pic_ipi, atpic_ipi), DEVMETHOD(pic_mask, atpic_mask), DEVMETHOD(pic_unmask, atpic_unmask), + DEVMETHOD(pic_id, atpic_id), { 0, 0 }, }; @@ -219,7 +224,8 @@ atpic_isa_attach(device_t dev) atpic_init(sc, ATPIC_SLAVE); atpic_init(sc, ATPIC_MASTER); - powerpc_register_8259(dev); + powerpc_register_pic(dev, 0x10); + pic8259 = dev; return (0); fail: @@ -328,3 +334,11 @@ atpic_unmask(device_t dev, u_int irq) atpic_write(sc, ATPIC_MASTER, 1, sc->sc_mask[ATPIC_MASTER]); } } + +static uint32_t +atpic_id (device_t dev) +{ + + return (ATPIC_ID); +} + diff --git a/sys/powerpc/mpc85xx/isa.c b/sys/powerpc/mpc85xx/isa.c index 5b996ca..eeffbfd 100644 --- a/sys/powerpc/mpc85xx/isa.c +++ b/sys/powerpc/mpc85xx/isa.c @@ -32,12 +32,16 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <sys/rman.h> +#include <machine/intr_machdep.h> +#include <machine/ocpbus.h> #include <machine/resource.h> #include <isa/isareg.h> #include <isa/isavar.h> #include <isa/isa_common.h> +#include "ocpbus.h" + void isa_init(device_t dev) { @@ -58,7 +62,10 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid, resource_list_find(rl, type, *rid) == NULL) { switch (type) { case SYS_RES_IOPORT: rids = ISA_PNP_NPORT; break; - case SYS_RES_IRQ: rids = ISA_PNP_NIRQ; break; + case SYS_RES_IRQ: + rids = ISA_PNP_NIRQ; + start = ISA_IRQ(start); + break; case SYS_RES_MEMORY: rids = ISA_PNP_NMEM; break; default: rids = 0; break; } diff --git a/sys/powerpc/mpc85xx/ocpbus.c b/sys/powerpc/mpc85xx/ocpbus.c index 6c6515e..17f9d9d 100644 --- a/sys/powerpc/mpc85xx/ocpbus.c +++ b/sys/powerpc/mpc85xx/ocpbus.c @@ -277,7 +277,7 @@ ocpbus_attach(device_t dev) ccsr_read4(OCP85XX_PORDEVSR), ccsr_read4(OCP85XX_PORDEVSR2)); - for (i = PIC_IRQ_START; i < PIC_IRQ_START + 4; i++) + for (i = INTR_VEC(OPIC_ID, 0); i < INTR_VEC(OPIC_ID, 4); i++) powerpc_config_intr(i, INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); return (bus_generic_attach(dev)); @@ -305,35 +305,35 @@ const struct ocp_resource mpc8555_resources[] = { {OCPBUS_DEVTYPE_QUICC, 0, SYS_RES_MEMORY, 0, OCP85XX_QUICC_OFF, OCP85XX_QUICC_SIZE}, - {OCPBUS_DEVTYPE_QUICC, 0, SYS_RES_IRQ, 0, PIC_IRQ_INT(30), 1}, + {OCPBUS_DEVTYPE_QUICC, 0, SYS_RES_IRQ, 0, 30, 1}, {OCPBUS_DEVTYPE_TSEC, 0, SYS_RES_MEMORY, 0, OCP85XX_TSEC0_OFF, OCP85XX_TSEC_SIZE}, - {OCPBUS_DEVTYPE_TSEC, 0, SYS_RES_IRQ, 0, PIC_IRQ_INT(13), 1}, - {OCPBUS_DEVTYPE_TSEC, 0, SYS_RES_IRQ, 1, PIC_IRQ_INT(14), 1}, - {OCPBUS_DEVTYPE_TSEC, 0, SYS_RES_IRQ, 2, PIC_IRQ_INT(18), 1}, + {OCPBUS_DEVTYPE_TSEC, 0, SYS_RES_IRQ, 0, 13, 1}, + {OCPBUS_DEVTYPE_TSEC, 0, SYS_RES_IRQ, 1, 14, 1}, + {OCPBUS_DEVTYPE_TSEC, 0, SYS_RES_IRQ, 2, 18, 1}, {OCPBUS_DEVTYPE_TSEC, 1, SYS_RES_MEMORY, 0, OCP85XX_TSEC1_OFF, OCP85XX_TSEC_SIZE}, - {OCPBUS_DEVTYPE_TSEC, 1, SYS_RES_IRQ, 0, PIC_IRQ_INT(19), 1}, - {OCPBUS_DEVTYPE_TSEC, 1, SYS_RES_IRQ, 1, PIC_IRQ_INT(20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P85XX_UART0_OFF, OCP85XX_UART_SIZE}, - {OCPBUS_DEVTYPE_UART, 0, SYS_RES_IRQ, 0, PIC_IRQ_INT(26), 1}, + {OCPBUS_DEVTYPE_UART, 0, SYS_RES_IRQ, 0, 26, 1}, {OCPBUS_DEVTYPE_UART, 1, SYS_RES_MEMORY, 0, OCP85XX_UART1_OFF, OCP85XX_UART_SIZE}, - {OCPBUS_DEVTYPE_UART, 1, SYS_RES_IRQ, 0, PIC_IRQ_INT(26), 1}, + {OCPBUS_DEVTYPE_UART, 1, SYS_RES_IRQ, 0, 26, 1}, {OCPBUS_DEVTYPE_PCIB, 0, SYS_RES_MEMORY, 0, OCP85XX_PCI0_OFF, OCP85XX_PCI_SIZE}, @@ -357,15 +357,15 @@ const struct ocp_resource mpc8555_resources[] = { {OCPBUS_DEVTYPE_I2C, 0, SYS_RES_MEMORY, 0, OCP85XX_I2C0_OFF, OCP85XX_I2C_SIZE}, - {OCPBUS_DEVTYPE_I2C, 0, SYS_RES_IRQ, 0, PIC_IRQ_INT(27), 1}, + {OCPBUS_DEVTYPE_I2C, 0, SYS_RES_IRQ, 0, 27, 1}, {OCPBUS_DEVTYPE_I2C, 1, SYS_RES_MEMORY, 0, OCP85XX_I2C1_OFF, OCP85XX_I2C_SIZE}, - {OCPBUS_DEVTYPE_I2C, 1, SYS_RES_IRQ, 0, PIC_IRQ_INT(27), 1}, + {OCPBUS_DEVTYPE_I2C, 1, SYS_RES_IRQ, 0, 27, 1}, {OCPBUS_DEVTYPE_SEC, 0, SYS_RES_MEMORY, 0, OCP85XX_SEC_OFF, OCP85XX_SEC_SIZE}, - {OCPBUS_DEVTYPE_SEC, 0, SYS_RES_IRQ, 0, PIC_IRQ_INT(29), 1}, - {OCPBUS_DEVTYPE_SEC, 0, SYS_RES_IRQ, 1, PIC_IRQ_INT(42), 1}, + {OCPBUS_DEVTYPE_SEC, 0, SYS_RES_IRQ, 0, 29, 1}, + {OCPBUS_DEVTYPE_SEC, 0, SYS_RES_IRQ, 1, 42, 1}, {0} }; @@ -402,7 +402,7 @@ ocpbus_get_resource(device_t dev, device_t child, int type, int rid, start = res->sr_offset + CCSRBAR_VA; break; case SYS_RES_IRQ: - start = res->sr_offset; + start = PIC_IRQ_INT(res->sr_offset); break; default: error = EINVAL; diff --git a/sys/powerpc/mpc85xx/ocpbus.h b/sys/powerpc/mpc85xx/ocpbus.h index fb715da..69c9569 100644 --- a/sys/powerpc/mpc85xx/ocpbus.h +++ b/sys/powerpc/mpc85xx/ocpbus.h @@ -104,11 +104,9 @@ /* * PIC definitions */ -#define ISA_IRQ_START 0 -#define PIC_IRQ_START (ISA_IRQ_START + 16) -#define ISA_IRQ(n) (ISA_IRQ_START + (n)) -#define PIC_IRQ_EXT(n) (PIC_IRQ_START + (n)) -#define PIC_IRQ_INT(n) (PIC_IRQ_START + 16 + (n)) +#define ISA_IRQ(n) (INTR_VEC(ATPIC_ID, n)) +#define PIC_IRQ_EXT(n) (INTR_VEC(OPIC_ID, (n))) +#define PIC_IRQ_INT(n) (INTR_VEC(OPIC_ID, (16 + (n)))) #endif /* _MACHINE_OCP85XX_H */ diff --git a/sys/powerpc/mpc85xx/opic.c b/sys/powerpc/mpc85xx/opic.c index 529226a..f2c5ef8 100644 --- a/sys/powerpc/mpc85xx/opic.c +++ b/sys/powerpc/mpc85xx/opic.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); * OpenPIC attachment to ocpbus */ static int openpic_ocpbus_probe(device_t); +static uint32_t openpic_ocpbus_id(device_t); static device_method_t openpic_ocpbus_methods[] = { /* Device interface */ @@ -63,6 +64,7 @@ static device_method_t openpic_ocpbus_methods[] = { DEVMETHOD(pic_ipi, openpic_ipi), DEVMETHOD(pic_mask, openpic_mask), DEVMETHOD(pic_unmask, openpic_unmask), + DEVMETHOD(pic_id, openpic_ocpbus_id), { 0, 0 }, }; @@ -93,3 +95,11 @@ openpic_ocpbus_probe (device_t dev) device_set_desc(dev, OPENPIC_DEVSTR); return (BUS_PROBE_DEFAULT); } + +static uint32_t +openpic_ocpbus_id (device_t dev) +{ + return (OPIC_ID); +} + + diff --git a/sys/powerpc/mpc85xx/pci_ocp.c b/sys/powerpc/mpc85xx/pci_ocp.c index cdcf986..f257882 100644 --- a/sys/powerpc/mpc85xx/pci_ocp.c +++ b/sys/powerpc/mpc85xx/pci_ocp.c @@ -792,7 +792,7 @@ pci_ocp_alloc_resource(device_t dev, device_t child, int type, int *rid, va = sc->sc_iomem_va; break; case SYS_RES_IRQ: - if (start < PIC_IRQ_START) { + if (INTR_IGN(start) == powerpc_ign_lookup(ATPIC_ID)) { device_printf(dev, "%s requested ISA interrupt %lu\n", device_get_nameunit(child), start); } |