Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha Rename the atomic operations to have generic ...



details:   https://anonhg.NetBSD.org/src/rev/0037fefee1ff
branches:  trunk
changeset: 486485:0037fefee1ff
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 23 05:12:53 2000 +0000

description:
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.

diffstat:

 sys/arch/alpha/alpha/cpu.c       |  12 +++---
 sys/arch/alpha/alpha/interrupt.c |   6 +-
 sys/arch/alpha/alpha/ipifuncs.c  |  10 ++--
 sys/arch/alpha/alpha/machdep.c   |   6 +-
 sys/arch/alpha/alpha/pmap.c      |  16 ++++----
 sys/arch/alpha/include/atomic.h  |  74 +++++++++++++++++++++------------------
 sys/arch/alpha/include/intr.h    |   4 +-
 sys/arch/alpha/include/pmap.h    |   4 +-
 sys/arch/alpha/include/types.h   |   3 +-
 9 files changed, 70 insertions(+), 65 deletions(-)

diffs (truncated from 454 to 300 lines):

diff -r f977cc532820 -r 0037fefee1ff sys/arch/alpha/alpha/cpu.c
--- a/sys/arch/alpha/alpha/cpu.c        Tue May 23 05:11:28 2000 +0000
+++ b/sys/arch/alpha/alpha/cpu.c        Tue May 23 05:12:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.43 2000/04/03 01:47:28 thorpej Exp $ */
+/* $NetBSD: cpu.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.43 2000/04/03 01:47:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -373,7 +373,7 @@
         */
        if (ma->ma_slot == hwrpb->rpb_primary_cpu_id) {
                ci->ci_flags |= CPUF_PRIMARY;
-               alpha_atomic_setbits_q(&cpus_running, (1UL << ma->ma_slot));
+               atomic_setbits_ulong(&cpus_running, (1UL << ma->ma_slot));
        }
 #endif /* MULTIPROCESSOR */
 }
@@ -523,7 +523,7 @@
        curpcb = ci->ci_idle_pcb_paddr;
 
        /* Mark the kernel pmap active on this processor. */
-       alpha_atomic_setbits_q(&pmap_kernel()->pm_cpus, cpumask);
+       atomic_setbits_ulong(&pmap_kernel()->pm_cpus, cpumask);
 
        /* Initialize trap vectors for this processor. */
        trap_init();
@@ -531,7 +531,7 @@
        /* Yahoo!  We're running kernel code!  Announce it! */
        printf("%s: processor ID %lu running\n", ci->ci_dev->dv_xname,
            alpha_pal_whami());
-       alpha_atomic_setbits_q(&cpus_running, cpumask);
+       atomic_setbits_ulong(&cpus_running, cpumask);
 
        /*
         * Lower interrupt level so that we can get IPIs.  Don't use
@@ -571,7 +571,7 @@
         */
        strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg);
        pcsp->pcs_iccb.iccb_rxlen = strlen(msg);
-       alpha_atomic_setbits_q(&hwrpb->rpb_rxrdy, cpumask);
+       atomic_setbits_ulong(&hwrpb->rpb_rxrdy, cpumask);
 
        /* Wait for the message to be received. */
        for (timeout = 10000; timeout != 0; timeout--) {
diff -r f977cc532820 -r 0037fefee1ff sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c  Tue May 23 05:11:28 2000 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c  Tue May 23 05:12:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.43 2000/02/29 21:42:54 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.43 2000/02/29 21:42:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,7 +93,7 @@
                }
 #endif
 
-               pending_ipis = alpha_atomic_loadlatch_q(&ci->ci_ipis, 0);
+               pending_ipis = atomic_loadlatch_ulong(&ci->ci_ipis, 0);
                for (bit = 0; bit < ALPHA_NIPIS; bit++)
                        if (pending_ipis & (1UL << bit))
                                (*ipifuncs[bit])();
diff -r f977cc532820 -r 0037fefee1ff sys/arch/alpha/alpha/ipifuncs.c
--- a/sys/arch/alpha/alpha/ipifuncs.c   Tue May 23 05:11:28 2000 +0000
+++ b/sys/arch/alpha/alpha/ipifuncs.c   Tue May 23 05:12:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.9 1999/12/02 01:09:11 thorpej Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.10 2000/05/23 05:12:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.9 1999/12/02 01:09:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.10 2000/05/23 05:12:54 thorpej Exp $");
 
 /*
  * Interprocessor interrupt handlers.
@@ -90,7 +90,7 @@
                panic("alpha_sched_ipi: bogus cpu_id");
 #endif
 
-       alpha_atomic_setbits_q(&cpu_info[cpu_id].ci_ipis, ipimask);
+       atomic_setbits_ulong(&cpu_info[cpu_id].ci_ipis, ipimask);
 printf("SENDING IPI TO %lu\n", cpu_id);
        alpha_pal_wripir(cpu_id);
 printf("IPI SENT\n");
@@ -122,7 +122,7 @@
        (void) splhigh();
 
        printf("%s: shutting down...\n", cpu_info[cpu_id].ci_dev->dv_xname);
-       alpha_atomic_clearbits_q(&cpus_running, (1UL << cpu_id));
+       atomic_clearbits_ulong(&cpus_running, (1UL << cpu_id));
 
        pcsp->pcs_flags &= ~(PCS_RC | PCS_HALT_REQ);
        pcsp->pcs_flags |= PCS_HALT_STAY_HALTED;
@@ -136,7 +136,7 @@
        u_long cpu_id = alpha_pal_whami();
 
        /* If we're doing a TBIA, we don't need to do a TBIAP or a SHOOTDOWN. */
-       alpha_atomic_clearbits_q(&cpu_info[cpu_id].ci_ipis,
+       atomic_clearbits_ulong(&cpu_info[cpu_id].ci_ipis,
            ALPHA_IPI_TBIAP|ALPHA_IPI_SHOOTDOWN);
 
        ALPHA_TBIA();
diff -r f977cc532820 -r 0037fefee1ff sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Tue May 23 05:11:28 2000 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Tue May 23 05:12:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.205 2000/05/22 17:13:53 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.206 2000/05/23 05:12:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.205 2000/05/22 17:13:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.206 2000/05/23 05:12:54 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1840,7 +1840,7 @@
 {
        u_int64_t n;
 
-       while ((n = alpha_atomic_loadlatch_q(&ssir, 0)) != 0) {
+       while ((n = atomic_loadlatch_ulong(&ssir, 0)) != 0) {
 #define        COUNT_SOFT      uvmexp.softs++
 
 #define        DO_SIR(bit, fn)                                                 \
diff -r f977cc532820 -r 0037fefee1ff sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c       Tue May 23 05:11:28 2000 +0000
+++ b/sys/arch/alpha/alpha/pmap.c       Tue May 23 05:12:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.131 2000/04/10 00:48:35 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.132 2000/05/23 05:12:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -154,7 +154,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.131 2000/04/10 00:48:35 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.132 2000/05/23 05:12:54 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -737,8 +737,8 @@
  *
  *     Increment or decrement a pmap statistic.
  */
-#define        PMAP_STAT_INCR(s, v)    alpha_atomic_add_q((unsigned long *)(&(s)), (v))
-#define        PMAP_STAT_DECR(s, v)    alpha_atomic_sub_q((unsigned long *)(&(s)), (v))
+#define        PMAP_STAT_INCR(s, v)    atomic_add_ulong((unsigned long *)(&(s)), (v))
+#define        PMAP_STAT_DECR(s, v)    atomic_sub_ulong((unsigned long *)(&(s)), (v))
 
 /*
  * pmap_bootstrap:
@@ -980,7 +980,7 @@
        /*
         * Mark the kernel pmap `active' on this processor.
         */
-       alpha_atomic_setbits_q(&pmap_kernel()->pm_cpus,
+       atomic_setbits_ulong(&pmap_kernel()->pm_cpus,
            (1UL << cpu_number()));
 }
 
@@ -2275,7 +2275,7 @@
        /*
         * Mark the pmap in use by this processor.
         */
-       alpha_atomic_setbits_q(&pmap->pm_cpus, (1UL << cpu_id));
+       atomic_setbits_ulong(&pmap->pm_cpus, (1UL << cpu_id));
 
        /*
         * Move the pmap to the end of the LRU list.
@@ -2321,7 +2321,7 @@
        /*
         * Mark the pmap no longer in use by this processor.
         */
-       alpha_atomic_clearbits_q(&pmap->pm_cpus, (1UL << cpu_number()));
+       atomic_clearbits_ulong(&pmap->pm_cpus, (1UL << cpu_number()));
 }
 
 /*
@@ -3983,7 +3983,7 @@
         * Have a new ASN, so there's no need to sync the I-stream
         * on the way back out to userspace.
         */
-       alpha_atomic_clearbits_q(&pmap->pm_needisync, (1UL << cpu_id));
+       atomic_clearbits_ulong(&pmap->pm_needisync, (1UL << cpu_id));
 #endif
 }
 
diff -r f977cc532820 -r 0037fefee1ff sys/arch/alpha/include/atomic.h
--- a/sys/arch/alpha/include/atomic.h   Tue May 23 05:11:28 2000 +0000
+++ b/sys/arch/alpha/include/atomic.h   Tue May 23 05:12:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic.h,v 1.3 2000/03/05 18:46:14 thorpej Exp $ */
+/* $NetBSD: atomic.h,v 1.4 2000/05/23 05:12:55 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -44,32 +44,36 @@
 #ifndef _ALPHA_ATOMIC_H_
 #define        _ALPHA_ATOMIC_H_
 
-static __inline void alpha_atomic_setbits_q __P((__volatile unsigned long *,
-       unsigned long)) __attribute__((__unused__));
-static __inline void alpha_atomic_clearbits_q __P((__volatile unsigned long *,
-       unsigned long)) __attribute__((__unused__));
+static __inline void atomic_setbits_ulong
+       __P((__volatile unsigned long *, unsigned long))
+       __attribute__((__unused__));
+static __inline void atomic_clearbits_ulong
+       __P((__volatile unsigned long *, unsigned long))
+       __attribute__((__unused__));
 
-static __inline void alpha_atomic_add_q __P((__volatile unsigned long *,
-       unsigned long)) __attribute__((__unused__));
-static __inline void alpha_atomic_sub_q __P((__volatile unsigned long *,
-       unsigned long)) __attribute__((__unused__));
+static __inline void atomic_add_ulong
+       __P((__volatile unsigned long *, unsigned long))
+       __attribute__((__unused__));
+static __inline void atomic_sub_ulong
+       __P((__volatile unsigned long *, unsigned long))
+       __attribute__((__unused__));
 
-static __inline unsigned long alpha_atomic_loadlatch_q
+static __inline unsigned long atomic_loadlatch_ulong
        __P((__volatile unsigned long *, unsigned long))
        __attribute__((__unused__));
 
 /*
- * alpha_atomic_setbits_q:
+ * atomic_setbits_ulong:
  *
- *     Atomically set bits in a quadword.
+ *     Atomically set bits in a `unsigned long'.
  */
 static __inline void
-alpha_atomic_setbits_q(__volatile unsigned long *ulp, unsigned long v)
+atomic_setbits_ulong(__volatile unsigned long *ulp, unsigned long v)
 {
        unsigned long t0;
 
        __asm __volatile(
-               "# BEGIN alpha_atomic_setbits_q\n"
+               "# BEGIN atomic_setbits_ulong\n"
                "1:     ldq_l   %0, %3          \n"
                "       or      %0, %2, %0      \n"
                "       stq_c   %0, %1          \n"
@@ -78,23 +82,23 @@
                "       br      3f              \n"
                "2:     br      1b              \n"
                "3:                             \n"
-               "       # END alpha_atomic_setbits_q"
+               "       # END atomic_setbits_ulong"
                : "=r" (t0), "=m" (*ulp)
                : "r" (v), "1" (*ulp));
 }
 
 /*
- * alpha_atomic_clearbits_q:
+ * atomic_clearbits_ulong:
  *
- *     Atomically clear bits in a quadword.
+ *     Atomically clear bits in a `unsigned long'.
  */
 static __inline void
-alpha_atomic_clearbits_q(__volatile unsigned long *ulp, unsigned long v)
+atomic_clearbits_ulong(__volatile unsigned long *ulp, unsigned long v)
 {
        unsigned long t0;
 



Home | Main Index | Thread Index | Old Index