summaryrefslogtreecommitdiffstats
path: root/sys/amd64/isa
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-03-20 21:53:27 +0000
committerjhb <jhb@FreeBSD.org>2008-03-20 21:53:27 +0000
commitfbea3b640303d33fbbb2c17e5e94d075c5b14def (patch)
tree68f35a8822805f64d4867d86b368c0e5051fa00f /sys/amd64/isa
parent6cf6d7b22b5d548a6ec6807400ca3ae0731e1ef6 (diff)
downloadFreeBSD-src-fbea3b640303d33fbbb2c17e5e94d075c5b14def.zip
FreeBSD-src-fbea3b640303d33fbbb2c17e5e94d075c5b14def.tar.gz
Explicitly use spinlock_enter/exit rather than locking the icu_lock spin
lock in the 8259A drivers as these drivers are only used on UP systems. This slightly reduces the penalty of an SMP kernel (such as GENERIC) on a UP x86 machine.
Diffstat (limited to 'sys/amd64/isa')
-rw-r--r--sys/amd64/isa/atpic.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/sys/amd64/isa/atpic.c b/sys/amd64/isa/atpic.c
index 3512091..f0a1081 100644
--- a/sys/amd64/isa/atpic.c
+++ b/sys/amd64/isa/atpic.c
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
-#include <sys/mutex.h>
#include <machine/cpufunc.h>
#include <machine/frame.h>
@@ -208,12 +207,12 @@ atpic_enable_source(struct intsrc *isrc)
struct atpic_intsrc *ai = (struct atpic_intsrc *)isrc;
struct atpic *ap = (struct atpic *)isrc->is_pic;
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
if (*ap->at_imen & IMEN_MASK(ai)) {
*ap->at_imen &= ~IMEN_MASK(ai);
outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen);
}
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
}
static void
@@ -222,7 +221,7 @@ atpic_disable_source(struct intsrc *isrc, int eoi)
struct atpic_intsrc *ai = (struct atpic_intsrc *)isrc;
struct atpic *ap = (struct atpic *)isrc->is_pic;
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
if (ai->at_trigger != INTR_TRIGGER_EDGE) {
*ap->at_imen |= IMEN_MASK(ai);
outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen);
@@ -240,16 +239,16 @@ atpic_disable_source(struct intsrc *isrc, int eoi)
_atpic_eoi_slave(isrc);
}
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
}
static void
atpic_eoi_master(struct intsrc *isrc)
{
#ifndef AUTO_EOI_1
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
_atpic_eoi_master(isrc);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
#endif
}
@@ -257,9 +256,9 @@ static void
atpic_eoi_slave(struct intsrc *isrc)
{
#ifndef AUTO_EOI_2
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
_atpic_eoi_slave(isrc);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
#endif
}
@@ -351,10 +350,10 @@ atpic_config_intr(struct intsrc *isrc, enum intr_trigger trig,
if (bootverbose)
printf("atpic: Programming IRQ%u as %s\n", vector,
trig == INTR_TRIGGER_EDGE ? "edge/high" : "level/low");
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
elcr_write_trigger(atpic_vector(isrc), trig);
ai->at_trigger = trig;
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
return (0);
}
@@ -375,7 +374,7 @@ i8259_init(struct atpic *pic, int slave)
int imr_addr;
/* Reset the PIC and program with next four bytes. */
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
outb(pic->at_ioaddr, ICW1_RESET | ICW1_IC4);
imr_addr = pic->at_ioaddr + ICU_IMR_OFFSET;
@@ -407,7 +406,7 @@ i8259_init(struct atpic *pic, int slave)
/* OCW2_L1 sets priority order to 3-7, 0-2 (com2 first). */
if (!slave)
outb(pic->at_ioaddr, OCW2_R | OCW2_SL | OCW2_L1);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
}
void
@@ -521,11 +520,11 @@ atpic_handle_intr(u_int vector, struct trapframe *frame)
* pending. Reset read register back to IRR when done.
*/
port = ((struct atpic *)isrc->is_pic)->at_ioaddr;
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
outb(port, OCW3_SEL | OCW3_RR | OCW3_RIS);
isr = inb(port);
outb(port, OCW3_SEL | OCW3_RR);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
if ((isr & IRQ_MASK(7)) == 0)
return;
}
OpenPOWER on IntegriCloud