--- driver.h.pao Sat May 2 21:48:51 1998 +++ driver.h Mon May 4 02:22:18 1998 @@ -14,7 +14,8 @@ 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, + struct dev_desc *desc)); #endif void pccard_driver_init __P((void)); void pccard_configure __P((void)); --- pccard.c.pao Sat May 2 21:48:51 1998 +++ pccard.c Mon May 4 02:28:25 1998 @@ -80,6 +80,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 *); @@ -93,6 +95,10 @@ static void power_off_slot(void *); #endif +#ifdef REAL_INTR_COUNT +static int dev_name_to_id(char *); +#endif + #if NAPM > 0 /* * For the APM stuff, the apmhook structure is kept @@ -557,8 +563,16 @@ */ int pccard_alloc_intr(u_int imask, inthand2_t *hand, int unit, +#ifdef REAL_INTR_COUNT + u_int *maskp, u_int *pcic_imask, struct dev_desc *desc) +#else u_int *maskp, u_int *pcic_imask) +#endif { +#ifdef REAL_INTR_COUNT + static char dev_name[16 + 2]; + int dev_id; +#endif int irq, minirq, maxirq; unsigned int mask; @@ -573,7 +587,14 @@ if (!(mask & imask)) continue; INTRMASK(*maskp, mask); +#ifdef REAL_INTR_COUNT + sprintf(dev_name, "%s%d", desc->name, desc->unit); + dev_id = dev_name_to_id(dev_name); + + 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)); @@ -636,9 +657,15 @@ * XXX We lose at the moment if the second * device relies on a different interrupt mask. */ +#ifdef REAL_INTR_COUNT + irq = pccard_alloc_intr(desc->irqmask, + slot_irq_handler, (int)slt, + drv->imask, slt->ctrl->imask, desc); +#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); @@ -1207,5 +1234,28 @@ crd_devsw_installed = 1; } } + +#ifdef REAL_INTR_COUNT +static int +dev_name_to_id(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)