Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 May 2007 22:34:08 GMT
From:      Bruce M Simpson <bms@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 119604 for review
Message-ID:  <200705092234.l49MY8F6089808@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119604

Change 119604 by bms@bms_anglepoise on 2007/05/09 22:33:20

	Try to route an interrupt. It looks like this request got proxied
	to nexus. I haven't tested this to make sure if it worked or not yet.

Affected files ...

.. //depot/projects/mips2/src/sys/mips/mips32/sentry5/siba_cc.c#4 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/mips32/sentry5/siba_cc.c#4 (text+ko) ====

@@ -47,6 +47,7 @@
 
 static int	siba_cc_attach(device_t);
 static int	siba_cc_probe(device_t);
+static void	siba_cc_intr(void *v);
 
 static int
 siba_cc_probe(device_t dev)
@@ -70,6 +71,7 @@
 {
 	//struct siba_cc_softc *sc = device_get_softc(dev);
 	struct resource *mem;
+	struct resource *irq;
 	int rid;
 
 	/*
@@ -79,22 +81,47 @@
 	 */
 #define MIPS_MEM_RID 0x20
 	rid = MIPS_MEM_RID;
-	mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
-	    RF_ACTIVE);
+	mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
 	if (mem == NULL) {
 		device_printf(dev, "unable to allocate memory\n");
 		return (ENXIO);
 	}
-#if 0
-	device_printf(dev, "start %08lx size %04lx\n",
-	    rman_get_start(mem), rman_get_size(mem));
-#endif
+
+	rid = 0;
+	irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, 0);
+	if (irq == NULL) {
+		device_printf(dev, "unable to allocate irq\n");
+		return (ENXIO);
+	}
+
+	/* now setup the interrupt */
+	/* may be fast, exclusive or mpsafe at a later date */
+
+	/*
+	 * XXX is this interrupt line in ChipCommon used for anything
+	 * other than the uart? in that case we shouldn't hog it ourselves
+	 * and let uart claim it to avoid polled mode.
+	 */
+	int err;
+	void *cookie;
+	err = bus_setup_intr(dev, irq, INTR_TYPE_TTY, NULL, siba_cc_intr, NULL,
+	    &cookie);
+	if (err != 0) {
+		device_printf(dev, "unable to setup intr\n");
+		return (ENXIO);
+	}
 
 	/* TODO: attach uart child */
 
 	return (0);
 }
 
+static void
+siba_cc_intr(void *v)
+{
+
+}
+
 static device_method_t siba_cc_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_attach,	siba_cc_attach),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705092234.l49MY8F6089808>