intr/i386: Define IDT_HWI_VECTORS
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 21 Aug 2011 13:02:48 +0000 (21:02 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 21 Aug 2011 13:17:31 +0000 (21:17 +0800)
This macro defines how many IDT vectors that could be setup as hardware
interrupts.  Use this macro instead of MAX_HARDINTS and APIC_INTMAPSIZE.

sys/platform/pc32/apic/ioapic_abi.c
sys/platform/pc32/apic/ioapic_abi.h
sys/platform/pc32/apic/ioapic_ipl.h
sys/platform/pc32/i386/nexus.c
sys/platform/pc32/icu/icu_abi.c
sys/platform/pc32/include/intr_machdep.h

index 1f3bf2d..b209473 100644 (file)
@@ -62,6 +62,8 @@
 #include <machine_base/apic/ioapic_ipl.h>
 #include <machine_base/apic/apicreg.h>
 
+#define IOAPIC_HWI_VECTORS     IDT_HWI_VECTORS
+
 extern inthand_t
        IDTVEC(ioapic_intr0),
        IDTVEC(ioapic_intr1),
@@ -459,7 +461,7 @@ static struct ioapic_irqmap {
        enum intr_polarity      im_pola;
        int                     im_gsi;
        uint32_t                im_flags;       /* IOAPIC_IMF_ */
-} ioapic_irqmaps[MAX_HARDINTS];        /* XXX MAX_HARDINTS may not be correct */
+} ioapic_irqmaps[IOAPIC_HWI_VECTORS];
 
 #define IOAPIC_IMT_UNUSED      0
 #define IOAPIC_IMT_RESERVED    1
@@ -502,7 +504,7 @@ struct machintr_abi MachIntrABI_IOAPIC = {
 
 static int     ioapic_abi_extint_irq = -1;
 
-struct apic_intmapinfo int_to_apicintpin[APIC_INTMAPSIZE];
+struct apic_intmapinfo int_to_apicintpin[IOAPIC_HWI_VECTORS];
 
 static void
 ioapic_abi_intren(int irq)
index c8ba181..9312845 100644 (file)
@@ -45,7 +45,6 @@
 #include <sys/bus.h>
 #endif
 
-#define APIC_INTMAPSIZE 192
 /*
  * NOTE:
  * - Keep size of apic_intmapinfo power of 2
index fcdd88f..6a325cc 100644 (file)
@@ -29,8 +29,6 @@
 #ifndef _ARCH_APIC_IOAPIC_IPL_H_
 #define        _ARCH_APIC_IOAPIC_IPL_H_
 
-#define IOAPIC_HWI_VECTORS 192
-
 #ifdef LOCORE
 
 /*
index acb8a61..9ffb811 100644 (file)
@@ -57,7 +57,7 @@
 
 #include <machine/nexusvar.h>
 #include <machine/smp.h>
-#include <machine_base/apic/ioapic_abi.h>
+#include <machine/intr_machdep.h>
 #include <machine_base/apic/ioapic.h>
 
 #include <bus/pci/pcivar.h>
@@ -164,8 +164,11 @@ nexus_probe(device_t dev)
        irq_rman.rm_type = RMAN_ARRAY;
        irq_rman.rm_descr = "Interrupt request lines";
 
+       /*
+        * XXX should use MachIntrABI.rman_setup
+        */
        if (ioapic_enable) {
-               irq_rman.rm_end = APIC_INTMAPSIZE - 1;
+               irq_rman.rm_end = IDT_HWI_VECTORS - 1;
                if (rman_init(&irq_rman)
                    || rman_manage_region(&irq_rman,
                                          irq_rman.rm_start, irq_rman.rm_end))
index 09680b5..84ae052 100644 (file)
@@ -84,7 +84,7 @@ static inthand_t *icu_intr[ICU_HWI_VECTORS] = {
 static struct icu_irqmap {
        int                     im_type;        /* ICU_IMT_ */
        enum intr_trigger       im_trig;
-} icu_irqmaps[MAX_HARDINTS];   /* XXX MAX_HARDINTS may not be correct */
+} icu_irqmaps[IDT_HWI_VECTORS];
 
 #define ICU_IMT_UNUSED         0       /* KEEP THIS */
 #define ICU_IMT_RESERVED       1
@@ -261,7 +261,7 @@ icu_intr_config(int irq, enum intr_trigger trig,
 
        KKASSERT(trig == INTR_TRIGGER_EDGE || trig == INTR_TRIGGER_LEVEL);
 
-       KKASSERT(irq >= 0 && irq < MAX_HARDINTS);
+       KKASSERT(irq >= 0 && irq < IDT_HWI_VECTORS);
        map = &icu_irqmaps[irq];
 
        KKASSERT(map->im_type == ICU_IMT_LINE);
index 1a13b77..f4b7dbd 100644 (file)
@@ -53,6 +53,8 @@
 #define IDT_OFFSET_SYSCALL     0x80
 #define IDT_OFFSET_IPI         0xe0
 
+#define IDT_HWI_VECTORS                (IDT_OFFSET_IPI - IDT_OFFSET)
+
 /*
  * Local APIC TPR priority vector levels:
  *