summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2005-05-31 09:34:24 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2005-05-31 09:34:24 +0000
commita54ff00c558cd8f3c62ed639b4c898f86c64389e (patch)
tree9f97547d4ed6b9df2115cbd7b0f0a6fc6311fb85
parent76e09d4ba8a27be08dece281483a60059c9445c4 (diff)
Lock the apic with a mutex, not a SIMPLE_LOCK.
markus@ ok miod@ tried to ok, but he doesn't officially have an amd64.
-rw-r--r--sys/arch/amd64/amd64/ioapic.c8
-rw-r--r--sys/arch/amd64/include/pic.h9
2 files changed, 7 insertions, 10 deletions
diff --git a/sys/arch/amd64/amd64/ioapic.c b/sys/arch/amd64/amd64/ioapic.c
index 6ee5bf11a1b..b252261b234 100644
--- a/sys/arch/amd64/amd64/ioapic.c
+++ b/sys/arch/amd64/amd64/ioapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioapic.c,v 1.5 2005/05/29 03:20:36 deraadt Exp $ */
+/* $OpenBSD: ioapic.c,v 1.6 2005/05/31 09:34:22 art Exp $ */
/* $NetBSD: ioapic.c,v 1.6 2003/05/15 13:30:31 fvdl Exp $ */
/*-
@@ -127,14 +127,14 @@ ioapic_lock(struct ioapic_softc *sc)
flags = read_psl();
disable_intr();
- SIMPLE_LOCK(&sc->sc_pic.pic_lock);
+ mtx_enter(&sc->sc_pic.pic_mutex);
return flags;
}
static __inline void
ioapic_unlock(struct ioapic_softc *sc, u_long flags)
{
- SIMPLE_UNLOCK(&sc->sc_pic.pic_lock);
+ mtx_leave(&sc->sc_pic.pic_mutex);
write_psl(flags);
}
@@ -294,7 +294,7 @@ ioapic_attach(struct device *parent, struct device *self, void *aux)
sc->sc_data = (volatile u_int32_t *)(bh + IOAPIC_DATA);
sc->sc_pic.pic_type = PIC_IOAPIC;
- SIMPLE_LOCK_INIT(&sc->sc_pic.pic_lock);
+ mtx_init(&sc->sc_pic.pic_mutex, IPL_NONE);
sc->sc_pic.pic_hwmask = ioapic_hwmask;
sc->sc_pic.pic_hwunmask = ioapic_hwunmask;
sc->sc_pic.pic_addroute = ioapic_addroute;
diff --git a/sys/arch/amd64/include/pic.h b/sys/arch/amd64/include/pic.h
index 0859288542f..f880c524ac8 100644
--- a/sys/arch/amd64/include/pic.h
+++ b/sys/arch/amd64/include/pic.h
@@ -1,15 +1,12 @@
-/* $OpenBSD: pic.h,v 1.4 2005/05/29 03:20:36 deraadt Exp $ */
+/* $OpenBSD: pic.h,v 1.5 2005/05/31 09:34:23 art Exp $ */
/* $NetBSD: pic.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */
#ifndef _X86_PIC_H
#define _X86_PIC_H
#include <sys/device.h>
-#ifdef MULTIPROCESSOR
-#include <sys/mplock.h>
-#else
+#include <sys/mutex.h>
#include <sys/lock.h>
-#endif
struct cpu_info;
@@ -20,7 +17,7 @@ struct pic {
struct device pic_dev;
int pic_type;
#ifdef MULTIPROCESSOR
- struct SIMPLE_LOCK pic_lock;
+ struct mutex pic_mutex;
#endif
void (*pic_hwmask)(struct pic *, int);
void (*pic_hwunmask)(struct pic *, int);