--- sys/pccard/pccard.c.pao Fri Jul 11 00:45:27 1997 +++ sys/pccard/pccard.c Sat Jul 12 09:24:49 1997 @@ -56,6 +56,7 @@ #include #include +#define REAL_INTR_COUNT #define PCCARD_MEMSIZE (4*1024) @@ -72,6 +73,11 @@ static void power_off_slot(void *); #endif +#ifdef REAL_INTR_COUNT +static int drivername_to_devid(char *); +static char driver_name[16 + 2]; +#endif + #if NAPM > 0 /* * For the APM stuff, the apmhook structure is kept @@ -504,6 +510,9 @@ { int irq, minirq, maxirq; unsigned int mask; +#ifdef REAL_INTR_COUNT + int device_id; +#endif #if defined(PCIC_IRQ) if (ctrlid >= 0) { @@ -527,7 +536,17 @@ continue; if (maskp) INTRMASK (*maskp, mask); +#ifdef REAL_INTR_COUNT + if (ctrlid >= 0) { + device_id = 0; + } else { + device_id = drivername_to_devid(driver_name); + } + + if (register_intr(irq, device_id, 0, hand, maskp, unit)==0) { +#else if (register_intr(irq, 0, 0, hand, maskp, unit)==0) { +#endif /* add this to the PCIC controller's mask */ INTRMASK(*pcic_imask, (1 << irq)); INTREN (mask); @@ -588,6 +607,9 @@ * XXX We lose at the moment if the second * device relies on a different interrupt mask. */ +#ifdef REAL_INTR_COUNT + sprintf(driver_name, "%s%d", drvp->name, drvp->unit); +#endif irq = pccard_alloc_intr(drvp->irqmask, slot_irq_handler, (int)sp, dp->imask, sp->ctrl->imask, -1); @@ -1189,5 +1211,28 @@ crd_devsw_installed = 1; } } + +#ifdef REAL_INTR_COUNT +static int +drivername_to_devid(char *d_name) +{ + int id; + char *cp; + size_t len; + + len = strlen(d_name); + + id = 0; + cp = intrnames; + while (cp < eintrnames) { + if (strncmp(cp, d_name, len) == 0) + return (id); + while (*cp++ != '\0') + ; + id++; + } + return (0); +} +#endif SYSINIT(crddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,crd_drvinit,NULL)