Implement interrupt routing for DEC_KN20AA.

Tested by:	wilko
MFC after:	2 weeks
This commit is contained in:
ticso 2005-02-10 00:35:31 +00:00
parent 89a577e7b4
commit 8f2098faeb

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
void dec_kn20aa_init(void);
static void dec_kn20aa_cons_init(void);
static void dec_kn20aa_intr_init(void);
static void dec_kn20aa_intr_map(void *);
static int dec_kn20aa_intr_route(device_t pcib, device_t dev, int pin);
static void dec_kn20aa_intr_disable(int);
static void dec_kn20aa_intr_enable(int);
@ -81,7 +81,7 @@ dec_kn20aa_init()
platform.iobus = "cia";
platform.cons_init = dec_kn20aa_cons_init;
platform.pci_intr_init = dec_kn20aa_intr_init;
platform.pci_intr_map = dec_kn20aa_intr_map;
platform.pci_intr_route = dec_kn20aa_intr_route;
platform.pci_intr_disable = dec_kn20aa_intr_disable;
platform.pci_intr_enable = dec_kn20aa_intr_enable;
}
@ -242,58 +242,45 @@ dec_kn20aa_intr_init()
dec_kn20aa_intr_enable(31);
}
void
dec_kn20aa_intr_map(void *arg)
static int
dec_kn20aa_intr_route(device_t pcib, device_t dev, int pin)
{
pcicfgregs *cfg;
int irq = 255;
int slot = pci_get_slot(dev);
cfg = (pcicfgregs *)arg;
/*
* Slot->interrupt translation. Appears to work, though it
* may not hold up forever.
*
* The DEC engineers who did this hardware obviously engaged
* in random drug testing.
*/
switch (cfg->slot) {
switch (slot) {
case 11:
irq = pin - 1;
break;
case 12:
cfg->intline = ((cfg->slot - 11) + 0) * 4;
irq = 4 + pin - 1;
break;
case 7:
cfg->intline = 8;
irq = 8 + pin - 1;
break;
case 9:
cfg->intline = 12;
break;
case 6: /* 21040 on AlphaStation 500 */
cfg->intline = 13;
case 9: /* slot on AlphaStation 600 only */
irq = 12 + pin - 1;
break;
case 8:
cfg->intline = 16;
irq = 16 + pin - 1;
break;
case 6: /* 21040 on AlphaStation 500 */
if (pin == 1)
irq = 13;
break;
case 10: /* 8275EB on AlphaStation 500 */
return;
break;
default:
if(!cfg->bus){
printf("dec_kn20aa_intr_map: weird slot %d\n",
cfg->slot);
return;
} else {
cfg->intline = cfg->slot;
}
printf("dec_kn20aa_intr_route: weird slot %d\n", slot);
}
cfg->intline += cfg->bus*16;
if (cfg->intline > KN20AA_MAX_IRQ)
panic("dec_kn20aa_intr_map: cfg->intline too large (%d)\n",
cfg->intline);
return (irq);
}
void