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>
This commit is contained in:
parent
c9f24c9fd2
commit
e771ecca0f
@ -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;
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cy.c,v 1.4 1997/08/30 01:23:40 smp Exp smp $
|
||||
* $Id: cy.c,v 1.5 1997/09/01 07:37:01 smp Exp smp $
|
||||
*/
|
||||
|
||||
#include "cy.h"
|
||||
@ -88,6 +88,11 @@
|
||||
#include <i386/isa/cyreg.h>
|
||||
#include <i386/isa/ic/cd1400.h>
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
#define enable_intr() COM_ENABLE_INTR()
|
||||
#endif /* SMP */
|
||||
|
||||
/*
|
||||
* Dictionary so that I can name everything *sio* or *com* to compare with
|
||||
* sio.c. There is also lots of ugly formatting and unnecessary ifdefs to
|
||||
@ -988,7 +993,7 @@ siointr(unit)
|
||||
int baseu, cyu, cy_align;
|
||||
u_char status;
|
||||
|
||||
MPINTR_LOCK(); /* XXX could this be placed down lower in the loop? */
|
||||
COM_LOCK(); /* XXX could this be placed down lower in the loop? */
|
||||
|
||||
baseu = unit * CY_MAX_PORTS;
|
||||
cy_iobase = com_addr(baseu)->cy_iobase;
|
||||
@ -1337,7 +1342,7 @@ siointr(unit)
|
||||
|
||||
schedsofttty();
|
||||
|
||||
MPINTR_UNLOCK();
|
||||
COM_UNLOCK();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cy.c,v 1.4 1997/08/30 01:23:40 smp Exp smp $
|
||||
* $Id: cy.c,v 1.5 1997/09/01 07:37:01 smp Exp smp $
|
||||
*/
|
||||
|
||||
#include "cy.h"
|
||||
@ -88,6 +88,11 @@
|
||||
#include <i386/isa/cyreg.h>
|
||||
#include <i386/isa/ic/cd1400.h>
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
#define enable_intr() COM_ENABLE_INTR()
|
||||
#endif /* SMP */
|
||||
|
||||
/*
|
||||
* Dictionary so that I can name everything *sio* or *com* to compare with
|
||||
* sio.c. There is also lots of ugly formatting and unnecessary ifdefs to
|
||||
@ -988,7 +993,7 @@ siointr(unit)
|
||||
int baseu, cyu, cy_align;
|
||||
u_char status;
|
||||
|
||||
MPINTR_LOCK(); /* XXX could this be placed down lower in the loop? */
|
||||
COM_LOCK(); /* XXX could this be placed down lower in the loop? */
|
||||
|
||||
baseu = unit * CY_MAX_PORTS;
|
||||
cy_iobase = com_addr(baseu)->cy_iobase;
|
||||
@ -1337,7 +1342,7 @@ siointr(unit)
|
||||
|
||||
schedsofttty();
|
||||
|
||||
MPINTR_UNLOCK();
|
||||
COM_UNLOCK();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: sio.c,v 1.10 1997/08/31 03:04:36 smp Exp smp $
|
||||
* $Id: sio.c,v 1.11 1997/09/01 07:37:01 smp Exp smp $
|
||||
*/
|
||||
|
||||
#include "opt_comconsole.h"
|
||||
@ -66,40 +66,6 @@
|
||||
|
||||
#include <machine/clock.h>
|
||||
|
||||
#ifdef SMP
|
||||
#include <machine/smptests.h> /** USE_COMLOCK */
|
||||
|
||||
#ifdef USE_COMLOCK
|
||||
|
||||
#define DISABLE_INTR() \
|
||||
__asm __volatile("cli" : : : "memory"); \
|
||||
s_lock(&com_lock);
|
||||
|
||||
#define ENABLE_INTR() \
|
||||
s_unlock(&com_lock); \
|
||||
__asm __volatile("sti");
|
||||
|
||||
#define COM_LOCK() s_lock(&com_lock);
|
||||
#define COM_UNLOCK() s_unlock(&com_lock);
|
||||
|
||||
#else /* USE_COMLOCK */
|
||||
|
||||
#define DISABLE_INTR() disable_intr()
|
||||
#define ENABLE_INTR() enable_intr()
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
|
||||
#endif /* USE_COMLOCK */
|
||||
|
||||
#else /* SMP */
|
||||
|
||||
#define DISABLE_INTR() disable_intr()
|
||||
#define ENABLE_INTR() enable_intr()
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
|
||||
#endif /* SMP */
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/sioreg.h>
|
||||
@ -117,6 +83,11 @@
|
||||
#include <pccard/slot.h>
|
||||
#endif
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
#define enable_intr() COM_ENABLE_INTR()
|
||||
#endif /* SMP */
|
||||
|
||||
#ifdef APIC_IO
|
||||
/*
|
||||
* INTs are masked in the (global) IO APIC,
|
||||
@ -678,7 +649,7 @@ sioprobe(dev)
|
||||
* but mask them in the processor as well in case there are some
|
||||
* (misconfigured) shared interrupts.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
/* EXTRA DELAY? */
|
||||
|
||||
/*
|
||||
@ -784,7 +755,7 @@ sioprobe(dev)
|
||||
failures[8] = isa_irq_pending(idev) ? 1 : 0;
|
||||
failures[9] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND;
|
||||
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
|
||||
result = IO_COMSIZE;
|
||||
for (fn = 0; fn < sizeof failures; ++fn)
|
||||
@ -1218,14 +1189,14 @@ sioopen(dev, flag, mode, p)
|
||||
}
|
||||
}
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
(void) inb(com->line_status_port);
|
||||
(void) inb(com->data_port);
|
||||
com->prev_modem_status = com->last_modem_status
|
||||
= inb(com->modem_status_port);
|
||||
outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS
|
||||
| IER_EMSC);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
/*
|
||||
* Handle initial DCD. Callout devices get a fake initial
|
||||
* DCD (trapdoor DCD). If we are callout, then any sleeping
|
||||
@ -1865,7 +1836,7 @@ siopoll()
|
||||
* (actually never opened devices) so that we don't
|
||||
* loop.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
incc = com->iptr - com->ibuf;
|
||||
com->iptr = com->ibuf;
|
||||
if (com->state & CS_CHECKMSR) {
|
||||
@ -1873,7 +1844,7 @@ siopoll()
|
||||
com->state &= ~CS_CHECKMSR;
|
||||
}
|
||||
com_events -= incc;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (incc != 0)
|
||||
log(LOG_DEBUG,
|
||||
"sio%d: %d events for device with no tp\n",
|
||||
@ -1887,7 +1858,7 @@ siopoll()
|
||||
incc = 0;
|
||||
} else {
|
||||
buf = ibuf;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
incc = com->iptr - buf;
|
||||
com_events -= incc;
|
||||
if (ibuf == com->ibuf1)
|
||||
@ -1908,29 +1879,29 @@ siopoll()
|
||||
&& !(tp->t_state & TS_TBLOCK))
|
||||
outb(com->modem_ctl_port,
|
||||
com->mcr_image |= MCR_RTS);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
com->ibuf = ibuf;
|
||||
}
|
||||
|
||||
if (com->state & CS_CHECKMSR) {
|
||||
u_char delta_modem_status;
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
delta_modem_status = com->last_modem_status
|
||||
^ com->prev_modem_status;
|
||||
com->prev_modem_status = com->last_modem_status;
|
||||
com_events -= LOTS_OF_EVENTS;
|
||||
com->state &= ~CS_CHECKMSR;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (delta_modem_status & MSR_DCD)
|
||||
(*linesw[tp->t_line].l_modem)
|
||||
(tp, com->prev_modem_status & MSR_DCD);
|
||||
}
|
||||
if (com->state & CS_ODONE) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
com_events -= LOTS_OF_EVENTS;
|
||||
com->state &= ~CS_ODONE;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (!(com->state & CS_BUSY)
|
||||
&& !(com->extra_state & CSE_BUSYCHECK)) {
|
||||
timeout(siobusycheck, com, hz / 100);
|
||||
@ -2084,11 +2055,11 @@ comparam(tp, t)
|
||||
* line status port outside of siointr1() might lose some receiver
|
||||
* error bits, but that is acceptable here.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
retry:
|
||||
com->state &= ~CS_TTGO;
|
||||
txtimeout = tp->t_timeout;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
|
||||
!= (LSR_TSRE | LSR_TXRDY)) {
|
||||
tp->t_state |= TS_SO_OCOMPLETE;
|
||||
@ -2103,16 +2074,16 @@ comparam(tp, t)
|
||||
error = ENODEV;
|
||||
if (error != 0 && error != EAGAIN) {
|
||||
if (!(tp->t_state & TS_TTSTOP)) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
com->state |= CS_TTGO;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
DISABLE_INTR(); /* very important while com_data is hidden */
|
||||
disable_intr(); /* very important while com_data is hidden */
|
||||
|
||||
/*
|
||||
* XXX - clearing CS_TTGO is not sufficient to stop further output,
|
||||
@ -2208,7 +2179,7 @@ comparam(tp, t)
|
||||
if (com->state >= (CS_BUSY | CS_TTGO))
|
||||
siointr1(com);
|
||||
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
splx(s);
|
||||
comstart(tp);
|
||||
return (0);
|
||||
@ -2225,7 +2196,7 @@ comstart(tp)
|
||||
unit = DEV_TO_UNIT(tp->t_dev);
|
||||
com = com_addr(unit);
|
||||
s = spltty();
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (tp->t_state & TS_TTSTOP)
|
||||
com->state &= ~CS_TTGO;
|
||||
else
|
||||
@ -2238,7 +2209,7 @@ comstart(tp)
|
||||
&& com->state & CS_RTS_IFLOW)
|
||||
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
|
||||
splx(s);
|
||||
return;
|
||||
@ -2253,7 +2224,7 @@ comstart(tp)
|
||||
sizeof com->obuf1);
|
||||
com->obufs[0].l_next = NULL;
|
||||
com->obufs[0].l_queued = TRUE;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state & CS_BUSY) {
|
||||
qp = com->obufq.l_next;
|
||||
while ((next = qp->l_next) != NULL)
|
||||
@ -2265,7 +2236,7 @@ comstart(tp)
|
||||
com->obufq.l_next = &com->obufs[0];
|
||||
com->state |= CS_BUSY;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
if (tp->t_outq.c_cc != 0 && !com->obufs[1].l_queued) {
|
||||
com->obufs[1].l_tail
|
||||
@ -2273,7 +2244,7 @@ comstart(tp)
|
||||
sizeof com->obuf2);
|
||||
com->obufs[1].l_next = NULL;
|
||||
com->obufs[1].l_queued = TRUE;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state & CS_BUSY) {
|
||||
qp = com->obufq.l_next;
|
||||
while ((next = qp->l_next) != NULL)
|
||||
@ -2285,14 +2256,14 @@ comstart(tp)
|
||||
com->obufq.l_next = &com->obufs[1];
|
||||
com->state |= CS_BUSY;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
tp->t_state |= TS_BUSY;
|
||||
}
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state >= (CS_BUSY | CS_TTGO))
|
||||
siointr1(com); /* fake interrupt to start output */
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
ttwwakeup(tp);
|
||||
splx(s);
|
||||
}
|
||||
@ -2307,7 +2278,7 @@ siostop(tp, rw)
|
||||
com = com_addr(DEV_TO_UNIT(tp->t_dev));
|
||||
if (com->gone)
|
||||
return;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (rw & FWRITE) {
|
||||
if (com->hasfifo)
|
||||
#ifdef COM_ESP
|
||||
@ -2336,7 +2307,7 @@ siostop(tp, rw)
|
||||
com_events -= (com->iptr - com->ibuf);
|
||||
com->iptr = com->ibuf;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
comstart(tp);
|
||||
}
|
||||
|
||||
@ -2395,7 +2366,7 @@ commctl(com, bits, how)
|
||||
mcr |= MCR_RTS;
|
||||
if (com->gone)
|
||||
return(0);
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
switch (how) {
|
||||
case DMSET:
|
||||
outb(com->modem_ctl_port,
|
||||
@ -2408,7 +2379,7 @@ commctl(com, bits, how)
|
||||
outb(com->modem_ctl_port, com->mcr_image &= ~mcr);
|
||||
break;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2466,9 +2437,9 @@ comwakeup(chan)
|
||||
com = com_addr(unit);
|
||||
if (com != NULL && !com->gone
|
||||
&& (com->state >= (CS_BUSY | CS_TTGO) || com->poll)) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
siointr1(com);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2490,10 +2461,10 @@ comwakeup(chan)
|
||||
u_int delta;
|
||||
u_long total;
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
delta = com->delta_error_counts[errnum];
|
||||
com->delta_error_counts[errnum] = 0;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (delta == 0)
|
||||
continue;
|
||||
total = com->error_counts[errnum] += delta;
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Steve McCanne's microtime code
|
||||
* $Id: microtime.s,v 1.29 1997/08/24 00:05:35 fsmp Exp $
|
||||
* $Id: microtime.s,v 1.8 1997/09/01 07:35:31 smp Exp smp $
|
||||
*/
|
||||
|
||||
#include "opt_cpu.h"
|
||||
@ -45,7 +45,7 @@
|
||||
#include <i386/isa/timerreg.h>
|
||||
|
||||
#ifdef SMP
|
||||
#include <machine/smptests.h> /** SIMPLE_MPINTRLOCK */
|
||||
#include <machine/smptests.h> /** USE_CLOCKLOCK */
|
||||
#endif
|
||||
|
||||
ENTRY(microtime)
|
||||
@ -62,7 +62,7 @@ ENTRY(microtime)
|
||||
|
||||
pushfl
|
||||
cli /* disable interrupts */
|
||||
#ifdef SIMPLE_MPINTRLOCK
|
||||
#ifdef USE_CLOCKLOCK
|
||||
pushl %eax /* s_lock destroys %eax, %ecx */
|
||||
pushl %ecx
|
||||
pushl $_clock_lock
|
||||
@ -70,7 +70,7 @@ ENTRY(microtime)
|
||||
addl $4, %esp
|
||||
popl %ecx
|
||||
popl %eax
|
||||
#endif /* SIMPLE_MPINTRLOCK */
|
||||
#endif /* USE_CLOCKLOCK */
|
||||
outb %al, $TIMER_MODE /* latch timer 0's counter */
|
||||
inb $TIMER_CNTR0, %al /* read counter value, LSB first */
|
||||
movb %al, %cl
|
||||
@ -203,13 +203,13 @@ common_microtime:
|
||||
addl _time+4, %eax /* usec += time.tv_sec */
|
||||
movl _time, %edx /* sec = time.tv_sec */
|
||||
|
||||
#ifdef SIMPLE_MPINTRLOCK
|
||||
#ifdef USE_CLOCKLOCK
|
||||
pushl %eax /* s_lock destroys %eax, %ecx */
|
||||
pushl $_clock_lock
|
||||
call _s_unlock
|
||||
addl $4, %esp
|
||||
popl %eax
|
||||
#endif /* SIMPLE_MPINTRLOCK */
|
||||
#endif /* USE_CLOCKLOCK */
|
||||
popfl /* restore interrupt mask */
|
||||
|
||||
cmpl $1000000, %eax /* usec valid? */
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: lock.h,v 1.3 1997/08/31 03:03:48 smp Exp smp $
|
||||
* $Id: lock.h,v 1.4 1997/09/01 07:37:58 smp Exp smp $
|
||||
*/
|
||||
|
||||
|
||||
@ -143,7 +143,13 @@
|
||||
|
||||
#ifdef SMP
|
||||
|
||||
#include <machine/smptests.h> /** XXX_MPINTR_LOCK */
|
||||
#include <machine/smptests.h> /** xxx_LOCK */
|
||||
|
||||
/*
|
||||
* Locks regions protected in UP kernel via cli/sti.
|
||||
*/
|
||||
#define MPINTR_LOCK() s_lock(&mpintr_lock)
|
||||
#define MPINTR_UNLOCK() s_unlock(&mpintr_lock)
|
||||
|
||||
/*
|
||||
* Protects cpl/cml/cil/ipending data as a critical region.
|
||||
@ -157,27 +163,50 @@
|
||||
#define SCPL_LOCK() ss_lock(&cpl_lock) /* INT safe: top end */
|
||||
#define SCPL_UNLOCK() ss_unlock(&cpl_lock)
|
||||
|
||||
/*
|
||||
* Locks regions protected in UP kernel via cli/sti.
|
||||
*/
|
||||
#if defined(SIMPLE_MPINTRLOCK)
|
||||
#define MPINTR_LOCK() s_lock(&mpintr_lock)
|
||||
#define MPINTR_UNLOCK() s_unlock(&mpintr_lock)
|
||||
#elif defined(RECURSIVE_MPINTRLOCK)
|
||||
#define MPINTR_LOCK() get_mpintrlock()
|
||||
#define MPINTR_UNLOCK() rel_mpintrlock();
|
||||
/* sio/cy lock */
|
||||
#ifdef USE_COMLOCK
|
||||
#define COM_LOCK() s_lock(&com_lock)
|
||||
#define COM_UNLOCK() s_unlock(&com_lock)
|
||||
#define COM_DISABLE_INTR() \
|
||||
{ __asm __volatile("cli" : : : "memory"); COM_LOCK(); }
|
||||
#define COM_ENABLE_INTR() \
|
||||
{ COM_UNLOCK(); __asm __volatile("sti"); }
|
||||
#else
|
||||
#error whats up doc?
|
||||
#endif /* _MPINTRLOCK */
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
#define COM_DISABLE_INTR() disable_intr()
|
||||
#define COM_ENABLE_INTR() enable_intr()
|
||||
#endif /* USE_COMLOCK */
|
||||
|
||||
/* clock hardware/struct lock */
|
||||
#ifdef USE_CLOCKLOCK
|
||||
#define CLOCK_LOCK() s_lock(&clock_lock)
|
||||
#define CLOCK_UNLOCK() s_unlock(&clock_lock)
|
||||
#define CLOCK_DISABLE_INTR() \
|
||||
{ __asm __volatile("cli" : : : "memory"); CLOCK_LOCK(); }
|
||||
#define CLOCK_ENABLE_INTR() \
|
||||
{ CLOCK_UNLOCK(); __asm __volatile("sti"); }
|
||||
#else
|
||||
#define CLOCK_LOCK()
|
||||
#define CLOCK_UNLOCK()
|
||||
#define CLOCK_DISABLE_INTR() disable_intr()
|
||||
#define CLOCK_ENABLE_INTR() enable_intr()
|
||||
#endif /* USE_CLOCKLOCK */
|
||||
|
||||
#else /* SMP */
|
||||
|
||||
#define MPINTR_LOCK()
|
||||
#define MPINTR_UNLOCK()
|
||||
|
||||
#define CPL_LOCK()
|
||||
#define CPL_UNLOCK()
|
||||
#define SCPL_LOCK()
|
||||
#define SCPL_UNLOCK()
|
||||
#define MPINTR_LOCK()
|
||||
#define MPINTR_UNLOCK()
|
||||
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
#define CLOCK_LOCK()
|
||||
#define CLOCK_UNLOCK()
|
||||
|
||||
#endif /* SMP */
|
||||
|
||||
@ -204,10 +233,7 @@ extern struct simplelock fast_intr_lock;
|
||||
extern struct simplelock intr_lock;
|
||||
extern struct simplelock clock_lock;
|
||||
extern struct simplelock com_lock;
|
||||
|
||||
#ifdef SIMPLE_MPINTRLOCK
|
||||
extern struct simplelock mpintr_lock;
|
||||
#endif/* SIMPLE_MPINTRLOCK */
|
||||
|
||||
#if !defined(SIMPLELOCK_DEBUG) && NCPUS > 1
|
||||
/*
|
||||
|
@ -22,7 +22,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: smptests.h,v 1.27 1997/08/31 03:02:19 smp Exp smp $
|
||||
* $Id: smptests.h,v 1.28 1997/09/01 07:37:58 smp Exp smp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_SMPTESTS_H_
|
||||
@ -52,25 +52,10 @@
|
||||
|
||||
|
||||
/*
|
||||
* There are places in the current kernel where it thinks it has exclusive
|
||||
* access to the world by bracketing things with disable_intr()/enable_intr().
|
||||
* Now that we started letting multiple CPUs into the kernel this is no
|
||||
* longer true.
|
||||
*
|
||||
* SIMPLE_MPINTRLOCK activates code that uses a simplelock to protect
|
||||
* all code suppossedly protected by disable_intr()/enable_intr().
|
||||
*
|
||||
* RECURSIVE_MPINTRLOCK is an attept to provide a recursive lock, doesn't work!
|
||||
*
|
||||
* Only define one of these (on neither, but FAST_HI is then problamatic):
|
||||
#define SIMPLE_MPINTRLOCK
|
||||
#define RECURSIVE_MPINTRLOCK
|
||||
*/
|
||||
#define SIMPLE_MPINTRLOCK
|
||||
|
||||
|
||||
/* */
|
||||
#define USE_COMLOCK
|
||||
#define USE_CLOCKLOCK
|
||||
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cy.c,v 1.4 1997/08/30 01:23:40 smp Exp smp $
|
||||
* $Id: cy.c,v 1.5 1997/09/01 07:37:01 smp Exp smp $
|
||||
*/
|
||||
|
||||
#include "cy.h"
|
||||
@ -88,6 +88,11 @@
|
||||
#include <i386/isa/cyreg.h>
|
||||
#include <i386/isa/ic/cd1400.h>
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
#define enable_intr() COM_ENABLE_INTR()
|
||||
#endif /* SMP */
|
||||
|
||||
/*
|
||||
* Dictionary so that I can name everything *sio* or *com* to compare with
|
||||
* sio.c. There is also lots of ugly formatting and unnecessary ifdefs to
|
||||
@ -988,7 +993,7 @@ siointr(unit)
|
||||
int baseu, cyu, cy_align;
|
||||
u_char status;
|
||||
|
||||
MPINTR_LOCK(); /* XXX could this be placed down lower in the loop? */
|
||||
COM_LOCK(); /* XXX could this be placed down lower in the loop? */
|
||||
|
||||
baseu = unit * CY_MAX_PORTS;
|
||||
cy_iobase = com_addr(baseu)->cy_iobase;
|
||||
@ -1337,7 +1342,7 @@ siointr(unit)
|
||||
|
||||
schedsofttty();
|
||||
|
||||
MPINTR_UNLOCK();
|
||||
COM_UNLOCK();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: sio.c,v 1.10 1997/08/31 03:04:36 smp Exp smp $
|
||||
* $Id: sio.c,v 1.11 1997/09/01 07:37:01 smp Exp smp $
|
||||
*/
|
||||
|
||||
#include "opt_comconsole.h"
|
||||
@ -66,40 +66,6 @@
|
||||
|
||||
#include <machine/clock.h>
|
||||
|
||||
#ifdef SMP
|
||||
#include <machine/smptests.h> /** USE_COMLOCK */
|
||||
|
||||
#ifdef USE_COMLOCK
|
||||
|
||||
#define DISABLE_INTR() \
|
||||
__asm __volatile("cli" : : : "memory"); \
|
||||
s_lock(&com_lock);
|
||||
|
||||
#define ENABLE_INTR() \
|
||||
s_unlock(&com_lock); \
|
||||
__asm __volatile("sti");
|
||||
|
||||
#define COM_LOCK() s_lock(&com_lock);
|
||||
#define COM_UNLOCK() s_unlock(&com_lock);
|
||||
|
||||
#else /* USE_COMLOCK */
|
||||
|
||||
#define DISABLE_INTR() disable_intr()
|
||||
#define ENABLE_INTR() enable_intr()
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
|
||||
#endif /* USE_COMLOCK */
|
||||
|
||||
#else /* SMP */
|
||||
|
||||
#define DISABLE_INTR() disable_intr()
|
||||
#define ENABLE_INTR() enable_intr()
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
|
||||
#endif /* SMP */
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/sioreg.h>
|
||||
@ -117,6 +83,11 @@
|
||||
#include <pccard/slot.h>
|
||||
#endif
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
#define enable_intr() COM_ENABLE_INTR()
|
||||
#endif /* SMP */
|
||||
|
||||
#ifdef APIC_IO
|
||||
/*
|
||||
* INTs are masked in the (global) IO APIC,
|
||||
@ -678,7 +649,7 @@ sioprobe(dev)
|
||||
* but mask them in the processor as well in case there are some
|
||||
* (misconfigured) shared interrupts.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
/* EXTRA DELAY? */
|
||||
|
||||
/*
|
||||
@ -784,7 +755,7 @@ sioprobe(dev)
|
||||
failures[8] = isa_irq_pending(idev) ? 1 : 0;
|
||||
failures[9] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND;
|
||||
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
|
||||
result = IO_COMSIZE;
|
||||
for (fn = 0; fn < sizeof failures; ++fn)
|
||||
@ -1218,14 +1189,14 @@ sioopen(dev, flag, mode, p)
|
||||
}
|
||||
}
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
(void) inb(com->line_status_port);
|
||||
(void) inb(com->data_port);
|
||||
com->prev_modem_status = com->last_modem_status
|
||||
= inb(com->modem_status_port);
|
||||
outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS
|
||||
| IER_EMSC);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
/*
|
||||
* Handle initial DCD. Callout devices get a fake initial
|
||||
* DCD (trapdoor DCD). If we are callout, then any sleeping
|
||||
@ -1865,7 +1836,7 @@ siopoll()
|
||||
* (actually never opened devices) so that we don't
|
||||
* loop.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
incc = com->iptr - com->ibuf;
|
||||
com->iptr = com->ibuf;
|
||||
if (com->state & CS_CHECKMSR) {
|
||||
@ -1873,7 +1844,7 @@ siopoll()
|
||||
com->state &= ~CS_CHECKMSR;
|
||||
}
|
||||
com_events -= incc;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (incc != 0)
|
||||
log(LOG_DEBUG,
|
||||
"sio%d: %d events for device with no tp\n",
|
||||
@ -1887,7 +1858,7 @@ siopoll()
|
||||
incc = 0;
|
||||
} else {
|
||||
buf = ibuf;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
incc = com->iptr - buf;
|
||||
com_events -= incc;
|
||||
if (ibuf == com->ibuf1)
|
||||
@ -1908,29 +1879,29 @@ siopoll()
|
||||
&& !(tp->t_state & TS_TBLOCK))
|
||||
outb(com->modem_ctl_port,
|
||||
com->mcr_image |= MCR_RTS);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
com->ibuf = ibuf;
|
||||
}
|
||||
|
||||
if (com->state & CS_CHECKMSR) {
|
||||
u_char delta_modem_status;
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
delta_modem_status = com->last_modem_status
|
||||
^ com->prev_modem_status;
|
||||
com->prev_modem_status = com->last_modem_status;
|
||||
com_events -= LOTS_OF_EVENTS;
|
||||
com->state &= ~CS_CHECKMSR;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (delta_modem_status & MSR_DCD)
|
||||
(*linesw[tp->t_line].l_modem)
|
||||
(tp, com->prev_modem_status & MSR_DCD);
|
||||
}
|
||||
if (com->state & CS_ODONE) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
com_events -= LOTS_OF_EVENTS;
|
||||
com->state &= ~CS_ODONE;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (!(com->state & CS_BUSY)
|
||||
&& !(com->extra_state & CSE_BUSYCHECK)) {
|
||||
timeout(siobusycheck, com, hz / 100);
|
||||
@ -2084,11 +2055,11 @@ comparam(tp, t)
|
||||
* line status port outside of siointr1() might lose some receiver
|
||||
* error bits, but that is acceptable here.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
retry:
|
||||
com->state &= ~CS_TTGO;
|
||||
txtimeout = tp->t_timeout;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
|
||||
!= (LSR_TSRE | LSR_TXRDY)) {
|
||||
tp->t_state |= TS_SO_OCOMPLETE;
|
||||
@ -2103,16 +2074,16 @@ comparam(tp, t)
|
||||
error = ENODEV;
|
||||
if (error != 0 && error != EAGAIN) {
|
||||
if (!(tp->t_state & TS_TTSTOP)) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
com->state |= CS_TTGO;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
DISABLE_INTR(); /* very important while com_data is hidden */
|
||||
disable_intr(); /* very important while com_data is hidden */
|
||||
|
||||
/*
|
||||
* XXX - clearing CS_TTGO is not sufficient to stop further output,
|
||||
@ -2208,7 +2179,7 @@ comparam(tp, t)
|
||||
if (com->state >= (CS_BUSY | CS_TTGO))
|
||||
siointr1(com);
|
||||
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
splx(s);
|
||||
comstart(tp);
|
||||
return (0);
|
||||
@ -2225,7 +2196,7 @@ comstart(tp)
|
||||
unit = DEV_TO_UNIT(tp->t_dev);
|
||||
com = com_addr(unit);
|
||||
s = spltty();
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (tp->t_state & TS_TTSTOP)
|
||||
com->state &= ~CS_TTGO;
|
||||
else
|
||||
@ -2238,7 +2209,7 @@ comstart(tp)
|
||||
&& com->state & CS_RTS_IFLOW)
|
||||
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
|
||||
splx(s);
|
||||
return;
|
||||
@ -2253,7 +2224,7 @@ comstart(tp)
|
||||
sizeof com->obuf1);
|
||||
com->obufs[0].l_next = NULL;
|
||||
com->obufs[0].l_queued = TRUE;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state & CS_BUSY) {
|
||||
qp = com->obufq.l_next;
|
||||
while ((next = qp->l_next) != NULL)
|
||||
@ -2265,7 +2236,7 @@ comstart(tp)
|
||||
com->obufq.l_next = &com->obufs[0];
|
||||
com->state |= CS_BUSY;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
if (tp->t_outq.c_cc != 0 && !com->obufs[1].l_queued) {
|
||||
com->obufs[1].l_tail
|
||||
@ -2273,7 +2244,7 @@ comstart(tp)
|
||||
sizeof com->obuf2);
|
||||
com->obufs[1].l_next = NULL;
|
||||
com->obufs[1].l_queued = TRUE;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state & CS_BUSY) {
|
||||
qp = com->obufq.l_next;
|
||||
while ((next = qp->l_next) != NULL)
|
||||
@ -2285,14 +2256,14 @@ comstart(tp)
|
||||
com->obufq.l_next = &com->obufs[1];
|
||||
com->state |= CS_BUSY;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
tp->t_state |= TS_BUSY;
|
||||
}
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state >= (CS_BUSY | CS_TTGO))
|
||||
siointr1(com); /* fake interrupt to start output */
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
ttwwakeup(tp);
|
||||
splx(s);
|
||||
}
|
||||
@ -2307,7 +2278,7 @@ siostop(tp, rw)
|
||||
com = com_addr(DEV_TO_UNIT(tp->t_dev));
|
||||
if (com->gone)
|
||||
return;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (rw & FWRITE) {
|
||||
if (com->hasfifo)
|
||||
#ifdef COM_ESP
|
||||
@ -2336,7 +2307,7 @@ siostop(tp, rw)
|
||||
com_events -= (com->iptr - com->ibuf);
|
||||
com->iptr = com->ibuf;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
comstart(tp);
|
||||
}
|
||||
|
||||
@ -2395,7 +2366,7 @@ commctl(com, bits, how)
|
||||
mcr |= MCR_RTS;
|
||||
if (com->gone)
|
||||
return(0);
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
switch (how) {
|
||||
case DMSET:
|
||||
outb(com->modem_ctl_port,
|
||||
@ -2408,7 +2379,7 @@ commctl(com, bits, how)
|
||||
outb(com->modem_ctl_port, com->mcr_image &= ~mcr);
|
||||
break;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2466,9 +2437,9 @@ comwakeup(chan)
|
||||
com = com_addr(unit);
|
||||
if (com != NULL && !com->gone
|
||||
&& (com->state >= (CS_BUSY | CS_TTGO) || com->poll)) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
siointr1(com);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2490,10 +2461,10 @@ comwakeup(chan)
|
||||
u_int delta;
|
||||
u_long total;
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
delta = com->delta_error_counts[errnum];
|
||||
com->delta_error_counts[errnum] = 0;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (delta == 0)
|
||||
continue;
|
||||
total = com->error_counts[errnum] += delta;
|
||||
|
@ -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;
|
||||
|
109
sys/isa/sio.c
109
sys/isa/sio.c
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: sio.c,v 1.10 1997/08/31 03:04:36 smp Exp smp $
|
||||
* $Id: sio.c,v 1.11 1997/09/01 07:37:01 smp Exp smp $
|
||||
*/
|
||||
|
||||
#include "opt_comconsole.h"
|
||||
@ -66,40 +66,6 @@
|
||||
|
||||
#include <machine/clock.h>
|
||||
|
||||
#ifdef SMP
|
||||
#include <machine/smptests.h> /** USE_COMLOCK */
|
||||
|
||||
#ifdef USE_COMLOCK
|
||||
|
||||
#define DISABLE_INTR() \
|
||||
__asm __volatile("cli" : : : "memory"); \
|
||||
s_lock(&com_lock);
|
||||
|
||||
#define ENABLE_INTR() \
|
||||
s_unlock(&com_lock); \
|
||||
__asm __volatile("sti");
|
||||
|
||||
#define COM_LOCK() s_lock(&com_lock);
|
||||
#define COM_UNLOCK() s_unlock(&com_lock);
|
||||
|
||||
#else /* USE_COMLOCK */
|
||||
|
||||
#define DISABLE_INTR() disable_intr()
|
||||
#define ENABLE_INTR() enable_intr()
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
|
||||
#endif /* USE_COMLOCK */
|
||||
|
||||
#else /* SMP */
|
||||
|
||||
#define DISABLE_INTR() disable_intr()
|
||||
#define ENABLE_INTR() enable_intr()
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
|
||||
#endif /* SMP */
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/sioreg.h>
|
||||
@ -117,6 +83,11 @@
|
||||
#include <pccard/slot.h>
|
||||
#endif
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
#define enable_intr() COM_ENABLE_INTR()
|
||||
#endif /* SMP */
|
||||
|
||||
#ifdef APIC_IO
|
||||
/*
|
||||
* INTs are masked in the (global) IO APIC,
|
||||
@ -678,7 +649,7 @@ sioprobe(dev)
|
||||
* but mask them in the processor as well in case there are some
|
||||
* (misconfigured) shared interrupts.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
/* EXTRA DELAY? */
|
||||
|
||||
/*
|
||||
@ -784,7 +755,7 @@ sioprobe(dev)
|
||||
failures[8] = isa_irq_pending(idev) ? 1 : 0;
|
||||
failures[9] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_NOPEND;
|
||||
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
|
||||
result = IO_COMSIZE;
|
||||
for (fn = 0; fn < sizeof failures; ++fn)
|
||||
@ -1218,14 +1189,14 @@ sioopen(dev, flag, mode, p)
|
||||
}
|
||||
}
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
(void) inb(com->line_status_port);
|
||||
(void) inb(com->data_port);
|
||||
com->prev_modem_status = com->last_modem_status
|
||||
= inb(com->modem_status_port);
|
||||
outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS
|
||||
| IER_EMSC);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
/*
|
||||
* Handle initial DCD. Callout devices get a fake initial
|
||||
* DCD (trapdoor DCD). If we are callout, then any sleeping
|
||||
@ -1865,7 +1836,7 @@ siopoll()
|
||||
* (actually never opened devices) so that we don't
|
||||
* loop.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
incc = com->iptr - com->ibuf;
|
||||
com->iptr = com->ibuf;
|
||||
if (com->state & CS_CHECKMSR) {
|
||||
@ -1873,7 +1844,7 @@ siopoll()
|
||||
com->state &= ~CS_CHECKMSR;
|
||||
}
|
||||
com_events -= incc;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (incc != 0)
|
||||
log(LOG_DEBUG,
|
||||
"sio%d: %d events for device with no tp\n",
|
||||
@ -1887,7 +1858,7 @@ siopoll()
|
||||
incc = 0;
|
||||
} else {
|
||||
buf = ibuf;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
incc = com->iptr - buf;
|
||||
com_events -= incc;
|
||||
if (ibuf == com->ibuf1)
|
||||
@ -1908,29 +1879,29 @@ siopoll()
|
||||
&& !(tp->t_state & TS_TBLOCK))
|
||||
outb(com->modem_ctl_port,
|
||||
com->mcr_image |= MCR_RTS);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
com->ibuf = ibuf;
|
||||
}
|
||||
|
||||
if (com->state & CS_CHECKMSR) {
|
||||
u_char delta_modem_status;
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
delta_modem_status = com->last_modem_status
|
||||
^ com->prev_modem_status;
|
||||
com->prev_modem_status = com->last_modem_status;
|
||||
com_events -= LOTS_OF_EVENTS;
|
||||
com->state &= ~CS_CHECKMSR;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (delta_modem_status & MSR_DCD)
|
||||
(*linesw[tp->t_line].l_modem)
|
||||
(tp, com->prev_modem_status & MSR_DCD);
|
||||
}
|
||||
if (com->state & CS_ODONE) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
com_events -= LOTS_OF_EVENTS;
|
||||
com->state &= ~CS_ODONE;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (!(com->state & CS_BUSY)
|
||||
&& !(com->extra_state & CSE_BUSYCHECK)) {
|
||||
timeout(siobusycheck, com, hz / 100);
|
||||
@ -2084,11 +2055,11 @@ comparam(tp, t)
|
||||
* line status port outside of siointr1() might lose some receiver
|
||||
* error bits, but that is acceptable here.
|
||||
*/
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
retry:
|
||||
com->state &= ~CS_TTGO;
|
||||
txtimeout = tp->t_timeout;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
|
||||
!= (LSR_TSRE | LSR_TXRDY)) {
|
||||
tp->t_state |= TS_SO_OCOMPLETE;
|
||||
@ -2103,16 +2074,16 @@ comparam(tp, t)
|
||||
error = ENODEV;
|
||||
if (error != 0 && error != EAGAIN) {
|
||||
if (!(tp->t_state & TS_TTSTOP)) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
com->state |= CS_TTGO;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
DISABLE_INTR(); /* very important while com_data is hidden */
|
||||
disable_intr(); /* very important while com_data is hidden */
|
||||
|
||||
/*
|
||||
* XXX - clearing CS_TTGO is not sufficient to stop further output,
|
||||
@ -2208,7 +2179,7 @@ comparam(tp, t)
|
||||
if (com->state >= (CS_BUSY | CS_TTGO))
|
||||
siointr1(com);
|
||||
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
splx(s);
|
||||
comstart(tp);
|
||||
return (0);
|
||||
@ -2225,7 +2196,7 @@ comstart(tp)
|
||||
unit = DEV_TO_UNIT(tp->t_dev);
|
||||
com = com_addr(unit);
|
||||
s = spltty();
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (tp->t_state & TS_TTSTOP)
|
||||
com->state &= ~CS_TTGO;
|
||||
else
|
||||
@ -2238,7 +2209,7 @@ comstart(tp)
|
||||
&& com->state & CS_RTS_IFLOW)
|
||||
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
|
||||
splx(s);
|
||||
return;
|
||||
@ -2253,7 +2224,7 @@ comstart(tp)
|
||||
sizeof com->obuf1);
|
||||
com->obufs[0].l_next = NULL;
|
||||
com->obufs[0].l_queued = TRUE;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state & CS_BUSY) {
|
||||
qp = com->obufq.l_next;
|
||||
while ((next = qp->l_next) != NULL)
|
||||
@ -2265,7 +2236,7 @@ comstart(tp)
|
||||
com->obufq.l_next = &com->obufs[0];
|
||||
com->state |= CS_BUSY;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
if (tp->t_outq.c_cc != 0 && !com->obufs[1].l_queued) {
|
||||
com->obufs[1].l_tail
|
||||
@ -2273,7 +2244,7 @@ comstart(tp)
|
||||
sizeof com->obuf2);
|
||||
com->obufs[1].l_next = NULL;
|
||||
com->obufs[1].l_queued = TRUE;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state & CS_BUSY) {
|
||||
qp = com->obufq.l_next;
|
||||
while ((next = qp->l_next) != NULL)
|
||||
@ -2285,14 +2256,14 @@ comstart(tp)
|
||||
com->obufq.l_next = &com->obufs[1];
|
||||
com->state |= CS_BUSY;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
tp->t_state |= TS_BUSY;
|
||||
}
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (com->state >= (CS_BUSY | CS_TTGO))
|
||||
siointr1(com); /* fake interrupt to start output */
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
ttwwakeup(tp);
|
||||
splx(s);
|
||||
}
|
||||
@ -2307,7 +2278,7 @@ siostop(tp, rw)
|
||||
com = com_addr(DEV_TO_UNIT(tp->t_dev));
|
||||
if (com->gone)
|
||||
return;
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
if (rw & FWRITE) {
|
||||
if (com->hasfifo)
|
||||
#ifdef COM_ESP
|
||||
@ -2336,7 +2307,7 @@ siostop(tp, rw)
|
||||
com_events -= (com->iptr - com->ibuf);
|
||||
com->iptr = com->ibuf;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
comstart(tp);
|
||||
}
|
||||
|
||||
@ -2395,7 +2366,7 @@ commctl(com, bits, how)
|
||||
mcr |= MCR_RTS;
|
||||
if (com->gone)
|
||||
return(0);
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
switch (how) {
|
||||
case DMSET:
|
||||
outb(com->modem_ctl_port,
|
||||
@ -2408,7 +2379,7 @@ commctl(com, bits, how)
|
||||
outb(com->modem_ctl_port, com->mcr_image &= ~mcr);
|
||||
break;
|
||||
}
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2466,9 +2437,9 @@ comwakeup(chan)
|
||||
com = com_addr(unit);
|
||||
if (com != NULL && !com->gone
|
||||
&& (com->state >= (CS_BUSY | CS_TTGO) || com->poll)) {
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
siointr1(com);
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2490,10 +2461,10 @@ comwakeup(chan)
|
||||
u_int delta;
|
||||
u_long total;
|
||||
|
||||
DISABLE_INTR();
|
||||
disable_intr();
|
||||
delta = com->delta_error_counts[errnum];
|
||||
com->delta_error_counts[errnum] = 0;
|
||||
ENABLE_INTR();
|
||||
enable_intr();
|
||||
if (delta == 0)
|
||||
continue;
|
||||
total = com->error_counts[errnum] += delta;
|
||||
|
Loading…
Reference in New Issue
Block a user