Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Nov 1999 10:07:02 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Mark Newton <newton@internode.com.au>
Cc:        peter.jeremy@alcatel.com.au, current@freebsd.org
Subject:   Re: panic: nexus_setup_intr: NULL irq resource!
Message-ID:  <Pine.BSF.4.10.9911121006490.25540-100000@salmon.nlsystems.com>
In-Reply-To: <199911120214.MAA21794@gizmo.internode.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 12 Nov 1999, Mark Newton wrote:

> Peter Jeremy wrote:
> 
>  > Since your patch effectively turns isa_setup_intr() into a nop for
>  > this case, a better patch would seem to be to skip the call to 
>  > BUS_SETUP_INTR() (and presumably bus_alloc_resource()) at the end
>  > of sioattach() when you're attaching a slave SIO port.
> 
> Absolutely true. :-)

Something like this should work:

Index: sio.c
===================================================================
RCS file: /home/ncvs/src/sys/isa/sio.c,v
retrieving revision 1.273
diff -u -r1.273 sio.c
--- sio.c	1999/10/28 05:06:12	1.273
+++ sio.c	1999/11/12 10:06:15
@@ -903,6 +903,7 @@
 	u_int		flags = device_get_flags(dev);
 	int		rid;
 	struct resource *port;
+	u_long		junk;
 
 	rid = 0;
 	port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
@@ -1112,12 +1113,19 @@
 	com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR;
 	pps_init(&com->pps);
 
-	rid = 0;
-	com->irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0ul, ~0ul, 1,
-	    RF_SHAREABLE | RF_ACTIVE);
-	BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres,
-		       INTR_TYPE_TTY | INTR_TYPE_FAST,
-		       siointr, com, &ih);
+	/*
+	 * Only setup the irq if there is one (in multiport, only the
+	 * master has an irq.
+	 */
+	if (bus_get_resource(dev, SYS_RES_IRQ, &junk, &junk) == 0) {
+		rid = 0;
+		com->irqres = bus_alloc_resource(dev, SYS_RES_IRQ,
+						 &rid, 0ul, ~0ul, 1,
+						 RF_SHAREABLE | RF_ACTIVE);
+		BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres,
+			       INTR_TYPE_TTY | INTR_TYPE_FAST,
+			       siointr, com, &ih);
+	}
 
 	return (0);
 }

--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9911121006490.25540-100000>