summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-05-15 15:23:37 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-05-15 15:23:37 +0000
commit91787813a837d6085f137a97a13ea2634706a87f (patch)
tree392f7d4efc7259dffec972044039b9f10b3682fa /sys
parent25e54d642cc3e82fba357ef0da029a8fc6cc807c (diff)
Remove the MI implementation of mutexes and remove the __HAVE_MUTEX
option. Every architecture implements mutexes now.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/include/_types.h3
-rw-r--r--sys/arch/amd64/include/_types.h3
-rw-r--r--sys/arch/armish/include/_types.h3
-rw-r--r--sys/arch/cats/include/_types.h3
-rw-r--r--sys/arch/hppa/include/_types.h3
-rw-r--r--sys/arch/i386/include/_types.h3
-rw-r--r--sys/arch/m68k/include/_types.h3
-rw-r--r--sys/arch/m88k/include/_types.h3
-rw-r--r--sys/arch/powerpc/include/_types.h3
-rw-r--r--sys/arch/sgi/include/_types.h3
-rw-r--r--sys/arch/sh/include/_types.h3
-rw-r--r--sys/arch/sparc/include/_types.h3
-rw-r--r--sys/arch/sparc64/include/_types.h3
-rw-r--r--sys/arch/vax/include/_types.h3
-rw-r--r--sys/arch/zaurus/include/_types.h3
-rw-r--r--sys/conf/files3
-rw-r--r--sys/kern/subr_mutex.c84
-rw-r--r--sys/sys/mutex.h57
18 files changed, 17 insertions, 172 deletions
diff --git a/sys/arch/alpha/include/_types.h b/sys/arch/alpha/include/_types.h
index 2c0a9f371c0..18535caa90b 100644
--- a/sys/arch/alpha/include/_types.h
+++ b/sys/arch/alpha/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.7 2007/05/15 07:13:49 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.8 2007/05/15 15:23:35 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -122,6 +122,5 @@ typedef void * __wctype_t;
#define __HAVE_CPUINFO
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_TIMECOUNTER
-#define __HAVE_MUTEX
#endif /* _ALPHA__TYPES_H_ */
diff --git a/sys/arch/amd64/include/_types.h b/sys/arch/amd64/include/_types.h
index b399e2d6f61..07aefab326c 100644
--- a/sys/arch/amd64/include/_types.h
+++ b/sys/arch/amd64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2006/11/07 09:09:42 otto Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:35 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -117,7 +117,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_CPUINFO
-#define __HAVE_MUTEX
#define __HAVE_TIMECOUNTER
#endif /* _AMD64__TYPES_H_ */
diff --git a/sys/arch/armish/include/_types.h b/sys/arch/armish/include/_types.h
index a9eaa5821c7..e04445dfcd2 100644
--- a/sys/arch/armish/include/_types.h
+++ b/sys/arch/armish/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2007/05/15 05:26:44 miod Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:35 art Exp $ */
/* $NetBSD: types.h,v 1.4 2002/02/28 03:17:26 simonb Exp $ */
#ifndef _ARMISH__TYPES_H_
@@ -6,6 +6,5 @@
#include <arm/_types.h>
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_MUTEX
#endif /* _ARMISH__TYPES_H_ */
diff --git a/sys/arch/cats/include/_types.h b/sys/arch/cats/include/_types.h
index fba2772bd00..80cabc3e2d5 100644
--- a/sys/arch/cats/include/_types.h
+++ b/sys/arch/cats/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2007/05/15 05:26:44 miod Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:35 art Exp $ */
/* public domain */
@@ -8,6 +8,5 @@
#include <arm/_types.h>
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_MUTEX
#endif /* _CATS__TYPES */
diff --git a/sys/arch/hppa/include/_types.h b/sys/arch/hppa/include/_types.h
index caeaae9d69f..ebe380ad296 100644
--- a/sys/arch/hppa/include/_types.h
+++ b/sys/arch/hppa/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.5 2007/05/15 01:56:46 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:35 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -123,7 +123,6 @@ typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
-#define __HAVE_MUTEX
#define __HAVE_CPUINFO
#endif /* _HPPA__TYPES_H_ */
diff --git a/sys/arch/i386/include/_types.h b/sys/arch/i386/include/_types.h
index 52cbef65faa..b6ae4922594 100644
--- a/sys/arch/i386/include/_types.h
+++ b/sys/arch/i386/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.5 2007/03/19 09:29:33 art Exp $ */
+/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:35 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -116,7 +116,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_CPUINFO
-#define __HAVE_MUTEX
#define __HAVE_TIMECOUNTER
#endif /* _I386__TYPES_H_ */
diff --git a/sys/arch/m68k/include/_types.h b/sys/arch/m68k/include/_types.h
index 0a3fe095832..f51e71a3b11 100644
--- a/sys/arch/m68k/include/_types.h
+++ b/sys/arch/m68k/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.4 2007/05/15 13:46:22 martin Exp $ */
+/* $OpenBSD: _types.h,v 1.5 2007/05/15 15:23:36 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -115,7 +115,6 @@ typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
-#define __HAVE_MUTEX
#define __HAVE_CPUINFO
#endif /* _M68K__TYPES_H_ */
diff --git a/sys/arch/m88k/include/_types.h b/sys/arch/m88k/include/_types.h
index 7a9867ec926..bb8f7fca0ad 100644
--- a/sys/arch/m88k/include/_types.h
+++ b/sys/arch/m88k/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2006/01/13 17:50:06 millert Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:36 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -117,6 +117,5 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_CPUINFO
-#define __HAVE_MUTEX
#endif /* _M88K__TYPES_H_ */
diff --git a/sys/arch/powerpc/include/_types.h b/sys/arch/powerpc/include/_types.h
index b0d801a32f6..b7666a54410 100644
--- a/sys/arch/powerpc/include/_types.h
+++ b/sys/arch/powerpc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.5 2007/04/13 18:48:38 kettenis Exp $ */
+/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:36 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -117,7 +117,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_CPUINFO
-#define __HAVE_MUTEX
#define __HAVE_TIMECOUNTER
#endif /* _POWERPC__TYPES_H_ */
diff --git a/sys/arch/sgi/include/_types.h b/sys/arch/sgi/include/_types.h
index cb7a8cf8164..600456175e0 100644
--- a/sys/arch/sgi/include/_types.h
+++ b/sys/arch/sgi/include/_types.h
@@ -1,6 +1,5 @@
-/* $OpenBSD: _types.h,v 1.2 2007/05/01 18:59:40 miod Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:36 art Exp $ */
/* public domain */
#include <mips64/_types.h>
-#define __HAVE_MUTEX
diff --git a/sys/arch/sh/include/_types.h b/sys/arch/sh/include/_types.h
index 01a8bf457cd..d382015007c 100644
--- a/sys/arch/sh/include/_types.h
+++ b/sys/arch/sh/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.3 2007/05/14 07:05:49 art Exp $ */
+/* $OpenBSD: _types.h,v 1.4 2007/05/15 15:23:36 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -117,7 +117,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_MUTEX
#define __HAVE_CPUINFO
#endif /* _SH__TYPES_H_ */
diff --git a/sys/arch/sparc/include/_types.h b/sys/arch/sparc/include/_types.h
index 8c485eac103..0978cc65b61 100644
--- a/sys/arch/sparc/include/_types.h
+++ b/sys/arch/sparc/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.6 2007/05/15 01:56:47 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.7 2007/05/15 15:23:36 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -114,7 +114,6 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-#define __HAVE_MUTEX
#define __HAVE_CPUINFO
#endif /* _SPARC__TYPES_H_ */
diff --git a/sys/arch/sparc64/include/_types.h b/sys/arch/sparc64/include/_types.h
index bc6dc98762d..9707c260acf 100644
--- a/sys/arch/sparc64/include/_types.h
+++ b/sys/arch/sparc64/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.5 2007/05/15 01:56:47 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.6 2007/05/15 15:23:36 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -123,7 +123,6 @@ typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_CPUINFO
-#define __HAVE_MUTEX
#define __HAVE_TIMECOUNTER
#endif /* _SPARC64__TYPES_H_ */
diff --git a/sys/arch/vax/include/_types.h b/sys/arch/vax/include/_types.h
index 0eafe9d539a..80170e20cd2 100644
--- a/sys/arch/vax/include/_types.h
+++ b/sys/arch/vax/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.4 2007/05/15 01:56:47 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.5 2007/05/15 15:23:36 art Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -115,6 +115,5 @@ typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
-#define __HAVE_MUTEX
#endif /* _MACHINE__TYPES_H_ */
diff --git a/sys/arch/zaurus/include/_types.h b/sys/arch/zaurus/include/_types.h
index 7cf8cf0a351..988d34f4caa 100644
--- a/sys/arch/zaurus/include/_types.h
+++ b/sys/arch/zaurus/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.2 2007/05/15 05:26:44 miod Exp $ */
+/* $OpenBSD: _types.h,v 1.3 2007/05/15 15:23:36 art Exp $ */
#ifndef _ZAURUS__TYPES_H_
#define _ZAURUS__TYPES_H_
@@ -6,6 +6,5 @@
#include <arm/_types.h>
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_MUTEX
#endif
diff --git a/sys/conf/files b/sys/conf/files
index 65bc2ec63c7..1047c3da5c8 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.398 2007/05/15 01:00:15 dlg Exp $
+# $OpenBSD: files,v 1.399 2007/05/15 15:23:36 art Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -666,7 +666,6 @@ file kern/subr_disk.c
file kern/subr_evcount.c
file kern/subr_extent.c
file kern/subr_log.c
-file kern/subr_mutex.c
file kern/subr_pool.c
file kern/subr_prf.c
file kern/subr_prof.c
diff --git a/sys/kern/subr_mutex.c b/sys/kern/subr_mutex.c
deleted file mode 100644
index 59b213c0ff6..00000000000
--- a/sys/kern/subr_mutex.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: subr_mutex.c,v 1.2 2006/06/04 19:08:03 miod Exp $ */
-
-/*
- * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/mutex.h>
-#include <sys/systm.h>
-
-#ifndef __HAVE_MUTEX
-
-/*
- * Single processor systems don't need any mutexes, but they need the spl
- * raising semantics of the mutexes.
- */
-void
-mtx_init1(struct mutex *mtx, int wantipl)
-{
- mtx->mtx_oldipl = 0;
- mtx->mtx_wantipl = wantipl;
- mtx->mtx_lock = 0;
-}
-
-void
-mtx_enter(struct mutex *mtx)
-{
-#define UGLY(lc, uc) case MUTEX_IPL_##uc: mtx->mtx_oldipl = spl##lc(); break
-
- switch (mtx->mtx_wantipl) {
- UGLY(high, HIGH);
- UGLY(statclock, STATCLOCK);
-#ifdef IPL_SCHED
- UGLY(sched, SCHED);
-#endif
- UGLY(clock, CLOCK);
- UGLY(vm, VM);
- UGLY(tty, TTY);
- UGLY(net, NET);
- UGLY(bio, BIO);
- UGLY(softnet, SOFTNET);
- UGLY(softclock, SOFTCLOCK);
- case MUTEX_IPL_NONE:
- break;
- default:
- panic("mtx_enter: ipl not implemented");
- }
-#undef UGLY
-
- MUTEX_ASSERT_UNLOCKED(mtx);
- mtx->mtx_lock = 1;
-}
-
-void
-mtx_leave(struct mutex *mtx)
-{
- MUTEX_ASSERT_LOCKED(mtx);
- mtx->mtx_lock = 0;
- if (mtx->mtx_wantipl != MUTEX_IPL_NONE)
- splx(mtx->mtx_oldipl);
-}
-
-#endif
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index 720b5162178..b731552b014 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.3 2005/07/18 02:43:27 fgsch Exp $ */
+/* $OpenBSD: mutex.h,v 1.4 2007/05/15 15:23:36 art Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -42,62 +42,7 @@
* "mtx_enter(foo); mtx_enter(bar); mtx_leave(foo); mtx_leave(bar);"
*/
-#ifdef __HAVE_MUTEX
#include <machine/mutex.h>
-#else
-
-/*
- * Simple non-mp implementation.
- */
-struct mutex {
- int mtx_lock;
- int mtx_wantipl;
- int mtx_oldipl;
-};
-
-/*
- * Since the alpha IPL levels are so messed up, we have to do magic to get
- * this right.
- */
-#define MUTEX_IPL(ipl) MUTEX_##ipl
-#define MUTEX_IPL_NONE 0
-#define MUTEX_IPL_SOFTSERIAL 1
-#define MUTEX_IPL_SOFTCLOCK 2
-#define MUTEX_IPL_SOFTNET 3
-#define MUTEX_IPL_NET 4
-#define MUTEX_IPL_BIO 5
-#define MUTEX_IPL_VM 6
-#define MUTEX_IPL_TTY 7
-#define MUTEX_IPL_SERIAL 8
-#define MUTEX_IPL_AUDIO 9
-#define MUTEX_IPL_CLOCK 10
-#define MUTEX_IPL_STATCLOCK 11
-#define MUTEX_IPL_SCHED 12
-#define MUTEX_IPL_HIGH 13
-
-void mtx_init1(struct mutex *, int);
-#define mtx_init(mtx, ipl) mtx_init1(mtx, MUTEX_##ipl)
-
-#define MUTEX_INITIALIZER(ipl) { 0, MUTEX_##ipl, 0 }
-
-#ifdef DIAGNOSTIC
-#define MUTEX_ASSERT_LOCKED(mtx) do { \
- if ((mtx)->mtx_lock == 0) \
- panic("mutex %p not held in %s", (mtx), __func__); \
-} while (0)
-
-#define MUTEX_ASSERT_UNLOCKED(mtx) do { \
- if ((mtx)->mtx_lock != 0) \
- panic("mutex %p held in %s", (mtx), __func__); \
-} while (0)
-#else
-#define MUTEX_ASSERT_LOCKED(mtx) do { } while (0)
-#define MUTEX_ASSERT_UNLOCKED(mtx) do { } while (0)
-#endif
-
-#define MUTEX_OLDIPL(mtx) (mtx)->mtx_oldipl
-
-#endif
/*
* Some architectures need to do magic for the ipl, so they need a macro.