diff options
| author | Steve Passe <fsmp@FreeBSD.org> | 1997-07-20 19:41:38 +0000 |
|---|---|---|
| committer | Steve Passe <fsmp@FreeBSD.org> | 1997-07-20 19:41:38 +0000 |
| commit | 35b3c4a0e5591671f86f5ce649aed698780cfb64 (patch) | |
| tree | 262ed31e026855350caaf4c356075a74060251e9 | |
| parent | c69ef9495ba42fb521db829e834d4e30e28d35ae (diff) | |
Notes
| -rw-r--r-- | sys/amd64/amd64/mp_machdep.c | 8 | ||||
| -rw-r--r-- | sys/amd64/amd64/mptable.c | 8 | ||||
| -rw-r--r-- | sys/amd64/amd64/tsc.c | 94 | ||||
| -rw-r--r-- | sys/amd64/include/mptable.h | 8 | ||||
| -rw-r--r-- | sys/amd64/isa/clock.c | 94 | ||||
| -rw-r--r-- | sys/i386/i386/microtime.s | 22 | ||||
| -rw-r--r-- | sys/i386/i386/mp_machdep.c | 8 | ||||
| -rw-r--r-- | sys/i386/i386/mpapic.c | 15 | ||||
| -rw-r--r-- | sys/i386/i386/mptable.c | 8 | ||||
| -rw-r--r-- | sys/i386/i386/tsc.c | 94 | ||||
| -rw-r--r-- | sys/i386/include/mptable.h | 8 | ||||
| -rw-r--r-- | sys/i386/isa/apic_ipl.s | 87 | ||||
| -rw-r--r-- | sys/i386/isa/clock.c | 94 | ||||
| -rw-r--r-- | sys/isa/atrtc.c | 94 | ||||
| -rw-r--r-- | sys/kern/subr_smp.c | 8 |
15 files changed, 423 insertions, 227 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 343ea7db2f7c..c9724a10b0d9 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.17 1997/07/20 17:43:20 smp Exp smp $ + * $Id: mp_machdep.c,v 1.18 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -1065,12 +1065,14 @@ isa_apic_pin(int isa_irq) int intr; #if defined(SMP_TIMER_NC) -#if defined(APIC_PIN0_TIMER) +#if defined(NEW_STRATEGY) || defined(APIC_PIN0_TIMER) +#error #error 'options SMP_TIMER_NC' no longer used, remove & reconfig. +#error #else if (isa_irq == 0) return -1; -#endif /* APIC_PIN0_TIMER */ +#endif /* NEW_STRATEGY || APIC_PIN0_TIMER */ #endif /* SMP_TIMER_NC */ for (intr = 0; intr < nintrs; ++intr) { /* check each record */ diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c index 343ea7db2f7c..c9724a10b0d9 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.17 1997/07/20 17:43:20 smp Exp smp $ + * $Id: mp_machdep.c,v 1.18 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -1065,12 +1065,14 @@ isa_apic_pin(int isa_irq) int intr; #if defined(SMP_TIMER_NC) -#if defined(APIC_PIN0_TIMER) +#if defined(NEW_STRATEGY) || defined(APIC_PIN0_TIMER) +#error #error 'options SMP_TIMER_NC' no longer used, remove & reconfig. +#error #else if (isa_irq == 0) return -1; -#endif /* APIC_PIN0_TIMER */ +#endif /* NEW_STRATEGY || APIC_PIN0_TIMER */ #endif /* SMP_TIMER_NC */ for (intr = 0; intr < nintrs; ++intr) { /* check each record */ diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index 00fefc3f08ea..e9faacc1ecf0 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.2 1997/07/20 17:02:32 smp Exp smp $ + * $Id: clock.c,v 1.3 1997/07/20 18:11:45 smp Exp smp $ */ /* @@ -832,7 +832,17 @@ resettodr() #ifdef APIC_IO /* XXX FIXME: from icu.s: */ -#if !defined(APIC_PIN0_TIMER) || defined(DO_RTC_VEC) +#ifdef NEW_STRATEGY + +extern u_int ivectors[]; +extern u_int vec[]; +extern void vec8254 __P((void)); +extern u_int Xintr8254; +extern u_int mask8254; + +#else /** NEW_STRATEGY */ + +#if !defined(APIC_PIN0_TIMER) extern u_int ivectors[]; extern u_int vec[]; #endif @@ -843,12 +853,7 @@ extern u_int Xintr8254; extern u_int mask8254; #endif /* APIC_PIN0_TIMER */ -#ifdef DO_RTC_VEC -/** XXX FIXME: remove vevRTS stuff after several weeks of no problems */ -extern void vecRTC __P((void)); -extern u_int XintrRTC; -extern u_int maskRTC; -#endif /* DO_RTC_VEC */ +#endif /** NEW_STRATEGY */ #endif /* APIC_IO */ @@ -880,6 +885,53 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO + +#ifdef NEW_STRATEGY + /* 1st look for ExtInt on pin 0 */ + if (apic_int_type(0, 0) == 3) { + /* + * Allow 8254 timer to INTerrupt 8259: + * re-initialize master 8259: + * reset; prog 4 bytes, single ICU, edge triggered + */ + outb(IO_ICU1, 0x13); + outb(IO_ICU1 + 1, NRSVIDT); /* start vector */ + outb(IO_ICU1 + 1, 0x00); /* ignore slave */ + outb(IO_ICU1 + 1, 0x03); /* auto EOI, 8086 */ + outb(IO_ICU1 + 1, 0xfe); /* unmask INT0 */ + + /* program IO APIC for type 3 INT on INT0 */ + if (ext_int_setup(0, 0) < 0) + panic("8254 redirect via APIC pin0 impossible!"); + + x = 0; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via 8259 on pin 0\n"); + } + + /* failing that, look for 8254 on pin 2 */ + else if (isa_apic_pin(0) == 2) { + x = 2; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via pin 2\n"); + } + + /* better write that 8254 INT discover code... */ + else + panic("neither pin 0 or pin 2 works for 8254"); + + /* setup the vectors for the chosen method */ + vec[x] = (u_int)vec8254; + Xintr8254 = (u_int)ivectors[x]; + mask8254 = (1 << x); + + register_intr(/* irq */ x, /* XXX id */ 0, /* flags */ 0, + /* XXX */ (inthand2_t *)clkintr, &clk_imask, + /* unit */ 0); + INTREN(mask8254); + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER /* * Allow 8254 timer to INTerrupt 8259: @@ -939,6 +991,9 @@ cpu_initclocks() /* unit */ 0); INTREN(mask8254); #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ + #else /* APIC_IO */ register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0, /* XXX */ (inthand2_t *)clkintr, &clk_imask, @@ -966,34 +1021,13 @@ cpu_initclocks() printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); #ifdef APIC_IO - -#ifdef DO_RTC_VEC - if ((x = isa_apic_pin(8)) < 0) - panic("APIC missing RTC connection"); - vec[x] = (u_int)vecRTC; - XintrRTC = (u_int)ivectors[x]; /* XXX might need Xfastintr# */ - maskRTC = (1 << x); - register_intr(/* irq */ x, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(maskRTC); -#else if (isa_apic_pin(8) != 8) panic("APIC RTC != 8"); +#endif /* APIC_IO */ register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, /* XXX */ (inthand2_t *)rtcintr, &stat_imask, /* unit */ 0); INTREN(IRQ8); -#endif /* DO_RTC_VEC */ - -#else /* APIC_IO */ - - register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(IRQ8); - -#endif /* APIC_IO */ writertc(RTC_STATUSB, rtc_statusb); } diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h index 343ea7db2f7c..c9724a10b0d9 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.17 1997/07/20 17:43:20 smp Exp smp $ + * $Id: mp_machdep.c,v 1.18 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -1065,12 +1065,14 @@ isa_apic_pin(int isa_irq) int intr; #if defined(SMP_TIMER_NC) -#if defined(APIC_PIN0_TIMER) +#if defined(NEW_STRATEGY) || defined(APIC_PIN0_TIMER) +#error #error 'options SMP_TIMER_NC' no longer used, remove & reconfig. +#error #else if (isa_irq == 0) return -1; -#endif /* APIC_PIN0_TIMER */ +#endif /* NEW_STRATEGY || APIC_PIN0_TIMER */ #endif /* SMP_TIMER_NC */ for (intr = 0; intr < nintrs; ++intr) { /* check each record */ diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 00fefc3f08ea..e9faacc1ecf0 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.2 1997/07/20 17:02:32 smp Exp smp $ + * $Id: clock.c,v 1.3 1997/07/20 18:11:45 smp Exp smp $ */ /* @@ -832,7 +832,17 @@ resettodr() #ifdef APIC_IO /* XXX FIXME: from icu.s: */ -#if !defined(APIC_PIN0_TIMER) || defined(DO_RTC_VEC) +#ifdef NEW_STRATEGY + +extern u_int ivectors[]; +extern u_int vec[]; +extern void vec8254 __P((void)); +extern u_int Xintr8254; +extern u_int mask8254; + +#else /** NEW_STRATEGY */ + +#if !defined(APIC_PIN0_TIMER) extern u_int ivectors[]; extern u_int vec[]; #endif @@ -843,12 +853,7 @@ extern u_int Xintr8254; extern u_int mask8254; #endif /* APIC_PIN0_TIMER */ -#ifdef DO_RTC_VEC -/** XXX FIXME: remove vevRTS stuff after several weeks of no problems */ -extern void vecRTC __P((void)); -extern u_int XintrRTC; -extern u_int maskRTC; -#endif /* DO_RTC_VEC */ +#endif /** NEW_STRATEGY */ #endif /* APIC_IO */ @@ -880,6 +885,53 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO + +#ifdef NEW_STRATEGY + /* 1st look for ExtInt on pin 0 */ + if (apic_int_type(0, 0) == 3) { + /* + * Allow 8254 timer to INTerrupt 8259: + * re-initialize master 8259: + * reset; prog 4 bytes, single ICU, edge triggered + */ + outb(IO_ICU1, 0x13); + outb(IO_ICU1 + 1, NRSVIDT); /* start vector */ + outb(IO_ICU1 + 1, 0x00); /* ignore slave */ + outb(IO_ICU1 + 1, 0x03); /* auto EOI, 8086 */ + outb(IO_ICU1 + 1, 0xfe); /* unmask INT0 */ + + /* program IO APIC for type 3 INT on INT0 */ + if (ext_int_setup(0, 0) < 0) + panic("8254 redirect via APIC pin0 impossible!"); + + x = 0; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via 8259 on pin 0\n"); + } + + /* failing that, look for 8254 on pin 2 */ + else if (isa_apic_pin(0) == 2) { + x = 2; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via pin 2\n"); + } + + /* better write that 8254 INT discover code... */ + else + panic("neither pin 0 or pin 2 works for 8254"); + + /* setup the vectors for the chosen method */ + vec[x] = (u_int)vec8254; + Xintr8254 = (u_int)ivectors[x]; + mask8254 = (1 << x); + + register_intr(/* irq */ x, /* XXX id */ 0, /* flags */ 0, + /* XXX */ (inthand2_t *)clkintr, &clk_imask, + /* unit */ 0); + INTREN(mask8254); + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER /* * Allow 8254 timer to INTerrupt 8259: @@ -939,6 +991,9 @@ cpu_initclocks() /* unit */ 0); INTREN(mask8254); #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ + #else /* APIC_IO */ register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0, /* XXX */ (inthand2_t *)clkintr, &clk_imask, @@ -966,34 +1021,13 @@ cpu_initclocks() printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); #ifdef APIC_IO - -#ifdef DO_RTC_VEC - if ((x = isa_apic_pin(8)) < 0) - panic("APIC missing RTC connection"); - vec[x] = (u_int)vecRTC; - XintrRTC = (u_int)ivectors[x]; /* XXX might need Xfastintr# */ - maskRTC = (1 << x); - register_intr(/* irq */ x, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(maskRTC); -#else if (isa_apic_pin(8) != 8) panic("APIC RTC != 8"); +#endif /* APIC_IO */ register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, /* XXX */ (inthand2_t *)rtcintr, &stat_imask, /* unit */ 0); INTREN(IRQ8); -#endif /* DO_RTC_VEC */ - -#else /* APIC_IO */ - - register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(IRQ8); - -#endif /* APIC_IO */ writertc(RTC_STATUSB, rtc_statusb); } diff --git a/sys/i386/i386/microtime.s b/sys/i386/i386/microtime.s index b0460cb4f464..173f61adc6cd 100644 --- a/sys/i386/i386/microtime.s +++ b/sys/i386/i386/microtime.s @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: Steve McCanne's microtime code - * $Id: microtime.s,v 1.1 1997/07/19 03:13:15 smp Exp smp $ + * $Id: microtime.s,v 1.25 1997/07/19 04:00:32 fsmp Exp $ */ #include "opt_cpu.h" @@ -40,7 +40,7 @@ #include <machine/asmacros.h> #ifdef APIC_IO -#include <machine/smptests.h> /** APIC_PIN0_TIMER */ +#include <machine/smptests.h> /** NEW STRATEGY, APIC_PIN0_TIMER */ #endif /* APIC_IO */ #include <i386/isa/icu.h> @@ -114,12 +114,21 @@ ENTRY(microtime) movl _timer0_max_count, %edx /* prepare for 2 uses */ #ifdef APIC_IO +#ifdef NEW_STRATEGY + + movl _ipending, %eax + testl %eax, _mask8254 /* is soft timer interrupt pending? */ + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER testl $IRQ0, _ipending /* is soft timer interrupt pending? */ #else movl _ipending, %eax testl %eax, _mask8254 /* is soft timer interrupt pending? */ #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ #else testb $IRQ0, _ipending /* is soft timer interrupt pending? */ #endif /* APIC_IO */ @@ -130,12 +139,21 @@ ENTRY(microtime) jbe 1f #ifdef APIC_IO +#ifdef NEW_STRATEGY + + movl lapic_irr1, %eax /** XXX assumption: IRQ0-24 */ + testl %eax, _mask8254 /* is hard timer interrupt pending? */ + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER testl $IRQ0, lapic_irr1 #else movl lapic_irr1, %eax /** XXX assumption: IRQ0-24 */ testl %eax, _mask8254 /* is hard timer interrupt pending? */ #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ #else inb $IO_ICU1, %al /* read IRR in ICU */ testb $IRQ0, %al /* is hard timer interrupt pending? */ diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 343ea7db2f7c..c9724a10b0d9 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.17 1997/07/20 17:43:20 smp Exp smp $ + * $Id: mp_machdep.c,v 1.18 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -1065,12 +1065,14 @@ isa_apic_pin(int isa_irq) int intr; #if defined(SMP_TIMER_NC) -#if defined(APIC_PIN0_TIMER) +#if defined(NEW_STRATEGY) || defined(APIC_PIN0_TIMER) +#error #error 'options SMP_TIMER_NC' no longer used, remove & reconfig. +#error #else if (isa_irq == 0) return -1; -#endif /* APIC_PIN0_TIMER */ +#endif /* NEW_STRATEGY || APIC_PIN0_TIMER */ #endif /* SMP_TIMER_NC */ for (intr = 0; intr < nintrs; ++intr) { /* check each record */ diff --git a/sys/i386/i386/mpapic.c b/sys/i386/i386/mpapic.c index 25bc4c40f58c..491a268f93dd 100644 --- a/sys/i386/i386/mpapic.c +++ b/sys/i386/i386/mpapic.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mpapic.c,v 1.14 1997/07/20 17:40:39 smp Exp smp $ + * $Id: mpapic.c,v 1.15 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -236,20 +236,12 @@ io_apic_setup(int apic) #undef DEFAULT_FLAGS -#if defined(TEST_ALTTIMER) - #if defined(TIMER_ALL) #define DEL_MODE IOART_DELLOPRI #else #define DEL_MODE IOART_DELFIXED #endif /** TIMER_ALL */ -#else - -#define DEL_MODE IOART_DELEXINT - -#endif /** TEST_ALTTIMER */ - #define DEFAULT_EXTINT_FLAGS \ ((u_int32_t) \ (IOART_INTMSET | \ @@ -272,7 +264,6 @@ ext_int_setup(int apic, int intr) if (apic_int_type(apic, intr) != 3) return -1; -/** XXX FIXME: changed on 970708, make default if no complaints */ #if defined(TIMER_ALL) target = IOART_DEST; #else @@ -286,10 +277,6 @@ ext_int_setup(int apic, int intr) io_apic_write(apic, select, flags | vector); io_apic_write(apic, select + 1, target); -#if defined(TEST_ALTTIMER) - printf("SMP: using ALT timer setup\n"); -#endif /** TEST_ALTTIMER */ - return 0; } #undef DEL_MODE diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c index 343ea7db2f7c..c9724a10b0d9 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.17 1997/07/20 17:43:20 smp Exp smp $ + * $Id: mp_machdep.c,v 1.18 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -1065,12 +1065,14 @@ isa_apic_pin(int isa_irq) int intr; #if defined(SMP_TIMER_NC) -#if defined(APIC_PIN0_TIMER) +#if defined(NEW_STRATEGY) || defined(APIC_PIN0_TIMER) +#error #error 'options SMP_TIMER_NC' no longer used, remove & reconfig. +#error #else if (isa_irq == 0) return -1; -#endif /* APIC_PIN0_TIMER */ +#endif /* NEW_STRATEGY || APIC_PIN0_TIMER */ #endif /* SMP_TIMER_NC */ for (intr = 0; intr < nintrs; ++intr) { /* check each record */ diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index 00fefc3f08ea..e9faacc1ecf0 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.2 1997/07/20 17:02:32 smp Exp smp $ + * $Id: clock.c,v 1.3 1997/07/20 18:11:45 smp Exp smp $ */ /* @@ -832,7 +832,17 @@ resettodr() #ifdef APIC_IO /* XXX FIXME: from icu.s: */ -#if !defined(APIC_PIN0_TIMER) || defined(DO_RTC_VEC) +#ifdef NEW_STRATEGY + +extern u_int ivectors[]; +extern u_int vec[]; +extern void vec8254 __P((void)); +extern u_int Xintr8254; +extern u_int mask8254; + +#else /** NEW_STRATEGY */ + +#if !defined(APIC_PIN0_TIMER) extern u_int ivectors[]; extern u_int vec[]; #endif @@ -843,12 +853,7 @@ extern u_int Xintr8254; extern u_int mask8254; #endif /* APIC_PIN0_TIMER */ -#ifdef DO_RTC_VEC -/** XXX FIXME: remove vevRTS stuff after several weeks of no problems */ -extern void vecRTC __P((void)); -extern u_int XintrRTC; -extern u_int maskRTC; -#endif /* DO_RTC_VEC */ +#endif /** NEW_STRATEGY */ #endif /* APIC_IO */ @@ -880,6 +885,53 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO + +#ifdef NEW_STRATEGY + /* 1st look for ExtInt on pin 0 */ + if (apic_int_type(0, 0) == 3) { + /* + * Allow 8254 timer to INTerrupt 8259: + * re-initialize master 8259: + * reset; prog 4 bytes, single ICU, edge triggered + */ + outb(IO_ICU1, 0x13); + outb(IO_ICU1 + 1, NRSVIDT); /* start vector */ + outb(IO_ICU1 + 1, 0x00); /* ignore slave */ + outb(IO_ICU1 + 1, 0x03); /* auto EOI, 8086 */ + outb(IO_ICU1 + 1, 0xfe); /* unmask INT0 */ + + /* program IO APIC for type 3 INT on INT0 */ + if (ext_int_setup(0, 0) < 0) + panic("8254 redirect via APIC pin0 impossible!"); + + x = 0; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via 8259 on pin 0\n"); + } + + /* failing that, look for 8254 on pin 2 */ + else if (isa_apic_pin(0) == 2) { + x = 2; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via pin 2\n"); + } + + /* better write that 8254 INT discover code... */ + else + panic("neither pin 0 or pin 2 works for 8254"); + + /* setup the vectors for the chosen method */ + vec[x] = (u_int)vec8254; + Xintr8254 = (u_int)ivectors[x]; + mask8254 = (1 << x); + + register_intr(/* irq */ x, /* XXX id */ 0, /* flags */ 0, + /* XXX */ (inthand2_t *)clkintr, &clk_imask, + /* unit */ 0); + INTREN(mask8254); + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER /* * Allow 8254 timer to INTerrupt 8259: @@ -939,6 +991,9 @@ cpu_initclocks() /* unit */ 0); INTREN(mask8254); #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ + #else /* APIC_IO */ register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0, /* XXX */ (inthand2_t *)clkintr, &clk_imask, @@ -966,34 +1021,13 @@ cpu_initclocks() printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); #ifdef APIC_IO - -#ifdef DO_RTC_VEC - if ((x = isa_apic_pin(8)) < 0) - panic("APIC missing RTC connection"); - vec[x] = (u_int)vecRTC; - XintrRTC = (u_int)ivectors[x]; /* XXX might need Xfastintr# */ - maskRTC = (1 << x); - register_intr(/* irq */ x, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(maskRTC); -#else if (isa_apic_pin(8) != 8) panic("APIC RTC != 8"); +#endif /* APIC_IO */ register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, /* XXX */ (inthand2_t *)rtcintr, &stat_imask, /* unit */ 0); INTREN(IRQ8); -#endif /* DO_RTC_VEC */ - -#else /* APIC_IO */ - - register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(IRQ8); - -#endif /* APIC_IO */ writertc(RTC_STATUSB, rtc_statusb); } diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h index 343ea7db2f7c..c9724a10b0d9 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.17 1997/07/20 17:43:20 smp Exp smp $ + * $Id: mp_machdep.c,v 1.18 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -1065,12 +1065,14 @@ isa_apic_pin(int isa_irq) int intr; #if defined(SMP_TIMER_NC) -#if defined(APIC_PIN0_TIMER) +#if defined(NEW_STRATEGY) || defined(APIC_PIN0_TIMER) +#error #error 'options SMP_TIMER_NC' no longer used, remove & reconfig. +#error #else if (isa_irq == 0) return -1; -#endif /* APIC_PIN0_TIMER */ +#endif /* NEW_STRATEGY || APIC_PIN0_TIMER */ #endif /* SMP_TIMER_NC */ for (intr = 0; intr < nintrs; ++intr) { /* check each record */ diff --git a/sys/i386/isa/apic_ipl.s b/sys/i386/isa/apic_ipl.s index bb88ceb7ddcc..e5f56032a1bd 100644 --- a/sys/i386/isa/apic_ipl.s +++ b/sys/i386/isa/apic_ipl.s @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, by Steve Passe * All rights reserved. * @@ -22,17 +22,17 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: apic_ipl.s,v 1.2 1997/07/19 02:28:29 fsmp Exp $ + * $Id: apic_ipl.s,v 1.2 1997/07/20 18:11:45 smp Exp smp $ */ -#ifdef APIC_IO -#include <machine/smptests.h> /** APIC_PIN0_TIMER */ -#endif /* APIC_IO */ + +#include <machine/smptests.h> /** NEW_STRATEGY, APIC_PIN0_TIMER */ .data ALIGN_DATA -#ifndef APIC_PIN0_TIMER +#ifdef NEW_STRATEGY + /* this allows us to change the 8254 APIC pin# assignment */ .globl _Xintr8254 _Xintr8254: @@ -42,20 +42,22 @@ _Xintr8254: .globl _mask8254 _mask8254: .long 0 -#endif /* APIC_PIN0_TIMER */ -#ifdef DO_RTC_VEC -/** XXX FIXME: remove me after several weeks of no problems */ -/* this allows us to change the RTC clock APIC pin# assignment */ - .globl _XintrRTC -_XintrRTC: +#else /** NEW_STRATEGY */ + +#ifndef APIC_PIN0_TIMER +/* this allows us to change the 8254 APIC pin# assignment */ + .globl _Xintr8254 +_Xintr8254: .long _Xintr7 -/* used by this file and clock.c */ - .globl _maskRTC -_maskRTC: +/* used by this file, microtime.s and clock.c */ + .globl _mask8254 +_mask8254: .long 0 -#endif /* DO_RTC_VEC */ +#endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ /* */ .globl _vec @@ -82,6 +84,24 @@ _vec: * generic vector function for 8254 clock */ ALIGN_TEXT +#ifdef NEW_STRATEGY + + .globl _vec8254 +_vec8254: + popl %eax /* return address */ + pushfl + pushl $KCSEL + pushl %eax + cli + movl _mask8254, %eax /* lazy masking */ + notl %eax + andl %eax, iactive + MEXITCOUNT + movl _Xintr8254, %eax + jmp %eax /* XXX might need _Xfastintr# */ + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER vec0: popl %eax /* return address */ @@ -108,29 +128,13 @@ _vec8254: jmp %eax /* XXX might need _Xfastintr# */ #endif /* APIC_PIN0_TIMER */ +#endif /** NEW_STRATEGY */ + /* * generic vector function for RTC clock */ ALIGN_TEXT -#ifdef DO_RTC_VEC - - .globl _vecRTC -_vecRTC: - popl %eax - pushfl - pushl $KCSEL - pushl %eax - cli - movl _maskRTC,%eax /* lazy masking */ - notl %eax - andl %eax, iactive - MEXITCOUNT - movl _XintrRTC, %eax - jmp %eax /* XXX might need _Xfastintr# */ - -#else /* DO_RTC_VEC */ - vec8: popl %eax pushfl @@ -141,9 +145,6 @@ vec8: MEXITCOUNT jmp _Xintr8 /* XXX might need _Xfastintr8 */ -#endif /* DO_RTC_VEC */ - - /* * The 'generic' vector stubs. */ @@ -161,9 +162,17 @@ __CONCAT(vec,irq_num): ; \ jmp __CONCAT(_Xintr,irq_num) +#ifdef NEW_STRATEGY + + BUILD_VEC(0) + +#else /** NEW_STRATEGY */ + #ifndef APIC_PIN0_TIMER BUILD_VEC(0) #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ BUILD_VEC(1) BUILD_VEC(2) BUILD_VEC(3) @@ -171,9 +180,7 @@ __CONCAT(vec,irq_num): ; \ BUILD_VEC(5) BUILD_VEC(6) BUILD_VEC(7) -#ifdef DO_RTC_VEC - BUILD_VEC(8) -#endif /* DO__RTC_VEC */ + /* IRQ8 is special case, done above */ BUILD_VEC(9) BUILD_VEC(10) BUILD_VEC(11) diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 00fefc3f08ea..e9faacc1ecf0 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.2 1997/07/20 17:02:32 smp Exp smp $ + * $Id: clock.c,v 1.3 1997/07/20 18:11:45 smp Exp smp $ */ /* @@ -832,7 +832,17 @@ resettodr() #ifdef APIC_IO /* XXX FIXME: from icu.s: */ -#if !defined(APIC_PIN0_TIMER) || defined(DO_RTC_VEC) +#ifdef NEW_STRATEGY + +extern u_int ivectors[]; +extern u_int vec[]; +extern void vec8254 __P((void)); +extern u_int Xintr8254; +extern u_int mask8254; + +#else /** NEW_STRATEGY */ + +#if !defined(APIC_PIN0_TIMER) extern u_int ivectors[]; extern u_int vec[]; #endif @@ -843,12 +853,7 @@ extern u_int Xintr8254; extern u_int mask8254; #endif /* APIC_PIN0_TIMER */ -#ifdef DO_RTC_VEC -/** XXX FIXME: remove vevRTS stuff after several weeks of no problems */ -extern void vecRTC __P((void)); -extern u_int XintrRTC; -extern u_int maskRTC; -#endif /* DO_RTC_VEC */ +#endif /** NEW_STRATEGY */ #endif /* APIC_IO */ @@ -880,6 +885,53 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO + +#ifdef NEW_STRATEGY + /* 1st look for ExtInt on pin 0 */ + if (apic_int_type(0, 0) == 3) { + /* + * Allow 8254 timer to INTerrupt 8259: + * re-initialize master 8259: + * reset; prog 4 bytes, single ICU, edge triggered + */ + outb(IO_ICU1, 0x13); + outb(IO_ICU1 + 1, NRSVIDT); /* start vector */ + outb(IO_ICU1 + 1, 0x00); /* ignore slave */ + outb(IO_ICU1 + 1, 0x03); /* auto EOI, 8086 */ + outb(IO_ICU1 + 1, 0xfe); /* unmask INT0 */ + + /* program IO APIC for type 3 INT on INT0 */ + if (ext_int_setup(0, 0) < 0) + panic("8254 redirect via APIC pin0 impossible!"); + + x = 0; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via 8259 on pin 0\n"); + } + + /* failing that, look for 8254 on pin 2 */ + else if (isa_apic_pin(0) == 2) { + x = 2; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via pin 2\n"); + } + + /* better write that 8254 INT discover code... */ + else + panic("neither pin 0 or pin 2 works for 8254"); + + /* setup the vectors for the chosen method */ + vec[x] = (u_int)vec8254; + Xintr8254 = (u_int)ivectors[x]; + mask8254 = (1 << x); + + register_intr(/* irq */ x, /* XXX id */ 0, /* flags */ 0, + /* XXX */ (inthand2_t *)clkintr, &clk_imask, + /* unit */ 0); + INTREN(mask8254); + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER /* * Allow 8254 timer to INTerrupt 8259: @@ -939,6 +991,9 @@ cpu_initclocks() /* unit */ 0); INTREN(mask8254); #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ + #else /* APIC_IO */ register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0, /* XXX */ (inthand2_t *)clkintr, &clk_imask, @@ -966,34 +1021,13 @@ cpu_initclocks() printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); #ifdef APIC_IO - -#ifdef DO_RTC_VEC - if ((x = isa_apic_pin(8)) < 0) - panic("APIC missing RTC connection"); - vec[x] = (u_int)vecRTC; - XintrRTC = (u_int)ivectors[x]; /* XXX might need Xfastintr# */ - maskRTC = (1 << x); - register_intr(/* irq */ x, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(maskRTC); -#else if (isa_apic_pin(8) != 8) panic("APIC RTC != 8"); +#endif /* APIC_IO */ register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, /* XXX */ (inthand2_t *)rtcintr, &stat_imask, /* unit */ 0); INTREN(IRQ8); -#endif /* DO_RTC_VEC */ - -#else /* APIC_IO */ - - register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(IRQ8); - -#endif /* APIC_IO */ writertc(RTC_STATUSB, rtc_statusb); } diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 00fefc3f08ea..e9faacc1ecf0 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.2 1997/07/20 17:02:32 smp Exp smp $ + * $Id: clock.c,v 1.3 1997/07/20 18:11:45 smp Exp smp $ */ /* @@ -832,7 +832,17 @@ resettodr() #ifdef APIC_IO /* XXX FIXME: from icu.s: */ -#if !defined(APIC_PIN0_TIMER) || defined(DO_RTC_VEC) +#ifdef NEW_STRATEGY + +extern u_int ivectors[]; +extern u_int vec[]; +extern void vec8254 __P((void)); +extern u_int Xintr8254; +extern u_int mask8254; + +#else /** NEW_STRATEGY */ + +#if !defined(APIC_PIN0_TIMER) extern u_int ivectors[]; extern u_int vec[]; #endif @@ -843,12 +853,7 @@ extern u_int Xintr8254; extern u_int mask8254; #endif /* APIC_PIN0_TIMER */ -#ifdef DO_RTC_VEC -/** XXX FIXME: remove vevRTS stuff after several weeks of no problems */ -extern void vecRTC __P((void)); -extern u_int XintrRTC; -extern u_int maskRTC; -#endif /* DO_RTC_VEC */ +#endif /** NEW_STRATEGY */ #endif /* APIC_IO */ @@ -880,6 +885,53 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO + +#ifdef NEW_STRATEGY + /* 1st look for ExtInt on pin 0 */ + if (apic_int_type(0, 0) == 3) { + /* + * Allow 8254 timer to INTerrupt 8259: + * re-initialize master 8259: + * reset; prog 4 bytes, single ICU, edge triggered + */ + outb(IO_ICU1, 0x13); + outb(IO_ICU1 + 1, NRSVIDT); /* start vector */ + outb(IO_ICU1 + 1, 0x00); /* ignore slave */ + outb(IO_ICU1 + 1, 0x03); /* auto EOI, 8086 */ + outb(IO_ICU1 + 1, 0xfe); /* unmask INT0 */ + + /* program IO APIC for type 3 INT on INT0 */ + if (ext_int_setup(0, 0) < 0) + panic("8254 redirect via APIC pin0 impossible!"); + + x = 0; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via 8259 on pin 0\n"); + } + + /* failing that, look for 8254 on pin 2 */ + else if (isa_apic_pin(0) == 2) { + x = 2; + /** if (bootverbose */ + printf("APIC_IO: routing 8254 via pin 2\n"); + } + + /* better write that 8254 INT discover code... */ + else + panic("neither pin 0 or pin 2 works for 8254"); + + /* setup the vectors for the chosen method */ + vec[x] = (u_int)vec8254; + Xintr8254 = (u_int)ivectors[x]; + mask8254 = (1 << x); + + register_intr(/* irq */ x, /* XXX id */ 0, /* flags */ 0, + /* XXX */ (inthand2_t *)clkintr, &clk_imask, + /* unit */ 0); + INTREN(mask8254); + +#else /** NEW_STRATEGY */ + #ifdef APIC_PIN0_TIMER /* * Allow 8254 timer to INTerrupt 8259: @@ -939,6 +991,9 @@ cpu_initclocks() /* unit */ 0); INTREN(mask8254); #endif /* APIC_PIN0_TIMER */ + +#endif /** NEW_STRATEGY */ + #else /* APIC_IO */ register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0, /* XXX */ (inthand2_t *)clkintr, &clk_imask, @@ -966,34 +1021,13 @@ cpu_initclocks() printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); #ifdef APIC_IO - -#ifdef DO_RTC_VEC - if ((x = isa_apic_pin(8)) < 0) - panic("APIC missing RTC connection"); - vec[x] = (u_int)vecRTC; - XintrRTC = (u_int)ivectors[x]; /* XXX might need Xfastintr# */ - maskRTC = (1 << x); - register_intr(/* irq */ x, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(maskRTC); -#else if (isa_apic_pin(8) != 8) panic("APIC RTC != 8"); +#endif /* APIC_IO */ register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, /* XXX */ (inthand2_t *)rtcintr, &stat_imask, /* unit */ 0); INTREN(IRQ8); -#endif /* DO_RTC_VEC */ - -#else /* APIC_IO */ - - register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, - /* XXX */ (inthand2_t *)rtcintr, &stat_imask, - /* unit */ 0); - INTREN(IRQ8); - -#endif /* APIC_IO */ writertc(RTC_STATUSB, rtc_statusb); } diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 343ea7db2f7c..c9724a10b0d9 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.17 1997/07/20 17:43:20 smp Exp smp $ + * $Id: mp_machdep.c,v 1.18 1997/07/20 18:13:01 smp Exp smp $ */ #include "opt_smp.h" @@ -1065,12 +1065,14 @@ isa_apic_pin(int isa_irq) int intr; #if defined(SMP_TIMER_NC) -#if defined(APIC_PIN0_TIMER) +#if defined(NEW_STRATEGY) || defined(APIC_PIN0_TIMER) +#error #error 'options SMP_TIMER_NC' no longer used, remove & reconfig. +#error #else if (isa_irq == 0) return -1; -#endif /* APIC_PIN0_TIMER */ +#endif /* NEW_STRATEGY || APIC_PIN0_TIMER */ #endif /* SMP_TIMER_NC */ for (intr = 0; intr < nintrs; ++intr) { /* check each record */ |
