summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2017-10-17 14:25:36 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2017-10-17 14:25:36 +0000
commit1736274fb9f19f34d92aa10612489925834772d7 (patch)
tree5c6e47d74a882ae412fb1b30c94e9a0994d70eac /sys/arch/sparc64
parentbffb3558829269f9819254da4202352807d3580a (diff)
Add a machine-independent implementation for the mplock.
This reduces code duplication and makes it easier to instrument lock primitives. The MI mplock uses the ticket lock code that has been in use on amd64, i386 and sparc64. These are the architectures that now switch to the MI code. The lock_machdep.c files are unhooked from the build but not removed yet, in case something goes wrong. OK mpi@, kettenis@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/conf/files.sparc643
-rw-r--r--sys/arch/sparc64/include/mplock.h49
2 files changed, 4 insertions, 48 deletions
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64
index 28b8e112c4c..e97e89aa7a9 100644
--- a/sys/arch/sparc64/conf/files.sparc64
+++ b/sys/arch/sparc64/conf/files.sparc64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.sparc64,v 1.148 2016/01/08 15:54:13 jcs Exp $
+# $OpenBSD: files.sparc64,v 1.149 2017/10/17 14:25:35 visa Exp $
# $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $
# maxpartitions must be first item in files.${ARCH}
@@ -326,7 +326,6 @@ file arch/sparc64/sparc64/ipifuncs.c multiprocessor
file arch/sparc64/sparc64/kgdb_machdep.c kgdb
# sparc64/sparc64/locore.s is handled specially in the makefile,
# because it must come first in the "ld" command line.
-file arch/sparc64/sparc64/lock_machdep.c multiprocessor
file arch/sparc64/sparc64/machdep.c
file arch/sparc64/sparc64/mdesc.c sun4v
file arch/sparc64/sparc64/mem.c
diff --git a/sys/arch/sparc64/include/mplock.h b/sys/arch/sparc64/include/mplock.h
index 7b7d9cc7a59..57d665d7884 100644
--- a/sys/arch/sparc64/include/mplock.h
+++ b/sys/arch/sparc64/include/mplock.h
@@ -1,53 +1,10 @@
-/* $OpenBSD: mplock.h,v 1.3 2014/03/14 01:20:44 dlg Exp $ */
+/* $OpenBSD: mplock.h,v 1.4 2017/10/17 14:25:35 visa Exp $ */
-/*
- * Copyright (c) 2004 Niklas Hallqvist. 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. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
- */
+/* public domain */
#ifndef _MACHINE_MPLOCK_H_
#define _MACHINE_MPLOCK_H_
-struct __mp_lock_cpu {
- volatile u_int mplc_ticket;
- volatile u_int mplc_depth;
-};
-
-struct __mp_lock {
- struct __mp_lock_cpu mpl_cpus[MAXCPUS];
- volatile u_int mpl_ticket;
- volatile u_int mpl_users;
-};
-
-#ifndef _LOCORE
-
-void __mp_lock_init(struct __mp_lock *);
-void __mp_lock(struct __mp_lock *);
-void __mp_unlock(struct __mp_lock *);
-int __mp_release_all(struct __mp_lock *);
-int __mp_release_all_but_one(struct __mp_lock *);
-void __mp_acquire_count(struct __mp_lock *, int);
-int __mp_lock_held(struct __mp_lock *);
-
-#endif
+#define __USE_MI_MPLOCK
#endif /* !_MACHINE_MPLOCK_H */