Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/vchiq/dist/interface/compat Do a better job...



details:   https://anonhg.NetBSD.org/src/rev/e010df425b0f
branches:  trunk
changeset: 789733:e010df425b0f
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Sep 05 13:56:12 2013 +0000

description:
Do a better job of matching some linux APIs. Still not quite working.

diffstat:

 sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h |  38 ++++------------
 1 files changed, 10 insertions(+), 28 deletions(-)

diffs (71 lines):

diff -r 3662896ce871 -r e010df425b0f sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h
--- a/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h   Thu Sep 05 12:23:07 2013 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h   Thu Sep 05 13:56:12 2013 +0000
@@ -96,7 +96,7 @@
 typedef volatile unsigned int atomic_t;
 
 #define atomic_set(p, v)       (*(p) = (v))
-#define atomic_read(p)         (*(p))
+#define atomic_read(p)         (*(volatile int *)(p))
 #define atomic_inc(p)          atomic_inc_uint(p)
 #define atomic_dec(p)          atomic_dec_uint(p)
 #define atomic_dec_and_test(p) (atomic_dec_uint_nv(p) == 0)
@@ -125,15 +125,6 @@
 #define spin_lock_destroy(lock)        mutex_destroy(lock)
 #define spin_lock(lock)                mutex_spin_enter(lock)
 #define spin_unlock(lock)      mutex_spin_exit(lock)
-#define spin_lock_bh(lock)     spin_lock(lock)
-#define spin_unlock_bh(lock)   spin_unlock(lock)
-#define spin_lock_irqsave(lock, flags)                 \
-       do {                                            \
-               spin_lock(lock);                        \
-               (void) &(flags);                        \
-       } while (0)
-#define spin_unlock_irqrestore(lock, flags)            \
-       spin_unlock(lock)
 
 /*
  * Mutex API
@@ -151,25 +142,16 @@
 /*
  * Rwlock API
  */
-typedef krwlock_t rwlock_t;
+typedef kmutex_t rwlock_t;
 
-/*
- * NB: Need to initialize these at attach time!
- */
-#define DEFINE_RWLOCK(name)    rwlock_t name
-#define rwlock_init(rwlock)    rw_init(rwlock)
-#define read_lock(rwlock)      rw_enter(rwlock, RW_READER)
-#define read_unlock(rwlock)    rw_exit(rwlock)
+#define DEFINE_RWLOCK(name)    kmutex_t name
 
-#define write_lock(rwlock)     rw_enter(rwlock, RW_WRITER)
-#define write_unlock(rwlock)   rw_exit(rwlock)
-#define write_lock_irqsave(rwlock, flags)              \
-       do {                                            \
-               write_lock(rwlock);                     \
-               (void) &(flags);                        \
-       } while (0)
-#define write_unlock_irqrestore(rwlock, flags)         \
-       write_unlock(rwlock)
+#define rwlock_init(rwlock)    mutex_init(rwlock, MUTEX_DEFAULT, IPL_VM)
+#define read_lock(rwlock)      mutex_spin_enter(rwlock)
+#define read_unlock(rwlock)    mutex_spin_exit(rwlock)
+
+#define write_lock(rwlock)     mutex_spin_enter(rwlock)
+#define write_unlock(rwlock)   mutex_spin_exit(rwlock)
 
 #define read_lock_bh(rwlock)   read_lock(rwlock)
 #define read_unlock_bh(rwlock) read_unlock(rwlock)
@@ -371,7 +353,7 @@
 #define time_before(a, b)      time_after((b), (a))
 
 /*
- * kthread API (we use proc)
+ * kthread API (we use lwp)
  */
 typedef lwp_t * VCHIQ_THREAD_T;
 



Home | Main Index | Thread Index | Old Index