svn commit: r207301 - in user/jmallett/octeon/sys/mips: cavium conf

Juli Mallett jmallett at FreeBSD.org
Tue Apr 27 22:50:46 UTC 2010


Author: jmallett
Date: Tue Apr 27 22:50:45 2010
New Revision: 207301
URL: http://svn.freebsd.org/changeset/base/207301

Log:
  Attach obio to ciu to avoid sending lots of stray interrupts to the UART
  handlers.  (It used to simply connect to the same interrupt as CIU's 0 line
  and unmask the UART interrupts in CIU.)

Modified:
  user/jmallett/octeon/sys/mips/cavium/obio.c
  user/jmallett/octeon/sys/mips/conf/OCTEON1.hints

Modified: user/jmallett/octeon/sys/mips/cavium/obio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/obio.c	Tue Apr 27 22:04:39 2010	(r207300)
+++ user/jmallett/octeon/sys/mips/cavium/obio.c	Tue Apr 27 22:50:45 2010	(r207301)
@@ -57,29 +57,29 @@ __FBSDID("$FreeBSD$");
 #include <mips/cavium/obiovar.h>
 
 #include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-interrupt.h>
 
 extern struct bus_space octeon_uart_tag;
 
-int	obio_probe(device_t);
-int	obio_attach(device_t);
+static void	obio_identify(driver_t *, device_t);
+static int	obio_probe(device_t);
+static int	obio_attach(device_t);
 
-/*
- * We need only one obio.  Any other device hanging off of it,
- * shouldn't cause multiple of these to be found.
- */
-static int have_one = 0;
+static void
+obio_identify(driver_t *drv, device_t parent)
+{
+	BUS_ADD_CHILD(parent, 0, "obio", 0);
+}
 
-int
+static int
 obio_probe(device_t dev)
 {
-	if (!have_one) {
-		have_one = 1;
-		return 0;
-	}
-	return (ENXIO);
+	if (device_get_unit(dev) != 0)
+		return (ENXIO);
+	return (0);
 }
 
-int
+static int
 obio_attach(device_t dev)
 {
 	struct obio_softc *sc = device_get_softc(dev);
@@ -104,10 +104,10 @@ obio_attach(device_t dev)
 
 	/* 
 	 * This module is intended for UART purposes only and
-	 * it's IRQ is 0  corresponding to IP2.
+	 * manages IRQs for UART0 and UART1.
 	 */
 	if (rman_init(&sc->oba_irq_rman) != 0 ||
-	    rman_manage_region(&sc->oba_irq_rman, 0, 0) != 0)
+	    rman_manage_region(&sc->oba_irq_rman, CVMX_IRQ_UART0, CVMX_IRQ_UART1) != 0)
 		panic("obio_attach: failed to set up IRQ rman");
 
 	device_add_child(dev, "uart", 1);  /* Setup Uart-1 first. */
@@ -129,6 +129,16 @@ obio_alloc_resource(device_t bus, device
 
 	switch (type) {
 	case SYS_RES_IRQ:
+		switch (device_get_unit(child)) {
+		case 0:
+			start = end = CVMX_IRQ_UART0;
+			break;
+		case 1:
+			start = end = CVMX_IRQ_UART1;
+			break;
+		default:
+			return (NULL);
+		}
 		rm = &sc->oba_irq_rman;
 		break;
 	case SYS_RES_MEMORY:
@@ -171,11 +181,14 @@ obio_activate_resource(device_t bus, dev
 	return (0);
 }
 static device_method_t obio_methods[] = {
-	DEVMETHOD(device_probe, obio_probe),
-	DEVMETHOD(device_attach, obio_attach),
-
-	DEVMETHOD(bus_alloc_resource, obio_alloc_resource),
-	DEVMETHOD(bus_activate_resource, obio_activate_resource),
+	/* Device methods */
+	DEVMETHOD(device_identify,	obio_identify),
+	DEVMETHOD(device_probe,		obio_probe),
+	DEVMETHOD(device_attach,	obio_attach),
+
+	/* Bus methods */
+	DEVMETHOD(bus_alloc_resource,	obio_alloc_resource),
+	DEVMETHOD(bus_activate_resource,obio_activate_resource),
 	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
 	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
 
@@ -189,4 +202,4 @@ static driver_t obio_driver = {
 };
 static devclass_t obio_devclass;
 
-DRIVER_MODULE(obio, nexus, obio_driver, obio_devclass, 0, 0);
+DRIVER_MODULE(obio, ciu, obio_driver, obio_devclass, 0, 0);

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1.hints
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Tue Apr 27 22:04:39 2010	(r207300)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Tue Apr 27 22:50:45 2010	(r207301)
@@ -3,7 +3,7 @@
 # All these values are complete nonsense...
 hw.uart.console="io:0x1"
 hint.ciu.0.at="nexus"
-hint.obio.0.at="nexus"
+hint.obio.0.at="ciu"
 hint.obio.0.maddr="0x1"
 hint.obio.0.msize="0x1"
 hint.obio.0.flags="0x1"


More information about the svn-src-user mailing list