summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorfsmp <fsmp@FreeBSD.org>1997-06-25 21:01:52 +0000
committerfsmp <fsmp@FreeBSD.org>1997-06-25 21:01:52 +0000
commitcf91630f75ebc45189e17de5b12f27a96a7605f3 (patch)
tree636d4226b66b0aab343ce6c226c93f010ec880f2 /sys
parentdba8ed633106407ed519b88268727767de2f71b5 (diff)
downloadFreeBSD-src-cf91630f75ebc45189e17de5b12f27a96a7605f3.zip
FreeBSD-src-cf91630f75ebc45189e17de5b12f27a96a7605f3.tar.gz
Merged/renamed functions:
- get_isa_apic_mask() -> isa_apic_mask() - get_isa_apic_irq() && get_eisa_apic_irq() -> isa_apic_pin() - get_pci_apic_irq() -> pci_apic_pin()
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/mp_machdep.c138
-rw-r--r--sys/amd64/amd64/mptable.c138
-rw-r--r--sys/amd64/include/mptable.h138
-rw-r--r--sys/i386/i386/mp_machdep.c138
-rw-r--r--sys/i386/i386/mptable.c138
-rw-r--r--sys/i386/include/mptable.h138
-rw-r--r--sys/kern/subr_smp.c138
7 files changed, 392 insertions, 574 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 91e77c2..b81115d 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.4 1997/06/25 20:44:00 smp Exp smp $
*/
#include "opt_smp.h"
@@ -958,106 +958,80 @@ apic_int_is_bus_type(int intr, int bus_type)
/*
- * determine which APIC pin an ISA INT is attached to.
- */
-#define INTTYPE(I) (io_apic_ints[(I)].int_type)
-#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
-
-#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
-int
-get_isa_apic_irq(int isaIRQ)
-{
- int intr;
-
-#if defined(SMP_TIMER_NC)
- if (isaIRQ == 0)
- return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == isaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, ISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
-}
-#undef SRCBUSIRQ
-
-
-/*
- *
+ * Given a traditional ISA INT mask, return an APIC mask.
*/
u_int
-get_isa_apic_mask(u_int isaMASK)
+isa_apic_mask(u_int isa_mask)
{
- int apicpin, isairq;
+ int isa_irq;
+ int apic_pin;
- isairq = ffs(isaMASK);
- if (isairq == 0) {
+ isa_irq = ffs(isa_mask); /* find its bit position */
+ if (isa_irq == 0) /* doesn't exist */
return 0;
- }
- --isairq;
+ --isa_irq; /* make it zero based */
- apicpin = get_isa_apic_irq(isairq);
- if (apicpin == -1) {
- apicpin = get_eisa_apic_irq(isairq);
- if (apicpin == -1) {
- return 0;
- }
- }
+ apic_pin = isa_apic_pin(isa_irq); /* look for APIC connection */
+ if (apic_pin == -1)
+ return 0;
- return (1 << apicpin);
+ return (1 << apic_pin); /* convert pin# to a mask */
}
/*
- * determine which APIC pin an EISA INT is attached to.
+ * Determine which APIC pin an ISA/EISA INT is attached to.
*/
+#define INTTYPE(I) (io_apic_ints[(I)].int_type)
+#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
+
#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
int
-get_eisa_apic_irq(int eisaIRQ)
+isa_apic_pin(int isa_irq)
{
int intr;
#if defined(SMP_TIMER_NC)
- if (eisaIRQ == 0)
+ if (isa_irq == 0)
return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == eisaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, EISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
+#endif /* SMP_TIMER_NC */
+
+ for (intr = 0; intr < nintrs; ++intr) { /* check each record */
+ if (INTTYPE(intr) == 0) { /* standard INT */
+ if (SRCBUSIRQ(intr) == isa_irq) {
+ if (apic_int_is_bus_type(intr, ISA) ||
+ apic_int_is_bus_type(intr, EISA))
+ return INTPIN(intr); /* found */
+ }
+ }
+ }
+ return -1; /* NOT found */
}
#undef SRCBUSIRQ
/*
- * determine which APIC pin a PCI INT is attached to.
+ * Determine which APIC pin a PCI INT is attached to.
*/
#define SRCBUSID(I) (io_apic_ints[(I)].src_bus_id)
#define SRCBUSDEVICE(I) ((io_apic_ints[(I)].src_bus_irq >> 2) & 0x1f)
#define SRCBUSLINE(I) (io_apic_ints[(I)].src_bus_irq & 0x03)
int
-get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
+pci_apic_pin(int pciBus, int pciDevice, int pciInt)
{
int intr;
- --pciInt; /* zero based */
+ --pciInt; /* zero based */
- for (intr = 0; intr < nintrs; ++intr) /* search each record */
- if ((INTTYPE(intr) == 0)
+ for (intr = 0; intr < nintrs; ++intr) /* check each record */
+ if ((INTTYPE(intr) == 0) /* standard INT */
&& (SRCBUSID(intr) == pciBus)
&& (SRCBUSDEVICE(intr) == pciDevice)
&& (SRCBUSLINE(intr) == pciInt)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, PCI)) /* check bus match */
+ if (apic_int_is_bus_type(intr, PCI))
return INTPIN(intr); /* exact match */
- return -1; /* NOT found */
+ return -1; /* NOT found */
}
#undef SRCBUSLINE
#undef SRCBUSDEVICE
@@ -1068,45 +1042,45 @@ get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
/*
- * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
+ * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
+ *
+ * XXX FIXME:
+ * Exactly what this means is unclear at this point. It is a solution
+ * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
+ * could route any of the ISA INTs to upper (>15) IRQ values. But most would
+ * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
+ * option.
*/
int
-undirect_pci_irq(int rirq)
+undirect_isa_irq(int rirq)
{
#if defined(READY)
- if (bootverbose)
- printf("Freeing redirected PCI irq %d.\n", rirq);
-
+ printf("Freeing redirected ISA irq %d.\n", rirq);
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- if (bootverbose)
- printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
- rirq);
+ printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
return 0;
#endif /* READY */
}
/*
- * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
- *
- * XXX FIXME:
- * Exactly what this means is unclear at this point. It is a solution
- * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
- * could route any of the ISA INTs to upper (>15) IRQ values. But most would
- * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
- * option.
+ * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
*/
int
-undirect_isa_irq(int rirq)
+undirect_pci_irq(int rirq)
{
#if defined(READY)
- printf("Freeing redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing redirected PCI irq %d.\n", rirq);
+
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
+ rirq);
return 0;
#endif /* READY */
}
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index 91e77c2..b81115d 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.4 1997/06/25 20:44:00 smp Exp smp $
*/
#include "opt_smp.h"
@@ -958,106 +958,80 @@ apic_int_is_bus_type(int intr, int bus_type)
/*
- * determine which APIC pin an ISA INT is attached to.
- */
-#define INTTYPE(I) (io_apic_ints[(I)].int_type)
-#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
-
-#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
-int
-get_isa_apic_irq(int isaIRQ)
-{
- int intr;
-
-#if defined(SMP_TIMER_NC)
- if (isaIRQ == 0)
- return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == isaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, ISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
-}
-#undef SRCBUSIRQ
-
-
-/*
- *
+ * Given a traditional ISA INT mask, return an APIC mask.
*/
u_int
-get_isa_apic_mask(u_int isaMASK)
+isa_apic_mask(u_int isa_mask)
{
- int apicpin, isairq;
+ int isa_irq;
+ int apic_pin;
- isairq = ffs(isaMASK);
- if (isairq == 0) {
+ isa_irq = ffs(isa_mask); /* find its bit position */
+ if (isa_irq == 0) /* doesn't exist */
return 0;
- }
- --isairq;
+ --isa_irq; /* make it zero based */
- apicpin = get_isa_apic_irq(isairq);
- if (apicpin == -1) {
- apicpin = get_eisa_apic_irq(isairq);
- if (apicpin == -1) {
- return 0;
- }
- }
+ apic_pin = isa_apic_pin(isa_irq); /* look for APIC connection */
+ if (apic_pin == -1)
+ return 0;
- return (1 << apicpin);
+ return (1 << apic_pin); /* convert pin# to a mask */
}
/*
- * determine which APIC pin an EISA INT is attached to.
+ * Determine which APIC pin an ISA/EISA INT is attached to.
*/
+#define INTTYPE(I) (io_apic_ints[(I)].int_type)
+#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
+
#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
int
-get_eisa_apic_irq(int eisaIRQ)
+isa_apic_pin(int isa_irq)
{
int intr;
#if defined(SMP_TIMER_NC)
- if (eisaIRQ == 0)
+ if (isa_irq == 0)
return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == eisaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, EISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
+#endif /* SMP_TIMER_NC */
+
+ for (intr = 0; intr < nintrs; ++intr) { /* check each record */
+ if (INTTYPE(intr) == 0) { /* standard INT */
+ if (SRCBUSIRQ(intr) == isa_irq) {
+ if (apic_int_is_bus_type(intr, ISA) ||
+ apic_int_is_bus_type(intr, EISA))
+ return INTPIN(intr); /* found */
+ }
+ }
+ }
+ return -1; /* NOT found */
}
#undef SRCBUSIRQ
/*
- * determine which APIC pin a PCI INT is attached to.
+ * Determine which APIC pin a PCI INT is attached to.
*/
#define SRCBUSID(I) (io_apic_ints[(I)].src_bus_id)
#define SRCBUSDEVICE(I) ((io_apic_ints[(I)].src_bus_irq >> 2) & 0x1f)
#define SRCBUSLINE(I) (io_apic_ints[(I)].src_bus_irq & 0x03)
int
-get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
+pci_apic_pin(int pciBus, int pciDevice, int pciInt)
{
int intr;
- --pciInt; /* zero based */
+ --pciInt; /* zero based */
- for (intr = 0; intr < nintrs; ++intr) /* search each record */
- if ((INTTYPE(intr) == 0)
+ for (intr = 0; intr < nintrs; ++intr) /* check each record */
+ if ((INTTYPE(intr) == 0) /* standard INT */
&& (SRCBUSID(intr) == pciBus)
&& (SRCBUSDEVICE(intr) == pciDevice)
&& (SRCBUSLINE(intr) == pciInt)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, PCI)) /* check bus match */
+ if (apic_int_is_bus_type(intr, PCI))
return INTPIN(intr); /* exact match */
- return -1; /* NOT found */
+ return -1; /* NOT found */
}
#undef SRCBUSLINE
#undef SRCBUSDEVICE
@@ -1068,45 +1042,45 @@ get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
/*
- * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
+ * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
+ *
+ * XXX FIXME:
+ * Exactly what this means is unclear at this point. It is a solution
+ * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
+ * could route any of the ISA INTs to upper (>15) IRQ values. But most would
+ * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
+ * option.
*/
int
-undirect_pci_irq(int rirq)
+undirect_isa_irq(int rirq)
{
#if defined(READY)
- if (bootverbose)
- printf("Freeing redirected PCI irq %d.\n", rirq);
-
+ printf("Freeing redirected ISA irq %d.\n", rirq);
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- if (bootverbose)
- printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
- rirq);
+ printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
return 0;
#endif /* READY */
}
/*
- * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
- *
- * XXX FIXME:
- * Exactly what this means is unclear at this point. It is a solution
- * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
- * could route any of the ISA INTs to upper (>15) IRQ values. But most would
- * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
- * option.
+ * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
*/
int
-undirect_isa_irq(int rirq)
+undirect_pci_irq(int rirq)
{
#if defined(READY)
- printf("Freeing redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing redirected PCI irq %d.\n", rirq);
+
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
+ rirq);
return 0;
#endif /* READY */
}
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 91e77c2..b81115d 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.4 1997/06/25 20:44:00 smp Exp smp $
*/
#include "opt_smp.h"
@@ -958,106 +958,80 @@ apic_int_is_bus_type(int intr, int bus_type)
/*
- * determine which APIC pin an ISA INT is attached to.
- */
-#define INTTYPE(I) (io_apic_ints[(I)].int_type)
-#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
-
-#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
-int
-get_isa_apic_irq(int isaIRQ)
-{
- int intr;
-
-#if defined(SMP_TIMER_NC)
- if (isaIRQ == 0)
- return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == isaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, ISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
-}
-#undef SRCBUSIRQ
-
-
-/*
- *
+ * Given a traditional ISA INT mask, return an APIC mask.
*/
u_int
-get_isa_apic_mask(u_int isaMASK)
+isa_apic_mask(u_int isa_mask)
{
- int apicpin, isairq;
+ int isa_irq;
+ int apic_pin;
- isairq = ffs(isaMASK);
- if (isairq == 0) {
+ isa_irq = ffs(isa_mask); /* find its bit position */
+ if (isa_irq == 0) /* doesn't exist */
return 0;
- }
- --isairq;
+ --isa_irq; /* make it zero based */
- apicpin = get_isa_apic_irq(isairq);
- if (apicpin == -1) {
- apicpin = get_eisa_apic_irq(isairq);
- if (apicpin == -1) {
- return 0;
- }
- }
+ apic_pin = isa_apic_pin(isa_irq); /* look for APIC connection */
+ if (apic_pin == -1)
+ return 0;
- return (1 << apicpin);
+ return (1 << apic_pin); /* convert pin# to a mask */
}
/*
- * determine which APIC pin an EISA INT is attached to.
+ * Determine which APIC pin an ISA/EISA INT is attached to.
*/
+#define INTTYPE(I) (io_apic_ints[(I)].int_type)
+#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
+
#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
int
-get_eisa_apic_irq(int eisaIRQ)
+isa_apic_pin(int isa_irq)
{
int intr;
#if defined(SMP_TIMER_NC)
- if (eisaIRQ == 0)
+ if (isa_irq == 0)
return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == eisaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, EISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
+#endif /* SMP_TIMER_NC */
+
+ for (intr = 0; intr < nintrs; ++intr) { /* check each record */
+ if (INTTYPE(intr) == 0) { /* standard INT */
+ if (SRCBUSIRQ(intr) == isa_irq) {
+ if (apic_int_is_bus_type(intr, ISA) ||
+ apic_int_is_bus_type(intr, EISA))
+ return INTPIN(intr); /* found */
+ }
+ }
+ }
+ return -1; /* NOT found */
}
#undef SRCBUSIRQ
/*
- * determine which APIC pin a PCI INT is attached to.
+ * Determine which APIC pin a PCI INT is attached to.
*/
#define SRCBUSID(I) (io_apic_ints[(I)].src_bus_id)
#define SRCBUSDEVICE(I) ((io_apic_ints[(I)].src_bus_irq >> 2) & 0x1f)
#define SRCBUSLINE(I) (io_apic_ints[(I)].src_bus_irq & 0x03)
int
-get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
+pci_apic_pin(int pciBus, int pciDevice, int pciInt)
{
int intr;
- --pciInt; /* zero based */
+ --pciInt; /* zero based */
- for (intr = 0; intr < nintrs; ++intr) /* search each record */
- if ((INTTYPE(intr) == 0)
+ for (intr = 0; intr < nintrs; ++intr) /* check each record */
+ if ((INTTYPE(intr) == 0) /* standard INT */
&& (SRCBUSID(intr) == pciBus)
&& (SRCBUSDEVICE(intr) == pciDevice)
&& (SRCBUSLINE(intr) == pciInt)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, PCI)) /* check bus match */
+ if (apic_int_is_bus_type(intr, PCI))
return INTPIN(intr); /* exact match */
- return -1; /* NOT found */
+ return -1; /* NOT found */
}
#undef SRCBUSLINE
#undef SRCBUSDEVICE
@@ -1068,45 +1042,45 @@ get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
/*
- * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
+ * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
+ *
+ * XXX FIXME:
+ * Exactly what this means is unclear at this point. It is a solution
+ * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
+ * could route any of the ISA INTs to upper (>15) IRQ values. But most would
+ * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
+ * option.
*/
int
-undirect_pci_irq(int rirq)
+undirect_isa_irq(int rirq)
{
#if defined(READY)
- if (bootverbose)
- printf("Freeing redirected PCI irq %d.\n", rirq);
-
+ printf("Freeing redirected ISA irq %d.\n", rirq);
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- if (bootverbose)
- printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
- rirq);
+ printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
return 0;
#endif /* READY */
}
/*
- * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
- *
- * XXX FIXME:
- * Exactly what this means is unclear at this point. It is a solution
- * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
- * could route any of the ISA INTs to upper (>15) IRQ values. But most would
- * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
- * option.
+ * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
*/
int
-undirect_isa_irq(int rirq)
+undirect_pci_irq(int rirq)
{
#if defined(READY)
- printf("Freeing redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing redirected PCI irq %d.\n", rirq);
+
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
+ rirq);
return 0;
#endif /* READY */
}
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index 91e77c2..b81115d 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.4 1997/06/25 20:44:00 smp Exp smp $
*/
#include "opt_smp.h"
@@ -958,106 +958,80 @@ apic_int_is_bus_type(int intr, int bus_type)
/*
- * determine which APIC pin an ISA INT is attached to.
- */
-#define INTTYPE(I) (io_apic_ints[(I)].int_type)
-#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
-
-#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
-int
-get_isa_apic_irq(int isaIRQ)
-{
- int intr;
-
-#if defined(SMP_TIMER_NC)
- if (isaIRQ == 0)
- return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == isaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, ISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
-}
-#undef SRCBUSIRQ
-
-
-/*
- *
+ * Given a traditional ISA INT mask, return an APIC mask.
*/
u_int
-get_isa_apic_mask(u_int isaMASK)
+isa_apic_mask(u_int isa_mask)
{
- int apicpin, isairq;
+ int isa_irq;
+ int apic_pin;
- isairq = ffs(isaMASK);
- if (isairq == 0) {
+ isa_irq = ffs(isa_mask); /* find its bit position */
+ if (isa_irq == 0) /* doesn't exist */
return 0;
- }
- --isairq;
+ --isa_irq; /* make it zero based */
- apicpin = get_isa_apic_irq(isairq);
- if (apicpin == -1) {
- apicpin = get_eisa_apic_irq(isairq);
- if (apicpin == -1) {
- return 0;
- }
- }
+ apic_pin = isa_apic_pin(isa_irq); /* look for APIC connection */
+ if (apic_pin == -1)
+ return 0;
- return (1 << apicpin);
+ return (1 << apic_pin); /* convert pin# to a mask */
}
/*
- * determine which APIC pin an EISA INT is attached to.
+ * Determine which APIC pin an ISA/EISA INT is attached to.
*/
+#define INTTYPE(I) (io_apic_ints[(I)].int_type)
+#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
+
#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
int
-get_eisa_apic_irq(int eisaIRQ)
+isa_apic_pin(int isa_irq)
{
int intr;
#if defined(SMP_TIMER_NC)
- if (eisaIRQ == 0)
+ if (isa_irq == 0)
return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == eisaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, EISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
+#endif /* SMP_TIMER_NC */
+
+ for (intr = 0; intr < nintrs; ++intr) { /* check each record */
+ if (INTTYPE(intr) == 0) { /* standard INT */
+ if (SRCBUSIRQ(intr) == isa_irq) {
+ if (apic_int_is_bus_type(intr, ISA) ||
+ apic_int_is_bus_type(intr, EISA))
+ return INTPIN(intr); /* found */
+ }
+ }
+ }
+ return -1; /* NOT found */
}
#undef SRCBUSIRQ
/*
- * determine which APIC pin a PCI INT is attached to.
+ * Determine which APIC pin a PCI INT is attached to.
*/
#define SRCBUSID(I) (io_apic_ints[(I)].src_bus_id)
#define SRCBUSDEVICE(I) ((io_apic_ints[(I)].src_bus_irq >> 2) & 0x1f)
#define SRCBUSLINE(I) (io_apic_ints[(I)].src_bus_irq & 0x03)
int
-get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
+pci_apic_pin(int pciBus, int pciDevice, int pciInt)
{
int intr;
- --pciInt; /* zero based */
+ --pciInt; /* zero based */
- for (intr = 0; intr < nintrs; ++intr) /* search each record */
- if ((INTTYPE(intr) == 0)
+ for (intr = 0; intr < nintrs; ++intr) /* check each record */
+ if ((INTTYPE(intr) == 0) /* standard INT */
&& (SRCBUSID(intr) == pciBus)
&& (SRCBUSDEVICE(intr) == pciDevice)
&& (SRCBUSLINE(intr) == pciInt)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, PCI)) /* check bus match */
+ if (apic_int_is_bus_type(intr, PCI))
return INTPIN(intr); /* exact match */
- return -1; /* NOT found */
+ return -1; /* NOT found */
}
#undef SRCBUSLINE
#undef SRCBUSDEVICE
@@ -1068,45 +1042,45 @@ get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
/*
- * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
+ * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
+ *
+ * XXX FIXME:
+ * Exactly what this means is unclear at this point. It is a solution
+ * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
+ * could route any of the ISA INTs to upper (>15) IRQ values. But most would
+ * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
+ * option.
*/
int
-undirect_pci_irq(int rirq)
+undirect_isa_irq(int rirq)
{
#if defined(READY)
- if (bootverbose)
- printf("Freeing redirected PCI irq %d.\n", rirq);
-
+ printf("Freeing redirected ISA irq %d.\n", rirq);
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- if (bootverbose)
- printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
- rirq);
+ printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
return 0;
#endif /* READY */
}
/*
- * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
- *
- * XXX FIXME:
- * Exactly what this means is unclear at this point. It is a solution
- * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
- * could route any of the ISA INTs to upper (>15) IRQ values. But most would
- * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
- * option.
+ * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
*/
int
-undirect_isa_irq(int rirq)
+undirect_pci_irq(int rirq)
{
#if defined(READY)
- printf("Freeing redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing redirected PCI irq %d.\n", rirq);
+
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
+ rirq);
return 0;
#endif /* READY */
}
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index 91e77c2..b81115d 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.4 1997/06/25 20:44:00 smp Exp smp $
*/
#include "opt_smp.h"
@@ -958,106 +958,80 @@ apic_int_is_bus_type(int intr, int bus_type)
/*
- * determine which APIC pin an ISA INT is attached to.
- */
-#define INTTYPE(I) (io_apic_ints[(I)].int_type)
-#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
-
-#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
-int
-get_isa_apic_irq(int isaIRQ)
-{
- int intr;
-
-#if defined(SMP_TIMER_NC)
- if (isaIRQ == 0)
- return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == isaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, ISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
-}
-#undef SRCBUSIRQ
-
-
-/*
- *
+ * Given a traditional ISA INT mask, return an APIC mask.
*/
u_int
-get_isa_apic_mask(u_int isaMASK)
+isa_apic_mask(u_int isa_mask)
{
- int apicpin, isairq;
+ int isa_irq;
+ int apic_pin;
- isairq = ffs(isaMASK);
- if (isairq == 0) {
+ isa_irq = ffs(isa_mask); /* find its bit position */
+ if (isa_irq == 0) /* doesn't exist */
return 0;
- }
- --isairq;
+ --isa_irq; /* make it zero based */
- apicpin = get_isa_apic_irq(isairq);
- if (apicpin == -1) {
- apicpin = get_eisa_apic_irq(isairq);
- if (apicpin == -1) {
- return 0;
- }
- }
+ apic_pin = isa_apic_pin(isa_irq); /* look for APIC connection */
+ if (apic_pin == -1)
+ return 0;
- return (1 << apicpin);
+ return (1 << apic_pin); /* convert pin# to a mask */
}
/*
- * determine which APIC pin an EISA INT is attached to.
+ * Determine which APIC pin an ISA/EISA INT is attached to.
*/
+#define INTTYPE(I) (io_apic_ints[(I)].int_type)
+#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
+
#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
int
-get_eisa_apic_irq(int eisaIRQ)
+isa_apic_pin(int isa_irq)
{
int intr;
#if defined(SMP_TIMER_NC)
- if (eisaIRQ == 0)
+ if (isa_irq == 0)
return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == eisaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, EISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
+#endif /* SMP_TIMER_NC */
+
+ for (intr = 0; intr < nintrs; ++intr) { /* check each record */
+ if (INTTYPE(intr) == 0) { /* standard INT */
+ if (SRCBUSIRQ(intr) == isa_irq) {
+ if (apic_int_is_bus_type(intr, ISA) ||
+ apic_int_is_bus_type(intr, EISA))
+ return INTPIN(intr); /* found */
+ }
+ }
+ }
+ return -1; /* NOT found */
}
#undef SRCBUSIRQ
/*
- * determine which APIC pin a PCI INT is attached to.
+ * Determine which APIC pin a PCI INT is attached to.
*/
#define SRCBUSID(I) (io_apic_ints[(I)].src_bus_id)
#define SRCBUSDEVICE(I) ((io_apic_ints[(I)].src_bus_irq >> 2) & 0x1f)
#define SRCBUSLINE(I) (io_apic_ints[(I)].src_bus_irq & 0x03)
int
-get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
+pci_apic_pin(int pciBus, int pciDevice, int pciInt)
{
int intr;
- --pciInt; /* zero based */
+ --pciInt; /* zero based */
- for (intr = 0; intr < nintrs; ++intr) /* search each record */
- if ((INTTYPE(intr) == 0)
+ for (intr = 0; intr < nintrs; ++intr) /* check each record */
+ if ((INTTYPE(intr) == 0) /* standard INT */
&& (SRCBUSID(intr) == pciBus)
&& (SRCBUSDEVICE(intr) == pciDevice)
&& (SRCBUSLINE(intr) == pciInt)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, PCI)) /* check bus match */
+ if (apic_int_is_bus_type(intr, PCI))
return INTPIN(intr); /* exact match */
- return -1; /* NOT found */
+ return -1; /* NOT found */
}
#undef SRCBUSLINE
#undef SRCBUSDEVICE
@@ -1068,45 +1042,45 @@ get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
/*
- * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
+ * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
+ *
+ * XXX FIXME:
+ * Exactly what this means is unclear at this point. It is a solution
+ * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
+ * could route any of the ISA INTs to upper (>15) IRQ values. But most would
+ * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
+ * option.
*/
int
-undirect_pci_irq(int rirq)
+undirect_isa_irq(int rirq)
{
#if defined(READY)
- if (bootverbose)
- printf("Freeing redirected PCI irq %d.\n", rirq);
-
+ printf("Freeing redirected ISA irq %d.\n", rirq);
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- if (bootverbose)
- printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
- rirq);
+ printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
return 0;
#endif /* READY */
}
/*
- * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
- *
- * XXX FIXME:
- * Exactly what this means is unclear at this point. It is a solution
- * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
- * could route any of the ISA INTs to upper (>15) IRQ values. But most would
- * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
- * option.
+ * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
*/
int
-undirect_isa_irq(int rirq)
+undirect_pci_irq(int rirq)
{
#if defined(READY)
- printf("Freeing redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing redirected PCI irq %d.\n", rirq);
+
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
+ rirq);
return 0;
#endif /* READY */
}
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index 91e77c2..b81115d 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.4 1997/06/25 20:44:00 smp Exp smp $
*/
#include "opt_smp.h"
@@ -958,106 +958,80 @@ apic_int_is_bus_type(int intr, int bus_type)
/*
- * determine which APIC pin an ISA INT is attached to.
- */
-#define INTTYPE(I) (io_apic_ints[(I)].int_type)
-#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
-
-#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
-int
-get_isa_apic_irq(int isaIRQ)
-{
- int intr;
-
-#if defined(SMP_TIMER_NC)
- if (isaIRQ == 0)
- return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == isaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, ISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
-}
-#undef SRCBUSIRQ
-
-
-/*
- *
+ * Given a traditional ISA INT mask, return an APIC mask.
*/
u_int
-get_isa_apic_mask(u_int isaMASK)
+isa_apic_mask(u_int isa_mask)
{
- int apicpin, isairq;
+ int isa_irq;
+ int apic_pin;
- isairq = ffs(isaMASK);
- if (isairq == 0) {
+ isa_irq = ffs(isa_mask); /* find its bit position */
+ if (isa_irq == 0) /* doesn't exist */
return 0;
- }
- --isairq;
+ --isa_irq; /* make it zero based */
- apicpin = get_isa_apic_irq(isairq);
- if (apicpin == -1) {
- apicpin = get_eisa_apic_irq(isairq);
- if (apicpin == -1) {
- return 0;
- }
- }
+ apic_pin = isa_apic_pin(isa_irq); /* look for APIC connection */
+ if (apic_pin == -1)
+ return 0;
- return (1 << apicpin);
+ return (1 << apic_pin); /* convert pin# to a mask */
}
/*
- * determine which APIC pin an EISA INT is attached to.
+ * Determine which APIC pin an ISA/EISA INT is attached to.
*/
+#define INTTYPE(I) (io_apic_ints[(I)].int_type)
+#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
+
#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
int
-get_eisa_apic_irq(int eisaIRQ)
+isa_apic_pin(int isa_irq)
{
int intr;
#if defined(SMP_TIMER_NC)
- if (eisaIRQ == 0)
+ if (isa_irq == 0)
return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == eisaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, EISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
+#endif /* SMP_TIMER_NC */
+
+ for (intr = 0; intr < nintrs; ++intr) { /* check each record */
+ if (INTTYPE(intr) == 0) { /* standard INT */
+ if (SRCBUSIRQ(intr) == isa_irq) {
+ if (apic_int_is_bus_type(intr, ISA) ||
+ apic_int_is_bus_type(intr, EISA))
+ return INTPIN(intr); /* found */
+ }
+ }
+ }
+ return -1; /* NOT found */
}
#undef SRCBUSIRQ
/*
- * determine which APIC pin a PCI INT is attached to.
+ * Determine which APIC pin a PCI INT is attached to.
*/
#define SRCBUSID(I) (io_apic_ints[(I)].src_bus_id)
#define SRCBUSDEVICE(I) ((io_apic_ints[(I)].src_bus_irq >> 2) & 0x1f)
#define SRCBUSLINE(I) (io_apic_ints[(I)].src_bus_irq & 0x03)
int
-get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
+pci_apic_pin(int pciBus, int pciDevice, int pciInt)
{
int intr;
- --pciInt; /* zero based */
+ --pciInt; /* zero based */
- for (intr = 0; intr < nintrs; ++intr) /* search each record */
- if ((INTTYPE(intr) == 0)
+ for (intr = 0; intr < nintrs; ++intr) /* check each record */
+ if ((INTTYPE(intr) == 0) /* standard INT */
&& (SRCBUSID(intr) == pciBus)
&& (SRCBUSDEVICE(intr) == pciDevice)
&& (SRCBUSLINE(intr) == pciInt)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, PCI)) /* check bus match */
+ if (apic_int_is_bus_type(intr, PCI))
return INTPIN(intr); /* exact match */
- return -1; /* NOT found */
+ return -1; /* NOT found */
}
#undef SRCBUSLINE
#undef SRCBUSDEVICE
@@ -1068,45 +1042,45 @@ get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
/*
- * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
+ * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
+ *
+ * XXX FIXME:
+ * Exactly what this means is unclear at this point. It is a solution
+ * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
+ * could route any of the ISA INTs to upper (>15) IRQ values. But most would
+ * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
+ * option.
*/
int
-undirect_pci_irq(int rirq)
+undirect_isa_irq(int rirq)
{
#if defined(READY)
- if (bootverbose)
- printf("Freeing redirected PCI irq %d.\n", rirq);
-
+ printf("Freeing redirected ISA irq %d.\n", rirq);
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- if (bootverbose)
- printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
- rirq);
+ printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
return 0;
#endif /* READY */
}
/*
- * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
- *
- * XXX FIXME:
- * Exactly what this means is unclear at this point. It is a solution
- * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
- * could route any of the ISA INTs to upper (>15) IRQ values. But most would
- * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
- * option.
+ * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
*/
int
-undirect_isa_irq(int rirq)
+undirect_pci_irq(int rirq)
{
#if defined(READY)
- printf("Freeing redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing redirected PCI irq %d.\n", rirq);
+
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
+ rirq);
return 0;
#endif /* READY */
}
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 91e77c2..b81115d 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.20 1997/06/24 07:48:02 fsmp Exp $
+ * $Id: mp_machdep.c,v 1.4 1997/06/25 20:44:00 smp Exp smp $
*/
#include "opt_smp.h"
@@ -958,106 +958,80 @@ apic_int_is_bus_type(int intr, int bus_type)
/*
- * determine which APIC pin an ISA INT is attached to.
- */
-#define INTTYPE(I) (io_apic_ints[(I)].int_type)
-#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
-
-#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
-int
-get_isa_apic_irq(int isaIRQ)
-{
- int intr;
-
-#if defined(SMP_TIMER_NC)
- if (isaIRQ == 0)
- return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == isaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, ISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
-}
-#undef SRCBUSIRQ
-
-
-/*
- *
+ * Given a traditional ISA INT mask, return an APIC mask.
*/
u_int
-get_isa_apic_mask(u_int isaMASK)
+isa_apic_mask(u_int isa_mask)
{
- int apicpin, isairq;
+ int isa_irq;
+ int apic_pin;
- isairq = ffs(isaMASK);
- if (isairq == 0) {
+ isa_irq = ffs(isa_mask); /* find its bit position */
+ if (isa_irq == 0) /* doesn't exist */
return 0;
- }
- --isairq;
+ --isa_irq; /* make it zero based */
- apicpin = get_isa_apic_irq(isairq);
- if (apicpin == -1) {
- apicpin = get_eisa_apic_irq(isairq);
- if (apicpin == -1) {
- return 0;
- }
- }
+ apic_pin = isa_apic_pin(isa_irq); /* look for APIC connection */
+ if (apic_pin == -1)
+ return 0;
- return (1 << apicpin);
+ return (1 << apic_pin); /* convert pin# to a mask */
}
/*
- * determine which APIC pin an EISA INT is attached to.
+ * Determine which APIC pin an ISA/EISA INT is attached to.
*/
+#define INTTYPE(I) (io_apic_ints[(I)].int_type)
+#define INTPIN(I) (io_apic_ints[(I)].dst_apic_int)
+
#define SRCBUSIRQ(I) (io_apic_ints[(I)].src_bus_irq)
int
-get_eisa_apic_irq(int eisaIRQ)
+isa_apic_pin(int isa_irq)
{
int intr;
#if defined(SMP_TIMER_NC)
- if (eisaIRQ == 0)
+ if (isa_irq == 0)
return -1;
-#endif /* SMP_TIMER_NC */
-
- for (intr = 0; intr < nintrs; ++intr) /* search each INT record */
- if ((INTTYPE(intr) == 0)
- && (SRCBUSIRQ(intr) == eisaIRQ)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, EISA)) /* check bus match */
- return INTPIN(intr); /* exact match */
-
- return -1; /* NOT found */
+#endif /* SMP_TIMER_NC */
+
+ for (intr = 0; intr < nintrs; ++intr) { /* check each record */
+ if (INTTYPE(intr) == 0) { /* standard INT */
+ if (SRCBUSIRQ(intr) == isa_irq) {
+ if (apic_int_is_bus_type(intr, ISA) ||
+ apic_int_is_bus_type(intr, EISA))
+ return INTPIN(intr); /* found */
+ }
+ }
+ }
+ return -1; /* NOT found */
}
#undef SRCBUSIRQ
/*
- * determine which APIC pin a PCI INT is attached to.
+ * Determine which APIC pin a PCI INT is attached to.
*/
#define SRCBUSID(I) (io_apic_ints[(I)].src_bus_id)
#define SRCBUSDEVICE(I) ((io_apic_ints[(I)].src_bus_irq >> 2) & 0x1f)
#define SRCBUSLINE(I) (io_apic_ints[(I)].src_bus_irq & 0x03)
int
-get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
+pci_apic_pin(int pciBus, int pciDevice, int pciInt)
{
int intr;
- --pciInt; /* zero based */
+ --pciInt; /* zero based */
- for (intr = 0; intr < nintrs; ++intr) /* search each record */
- if ((INTTYPE(intr) == 0)
+ for (intr = 0; intr < nintrs; ++intr) /* check each record */
+ if ((INTTYPE(intr) == 0) /* standard INT */
&& (SRCBUSID(intr) == pciBus)
&& (SRCBUSDEVICE(intr) == pciDevice)
&& (SRCBUSLINE(intr) == pciInt)) /* a candidate IRQ */
- if (apic_int_is_bus_type(intr, PCI)) /* check bus match */
+ if (apic_int_is_bus_type(intr, PCI))
return INTPIN(intr); /* exact match */
- return -1; /* NOT found */
+ return -1; /* NOT found */
}
#undef SRCBUSLINE
#undef SRCBUSDEVICE
@@ -1068,45 +1042,45 @@ get_pci_apic_irq(int pciBus, int pciDevice, int pciInt)
/*
- * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
+ * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
+ *
+ * XXX FIXME:
+ * Exactly what this means is unclear at this point. It is a solution
+ * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
+ * could route any of the ISA INTs to upper (>15) IRQ values. But most would
+ * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
+ * option.
*/
int
-undirect_pci_irq(int rirq)
+undirect_isa_irq(int rirq)
{
#if defined(READY)
- if (bootverbose)
- printf("Freeing redirected PCI irq %d.\n", rirq);
-
+ printf("Freeing redirected ISA irq %d.\n", rirq);
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- if (bootverbose)
- printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
- rirq);
+ printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
return 0;
#endif /* READY */
}
/*
- * Reprogram the MB chipset to NOT redirect an ISA INTerrupt.
- *
- * XXX FIXME:
- * Exactly what this means is unclear at this point. It is a solution
- * for motherboards that redirect the MBIRQ0 pin. Generically a motherboard
- * could route any of the ISA INTs to upper (>15) IRQ values. But most would
- * NOT be redirected via MBIRQ0, thus "undirect()ing" them would NOT be an
- * option.
+ * Reprogram the MB chipset to NOT redirect a PCI INTerrupt
*/
int
-undirect_isa_irq(int rirq)
+undirect_pci_irq(int rirq)
{
#if defined(READY)
- printf("Freeing redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing redirected PCI irq %d.\n", rirq);
+
/** FIXME: tickle the MB redirector chip */
return ???;
#else
- printf("Freeing (NOT implemented) redirected ISA irq %d.\n", rirq);
+ if (bootverbose)
+ printf("Freeing (NOT implemented) redirected PCI irq %d.\n",
+ rirq);
return 0;
#endif /* READY */
}
OpenPOWER on IntegriCloud