You seem to have put in some hard work there. Yes, your analysis is
correct. the problem has been corrected not so long ago, albeit in a
slightly different way.

As it is now the ppi bus does not attach if the bus is polled mode. But
you are saying it works in polled mode as well.

I've attached a patch that only enables the alloc and setup of the irq
in the case where PERIPH_1284 is defined. If that is defined, then the
irq alloc is attempted, but if it fails, your patch kicks in and does
not set it up in ppiopen.

The patch is against current as of 2000-05-05, so you will have
to update that part of the source. If this is not an option for
you, let me know and send me the output of ident ppi.c, so I can
make a patch for you. Mike, please let me know if this works for you.

Nicolas, could you tell me whether this is the correct thing to do? the
thing that I think is missing is somehow the possibility to use
'interrupts' even in polled mode. Basically the ppbus should simulate
the interrupt by calling the interrupt after a poll has decided that an
interrupt has occurred.

Mike, well done!

[EMAIL PROTECTED]                                          USB project
Index: ppi.c
RCS file: /home/ncvs/src/sys/dev/ppbus/ppi.c,v
retrieving revision 1.22
diff -w -u -r1.22 ppi.c
--- ppi.c       2000/04/07 00:09:24     1.22
+++ ppi.c       2000/05/05 14:27:26
@@ -68,8 +68,10 @@
     int                ppi_mode;                       /* IEEE1284 mode */
     char       ppi_buffer[BUFSIZE];
+#ifdef PERIPH_1284
     struct resource *intr_resource;    /* interrupt resource */
     void *intr_cookie;                 /* interrupt registration cookie */
+#endif /* PERIPH_1284 */
 #define DEVTOSOFTC(dev) \
@@ -170,13 +172,11 @@
        /* retrive the irq */
        BUS_READ_IVAR(device_get_parent(dev), dev, PPBUS_IVAR_IRQ, &irq);
+#ifdef PERIPH_1284
        /* declare our interrupt handler */
        ppi->intr_resource = bus_alloc_resource(dev, SYS_RES_IRQ,
                                                &zero, irq, irq, 1, RF_ACTIVE);
-       if (ppi->intr_resource == NULL) {
-               device_printf(dev, "can't allocate irq\n");
-               return (ENOMEM);
-       }
+#endif /* PERIPH_1284 */
        make_dev(&ppi_cdevsw, device_get_unit(dev),     /* XXX cleanup */
                 UID_ROOT, GID_WHEEL,
@@ -276,9 +276,13 @@
                ppi->ppi_flags |= HAVE_PPBUS;
+#ifdef PERIPH_1284
+               if (ppi->intr_resource) {
                /* register our interrupt handler */
                BUS_SETUP_INTR(device_get_parent(ppidev), ppidev, ppi->intr_resource,
                               INTR_TYPE_TTY, ppiintr, dev, &ppi->intr_cookie);
+               }
+#endif /* PERIPH_1284 */
        ppi->ppi_count += 1;

Reply via email to