Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/net/lib/libshmif Change bus header a little: reserv...



details:   https://anonhg.NetBSD.org/src/rev/f53ab87b891d
branches:  trunk
changeset: 757023:f53ab87b891d
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Aug 11 10:30:30 2010 +0000

description:
Change bus header a little: reserve only 32bits for the lock and
use 32bit atomic ops to handle it.  Begin data from 0x10 instead
of 0x14.

diffstat:

 sys/rump/net/lib/libshmif/if_shmem.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (53 lines):

diff -r 822b9a7862a6 -r f53ab87b891d sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c      Wed Aug 11 10:25:59 2010 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c      Wed Aug 11 10:30:30 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_shmem.c,v 1.13 2010/08/10 18:17:12 pooka Exp $      */
+/*     $NetBSD: if_shmem.c,v 1.14 2010/08/11 10:30:30 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.13 2010/08/10 18:17:12 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.14 2010/08/11 10:30:30 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -76,11 +76,11 @@
        uint32_t sc_nextpacket;
        uint32_t sc_prevgen;
 };
-#define IFMEM_LOCK             (0)
-#define IFMEM_GENERATION       (8)
-#define IFMEM_LASTPACKET       (12)
-#define IFMEM_WAKEUP           (16)
-#define IFMEM_DATA             (20)
+#define IFMEM_LOCK             (0x00)
+#define IFMEM_GENERATION       (0x04)
+#define IFMEM_LASTPACKET       (0x08)
+#define IFMEM_WAKEUP           (0x0c)
+#define IFMEM_DATA             (0x10)
 
 #define BUSCTRL_ATOFF(sc, off) ((uint32_t *)(sc->sc_busmem+(off)))
 
@@ -102,7 +102,7 @@
 lockbus(struct shmif_sc *sc)
 {
 
-       while (atomic_cas_uint((void *)sc->sc_busmem,
+       while (atomic_cas_32((uint32_t *)sc->sc_busmem,
            LOCK_UNLOCKED, LOCK_LOCKED) == LOCK_LOCKED)
                continue;
        membar_enter();
@@ -114,7 +114,7 @@
        unsigned int old;
 
        membar_exit();
-       old = atomic_swap_uint((void *)sc->sc_busmem, LOCK_UNLOCKED);
+       old = atomic_swap_32((uint32_t *)sc->sc_busmem, LOCK_UNLOCKED);
        KASSERT(old == LOCK_LOCKED);
 }
 



Home | Main Index | Thread Index | Old Index