summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorfsmp <fsmp@FreeBSD.org>1997-09-01 07:45:37 +0000
committerfsmp <fsmp@FreeBSD.org>1997-09-01 07:45:37 +0000
commite771ecca0f52de0eb9e330af62ef2a6685ff7bc6 (patch)
tree792ab41dec7c5dfa5f548445fbb361df451ef055 /sys/amd64
parentc9f24c9fd2c2e8be3133555fca3de9a9ddd4ab21 (diff)
downloadFreeBSD-src-e771ecca0f52de0eb9e330af62ef2a6685ff7bc6.zip
FreeBSD-src-e771ecca0f52de0eb9e330af62ef2a6685ff7bc6.tar.gz
General cleanup of the sub-system locking macros.
Eliminated the RECURSIVE_MPINTRLOCK. clock.c and microtime use clock_lock. sio.c and cy.c use com_lock. Suggestions by: Bruce Evans <bde@zeta.org.au>
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/tsc.c47
-rw-r--r--sys/amd64/include/cpufunc.h10
-rw-r--r--sys/amd64/isa/clock.c47
3 files changed, 31 insertions, 73 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c
index 0755baf..e812a20 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.10 1997/08/30 01:23:40 smp Exp smp $
+ * $Id: clock.c,v 1.12 1997/09/01 07:37:01 smp Exp smp $
*/
/*
@@ -78,31 +78,8 @@
#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()
-
+#define disable_intr() CLOCK_DISABLE_INTR()
+#define enable_intr() CLOCK_ENABLE_INTR()
#endif /* SMP */
/*
@@ -211,11 +188,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;
@@ -229,12 +206,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.
*/
@@ -386,7 +363,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);
@@ -509,10 +486,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);
@@ -655,7 +632,7 @@ 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;
@@ -1032,7 +1009,7 @@ 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;
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 9fd475e..df987bd 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.69 1997/07/17 04:33:46 dyson Exp $
+ * $Id: cpufunc.h,v 1.2 1997/09/01 07:37:58 smp Exp smp $
*/
/*
@@ -58,13 +58,17 @@ static __inline void
disable_intr(void)
{
__asm __volatile("cli" : : : "memory");
- MPINTR_LOCK();
+#ifdef SMP
+ s_lock(&mpintr_lock);
+#endif
}
static __inline void
enable_intr(void)
{
- MPINTR_UNLOCK();
+#ifdef SMP
+ s_unlock(&mpintr_lock);
+#endif
__asm __volatile("sti");
}
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 0755baf..e812a20 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.10 1997/08/30 01:23:40 smp Exp smp $
+ * $Id: clock.c,v 1.12 1997/09/01 07:37:01 smp Exp smp $
*/
/*
@@ -78,31 +78,8 @@
#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()
-
+#define disable_intr() CLOCK_DISABLE_INTR()
+#define enable_intr() CLOCK_ENABLE_INTR()
#endif /* SMP */
/*
@@ -211,11 +188,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;
@@ -229,12 +206,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.
*/
@@ -386,7 +363,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);
@@ -509,10 +486,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);
@@ -655,7 +632,7 @@ 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;
@@ -1032,7 +1009,7 @@ 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;
OpenPOWER on IntegriCloud