svn commit: r208198 - in projects/ppc64/sys/powerpc: include mpc85xx

Nathan Whitehorn nwhitehorn at FreeBSD.org
Mon May 17 16:55:26 UTC 2010


Author: nwhitehorn
Date: Mon May 17 16:55:26 2010
New Revision: 208198
URL: http://svn.freebsd.org/changeset/base/208198

Log:
  Unbreak Book-E build and convert to new multi-PIC architecture. Untested.

Modified:
  projects/ppc64/sys/powerpc/include/ocpbus.h
  projects/ppc64/sys/powerpc/include/pmap.h
  projects/ppc64/sys/powerpc/mpc85xx/atpic.c
  projects/ppc64/sys/powerpc/mpc85xx/isa.c
  projects/ppc64/sys/powerpc/mpc85xx/ocpbus.c
  projects/ppc64/sys/powerpc/mpc85xx/ocpbus.h
  projects/ppc64/sys/powerpc/mpc85xx/opic.c
  projects/ppc64/sys/powerpc/mpc85xx/pci_ocp.c

Modified: projects/ppc64/sys/powerpc/include/ocpbus.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/ocpbus.h	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/include/ocpbus.h	Mon May 17 16:55:26 2010	(r208198)
@@ -44,4 +44,8 @@
 #define	OCPBUS_DEVTYPE_I2C	7
 #define	OCPBUS_DEVTYPE_SEC	8
 
+/* PIC IDs */
+#define	OPIC_ID			0
+#define	ATPIC_ID		1
+
 #endif /* _MACHINE_OCPBUS_H_ */

Modified: projects/ppc64/sys/powerpc/include/pmap.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/pmap.h	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/include/pmap.h	Mon May 17 16:55:26 2010	(r208198)
@@ -160,6 +160,10 @@ struct pmap {
 	/* Page table directory, array of pointers to page tables. */
 	pte_t			*pm_pdir[PDIR_NENTRIES];
 
+	/* generation count (pmap lock dropped) */
+	uint32_t		pm_gen_count;
+	u_int			pm_retries;
+
 	/* List of allocated ptbl bufs (ptbl kva regions). */
 	TAILQ_HEAD(, ptbl_buf)	pm_ptbl_list;
 };

Modified: projects/ppc64/sys/powerpc/mpc85xx/atpic.c
==============================================================================
--- projects/ppc64/sys/powerpc/mpc85xx/atpic.c	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/mpc85xx/atpic.c	Mon May 17 16:55:26 2010	(r208198)
@@ -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,10 @@ 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 (0xff);
+}
+

Modified: projects/ppc64/sys/powerpc/mpc85xx/isa.c
==============================================================================
--- projects/ppc64/sys/powerpc/mpc85xx/isa.c	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/mpc85xx/isa.c	Mon May 17 16:55:26 2010	(r208198)
@@ -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_
 	    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;
 		}

Modified: projects/ppc64/sys/powerpc/mpc85xx/ocpbus.c
==============================================================================
--- projects/ppc64/sys/powerpc/mpc85xx/ocpbus.c	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/mpc85xx/ocpbus.c	Mon May 17 16:55:26 2010	(r208198)
@@ -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_resour
 
 	{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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-	{OCPBUS_DEVTYPE_TSEC, 2, SYS_RES_IRQ, 2, PIC_IRQ_INT(17), 1},
+	{OCPBUS_DEVTYPE_TSEC, 2, SYS_RES_IRQ, 0, 15, 1},
+	{OCPBUS_DEVTYPE_TSEC, 2, SYS_RES_IRQ, 1, 16, 1},
+	{OCPBUS_DEVTYPE_TSEC, 2, SYS_RES_IRQ, 2, 17, 1},
 	{OCPBUS_DEVTYPE_TSEC, 3, SYS_RES_MEMORY, 0, OCP85XX_TSEC3_OFF,
 	    OCP85XX_TSEC_SIZE},
-	{OCPBUS_DEVTYPE_TSEC, 3, SYS_RES_IRQ, 0, PIC_IRQ_INT(21), 1},
-	{OCPBUS_DEVTYPE_TSEC, 3, SYS_RES_IRQ, 1, PIC_IRQ_INT(22), 1},
-	{OCPBUS_DEVTYPE_TSEC, 3, SYS_RES_IRQ, 2, PIC_IRQ_INT(23), 1},
+	{OCPBUS_DEVTYPE_TSEC, 3, SYS_RES_IRQ, 0, 21, 1},
+	{OCPBUS_DEVTYPE_TSEC, 3, SYS_RES_IRQ, 1, 22, 1},
+	{OCPBUS_DEVTYPE_TSEC, 3, SYS_RES_IRQ, 2, 23, 1},
 
 	{OCPBUS_DEVTYPE_UART, 0, SYS_RES_MEMORY, 0, OCP85XX_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_resour
 
 	{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
 				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;

Modified: projects/ppc64/sys/powerpc/mpc85xx/ocpbus.h
==============================================================================
--- projects/ppc64/sys/powerpc/mpc85xx/ocpbus.h	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/mpc85xx/ocpbus.h	Mon May 17 16:55:26 2010	(r208198)
@@ -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 */

Modified: projects/ppc64/sys/powerpc/mpc85xx/opic.c
==============================================================================
--- projects/ppc64/sys/powerpc/mpc85xx/opic.c	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/mpc85xx/opic.c	Mon May 17 16:55:26 2010	(r208198)
@@ -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_m
 	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);
+}
+
+

Modified: projects/ppc64/sys/powerpc/mpc85xx/pci_ocp.c
==============================================================================
--- projects/ppc64/sys/powerpc/mpc85xx/pci_ocp.c	Mon May 17 16:54:31 2010	(r208197)
+++ projects/ppc64/sys/powerpc/mpc85xx/pci_ocp.c	Mon May 17 16:55:26 2010	(r208198)
@@ -792,7 +792,7 @@ pci_ocp_alloc_resource(device_t dev, dev
 		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);
 		}


More information about the svn-src-projects mailing list