summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2008-03-10 14:01:35 +0000
committerad <ad@NetBSD.org>2008-03-10 14:01:35 +0000
commited4dfedcd6fef60c21ee040edfcff21d15fec988 (patch)
tree2c4e05cad4db511abcf0c916c0c072c282648325 /sys
parentd247e228e67093a95f9034e25afe90d630db4fef (diff)
Finish moving alpha over to the MI atomic ops.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/pmap.c8
-rw-r--r--sys/arch/alpha/common/shared_intr.c10
-rw-r--r--sys/arch/alpha/include/Makefile4
-rw-r--r--sys/arch/alpha/include/atomic.h179
-rw-r--r--sys/arch/alpha/include/intr.h4
-rw-r--r--sys/arch/alpha/include/pmap.h7
6 files changed, 16 insertions, 196 deletions
diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c
index 80ce5520534..1a8d3189458 100644
--- a/sys/arch/alpha/alpha/pmap.c
+++ b/sys/arch/alpha/alpha/pmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.234 2008/03/10 13:37:38 ad Exp $ */
+/* $NetBSD: pmap.c,v 1.235 2008/03/10 14:01:35 ad Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc.
@@ -147,7 +147,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.234 2008/03/10 13:37:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.235 2008/03/10 14:01:35 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -761,8 +761,8 @@ do { \
*
* Increment or decrement a pmap statistic.
*/
-#define PMAP_STAT_INCR(s, v) atomic_add_ulong((unsigned long *)(&(s)), (v))
-#define PMAP_STAT_DECR(s, v) atomic_add_ulong((unsigned long *)(&(s)), -(v))
+#define PMAP_STAT_INCR(s, v) atomic_add_long((unsigned long *)(&(s)), (v))
+#define PMAP_STAT_DECR(s, v) atomic_add_long((unsigned long *)(&(s)), -(v))
/*
* pmap_bootstrap:
diff --git a/sys/arch/alpha/common/shared_intr.c b/sys/arch/alpha/common/shared_intr.c
index 46a6f2faceb..3e74236c716 100644
--- a/sys/arch/alpha/common/shared_intr.c
+++ b/sys/arch/alpha/common/shared_intr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: shared_intr.c,v 1.18 2005/12/11 12:16:16 christos Exp $ */
+/* $NetBSD: shared_intr.c,v 1.19 2008/03/10 14:01:35 ad Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.18 2005/12/11 12:16:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.19 2008/03/10 14:01:35 ad Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -41,8 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.18 2005/12/11 12:16:16 christos Ex
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/queue.h>
-
-#include <machine/intr.h>
+#include <sys/atomic.h>
+#include <sys/intr.h>
static const char *intr_typename __P((int));
@@ -102,7 +102,7 @@ alpha_shared_intr_dispatch(struct alpha_shared_intr *intr, unsigned int num)
struct alpha_shared_intrhand *ih;
int rv, handled;
- atomic_add_ulong(&intr[num].intr_evcnt.ev_count, 1);
+ atomic_add_long(&intr[num].intr_evcnt.ev_count, 1);
ih = intr[num].intr_q.tqh_first;
handled = 0;
diff --git a/sys/arch/alpha/include/Makefile b/sys/arch/alpha/include/Makefile
index 2174ac2d1a2..26190824de5 100644
--- a/sys/arch/alpha/include/Makefile
+++ b/sys/arch/alpha/include/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.28 2007/02/09 21:55:01 ad Exp $
+# $NetBSD: Makefile,v 1.29 2008/03/10 14:01:35 ad Exp $
INCSDIR= /usr/include/alpha
-INCS= alpha_cpu.h ansi.h aout_machdep.h asm.h atomic.h autoconf.h \
+INCS= alpha_cpu.h ansi.h aout_machdep.h asm.h autoconf.h \
bswap.h bus.h bwx.h \
cdefs.h cfbreg.h cpu.h cpuconf.h \
disklabel.h \
diff --git a/sys/arch/alpha/include/atomic.h b/sys/arch/alpha/include/atomic.h
deleted file mode 100644
index bc156bbb124..00000000000
--- a/sys/arch/alpha/include/atomic.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $NetBSD: atomic.h,v 1.9 2005/12/28 19:09:29 perry Exp $ */
-
-/*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
-/*
- * Misc. `atomic' operations.
- */
-
-#ifndef _ALPHA_ATOMIC_H_
-#define _ALPHA_ATOMIC_H_
-
-/*
- * atomic_setbits_ulong:
- *
- * Atomically set bits in a `unsigned long'.
- */
-static __inline void
-atomic_setbits_ulong(volatile unsigned long *ulp, unsigned long v)
-{
- unsigned long t0;
-
- __asm volatile(
- "# BEGIN atomic_setbits_ulong\n"
- "1: ldq_l %0, %3 \n"
- " or %0, %2, %0 \n"
- " stq_c %0, %1 \n"
- " beq %0, 2f \n"
- " mb \n"
- " br 3f \n"
- "2: br 1b \n"
- "3: \n"
- " # END atomic_setbits_ulong"
- : "=&r" (t0), "=m" (*ulp)
- : "r" (v), "m" (*ulp)
- : "memory");
-}
-
-/*
- * atomic_clearbits_ulong:
- *
- * Atomically clear bits in a `unsigned long'.
- */
-static __inline void
-atomic_clearbits_ulong(volatile unsigned long *ulp, unsigned long v)
-{
- unsigned long t0;
-
- __asm volatile(
- "# BEGIN atomic_clearbits_ulong\n"
- "1: ldq_l %0, %3 \n"
- " and %0, %2, %0 \n"
- " stq_c %0, %1 \n"
- " beq %0, 2f \n"
- " mb \n"
- " br 3f \n"
- "2: br 1b \n"
- "3: \n"
- " # END atomic_clearbits_ulong"
- : "=&r" (t0), "=m" (*ulp)
- : "r" (~v), "m" (*ulp)
- : "memory");
-}
-
-/*
- * atomic_add_ulong:
- *
- * Atomically add a value to a `unsigned long'.
- */
-static __inline void
-atomic_add_ulong(volatile unsigned long *ulp, unsigned long v)
-{
- unsigned long t0;
-
- __asm volatile(
- "# BEGIN atomic_add_ulong\n"
- "1: ldq_l %0, %3 \n"
- " addq %0, %2, %0 \n"
- " stq_c %0, %1 \n"
- " beq %0, 2f \n"
- " mb \n"
- " br 3f \n"
- "2: br 1b \n"
- "3: \n"
- " # END atomic_add_ulong"
- : "=&r" (t0), "=m" (*ulp)
- : "r" (v), "m" (*ulp)
- : "memory");
-}
-
-/*
- * atomic_sub_ulong:
- *
- * Atomically subtract a value from a `unsigned long'.
- */
-static __inline void
-atomic_sub_ulong(volatile unsigned long *ulp, unsigned long v)
-{
- unsigned long t0;
-
- __asm volatile(
- "# BEGIN atomic_sub_ulong\n"
- "1: ldq_l %0, %3 \n"
- " subq %0, %2, %0 \n"
- " stq_c %0, %1 \n"
- " beq %0, 2f \n"
- " mb \n"
- " br 3f \n"
- "2: br 1b \n"
- "3: \n"
- " # END atomic_sub_ulong"
- : "=&r" (t0), "=m" (*ulp)
- : "r" (v), "m" (*ulp)
- : "memory");
-}
-
-/*
- * atomic_loadlatch_ulong:
- *
- * Atomically load and latch a `unsigned long' value.
- */
-static __inline unsigned long
-atomic_loadlatch_ulong(volatile unsigned long *ulp, unsigned long v)
-{
- unsigned long t0, v0;
-
- __asm volatile(
- "# BEGIN atomic_loadlatch_ulong\n"
- "1: mov %3, %0 \n"
- " ldq_l %1, %4 \n"
- " stq_c %0, %2 \n"
- " beq %0, 2f \n"
- " mb \n"
- " br 3f \n"
- "2: br 1b \n"
- "3: \n"
- " # END atomic_loadlatch_ulong"
- : "=&r" (t0), "=r" (v0), "=m" (*ulp)
- : "r" (v), "m" (*ulp)
- : "memory");
-
- return (v0);
-}
-
-#endif /* _ALPHA_ATOMIC_H_ */
diff --git a/sys/arch/alpha/include/intr.h b/sys/arch/alpha/include/intr.h
index b5fb0178dae..4be43151124 100644
--- a/sys/arch/alpha/include/intr.h
+++ b/sys/arch/alpha/include/intr.h
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.63 2008/01/04 21:47:16 ad Exp $ */
+/* $NetBSD: intr.h,v 1.64 2008/03/10 14:01:36 ad Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -69,8 +69,6 @@
#include <sys/evcnt.h>
-#include <machine/atomic.h>
-
/*
* The Alpha System Control Block. This is 8k long, and you get
* 16 bytes per vector (i.e. the vector numbers are spaced 16
diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h
index 3ee1d10eca2..d8f671e2bce 100644
--- a/sys/arch/alpha/include/pmap.h
+++ b/sys/arch/alpha/include/pmap.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.69 2008/01/02 11:48:21 ad Exp $ */
+/* $NetBSD: pmap.h,v 1.70 2008/03/10 14:01:36 ad Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -189,6 +189,8 @@ typedef struct pv_entry {
#ifdef _KERNEL
+#include <sys/atomic.h>
+
#ifndef _LKM
#include "opt_dec_kn8ae.h" /* XXX */
@@ -359,8 +361,7 @@ do { \
u_long cpu_mask = (1UL << cpu_number()); \
\
if ((pmap)->pm_needisync & cpu_mask) { \
- atomic_clearbits_ulong(&(pmap)->pm_needisync, \
- cpu_mask); \
+ atomic_and_ulong(&(pmap)->pm_needisync, ~cpu_mask); \
alpha_pal_imb(); \
} \
} while (0)