aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/amd64/mp_machdep.c
diff options
context:
space:
mode:
authorSteve Passe <fsmp@FreeBSD.org>1997-06-25 21:01:52 +0000
committerSteve Passe <fsmp@FreeBSD.org>1997-06-25 21:01:52 +0000
commit8b16756603b473fade3b4622a95e9a3ffcd84efb (patch)
treee7a392d1067f32179cb8afe722b645541e9f503b /sys/amd64/amd64/mp_machdep.c
parent293f18dbbf57c353c33e35e8a6188872c212274e (diff)
downloadsrc-8b16756603b473fade3b4622a95e9a3ffcd84efb.tar.gz
src-8b16756603b473fade3b4622a95e9a3ffcd84efb.zip
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()
Notes
Notes: svn path=/head/; revision=26950
Diffstat (limited to 'sys/amd64/amd64/mp_machdep.c')
-rw-r--r--sys/amd64/amd64/mp_machdep.c138
1 files changed, 56 insertions, 82 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 91e77c22c503..b81115dcd478 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 */
}