Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/sparc Rework locking mechanism introduced in ...



details:   https://anonhg.NetBSD.org/src/rev/6ccf5cc2d65a
branches:  trunk
changeset: 344617:6ccf5cc2d65a
user:      palle <palle%NetBSD.org@localhost>
date:      Thu Apr 07 19:46:39 2016 +0000

description:
Rework locking mechanism introduced in rev. 1.21: use __cpu_simple_lock... instead of mutex_... since this causes issues when LOCKDEBUG is defined

diffstat:

 sys/arch/sparc/sparc/openfirm.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r 6280cad64303 -r 6ccf5cc2d65a sys/arch/sparc/sparc/openfirm.c
--- a/sys/arch/sparc/sparc/openfirm.c   Thu Apr 07 17:48:40 2016 +0000
+++ b/sys/arch/sparc/sparc/openfirm.c   Thu Apr 07 19:46:39 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openfirm.c,v 1.21 2016/04/01 20:21:45 palle Exp $      */
+/*     $NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $      */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,10 +32,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.21 2016/04/01 20:21:45 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <machine/lock.h>
 #include <machine/psl.h>
 #include <machine/promlib.h>
 #include <lib/libkern/libkern.h>
@@ -56,7 +57,7 @@
  * Use a mutex to protect access to the buffer from multiple threads.
  * 
  */
-kmutex_t ofcall_mtx;
+static __cpu_simple_lock_t ofcall_lock;
 static char ofbounce[OFBOUNCE_MAXSIZE];
 #endif
 #endif
@@ -67,7 +68,7 @@
 #ifdef SUN4V
 #ifdef __arch64__
   KASSERT(((uint64_t)&ofbounce & 0xffffffffUL)==(uint64_t)&ofbounce);
-  mutex_init(&ofcall_mtx, MUTEX_DEFAULT, IPL_NONE);
+  __cpu_simple_lock_init(&ofcall_lock);
 #endif 
 #endif
 }
@@ -542,7 +543,7 @@
        }
 #ifdef SUN4V
 #if __arch64__
-       mutex_enter(&ofcall_mtx);
+       __cpu_simple_lock(&ofcall_lock);
        if (len > OFBOUNCE_MAXSIZE) 
                panic("OF_write(len = %d) exceedes bounce buffer\n", len);
        memcpy(ofbounce, addr, len);
@@ -564,7 +565,7 @@
        }
 #ifdef SUN4V
 #if __arch64__
-       mutex_exit(&ofcall_mtx);
+       __cpu_simple_unlock(&ofcall_lock);
 #endif
 #endif
        return act;



Home | Main Index | Thread Index | Old Index