summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/cpuconf.c1
-rw-r--r--sys/alpha/alpha/dec_1000a.c71
-rw-r--r--sys/alpha/alpha/dec_2100_a50.c42
-rw-r--r--sys/alpha/alpha/dec_2100_a500.c3
-rw-r--r--sys/alpha/alpha/dec_3000_300.c1
-rw-r--r--sys/alpha/alpha/dec_3000_500.c1
-rw-r--r--sys/alpha/alpha/dec_axppci_33.c63
-rw-r--r--sys/alpha/alpha/dec_eb164.c3
-rw-r--r--sys/alpha/alpha/dec_eb64plus.c3
-rw-r--r--sys/alpha/alpha/dec_kn20aa.c43
-rw-r--r--sys/alpha/alpha/dec_kn8ae.c1
-rw-r--r--sys/alpha/alpha/dec_st550.c34
-rw-r--r--sys/alpha/alpha/dec_st6600.c10
-rw-r--r--sys/alpha/alpha/machdep.c1
-rw-r--r--sys/alpha/include/cpuconf.h2
-rw-r--r--sys/alpha/include/md_var.h2
-rw-r--r--sys/alpha/osf1/osf1_misc.c1
-rw-r--r--sys/alpha/osf1/osf1_signal.c1
-rw-r--r--sys/alpha/pci/apecs_pci.c2
-rw-r--r--sys/alpha/pci/cia_pci.c1
-rw-r--r--sys/alpha/pci/irongate_pci.c2
-rw-r--r--sys/alpha/pci/lca_pci.c2
-rw-r--r--sys/alpha/pci/pcibus.c15
-rw-r--r--sys/alpha/pci/t2.c63
-rw-r--r--sys/alpha/pci/t2_pci.c2
-rw-r--r--sys/alpha/pci/t2var.h2
-rw-r--r--sys/alpha/pci/tsunami_pci.c1
27 files changed, 170 insertions, 203 deletions
diff --git a/sys/alpha/alpha/cpuconf.c b/sys/alpha/alpha/cpuconf.c
index 7f7da4f..e3f5dfa 100644
--- a/sys/alpha/alpha/cpuconf.c
+++ b/sys/alpha/alpha/cpuconf.c
@@ -33,6 +33,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <machine/cpuconf.h>
#include <machine/rpb.h>
diff --git a/sys/alpha/alpha/dec_1000a.c b/sys/alpha/alpha/dec_1000a.c
index 321c8cb..045dbbd 100644
--- a/sys/alpha/alpha/dec_1000a.c
+++ b/sys/alpha/alpha/dec_1000a.c
@@ -79,6 +79,7 @@
#include <sys/reboot.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
@@ -103,12 +104,12 @@ void dec_1000a_init __P((int));
static void dec_1000a_cons_init __P((void));
-static void dec_1000_intr_map __P((void *));
+static int dec_1000_intr_route __P((device_t, device_t, int));
static void dec_1000_intr_disable __P((int));
static void dec_1000_intr_enable __P((int));
static void dec_1000_intr_init __P((void));
-static void dec_1000a_intr_map __P((void *));
+static int dec_1000a_intr_route __P((device_t, device_t, int));
static void dec_1000a_intr_disable __P((int));
static void dec_1000a_intr_enable __P((int));
static void dec_1000a_intr_init __P((void));
@@ -147,7 +148,7 @@ dec_1000a_init(int cputype)
case PCS_PROC_EV4:
case PCS_PROC_EV45:
platform.iobus = "apecs";
- platform.pci_intr_map = dec_1000_intr_map;
+ platform.pci_intr_route = dec_1000_intr_route;
platform.pci_intr_disable = dec_1000_intr_disable;
platform.pci_intr_enable = dec_1000_intr_enable;
platform.pci_intr_init = dec_1000_intr_init;
@@ -155,7 +156,7 @@ dec_1000a_init(int cputype)
default:
platform.iobus = "cia";
- platform.pci_intr_map = dec_1000a_intr_map;
+ platform.pci_intr_route = dec_1000a_intr_route;
platform.pci_intr_disable = dec_1000a_intr_disable;
platform.pci_intr_enable = dec_1000a_intr_enable;
platform.pci_intr_init = dec_1000a_intr_init;
@@ -228,34 +229,26 @@ dec_1000a_cons_init()
}
-static void
-dec_1000_intr_map(arg)
- void *arg;
+static int
+dec_1000_intr_route(bus, dev, pin)
+ device_t bus, dev;
+ int pin;
{
- pcicfgregs *cfg;
-
- cfg = (pcicfgregs *)arg;
- if (cfg->intpin == 0) /* No IRQ used. */
- return;
- if (!(1 <= cfg->intpin && cfg->intpin <= 4))
- goto bad;
-
- switch(cfg->slot) {
+ switch(pci_get_slot(dev)) {
case 6:
- if(cfg->intpin != 1)
+ if (pin != 1)
break;
- cfg->intline = 0xc; /* integrated ncr scsi */
- return;
- break;
+ return(0xc); /* integrated ncr scsi */
case 11:
case 12:
case 13:
- cfg->intline = (cfg->slot - 11) * 4 + cfg->intpin - 1;
+ return((pci_get_slot(dev) - 11) * 4 + pin - 1);
return;
break;
}
bad: printf("dec_1000_intr_map: can't map dev %d pin %d\n",
- cfg->slot, cfg->intpin);
+ pci_get_slot(dev), pin);
+ return(255);
}
@@ -312,11 +305,12 @@ dec_1000_intr_init()
#define IMR2IRQ(bn) ((bn) - 1)
#define IRQ2IMR(irq) ((irq) + 1)
-static void
-dec_1000a_intr_map(arg)
- void *arg;
+
+static int
+dec_1000a_intr_route(bus, dev, pin)
+ device_t bus, dev;
+ int pin;
{
- pcicfgregs *cfg;
int device, imrbit;
/*
* Get bit number in mystery ICU imr.
@@ -341,28 +335,17 @@ dec_1000a_intr_map(arg)
/* 14 */ IRQSPLIT(8) /* Corelle */
};
- cfg = (pcicfgregs *)arg;
- device = cfg->slot;
-
- if (cfg->intpin == 0) /* No IRQ used. */
- return;
- if (!(1 <= cfg->intpin && cfg->intpin <= 4))
- goto bad;
-
- if (0 <= device && device < sizeof imrmap / sizeof imrmap[0]) {
- imrbit = imrmap[device][cfg->intpin - 1];
- if (imrbit) {
- cfg->intline = IMR2IRQ(imrbit);
- return;
- }
+ if (0 <= pci_get_slot(dev) && pci_get_slot(dev) < sizeof imrmap / sizeof imrmap[0]) {
+ imrbit = imrmap[device][pin - 1];
+ if (imrbit)
+ return(IMR2IRQ(imrbit));
}
-bad: printf("dec_1000a_intr_map: can't map dev %d pin %d\n",
- device, cfg->intpin);
+bad: printf("dec_1000a_intr_route: can't map dev %d pin %d\n",
+ pci_get_slot(dev), pin);
+ return(255);
}
-
-
static void
dec_1000a_intr_enable(irq)
int irq;
diff --git a/sys/alpha/alpha/dec_2100_a50.c b/sys/alpha/alpha/dec_2100_a50.c
index d9e8895..3e5dfd1 100644
--- a/sys/alpha/alpha/dec_2100_a50.c
+++ b/sys/alpha/alpha/dec_2100_a50.c
@@ -40,6 +40,7 @@
#include <sys/reboot.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
@@ -58,7 +59,7 @@ static int comcnrate = CONSPEED;
void dec_2100_a50_init __P((void));
static void dec_2100_a50_cons_init __P((void));
-static void dec_2100_a50_intr_map __P((void *));
+static int dec_2100_a50_intr_route __P((device_t, device_t, int));
void sio_intr_establish __P((int));
void sio_intr_disestablish __P((int));
void sio_intr_setup __P((void));
@@ -97,7 +98,7 @@ dec_2100_a50_init()
platform.iobus = "apecs";
platform.cons_init = dec_2100_a50_cons_init;
- platform.pci_intr_map = dec_2100_a50_intr_map;
+ platform.pci_intr_route = dec_2100_a50_intr_route;
}
/* XXX for forcing comconsole when srm serial console is used */
@@ -158,35 +159,27 @@ dec_2100_a50_cons_init()
#define SIO_PCIREG_PIRQ_RTCTRL 0x60 /* PIRQ0 Route Control */
-void
-dec_2100_a50_intr_map(void *arg)
+int
+dec_2100_a50_intr_route(device_t bus, device_t dev, int pin)
{
u_int8_t pirqline;
u_int32_t pirqreg;
int pirq;
- pcicfgregs *cfg;
- pirq = 0; /* gcc -Wuninitialized XXX */
- cfg = (pcicfgregs *)arg;
+ pirq = 255;
/*
* Slot->interrupt translation. Taken from NetBSD.
*/
- if(cfg->intpin == 0)
- return;
-
- if(cfg->intpin > 4)
- panic("dec_2100_a50_intr_map: bad intpin %d",cfg->intpin);
-
- switch (cfg->slot) {
+ switch (pci_get_slot(dev)) {
case 6: /* NCR SCSI */
pirq = 3;
break;
case 11: /* slot 1 */
case 14: /* slot 3 */
- switch(cfg->intpin) {
+ switch(pin) {
case 1:
case 4:
pirq = 0;
@@ -198,13 +191,12 @@ dec_2100_a50_intr_map(void *arg)
pirq = 1;
break;
default:
- panic("dec_2100_a50_intr_map bogus PCI pin %d\n",
- cfg->intpin);
-
+ panic("dec_2100_a50_intr_map bogus PCI pin %d\n", pin);
}
break;
+
case 12: /* slot 2 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1:
case 4:
pirq = 1;
@@ -216,14 +208,12 @@ dec_2100_a50_intr_map(void *arg)
pirq = 2;
break;
default:
- panic("dec_2100_a50_intr_map bogus PCI pin %d\n",
- cfg->intpin);
-
+ panic("dec_2100_a50_intr_map bogus PCI pin %d\n", pin);
};
break;
case 13: /* slot 3 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1:
case 4:
pirq = 2;
@@ -237,8 +227,8 @@ dec_2100_a50_intr_map(void *arg)
};
break;
default:
- printf("dec_2100_a50_intr_map: weird slot %d\n",
- cfg->slot);
+ printf("dec_2100_a50_intr_map: weird slot %d\n",
+ pci_get_slot(dev));
/* return; */
}
@@ -254,5 +244,5 @@ default:
if ((pirqline & 0x80) != 0)
panic("bad pirqline %d",pirqline);
pirqline &= 0xf;
- cfg->intline = pirqline;
+ return(pirqline);
}
diff --git a/sys/alpha/alpha/dec_2100_a500.c b/sys/alpha/alpha/dec_2100_a500.c
index 8366929..15973ba 100644
--- a/sys/alpha/alpha/dec_2100_a500.c
+++ b/sys/alpha/alpha/dec_2100_a500.c
@@ -32,6 +32,7 @@
#include <sys/reboot.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
@@ -80,7 +81,7 @@ dec_2100_a500_init(cputype)
platform.iobus = "t2";
platform.cons_init = dec_2100_a500_cons_init;
- platform.pci_intr_map = t2_intr_map;
+ platform.pci_intr_route = t2_intr_route;
platform.pci_intr_init = dec_2100_a500_intr_init;
t2_init();
diff --git a/sys/alpha/alpha/dec_3000_300.c b/sys/alpha/alpha/dec_3000_300.c
index 469eee0..5f269c0 100644
--- a/sys/alpha/alpha/dec_3000_300.c
+++ b/sys/alpha/alpha/dec_3000_300.c
@@ -34,6 +34,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
diff --git a/sys/alpha/alpha/dec_3000_500.c b/sys/alpha/alpha/dec_3000_500.c
index c9b8d1d..8a871a6 100644
--- a/sys/alpha/alpha/dec_3000_500.c
+++ b/sys/alpha/alpha/dec_3000_500.c
@@ -34,6 +34,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
diff --git a/sys/alpha/alpha/dec_axppci_33.c b/sys/alpha/alpha/dec_axppci_33.c
index 40b3c87..429a161 100644
--- a/sys/alpha/alpha/dec_axppci_33.c
+++ b/sys/alpha/alpha/dec_axppci_33.c
@@ -37,6 +37,7 @@
#include <sys/reboot.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
@@ -55,7 +56,7 @@ static int comcnrate = CONSPEED;
void dec_axppci_33_init __P((void));
static void dec_axppci_33_cons_init __P((void));
-static void dec_axppci_33_intr_map __P((void *));
+static int dec_axppci_33_intr_route __P((device_t, device_t, int));
extern int siocnattach __P((int, int));
extern int siogdbattach __P((int, int));
@@ -93,7 +94,7 @@ dec_axppci_33_init()
platform.iobus = "lca";
platform.cons_init = dec_axppci_33_cons_init;
- platform.pci_intr_map = dec_axppci_33_intr_map;
+ platform.pci_intr_route = dec_axppci_33_intr_route;
lca_init();
@@ -167,16 +168,13 @@ dec_axppci_33_cons_init()
#define SIO_PCIREG_PIRQ_RTCTRL 0x60 /* PIRQ0 Route Control */
-void
-dec_axppci_33_intr_map(void *arg)
+static int
+dec_axppci_33_intr_route(device_t pcib, device_t dev, int pin)
{
- pcicfgregs *cfg;
int pirq;
u_int32_t pirqreg;
u_int8_t pirqline;
- cfg = (pcicfgregs *)arg;
-
#ifndef DIAGNOSTIC
pirq = 0; /* XXX gcc -Wuninitialized */
#endif
@@ -185,23 +183,13 @@ dec_axppci_33_intr_map(void *arg)
* Slot->interrupt translation. Taken from NetBSD.
*/
- if (cfg->intpin == 0) {
- /* No IRQ used. */
- return;
- }
- if (cfg->intpin > 4) {
- printf("dec_axppci_33_intr_map: bad interrupt pin %d\n",
- cfg->intpin);
- return;
- }
-
- switch (cfg->slot) {
+ switch (pci_get_slot(dev)) {
case 6: /* NCR SCSI */
pirq = 3;
break;
case 11: /* slot 1 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1:
case 4:
pirq = 0;
@@ -212,16 +200,11 @@ dec_axppci_33_intr_map(void *arg)
case 3:
pirq = 1;
break;
-#ifdef DIAGNOSTIC
- default: /* XXX gcc -Wuninitialized */
- panic("dec_axppci_33_intr_map: bogus PCI pin %d\n",
- cfg->intpin);
-#endif
};
break;
case 12: /* slot 2 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1:
case 4:
pirq = 1;
@@ -232,16 +215,11 @@ dec_axppci_33_intr_map(void *arg)
case 3:
pirq = 2;
break;
-#ifdef DIAGNOSTIC
- default: /* XXX gcc -Wuninitialized */
- panic("dec_axppci_33_intr_map: bogus PCI pin %d\n",
- cfg->intpin);
-#endif
};
break;
case 8: /* slot 3 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1:
case 4:
pirq = 2;
@@ -252,35 +230,22 @@ dec_axppci_33_intr_map(void *arg)
case 3:
pirq = 0;
break;
-#ifdef DIAGNOSTIC
- default: /* XXX gcc -Wuninitialized */
- panic("dec_axppci_33_intr_map bogus: PCI pin %d\n",
- cfg->intpin);
-#endif
};
break;
default:
- printf("dec_axppci_33_intr_map: weird device number %d\n",
- cfg->slot);
- return;
+ printf("dec_axppci_33_intr_map: weird slot number %d\n",
+ pci_get_slot(dev));
+ return(255);
}
pirqreg = lca_pcib_read_config(0, 0, 7, 0,
SIO_PCIREG_PIRQ_RTCTRL, 4);
-#if 0
- printf("dec_axppci_33_intr_map: device %d pin %c: pirq %d, reg = %x\n",
- device, '@' + cfg->intpin, pirq, pirqreg);
-#endif
pirqline = (pirqreg >> (pirq * 8)) & 0xff;
if ((pirqline & 0x80) != 0)
panic("bad pirqline %d",pirqline);
pirqline &= 0xf;
-#if 0
- printf("dec_axppci_33_intr_map: device %d pin %c: mapped to line %d\n",
- device, '@' + cfg->intpin, pirqline);
-#endif
-
- cfg->intline = pirqline;
+ return(pirqline);
}
+
diff --git a/sys/alpha/alpha/dec_eb164.c b/sys/alpha/alpha/dec_eb164.c
index ca7c993..8889570 100644
--- a/sys/alpha/alpha/dec_eb164.c
+++ b/sys/alpha/alpha/dec_eb164.c
@@ -37,6 +37,7 @@
#include <sys/reboot.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
@@ -77,7 +78,7 @@ dec_eb164_init()
platform.iobus = "cia";
platform.cons_init = dec_eb164_cons_init;
platform.pci_intr_init = eb164_intr_init;
- platform.pci_intr_map = NULL;
+ platform.pci_intr_route = NULL;
if (strncmp(platform.model, "Digital AlphaPC 164 ", 20) == 0) {
platform.pci_intr_disable = eb164_intr_disable_icsr;
platform.pci_intr_enable = eb164_intr_enable_icsr;
diff --git a/sys/alpha/alpha/dec_eb64plus.c b/sys/alpha/alpha/dec_eb64plus.c
index fd68f5d..4cc3760 100644
--- a/sys/alpha/alpha/dec_eb64plus.c
+++ b/sys/alpha/alpha/dec_eb64plus.c
@@ -54,6 +54,7 @@
#include <sys/reboot.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
@@ -109,7 +110,7 @@ dec_eb64plus_init()
platform.cons_init = dec_eb64plus_cons_init;
platform.pci_intr_init = dec_eb64plus_intr_init;
/* SRM handles PCI interrupt mapping */
- platform.pci_intr_map = NULL;
+ platform.pci_intr_route = NULL;
/* see ../pci/pci_eb64plus_intr.s for intr. dis/enable */
platform.pci_intr_disable = eb64plus_intr_disable;
platform.pci_intr_enable = eb64plus_intr_enable;
diff --git a/sys/alpha/alpha/dec_kn20aa.c b/sys/alpha/alpha/dec_kn20aa.c
index 9151be6..0cbb897 100644
--- a/sys/alpha/alpha/dec_kn20aa.c
+++ b/sys/alpha/alpha/dec_kn20aa.c
@@ -37,6 +37,7 @@
#include <sys/reboot.h>
#include <sys/systm.h>
#include <sys/termios.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
@@ -57,7 +58,7 @@ static int comcnrate = CONSPEED;
void dec_kn20aa_init __P((void));
static void dec_kn20aa_cons_init __P((void));
static void dec_kn20aa_intr_init __P((void));
-static void dec_kn20aa_intr_map __P((void *));
+static int dec_kn20aa_intr_route __P((device_t, device_t, int));
static void dec_kn20aa_intr_disable __P((int));
static void dec_kn20aa_intr_enable __P((int));
@@ -92,7 +93,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;
}
@@ -276,12 +277,11 @@ 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 intline;
- cfg = (pcicfgregs *)arg;
/*
* Slot->interrupt translation. Appears to work, though it
* may not hold up forever.
@@ -289,45 +289,46 @@ dec_kn20aa_intr_map(void *arg)
* The DEC engineers who did this hardware obviously engaged
* in random drug testing.
*/
- switch (cfg->slot) {
+ switch (pci_get_slot(dev)) {
case 11:
case 12:
- cfg->intline = ((cfg->slot - 11) + 0) * 4;
+ intline = ((pci_get_slot(dev) - 11) + 0) * 4;
break;
case 7:
- cfg->intline = 8;
+ intline = 8;
break;
case 9:
- cfg->intline = 12;
+ intline = 12;
break;
case 6: /* 21040 on AlphaStation 500 */
- cfg->intline = 13;
+ intline = 13;
break;
case 8:
- cfg->intline = 16;
+ intline = 16;
break;
case 10: /* 8275EB on AlphaStation 500 */
- return;
+ return(255);
default:
- if(!cfg->bus){
+ if (pci_get_bus(dev) == 0) {
printf("dec_kn20aa_intr_map: weird slot %d\n",
- cfg->slot);
- return;
+ pci_get_slot(dev));
+ return(255);
} else {
- cfg->intline = cfg->slot;
+ intline = pci_get_slot(dev);
}
}
- cfg->intline += cfg->bus*16;
- if (cfg->intline > KN20AA_MAX_IRQ)
- panic("dec_kn20aa_intr_map: cfg->intline too large (%d)\n",
- cfg->intline);
+ intline += pci_get_bus(dev) * 16;
+ if (intline > KN20AA_MAX_IRQ)
+ panic("dec_kn20aa_intr_route: intline too large (%d)\n",
+ intline);
+ return(intline);
}
void
diff --git a/sys/alpha/alpha/dec_kn8ae.c b/sys/alpha/alpha/dec_kn8ae.c
index 8a28c57..e9deca9 100644
--- a/sys/alpha/alpha/dec_kn8ae.c
+++ b/sys/alpha/alpha/dec_kn8ae.c
@@ -38,6 +38,7 @@
#include <sys/termios.h>
#include <sys/cons.h>
#include <sys/reboot.h>
+#include <sys/bus.h>
#include <machine/rpb.h>
#include <machine/cpuconf.h>
diff --git a/sys/alpha/alpha/dec_st550.c b/sys/alpha/alpha/dec_st550.c
index cb341b1..a5f2ad6 100644
--- a/sys/alpha/alpha/dec_st550.c
+++ b/sys/alpha/alpha/dec_st550.c
@@ -67,7 +67,7 @@ static void pyxis_intr_enable __P((int));
static void pyxis_intr_disable __P((int));
static void st550_intr_enable __P((int));
static void st550_intr_disable __P((int));
-static void st550_intr_map __P((void *));
+static int st550_intr_route __P((device_t, device_t, int));
#define ST550_PCI_IRQ_BEGIN 8
#define ST550_PCI_MAX_IRQ 47
@@ -89,7 +89,7 @@ st550_init()
platform.iobus = "cia";
platform.cons_init = st550_cons_init;
platform.pci_intr_init = st550_intr_init;
- platform.pci_intr_map = st550_intr_map;
+ platform.pci_intr_route = st550_intr_route;
platform.pci_intr_disable = st550_intr_disable;
platform.pci_intr_enable = st550_intr_enable;
}
@@ -159,12 +159,9 @@ st550_intr_init()
pyxis_intr_enable(7); /* enable ISA PIC cascade */
}
-static void
-st550_intr_map(void *arg)
+static int
+st550_intr_route(device_t pcib, device_t dev, int pin)
{
- pcicfgregs *cfg;
-
- cfg = (pcicfgregs *)arg;
/* There are two main variants of Miata: Miata 1 (Intel SIO)
* and Miata {1.5,2} (Cypress).
@@ -179,25 +176,28 @@ st550_intr_map(void *arg)
* There will be no interrupt mapping for these devices, so just
* bail out now.
*/
- if(cfg->bus == 0) {
+ /*
+ * XXX FIXME this code does not match the above description.
+ */
+ if (pci_get_bus(dev) == 0) {
if ((hwrpb->rpb_variation & SV_ST_MASK) < SV_ST_MIATA_1_5) {
/* Miata 1 */
- if (cfg->slot == 7)
- return;
- else if (cfg->func == 4)
- return;
+ if (pci_get_slot(dev) == 7)
+ return(255);
+ else if (pci_get_function(dev) == 4)
+ return(255);
} else {
/* Miata 1.5 or Miata 2 */
- if (cfg->slot == 7) {
- if (cfg->func == 0)
- return;
- return;
+ if (pci_get_slot(dev) == 7) {
+ if (pci_get_function(dev) == 0)
+ return(255);
+ return(255);
}
}
}
/* Account for the PCI interrupt offset. */
/* cfg->intline += ST550_PCI_IRQ_BEGIN; */
- return;
+ return(255);
}
/*
diff --git a/sys/alpha/alpha/dec_st6600.c b/sys/alpha/alpha/dec_st6600.c
index ae74ce5..55b694f 100644
--- a/sys/alpha/alpha/dec_st6600.c
+++ b/sys/alpha/alpha/dec_st6600.c
@@ -55,7 +55,7 @@ static int comcnrate = CONSPEED;
void st6600_init __P((void));
static void st6600_cons_init __P((void));
static void st6600_intr_init __P((void));
-static void st6600_intr_map __P((void *));
+static int st6600_intr_route __P((device_t, device_t, int));
#define ST6600_PCI_IRQ_BEGIN 8
#define ST6600_PCI_MAX_IRQ 63
@@ -77,7 +77,7 @@ st6600_init()
platform.iobus = "tsunami";
platform.cons_init = st6600_cons_init;
platform.pci_intr_init = st6600_intr_init;
- platform.pci_intr_map = st6600_intr_map;
+ platform.pci_intr_route = st6600_intr_route;
}
extern int comconsole;
@@ -145,10 +145,10 @@ st6600_intr_init()
platform.pci_intr_enable(2);
}
-static void
-st6600_intr_map(void *arg)
+static int
+st6600_intr_route(device_t pcib, device_t dev, int pin)
{
- return;
+ return(255);
}
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index fc94bec..1d1e26b 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -107,6 +107,7 @@
#include <sys/reboot.h>
#include <sys/bio.h>
#include <sys/buf.h>
+#include <sys/bus.h>
#include <sys/mbuf.h>
#include <sys/vmmeter.h>
#include <sys/msgbuf.h>
diff --git a/sys/alpha/include/cpuconf.h b/sys/alpha/include/cpuconf.h
index db93a1d..66194f9 100644
--- a/sys/alpha/include/cpuconf.h
+++ b/sys/alpha/include/cpuconf.h
@@ -72,7 +72,7 @@ extern struct platform {
void (*mcheck_handler) __P((unsigned long, struct trapframe *,
unsigned long, unsigned long));
void (*pci_intr_init) __P((void));
- void (*pci_intr_map) __P((void *));
+ int (*pci_intr_route) __P((device_t, device_t, int));
void (*pci_intr_disable) __P((int));
void (*pci_intr_enable) __P((int));
int (*pci_setup_ide_intr) __P((struct device *dev,
diff --git a/sys/alpha/include/md_var.h b/sys/alpha/include/md_var.h
index 9439319..bf99dd7 100644
--- a/sys/alpha/include/md_var.h
+++ b/sys/alpha/include/md_var.h
@@ -71,7 +71,7 @@ int alpha_platform_pci_setup_intr(device_t dev, device_t child,
void **cookiep);
int alpha_platform_pci_teardown_intr(device_t dev, device_t child,
struct resource *irq, void *cookie);
+int alpha_pci_route_interrupt(device_t bus, device_t dev, int pin);
#endif
-void alpha_platform_assign_pciintr(struct pcicfg *cfg);
#endif /* !_MACHINE_MD_VAR_H_ */
diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c
index 7a7eaf0..90caab1 100644
--- a/sys/alpha/osf1/osf1_misc.c
+++ b/sys/alpha/osf1/osf1_misc.c
@@ -64,6 +64,7 @@
#include <alpha/osf1/osf1.h>
#include <sys/proc.h>
#include <sys/module.h>
+#include <sys/bus.h>
#include <vm/vm.h>
#include <alpha/osf1/exec_ecoff.h>
diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c
index 770ccf3..7ccb340 100644
--- a/sys/alpha/osf1/osf1_signal.c
+++ b/sys/alpha/osf1/osf1_signal.c
@@ -44,6 +44,7 @@
#include <sys/reboot.h>
#include <sys/bio.h>
#include <sys/buf.h>
+#include <sys/bus.h>
#include <sys/mbuf.h>
#include <sys/vmmeter.h>
#include <sys/msgbuf.h>
diff --git a/sys/alpha/pci/apecs_pci.c b/sys/alpha/pci/apecs_pci.c
index 7030111..2190748 100644
--- a/sys/alpha/pci/apecs_pci.c
+++ b/sys/alpha/pci/apecs_pci.c
@@ -35,6 +35,7 @@
#include <sys/rman.h>
#include <pci/pcivar.h>
#include <machine/swiz.h>
+#include <machine/md_var.h>
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
@@ -188,6 +189,7 @@ static device_method_t apecs_pcib_methods[] = {
DEVMETHOD(pcib_maxslots, apecs_pcib_maxslots),
DEVMETHOD(pcib_read_config, apecs_pcib_read_config),
DEVMETHOD(pcib_write_config, apecs_pcib_write_config),
+ DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt),
{ 0, 0 }
};
diff --git a/sys/alpha/pci/cia_pci.c b/sys/alpha/pci/cia_pci.c
index aa09f41..2a36ba2 100644
--- a/sys/alpha/pci/cia_pci.c
+++ b/sys/alpha/pci/cia_pci.c
@@ -410,6 +410,7 @@ static device_method_t cia_pcib_methods[] = {
DEVMETHOD(pcib_maxslots, cia_pcib_maxslots),
DEVMETHOD(pcib_read_config, cia_pcib_read_config),
DEVMETHOD(pcib_write_config, cia_pcib_write_config),
+ DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt),
{ 0, 0 }
};
diff --git a/sys/alpha/pci/irongate_pci.c b/sys/alpha/pci/irongate_pci.c
index 00c90aa..4950547 100644
--- a/sys/alpha/pci/irongate_pci.c
+++ b/sys/alpha/pci/irongate_pci.c
@@ -202,6 +202,8 @@ static device_method_t irongate_pcib_methods[] = {
DEVMETHOD(pcib_maxslots, irongate_pcib_maxslots),
DEVMETHOD(pcib_read_config, irongate_pcib_read_config),
DEVMETHOD(pcib_write_config, irongate_pcib_write_config),
+ DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt),
+
{ 0, 0 }
};
diff --git a/sys/alpha/pci/lca_pci.c b/sys/alpha/pci/lca_pci.c
index 36ede70..f139b59a 100644
--- a/sys/alpha/pci/lca_pci.c
+++ b/sys/alpha/pci/lca_pci.c
@@ -35,6 +35,7 @@
#include <sys/rman.h>
#include <pci/pcivar.h>
#include <machine/swiz.h>
+#include <machine/md_var.h>
#include <alpha/pci/lcareg.h>
#include <alpha/pci/lcavar.h>
@@ -184,6 +185,7 @@ static device_method_t lca_pcib_methods[] = {
DEVMETHOD(pcib_maxslots, lca_pcib_maxslots),
DEVMETHOD(pcib_read_config, lca_pcib_read_config),
DEVMETHOD(pcib_write_config, lca_pcib_write_config),
+ DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt),
{ 0, 0 }
};
diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c
index 0d54f63..aea4a88 100644
--- a/sys/alpha/pci/pcibus.c
+++ b/sys/alpha/pci/pcibus.c
@@ -76,11 +76,18 @@ SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense, 0,
SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask, 0,
"PCI chipset mask for HAE register");
-void
-alpha_platform_assign_pciintr(pcicfgregs *cfg)
+int
+alpha_pci_route_interrupt(device_t bus, device_t dev, int pin)
{
- if(platform.pci_intr_map)
- platform.pci_intr_map((void *)cfg);
+ /*
+ * Validate requested pin number.
+ */
+ if ((pin < 1) || (pin > 4))
+ return(255);
+
+ if (platform.pci_intr_route)
+ return(platform.pci_intr_route(bus, dev, pin));
+ return(255);
}
#if NISA > 0
diff --git a/sys/alpha/pci/t2.c b/sys/alpha/pci/t2.c
index 461376e..0e3c2a0 100644
--- a/sys/alpha/pci/t2.c
+++ b/sys/alpha/pci/t2.c
@@ -382,7 +382,7 @@ t2_attach(device_t dev)
*/
static int
-t2_ICIC_slot_to_STDIO_irq(pcicfgregs *cfg)
+t2_ICIC_slot_to_STDIO_irq(device_t bus, device_t dev, int pin)
{
int ret_irq = 0;
@@ -391,36 +391,42 @@ t2_ICIC_slot_to_STDIO_irq(pcicfgregs *cfg)
* Return the interrupt pin number for the PCI slots.
*/
- if ((cfg->intpin < 1) || (cfg->intpin > 4))
- return(-1);
-
- /* Generate the proper interrupt conversion for the physical
+ /*
+ * Generate the proper interrupt conversion for the physical
* PCI slots (for both the primary PCI slots and those behind
- * a PPB). */
-
- if ((cfg->slot >= 6) && (cfg->slot <= 9)) {
- ret_irq = (32 + (4 * (cfg->slot - 6))) +
- (cfg->intpin - 1) + (16 * cfg->secondarybus);
+ * a PPB).
+ */
+ /*
+ * XXX This code is wrong; we need to determine the correct
+ * swizzle for devices behind the onboard PCI:PCI bridge
+ * and ensure that the generic bridge code doesn't try to
+ * reroute them.
+ */
+ if ((pci_get_slot(dev) >= 6) && (pci_get_slot(dev) <= 9)) {
+ ret_irq = (32 + (4 * (pci_get_slot(dev) - 6))) +
+ (pin - 1) + (16 * pci_get_bus(dev));
return (ret_irq);
}
/* Convert the NCR810A chip behind the PPB */
- if (cfg->slot == 1) {
+ if (pci_get_slot(dev) == 1) {
ret_irq = 28;
return (ret_irq);
}
- /* Convert the NCR810A chip on the primary PCI bus or the
+ /*
+ * Convert the NCR810A chip on the primary PCI bus or the
* TULIP chip behind the PPB. There is no system that has
* both, so there really is no sharing going on although it
- * looks like it. */
- if ( (cfg->slot == 4) || (cfg->slot == 0) ) {
+ * looks like it.
+ */
+ if ((pci_get_slot(dev) == 4) || (pci_get_slot(dev) == 0)) {
ret_irq = 24;
return (ret_irq);
}
printf("ICIC invalid pci slot: 0x%x intpin: 0x%x bus num:0x%x\n",
- cfg->slot, cfg->intpin, cfg->bus);
+ pci_get_slot(dev), pin, pci_get_bus(dev));
return(-1);
}
@@ -429,59 +435,54 @@ t2_ICIC_slot_to_STDIO_irq(pcicfgregs *cfg)
*/
static int
-t2_pci0_slot_to_STDIO_irq(pcicfgregs *cfg)
+t2_pci0_slot_to_STDIO_irq(device_t bus, device_t dev, int pin)
{
- switch(cfg->slot) {
+ switch(pci_get_slot(dev)) {
case 0: /* ethernet (tulip) port */
return(0x2);
case 1: /* scsi 810 */
return(0x1);
case 6: /* optional slot 0 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1: return(0x0);
case 2: return(0x18);
case 3: return(0x1a);
case 4: return(0x1d);
}
case 7: /* optional slot 1 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1: return(0x4);
case 2: return(0x19);
case 3: return(0x1b);
case 4: return(0x1e);
}
case 8: /* optional slot 2 */
- switch (cfg->intpin) {
+ switch (pin) {
case 1: return(0x5);
case 2: return(0x14);
case 3: return(0x1c);
case 4: return(0x1f);
}
default: /* invalid slot */
- printf("PCI slot %d unknown\n", cfg->slot);
+ printf("PCI slot %d unknown\n", pci_get_slot(dev));
return(-1);
}
printf("invalid pci0 intpin slot: 0x%x intpin: 0x%x\n",
- cfg->slot, cfg->intpin);
+ pci_get_slot(dev), pin);
return (-1);
}
-
-void
-t2_intr_map(void *arg)
+int
+t2_intr_route(device_t bus, device_t dev, int pin)
{
- pcicfgregs *cfg;
-
- cfg = (pcicfgregs *)arg;
if (pci_int_type[0]) {
- t2_ICIC_slot_to_STDIO_irq(cfg);
+ return (t2_ICIC_slot_to_STDIO_irq(bus, dev, pin));
} else {
- t2_pci0_slot_to_STDIO_irq(cfg);
+ return (t2_pci0_slot_to_STDIO_irq(bus, dev, pin));
}
}
-
/*
* magical mystery table partly obtained from Linux
* at least some of their values for PCI masks
diff --git a/sys/alpha/pci/t2_pci.c b/sys/alpha/pci/t2_pci.c
index 73a754a..cd0bf06 100644
--- a/sys/alpha/pci/t2_pci.c
+++ b/sys/alpha/pci/t2_pci.c
@@ -35,6 +35,7 @@
#include <sys/rman.h>
#include <pci/pcivar.h>
#include <machine/swiz.h>
+#include <machine/md_var.h>
#include <alpha/pci/t2reg.h>
#include <alpha/pci/t2var.h>
@@ -190,6 +191,7 @@ static device_method_t t2_pcib_methods[] = {
DEVMETHOD(pcib_maxslots, t2_pcib_maxslots),
DEVMETHOD(pcib_read_config, t2_pcib_read_config),
DEVMETHOD(pcib_write_config, t2_pcib_write_config),
+ DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt),
{ 0, 0 }
};
diff --git a/sys/alpha/pci/t2var.h b/sys/alpha/pci/t2var.h
index a328633..770f05d 100644
--- a/sys/alpha/pci/t2var.h
+++ b/sys/alpha/pci/t2var.h
@@ -29,4 +29,4 @@
extern vm_offset_t sable_lynx_base;
extern void t2_init(void);
-void t2_intr_map(void *);
+extern int t2_intr_route(device_t, device_t, int);
diff --git a/sys/alpha/pci/tsunami_pci.c b/sys/alpha/pci/tsunami_pci.c
index f4a190b..b77754a 100644
--- a/sys/alpha/pci/tsunami_pci.c
+++ b/sys/alpha/pci/tsunami_pci.c
@@ -276,6 +276,7 @@ static device_method_t tsunami_pcib_methods[] = {
DEVMETHOD(pcib_maxslots, tsunami_pcib_maxslots),
DEVMETHOD(pcib_read_config, tsunami_pcib_read_config),
DEVMETHOD(pcib_write_config, tsunami_pcib_write_config),
+ DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt),
{ 0, 0 }
};
OpenPOWER on IntegriCloud