From 4e329ed74c68d196733f04b3d31fc3f36ca27976 Mon Sep 17 00:00:00 2001 From: KATO Takenori Date: Sun, 13 Jul 1997 12:14:18 +0000 Subject: [PATCH] Synchronize with sys/i386/isa/clock.c revision 1.89. --- sys/pc98/cbus/clock.c | 30 +++++++++++++++++++++++------- sys/pc98/cbus/pcrtc.c | 30 +++++++++++++++++++++++------- sys/pc98/pc98/clock.c | 30 +++++++++++++++++++++++------- 3 files changed, 69 insertions(+), 21 deletions(-) diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index 8f3bd554e39..70bd4465b1a 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.25 1997/06/02 15:45:40 kato Exp $ + * $Id: clock.c,v 1.26 1997/06/26 14:49:24 kato Exp $ */ /* @@ -70,6 +70,7 @@ #include #ifdef APIC_IO #include +#include /** TEST_ALTTIMER */ #endif /* APIC_IO */ #include @@ -1175,13 +1176,15 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO +#if 0 #ifndef IO_ICU1 #ifdef PC98 -#define IO_ICU1 0x20 +#define IO_ICU1 0x00 #else -#define IO_ICU1 0x20 +#define IO_ICU1 0x20 #endif #endif /* IO_ICU1 */ +#endif /** 0 */ /* 8254 is traditionally on ISA IRQ0 */ if ((x = isa_apic_pin(0)) < 0) { @@ -1190,14 +1193,27 @@ cpu_initclocks() printf("APIC missing 8254 connection\n"); /* allow 8254 timer to INTerrupt 8259 */ - x = inb(IO_ICU1 + 1); /* current mask in 8259 */ - x &= ~1; /* clear 8254 timer mask */ - outb(IO_ICU1 + 1, x); /* write new mask */ +#ifdef TEST_ALTTIMER + /* + * 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 */ +#else + x = inb(IO_ICU1 + 1); /* current mask in 8259 */ + x &= ~1; /* clear 8254 timer mask */ + outb(IO_ICU1 + 1, x); /* write new mask */ +#endif /* TEST_ALTTIMER */ /* program IO APIC for type 3 INT on INT0 */ if (ext_int_setup(0, 0) < 0) panic("8254 redirect impossible!"); - x = 0; /* 8259 is on 0 */ + x = 0; /* 8259 is on 0 */ } vec[x] = (u_int)vec8254; diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index 8f3bd554e39..70bd4465b1a 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.25 1997/06/02 15:45:40 kato Exp $ + * $Id: clock.c,v 1.26 1997/06/26 14:49:24 kato Exp $ */ /* @@ -70,6 +70,7 @@ #include #ifdef APIC_IO #include +#include /** TEST_ALTTIMER */ #endif /* APIC_IO */ #include @@ -1175,13 +1176,15 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO +#if 0 #ifndef IO_ICU1 #ifdef PC98 -#define IO_ICU1 0x20 +#define IO_ICU1 0x00 #else -#define IO_ICU1 0x20 +#define IO_ICU1 0x20 #endif #endif /* IO_ICU1 */ +#endif /** 0 */ /* 8254 is traditionally on ISA IRQ0 */ if ((x = isa_apic_pin(0)) < 0) { @@ -1190,14 +1193,27 @@ cpu_initclocks() printf("APIC missing 8254 connection\n"); /* allow 8254 timer to INTerrupt 8259 */ - x = inb(IO_ICU1 + 1); /* current mask in 8259 */ - x &= ~1; /* clear 8254 timer mask */ - outb(IO_ICU1 + 1, x); /* write new mask */ +#ifdef TEST_ALTTIMER + /* + * 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 */ +#else + x = inb(IO_ICU1 + 1); /* current mask in 8259 */ + x &= ~1; /* clear 8254 timer mask */ + outb(IO_ICU1 + 1, x); /* write new mask */ +#endif /* TEST_ALTTIMER */ /* program IO APIC for type 3 INT on INT0 */ if (ext_int_setup(0, 0) < 0) panic("8254 redirect impossible!"); - x = 0; /* 8259 is on 0 */ + x = 0; /* 8259 is on 0 */ } vec[x] = (u_int)vec8254; diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c index 8f3bd554e39..70bd4465b1a 100644 --- a/sys/pc98/pc98/clock.c +++ b/sys/pc98/pc98/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.25 1997/06/02 15:45:40 kato Exp $ + * $Id: clock.c,v 1.26 1997/06/26 14:49:24 kato Exp $ */ /* @@ -70,6 +70,7 @@ #include #ifdef APIC_IO #include +#include /** TEST_ALTTIMER */ #endif /* APIC_IO */ #include @@ -1175,13 +1176,15 @@ cpu_initclocks() /* Finish initializing 8253 timer 0. */ #ifdef APIC_IO +#if 0 #ifndef IO_ICU1 #ifdef PC98 -#define IO_ICU1 0x20 +#define IO_ICU1 0x00 #else -#define IO_ICU1 0x20 +#define IO_ICU1 0x20 #endif #endif /* IO_ICU1 */ +#endif /** 0 */ /* 8254 is traditionally on ISA IRQ0 */ if ((x = isa_apic_pin(0)) < 0) { @@ -1190,14 +1193,27 @@ cpu_initclocks() printf("APIC missing 8254 connection\n"); /* allow 8254 timer to INTerrupt 8259 */ - x = inb(IO_ICU1 + 1); /* current mask in 8259 */ - x &= ~1; /* clear 8254 timer mask */ - outb(IO_ICU1 + 1, x); /* write new mask */ +#ifdef TEST_ALTTIMER + /* + * 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 */ +#else + x = inb(IO_ICU1 + 1); /* current mask in 8259 */ + x &= ~1; /* clear 8254 timer mask */ + outb(IO_ICU1 + 1, x); /* write new mask */ +#endif /* TEST_ALTTIMER */ /* program IO APIC for type 3 INT on INT0 */ if (ext_int_setup(0, 0) < 0) panic("8254 redirect impossible!"); - x = 0; /* 8259 is on 0 */ + x = 0; /* 8259 is on 0 */ } vec[x] = (u_int)vec8254;