From: Sepherosa Ziehau Date: Wed, 31 Aug 2011 08:11:35 +0000 (+0800) Subject: intr/x86_64: Define IDT_HWI_VECTORS X-Git-Tag: v2.12.0~95 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/451af8d98a4c80b84e525152873b3cc74b9d2775 intr/x86_64: Define IDT_HWI_VECTORS This macro defines how many IDT vectors that could be setup as hardware interrupts. Use this macro instead of MAX_HARDINTS and APIC_INTMAPSIZE. --- diff --git a/sys/platform/pc64/apic/ioapic_abi.c b/sys/platform/pc64/apic/ioapic_abi.c index da0059c9e3..5656edf12a 100644 --- a/sys/platform/pc64/apic/ioapic_abi.c +++ b/sys/platform/pc64/apic/ioapic_abi.c @@ -62,6 +62,8 @@ #include #include +#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) diff --git a/sys/platform/pc64/apic/ioapic_abi.h b/sys/platform/pc64/apic/ioapic_abi.h index ae08c5a8ad..0a9d67f887 100644 --- a/sys/platform/pc64/apic/ioapic_abi.h +++ b/sys/platform/pc64/apic/ioapic_abi.h @@ -45,7 +45,6 @@ #include #endif -#define APIC_INTMAPSIZE 192 /* * NOTE: * - Keep size of apic_intmapinfo power of 2 diff --git a/sys/platform/pc64/apic/ioapic_ipl.h b/sys/platform/pc64/apic/ioapic_ipl.h index ad60bbec21..1d4fe36766 100644 --- a/sys/platform/pc64/apic/ioapic_ipl.h +++ b/sys/platform/pc64/apic/ioapic_ipl.h @@ -30,8 +30,6 @@ #ifndef _ARCH_APIC_IOAPIC_IPL_H_ #define _ARCH_APIC_IOAPIC_IPL_H_ -#define IOAPIC_HWI_VECTORS 192 - #ifdef LOCORE /* diff --git a/sys/platform/pc64/icu/icu_abi.c b/sys/platform/pc64/icu/icu_abi.c index 837b788076..ec007cf927 100644 --- a/sys/platform/pc64/icu/icu_abi.c +++ b/sys/platform/pc64/icu/icu_abi.c @@ -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); diff --git a/sys/platform/pc64/include/intr_machdep.h b/sys/platform/pc64/include/intr_machdep.h index 113845a376..f74d78e3fd 100644 --- a/sys/platform/pc64/include/intr_machdep.h +++ b/sys/platform/pc64/include/intr_machdep.h @@ -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: * diff --git a/sys/platform/pc64/x86_64/nexus.c b/sys/platform/pc64/x86_64/nexus.c index ed71718124..2dfc1c1139 100644 --- a/sys/platform/pc64/x86_64/nexus.c +++ b/sys/platform/pc64/x86_64/nexus.c @@ -58,8 +58,8 @@ #include #include +#include #include -#include #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))