intr/x86_64: Define IDT_HWI_VECTORS
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 31 Aug 2011 08:11:35 +0000 (16:11 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 31 Aug 2011 09:11:11 +0000 (17:11 +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/pc64/apic/ioapic_abi.c
sys/platform/pc64/apic/ioapic_abi.h
sys/platform/pc64/apic/ioapic_ipl.h
sys/platform/pc64/icu/icu_abi.c
sys/platform/pc64/include/intr_machdep.h
sys/platform/pc64/x86_64/nexus.c

index da0059c..5656edf 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 ae08c5a..0a9d67f 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 ad60bbe..1d4fe36 100644 (file)
@@ -30,8 +30,6 @@
 #ifndef _ARCH_APIC_IOAPIC_IPL_H_
 #define        _ARCH_APIC_IOAPIC_IPL_H_
 
-#define IOAPIC_HWI_VECTORS 192
-
 #ifdef LOCORE
 
 /*
index 837b788..ec007cf 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 113845a..f74d78e 100644 (file)
@@ -54,6 +54,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:
  *
index ed71718..2dfc1c1 100644 (file)
@@ -58,8 +58,8 @@
 
 #include <machine/nexusvar.h>
 #include <machine/smp.h>
+#include <machine/intr_machdep.h>
 #include <machine_base/apic/ioapic.h>
-#include <machine_base/apic/ioapic_abi.h>
 
 #define I386_BUS_SPACE_IO       0       /* space is i/o space */
 #define I386_BUS_SPACE_MEM      1       /* space is mem space */
@@ -160,8 +160,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))