--- driver.h.orig Sat May 29 02:38:27 1999 +++ driver.h Mon Nov 15 00:16:29 1999 @@ -12,7 +12,7 @@ void pccard_add_driver __P((struct pccard_device *)); #ifdef _I386_ISA_ISA_DEVICE_H_ /* XXX actually if inthand2_t is declared */ int pccard_alloc_intr __P((u_int imask, inthand2_t *hand, int unit, - u_int *maskp, u_int *pcic_imask)); + u_int *maskp, u_int *pcic_imask, int dev_id)); #endif void pccard_remove_driver __P((struct pccard_device *)); --- pccard.c.orig Tue Sep 21 00:19:44 1999 +++ pccard.c Mon Nov 15 00:25:02 1999 @@ -93,6 +93,8 @@ #define MIN(a,b) ((a)<(b)?(a):(b)) +#define REAL_INTR_COUNT + static u_int build_freelist(u_int); static int allocate_driver(struct slot *, struct dev_desc *); static void inserted(void *); @@ -107,6 +109,10 @@ static void pccard_configure(void *); SYSINIT(pccard, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE + 1, pccard_configure, NULL); +#ifdef REAL_INTR_COUNT +static int find_device_id(char *); +#endif + #if NAPM > 0 /* * For the APM stuff, the apmhook structure is kept @@ -586,7 +592,11 @@ */ int pccard_alloc_intr(u_int imask, inthand2_t *hand, int unit, +#ifdef REAL_INTR_COUNT + u_int *maskp, u_int *pcic_imask, int dev_id) +#else u_int *maskp, u_int *pcic_imask) +#endif { int irq, minirq, maxirq; unsigned int mask; @@ -598,7 +608,11 @@ if (!(mask & imask)) continue; INTRMASK(*maskp, mask); +#ifdef REAL_INTR_COUNT + if (register_intr(irq, dev_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 */ if (pcic_imask) INTRMASK(*pcic_imask, (1 << irq)); @@ -624,6 +638,11 @@ struct pccard_device *drv; int err, irq = 0, s; +#ifdef REAL_INTR_COUNT + char dev_name[16 + 2]; + int dev_id; +#endif + drv = find_driver(desc->name); if (drv == 0) return(ENXIO); @@ -663,9 +682,18 @@ * XXX We lose at the moment if the second * device relies on a different interrupt mask. */ +#ifdef REAL_INTR_COUNT + sprintf(dev_name, "%s%d", desc->name, desc->unit); + dev_id = find_device_id(dev_name); + + irq = pccard_alloc_intr(desc->irqmask, + slot_irq_handler, (int)slt, + drv->imask, slt->ctrl->imask, dev_id); +#else irq = pccard_alloc_intr(desc->irqmask, slot_irq_handler, (int)slt, drv->imask, slt->ctrl->imask); +#endif if (irq < 0) { printf("card%d: IRQ allocation failed.", slt->slotnum); @@ -1259,5 +1287,28 @@ crd_devsw_installed = 1; } } + +#ifdef REAL_INTR_COUNT +static int +find_device_id(char *dev_name) +{ + int id; + char *cp; + size_t len; + + len = strlen(dev_name); + + id = 0; + cp = intrnames; + while (cp < eintrnames) { + if (strncmp(cp, dev_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)