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:  [EMAIL PROTECTED]
Nonlinear Systems Ltd.                  Phone: +44 181 442 9037




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to