1129198Scognet/* $NetBSD: atomic.h,v 1.1 2002/10/19 12:22:34 bsh Exp $ */
2129198Scognet
3139735Simp/*-
4129198Scognet * Copyright (C) 2003-2004 Olivier Houchard
5129198Scognet * Copyright (C) 1994-1997 Mark Brinicombe
6129198Scognet * Copyright (C) 1994 Brini
7129198Scognet * All rights reserved.
8129198Scognet *
9129198Scognet * This code is derived from software written for Brini by Mark Brinicombe
10129198Scognet *
11129198Scognet * Redistribution and use in source and binary forms, with or without
12129198Scognet * modification, are permitted provided that the following conditions
13129198Scognet * are met:
14129198Scognet * 1. Redistributions of source code must retain the above copyright
15129198Scognet *    notice, this list of conditions and the following disclaimer.
16129198Scognet * 2. Redistributions in binary form must reproduce the above copyright
17129198Scognet *    notice, this list of conditions and the following disclaimer in the
18129198Scognet *    documentation and/or other materials provided with the distribution.
19129198Scognet * 3. All advertising materials mentioning features or use of this software
20129198Scognet *    must display the following acknowledgement:
21129198Scognet *	This product includes software developed by Brini.
22129198Scognet * 4. The name of Brini may not be used to endorse or promote products
23129198Scognet *    derived from this software without specific prior written permission.
24129198Scognet *
25129198Scognet * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR
26129198Scognet * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27129198Scognet * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28129198Scognet * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29129198Scognet * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30129198Scognet * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
31129198Scognet * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32129198Scognet * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33129198Scognet * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
34129198Scognet * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35129198Scognet *
36129198Scognet * $FreeBSD: stable/11/sys/arm/include/atomic.h 327195 2017-12-26 10:07:17Z kib $
37129198Scognet */
38129198Scognet
39129198Scognet#ifndef	_MACHINE_ATOMIC_H_
40129198Scognet#define	_MACHINE_ATOMIC_H_
41129198Scognet
42327195Skib#include <sys/atomic_common.h>
43327195Skib
44271398Sandrew#include <machine/armreg.h>
45129198Scognet
46175982Sraj#ifndef _KERNEL
47175982Sraj#include <machine/sysarch.h>
48175982Sraj#endif
49175982Sraj
50285631Sandrew#if __ARM_ARCH >= 6
51285631Sandrew#include <machine/atomic-v6.h>
52239268Sgonzo#else /* < armv6 */
53285631Sandrew#include <machine/atomic-v4.h>
54239268Sgonzo#endif /* Arch >= v6 */
55239268Sgonzo
56279543Sian#define atomic_clear_ptr		atomic_clear_32
57321039Smarkj#define atomic_clear_acq_ptr		atomic_clear_acq_32
58321039Smarkj#define atomic_clear_rel_ptr		atomic_clear_rel_32
59279543Sian#define atomic_set_ptr			atomic_set_32
60321039Smarkj#define atomic_set_acq_ptr		atomic_set_acq_32
61321039Smarkj#define atomic_set_rel_ptr		atomic_set_rel_32
62315371Smjg#define atomic_fcmpset_ptr		atomic_fcmpset_32
63315371Smjg#define atomic_fcmpset_rel_ptr		atomic_fcmpset_rel_32
64315371Smjg#define atomic_fcmpset_acq_ptr		atomic_fcmpset_acq_32
65279543Sian#define atomic_cmpset_ptr		atomic_cmpset_32
66321039Smarkj#define atomic_cmpset_acq_ptr		atomic_cmpset_acq_32
67279543Sian#define atomic_cmpset_rel_ptr		atomic_cmpset_rel_32
68321039Smarkj#define atomic_load_acq_ptr		atomic_load_acq_32
69279543Sian#define atomic_store_rel_ptr		atomic_store_rel_32
70321039Smarkj#define atomic_swap_ptr			atomic_swap_32
71321039Smarkj#define atomic_readandclear_ptr		atomic_readandclear_32
72165786Sticso
73165786Sticso#define atomic_add_int			atomic_add_32
74239268Sgonzo#define atomic_add_acq_int		atomic_add_acq_32
75239268Sgonzo#define atomic_add_rel_int		atomic_add_rel_32
76165786Sticso#define atomic_subtract_int		atomic_subtract_32
77239268Sgonzo#define atomic_subtract_acq_int		atomic_subtract_acq_32
78239268Sgonzo#define atomic_subtract_rel_int		atomic_subtract_rel_32
79165786Sticso#define atomic_clear_int		atomic_clear_32
80239268Sgonzo#define atomic_clear_acq_int		atomic_clear_acq_32
81239268Sgonzo#define atomic_clear_rel_int		atomic_clear_rel_32
82137222Scognet#define atomic_set_int			atomic_set_32
83239268Sgonzo#define atomic_set_acq_int		atomic_set_acq_32
84239268Sgonzo#define atomic_set_rel_int		atomic_set_rel_32
85315371Smjg#define atomic_fcmpset_int		atomic_fcmpset_32
86315371Smjg#define atomic_fcmpset_acq_int		atomic_fcmpset_acq_32
87315371Smjg#define atomic_fcmpset_rel_int		atomic_fcmpset_rel_32
88165786Sticso#define atomic_cmpset_int		atomic_cmpset_32
89239268Sgonzo#define atomic_cmpset_acq_int		atomic_cmpset_acq_32
90239268Sgonzo#define atomic_cmpset_rel_int		atomic_cmpset_rel_32
91165786Sticso#define atomic_fetchadd_int		atomic_fetchadd_32
92137222Scognet#define atomic_readandclear_int		atomic_readandclear_32
93239268Sgonzo#define atomic_load_acq_int		atomic_load_acq_32
94239268Sgonzo#define atomic_store_rel_int		atomic_store_rel_32
95291426Smmel#define atomic_swap_int			atomic_swap_32
96165786Sticso
97129198Scognet#endif /* _MACHINE_ATOMIC_H_ */
98