Developed a new strategy for handling the 8254/8259/APIC issue.

This commit is contained in:
Steve Passe 1997-07-20 19:41:38 +00:00
parent c69ef9495b
commit 35b3c4a0e5
15 changed files with 439 additions and 243 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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");
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 */
register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0,
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
}

View File

@ -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 */

View File

@ -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");
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 */
register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0,
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
}

View File

@ -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? */

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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");
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 */
register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0,
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
}

View File

@ -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 */

View File

@ -1,4 +1,4 @@
/*
/*-
* Copyright (c) 1997, by Steve Passe
* All rights reserved.
*
@ -22,16 +22,29 @@
* 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
#ifdef NEW_STRATEGY
/* this allows us to change the 8254 APIC pin# assignment */
.globl _Xintr8254
_Xintr8254:
.long _Xintr7
/* used by this file, microtime.s and clock.c */
.globl _mask8254
_mask8254:
.long 0
#else /** NEW_STRATEGY */
#ifndef APIC_PIN0_TIMER
/* this allows us to change the 8254 APIC pin# assignment */
.globl _Xintr8254
@ -44,18 +57,7 @@ _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:
.long _Xintr7
/* used by this file and clock.c */
.globl _maskRTC
_maskRTC:
.long 0
#endif /* DO_RTC_VEC */
#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)

View File

@ -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");
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 */
register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0,
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
}

View File

@ -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");
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 */
register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0,
/* XXX */ (inthand2_t *)rtcintr, &stat_imask,
/* unit */ 0);
INTREN(IRQ8);
writertc(RTC_STATUSB, rtc_statusb);
}

View File

@ -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 */