diff options
author | fsmp <fsmp@FreeBSD.org> | 1997-08-30 08:08:10 +0000 |
---|---|---|
committer | fsmp <fsmp@FreeBSD.org> | 1997-08-30 08:08:10 +0000 |
commit | e2310cdbcf324f3bbeda76add82e773d37ee43cd (patch) | |
tree | ab2ac308116ca3f26a9055eae17d100d5901e501 /sys/amd64 | |
parent | 62dbf14e9ad4dbe9bc03c2657d854b47ef4b3f65 (diff) | |
download | FreeBSD-src-e2310cdbcf324f3bbeda76add82e773d37ee43cd.zip FreeBSD-src-e2310cdbcf324f3bbeda76add82e773d37ee43cd.tar.gz |
Another round of lock pushdown.
Add a simplelock to deal with disable_intr()/enable_intr() as used in UP kernel.
UP kernel expects that this is enough to guarantee exclusive access to
regions of code bracketed by these 2 functions.
Add a simplelock to bracket clock accesses in clock.c: clock_lock.
Help from: Bruce Evans <bde@zeta.org.au>
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/apic_vector.S | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/exception.S | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/exception.s | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/mp_machdep.c | 22 | ||||
-rw-r--r-- | sys/amd64/amd64/mptable.c | 22 | ||||
-rw-r--r-- | sys/amd64/amd64/tsc.c | 55 | ||||
-rw-r--r-- | sys/amd64/include/cpufunc.h | 7 | ||||
-rw-r--r-- | sys/amd64/include/mptable.h | 22 | ||||
-rw-r--r-- | sys/amd64/include/profile.h | 6 | ||||
-rw-r--r-- | sys/amd64/include/smp.h | 10 | ||||
-rw-r--r-- | sys/amd64/isa/clock.c | 55 | ||||
-rw-r--r-- | sys/amd64/isa/intr_machdep.c | 10 | ||||
-rw-r--r-- | sys/amd64/isa/nmi.c | 10 |
13 files changed, 190 insertions, 47 deletions
diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S index d78d320..0652b69 100644 --- a/sys/amd64/amd64/apic_vector.S +++ b/sys/amd64/amd64/apic_vector.S @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.32 1997/08/29 18:37:23 smp Exp smp $ + * $Id: apic_vector.s,v 1.33 1997/08/30 01:23:40 smp Exp smp $ */ @@ -75,9 +75,10 @@ IDTVEC(vec_name) ; \ movl %ax,%ds ; \ MAYBE_MOVW_AX_ES ; \ FAKE_MCOUNT((4+ACTUALLY_PUSHED)*4(%esp)) ; \ - GET_FAST_INTR_LOCK ; \ pushl _intr_unit + (irq_num) * 4 ; \ + GET_FAST_INTR_LOCK ; \ call *_intr_handler + (irq_num) * 4 ; /* do the work ASAP */ \ + REL_FAST_INTR_LOCK ; \ addl $4, %esp ; \ movl $0, lapic_eoi ; \ lock ; \ @@ -86,7 +87,6 @@ IDTVEC(vec_name) ; \ lock ; \ incl (%eax) ; \ MEXITCOUNT ; \ - REL_FAST_INTR_LOCK ; \ MAYBE_POPL_ES ; \ popl %ds ; \ popl %edx ; \ diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S index f072e7a..9a74ca1 100644 --- a/sys/amd64/amd64/exception.S +++ b/sys/amd64/amd64/exception.S @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: exception.s,v 1.19 1997/08/28 09:50:41 smp Exp smp $ + * $Id: exception.s,v 1.42 1997/08/29 18:16:17 fsmp Exp $ */ #include "npx.h" /* NNPX */ @@ -38,9 +38,9 @@ #include <machine/ipl.h> /* SWI_AST_MASK ... */ #include <machine/psl.h> /* PSL_I */ #include <machine/trap.h> /* trap codes */ -#include <machine/asmacros.h> /* miscellaneous macros */ -#include <machine/param.h> +#include <machine/asmacros.h> #include <machine/smptests.h> /* INTR_SIMPLELOCK */ +#include <machine/lock.h> #ifndef SMP #undef INTR_SIMPLELOCK /* simplifies cpp tests */ diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s index f072e7a..9a74ca1 100644 --- a/sys/amd64/amd64/exception.s +++ b/sys/amd64/amd64/exception.s @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: exception.s,v 1.19 1997/08/28 09:50:41 smp Exp smp $ + * $Id: exception.s,v 1.42 1997/08/29 18:16:17 fsmp Exp $ */ #include "npx.h" /* NNPX */ @@ -38,9 +38,9 @@ #include <machine/ipl.h> /* SWI_AST_MASK ... */ #include <machine/psl.h> /* PSL_I */ #include <machine/trap.h> /* trap codes */ -#include <machine/asmacros.h> /* miscellaneous macros */ -#include <machine/param.h> +#include <machine/asmacros.h> #include <machine/smptests.h> /* INTR_SIMPLELOCK */ +#include <machine/lock.h> #ifndef SMP #undef INTR_SIMPLELOCK /* simplifies cpp tests */ diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index d5ea71c..955a3a1 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.46 1997/08/26 18:10:31 peter Exp $ + * $Id: mp_machdep.c,v 1.32 1997/08/30 01:25:13 smp Exp smp $ */ #include "opt_smp.h" @@ -1446,8 +1446,16 @@ struct simplelock fast_intr_lock; /* critical region around INTR() routines */ struct simplelock intr_lock; +#ifdef SIMPLE_MPINTRLOCK +/* critical region around INTR() routines */ +struct simplelock mpintr_lock; +struct simplelock clock_lock; +#endif + +#if 0 /* lock the com (tty) data structures */ struct simplelock com_lock; +#endif static void init_locks(void) @@ -1459,7 +1467,13 @@ init_locks(void) mp_lock = 0x00000001; /* ISR uses its own "giant lock" */ - isr_lock = 0x00000000; + isr_lock = FREE_LOCK; + +#ifdef SIMPLE_MPINTRLOCK + /* lock regions protected in UP kernel via cli/sti */ + s_lock_init((struct simplelock*)&mpintr_lock); + s_lock_init((struct simplelock*)&clock_lock); +#endif /* serializes FAST_INTR() accesses */ s_lock_init((struct simplelock*)&fast_intr_lock); @@ -1470,11 +1484,13 @@ init_locks(void) /* locks the IO APIC and apic_imen accesses */ s_lock_init((struct simplelock*)&imen_lock); - /* locks cpl accesses */ + /* locks cpl/cml/cim/ipending accesses */ s_lock_init((struct simplelock*)&cpl_lock); +#if 0 /* locks com (tty) data/hardware accesses: a FASTINTR() */ s_lock_init((struct simplelock*)&com_lock); +#endif } diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c index d5ea71c..955a3a1 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.46 1997/08/26 18:10:31 peter Exp $ + * $Id: mp_machdep.c,v 1.32 1997/08/30 01:25:13 smp Exp smp $ */ #include "opt_smp.h" @@ -1446,8 +1446,16 @@ struct simplelock fast_intr_lock; /* critical region around INTR() routines */ struct simplelock intr_lock; +#ifdef SIMPLE_MPINTRLOCK +/* critical region around INTR() routines */ +struct simplelock mpintr_lock; +struct simplelock clock_lock; +#endif + +#if 0 /* lock the com (tty) data structures */ struct simplelock com_lock; +#endif static void init_locks(void) @@ -1459,7 +1467,13 @@ init_locks(void) mp_lock = 0x00000001; /* ISR uses its own "giant lock" */ - isr_lock = 0x00000000; + isr_lock = FREE_LOCK; + +#ifdef SIMPLE_MPINTRLOCK + /* lock regions protected in UP kernel via cli/sti */ + s_lock_init((struct simplelock*)&mpintr_lock); + s_lock_init((struct simplelock*)&clock_lock); +#endif /* serializes FAST_INTR() accesses */ s_lock_init((struct simplelock*)&fast_intr_lock); @@ -1470,11 +1484,13 @@ init_locks(void) /* locks the IO APIC and apic_imen accesses */ s_lock_init((struct simplelock*)&imen_lock); - /* locks cpl accesses */ + /* locks cpl/cml/cim/ipending accesses */ s_lock_init((struct simplelock*)&cpl_lock); +#if 0 /* locks com (tty) data/hardware accesses: a FASTINTR() */ s_lock_init((struct simplelock*)&com_lock); +#endif } diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index 28f6dc9..0755baf 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.99 1997/08/21 05:08:07 fsmp Exp $ + * $Id: clock.c,v 1.10 1997/08/30 01:23:40 smp Exp smp $ */ /* @@ -65,9 +65,9 @@ #include <machine/frame.h> #include <machine/ipl.h> #include <machine/limits.h> -#ifdef APIC_IO +#if defined(SMP) || defined(APIC_IO) #include <machine/smp.h> -#endif /* APIC_IO */ +#endif /* SMP || APIC_IO */ #include <i386/isa/icu.h> #include <i386/isa/isa.h> @@ -77,6 +77,34 @@ #include <i386/isa/intr_machdep.h> #include <sys/interrupt.h> +#ifdef SMP +#include <machine/smptests.h> + +#ifdef SIMPLE_MPINTRLOCK +#define DISABLE_INTR() \ + __asm __volatile("cli" : : : "memory"); \ + s_lock(&clock_lock); + +#define ENABLE_INTR() \ + s_unlock(&clock_lock); \ + __asm __volatile("sti"); + +#define CLOCK_UNLOCK() \ + s_unlock(&clock_lock); +#else /* SIMPLE_MPINTRLOCK */ +#define DISABLE_INTR() disable_intr() +#define ENABLE_INTR() enable_intr() +#define CLOCK_UNLOCK() +#endif /* SIMPLE_MPINTRLOCK */ + +#else /* SMP */ + +#define DISABLE_INTR() disable_intr() +#define ENABLE_INTR() enable_intr() +#define CLOCK_UNLOCK() + +#endif /* SMP */ + /* * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we * can use a simple formula for leap years. @@ -183,11 +211,11 @@ clkintr(struct clockframe frame) timer0_max_count = TIMER_DIV(new_rate); timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT; - disable_intr(); + DISABLE_INTR(); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - enable_intr(); + ENABLE_INTR(); timer0_prescaler_count = 0; timer_func = new_function; timer0_state = ACQUIRED; @@ -201,12 +229,12 @@ clkintr(struct clockframe frame) timer0_max_count = hardclock_max_count; timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT; - disable_intr(); + DISABLE_INTR(); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - enable_intr(); + ENABLE_INTR(); /* * See microtime.s for this magic. */ @@ -358,7 +386,7 @@ getit(void) int high, low; ef = read_eflags(); - disable_intr(); + DISABLE_INTR(); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -366,6 +394,7 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); + CLOCK_UNLOCK(); write_eflags(ef); return ((high << 8) | low); } @@ -480,10 +509,10 @@ sysbeep(int pitch, int period) splx(x); return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */ } - disable_intr(); + DISABLE_INTR(); outb(TIMER_CNTR2, pitch); outb(TIMER_CNTR2, (pitch>>8)); - enable_intr(); + ENABLE_INTR(); if (!beeping) { /* enable counter2 output to speaker */ outb(IO_PPI, inb(IO_PPI) | 3); @@ -626,13 +655,14 @@ set_timer_freq(u_int freq, int intr_freq) u_long ef; ef = read_eflags(); - disable_intr(); + DISABLE_INTR(); timer_freq = freq; timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq); timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT; outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); + CLOCK_UNLOCK(); write_eflags(ef); } @@ -1002,10 +1032,11 @@ set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq) << I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq; multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; ef = read_eflags(); - disable_intr(); + DISABLE_INTR(); i586_ctr_freq = i586_freq; i586_ctr_comultiplier = comultiplier; i586_ctr_multiplier = multiplier; + CLOCK_UNLOCK(); write_eflags(ef); } diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index 41e1bd7..9fd475e 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cpufunc.h,v 1.68 1997/05/31 09:13:03 peter Exp $ + * $Id: cpufunc.h,v 1.69 1997/07/17 04:33:46 dyson Exp $ */ /* @@ -43,6 +43,9 @@ #include <sys/cdefs.h> #include <sys/types.h> +#include <machine/lock.h> + + #ifdef __GNUC__ static __inline void @@ -55,11 +58,13 @@ static __inline void disable_intr(void) { __asm __volatile("cli" : : : "memory"); + MPINTR_LOCK(); } static __inline void enable_intr(void) { + MPINTR_UNLOCK(); __asm __volatile("sti"); } diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h index d5ea71c..955a3a1 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.46 1997/08/26 18:10:31 peter Exp $ + * $Id: mp_machdep.c,v 1.32 1997/08/30 01:25:13 smp Exp smp $ */ #include "opt_smp.h" @@ -1446,8 +1446,16 @@ struct simplelock fast_intr_lock; /* critical region around INTR() routines */ struct simplelock intr_lock; +#ifdef SIMPLE_MPINTRLOCK +/* critical region around INTR() routines */ +struct simplelock mpintr_lock; +struct simplelock clock_lock; +#endif + +#if 0 /* lock the com (tty) data structures */ struct simplelock com_lock; +#endif static void init_locks(void) @@ -1459,7 +1467,13 @@ init_locks(void) mp_lock = 0x00000001; /* ISR uses its own "giant lock" */ - isr_lock = 0x00000000; + isr_lock = FREE_LOCK; + +#ifdef SIMPLE_MPINTRLOCK + /* lock regions protected in UP kernel via cli/sti */ + s_lock_init((struct simplelock*)&mpintr_lock); + s_lock_init((struct simplelock*)&clock_lock); +#endif /* serializes FAST_INTR() accesses */ s_lock_init((struct simplelock*)&fast_intr_lock); @@ -1470,11 +1484,13 @@ init_locks(void) /* locks the IO APIC and apic_imen accesses */ s_lock_init((struct simplelock*)&imen_lock); - /* locks cpl accesses */ + /* locks cpl/cml/cim/ipending accesses */ s_lock_init((struct simplelock*)&cpl_lock); +#if 0 /* locks com (tty) data/hardware accesses: a FASTINTR() */ s_lock_init((struct simplelock*)&com_lock); +#endif } diff --git a/sys/amd64/include/profile.h b/sys/amd64/include/profile.h index 50da5fe..d451245 100644 --- a/sys/amd64/include/profile.h +++ b/sys/amd64/include/profile.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)profile.h 8.1 (Berkeley) 6/11/93 - * $Id$ + * $Id: profile.h,v 1.11 1997/02/22 09:35:01 peter Exp $ */ #ifndef _MACHINE_PROFILE_H_ @@ -63,7 +63,11 @@ #else #define MCOUNT_DECL(s) u_long s; #define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); } +#ifdef SMP +#define MCOUNT_EXIT(s) { MPINTR_UNLOCK(); write_eflags(s); } +#else #define MCOUNT_EXIT(s) (write_eflags(s)) +#endif #endif /* GUPROF */ #else /* !KERNEL */ diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h index 276b838..a7051ff 100644 --- a/sys/amd64/include/smp.h +++ b/sys/amd64/include/smp.h @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: smp.h,v 1.29 1997/08/24 20:33:24 fsmp Exp $ + * $Id: smp.h,v 1.30 1997/08/26 18:10:37 peter Exp $ * */ @@ -60,11 +60,19 @@ void bootMP __P((void)); /* global data in mplock.s */ extern u_int mp_lock; extern u_int isr_lock; +#ifdef RECURSIVE_MPINTRLOCK +extern u_int mpintr_lock; +#endif /* RECURSIVE_MPINTRLOCK */ /* functions in mplock.s */ void get_mplock __P((void)); void rel_mplock __P((void)); void try_mplock __P((void)); +#ifdef RECURSIVE_MPINTRLOCK +void get_mpintrlock __P((void)); +void rel_mpintrlock __P((void)); +void try_mpintrlock __P((void)); +#endif /* RECURSIVE_MPINTRLOCK */ /* global data in apic_vector.s */ extern u_int ivectors[]; diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 28f6dc9..0755baf 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.99 1997/08/21 05:08:07 fsmp Exp $ + * $Id: clock.c,v 1.10 1997/08/30 01:23:40 smp Exp smp $ */ /* @@ -65,9 +65,9 @@ #include <machine/frame.h> #include <machine/ipl.h> #include <machine/limits.h> -#ifdef APIC_IO +#if defined(SMP) || defined(APIC_IO) #include <machine/smp.h> -#endif /* APIC_IO */ +#endif /* SMP || APIC_IO */ #include <i386/isa/icu.h> #include <i386/isa/isa.h> @@ -77,6 +77,34 @@ #include <i386/isa/intr_machdep.h> #include <sys/interrupt.h> +#ifdef SMP +#include <machine/smptests.h> + +#ifdef SIMPLE_MPINTRLOCK +#define DISABLE_INTR() \ + __asm __volatile("cli" : : : "memory"); \ + s_lock(&clock_lock); + +#define ENABLE_INTR() \ + s_unlock(&clock_lock); \ + __asm __volatile("sti"); + +#define CLOCK_UNLOCK() \ + s_unlock(&clock_lock); +#else /* SIMPLE_MPINTRLOCK */ +#define DISABLE_INTR() disable_intr() +#define ENABLE_INTR() enable_intr() +#define CLOCK_UNLOCK() +#endif /* SIMPLE_MPINTRLOCK */ + +#else /* SMP */ + +#define DISABLE_INTR() disable_intr() +#define ENABLE_INTR() enable_intr() +#define CLOCK_UNLOCK() + +#endif /* SMP */ + /* * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we * can use a simple formula for leap years. @@ -183,11 +211,11 @@ clkintr(struct clockframe frame) timer0_max_count = TIMER_DIV(new_rate); timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT; - disable_intr(); + DISABLE_INTR(); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - enable_intr(); + ENABLE_INTR(); timer0_prescaler_count = 0; timer_func = new_function; timer0_state = ACQUIRED; @@ -201,12 +229,12 @@ clkintr(struct clockframe frame) timer0_max_count = hardclock_max_count; timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT; - disable_intr(); + DISABLE_INTR(); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - enable_intr(); + ENABLE_INTR(); /* * See microtime.s for this magic. */ @@ -358,7 +386,7 @@ getit(void) int high, low; ef = read_eflags(); - disable_intr(); + DISABLE_INTR(); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -366,6 +394,7 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); + CLOCK_UNLOCK(); write_eflags(ef); return ((high << 8) | low); } @@ -480,10 +509,10 @@ sysbeep(int pitch, int period) splx(x); return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */ } - disable_intr(); + DISABLE_INTR(); outb(TIMER_CNTR2, pitch); outb(TIMER_CNTR2, (pitch>>8)); - enable_intr(); + ENABLE_INTR(); if (!beeping) { /* enable counter2 output to speaker */ outb(IO_PPI, inb(IO_PPI) | 3); @@ -626,13 +655,14 @@ set_timer_freq(u_int freq, int intr_freq) u_long ef; ef = read_eflags(); - disable_intr(); + DISABLE_INTR(); timer_freq = freq; timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq); timer0_overflow_threshold = timer0_max_count - TIMER0_LATCH_COUNT; outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); + CLOCK_UNLOCK(); write_eflags(ef); } @@ -1002,10 +1032,11 @@ set_i586_ctr_freq(u_int i586_freq, u_int i8254_freq) << I586_CTR_COMULTIPLIER_SHIFT) / i8254_freq; multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq; ef = read_eflags(); - disable_intr(); + DISABLE_INTR(); i586_ctr_freq = i586_freq; i586_ctr_comultiplier = comultiplier; i586_ctr_multiplier = multiplier; + CLOCK_UNLOCK(); write_eflags(ef); } diff --git a/sys/amd64/isa/intr_machdep.c b/sys/amd64/isa/intr_machdep.c index c9b5da5..fd836dd 100644 --- a/sys/amd64/isa/intr_machdep.c +++ b/sys/amd64/isa/intr_machdep.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: intr_machdep.c,v 1.1 1997/08/29 18:38:35 smp Exp smp $ + * $Id: intr_machdep.c,v 1.5 1997/08/29 18:45:19 fsmp Exp $ */ #include "opt_auto_eoi.h" @@ -451,6 +451,7 @@ icu_setup(int intr, inthand2_t *handler, void *arg, u_int *maskptr, int flags) SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); #endif /* FAST_HI */ INTREN(1 << intr); + MPINTR_UNLOCK(); write_eflags(ef); return (0); } @@ -487,8 +488,15 @@ icu_unset(intr, handler) intr_mptr[intr] = NULL; intr_mask[intr] = HWI_MASK | SWI_MASK; intr_unit[intr] = intr; +#ifdef FAST_HI_XXX + /* XXX how do I re-create dvp here? */ + setidt(flags & INTR_FAST ? TPR_FAST_INTS + intr : TPR_SLOW_INTS + intr, + slowintr[intr], SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#else /* FAST_HI */ setidt(ICU_OFFSET + intr, slowintr[intr], SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#endif /* FAST_HI */ + MPINTR_UNLOCK(); write_eflags(ef); return (0); } diff --git a/sys/amd64/isa/nmi.c b/sys/amd64/isa/nmi.c index c9b5da5..fd836dd 100644 --- a/sys/amd64/isa/nmi.c +++ b/sys/amd64/isa/nmi.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: intr_machdep.c,v 1.1 1997/08/29 18:38:35 smp Exp smp $ + * $Id: intr_machdep.c,v 1.5 1997/08/29 18:45:19 fsmp Exp $ */ #include "opt_auto_eoi.h" @@ -451,6 +451,7 @@ icu_setup(int intr, inthand2_t *handler, void *arg, u_int *maskptr, int flags) SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); #endif /* FAST_HI */ INTREN(1 << intr); + MPINTR_UNLOCK(); write_eflags(ef); return (0); } @@ -487,8 +488,15 @@ icu_unset(intr, handler) intr_mptr[intr] = NULL; intr_mask[intr] = HWI_MASK | SWI_MASK; intr_unit[intr] = intr; +#ifdef FAST_HI_XXX + /* XXX how do I re-create dvp here? */ + setidt(flags & INTR_FAST ? TPR_FAST_INTS + intr : TPR_SLOW_INTS + intr, + slowintr[intr], SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#else /* FAST_HI */ setidt(ICU_OFFSET + intr, slowintr[intr], SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#endif /* FAST_HI */ + MPINTR_UNLOCK(); write_eflags(ef); return (0); } |