--- driver.h.pao Tue Sep 15 12:17:38 1998 +++ driver.h Thu Sep 17 10:13:05 1998 @@ -14,7 +14,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_driver_init __P((void)); void pccard_remove_driver __P((struct pccard_device *)); --- pccard.c.pao Tue Sep 15 12:17:39 1998 +++ pccard.c Thu Sep 17 10:32:04 1998 @@ -78,6 +78,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 *); @@ -91,6 +93,10 @@ static void power_off_slot(void *); #endif +#ifdef REAL_INTR_COUNT +static int find_device_id(char *); +#endif + #if NAPM > 0 /* * For the APM stuff, the apmhook structure is kept @@ -591,7 +597,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; @@ -603,7 +613,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)); @@ -629,6 +643,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); @@ -666,9 +685,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("crd: IRQ allocation failed."); return(EINVAL); @@ -1257,5 +1285,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)