Include OCTEON support for syncw and saa/saad (Store Atomic Add).

This commit is contained in:
matt 2015-06-01 23:16:54 +00:00
parent 2d2997316d
commit ac748598de
7 changed files with 71 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_add.S,v 1.4 2012/03/14 16:50:34 christos Exp $ */
/* $NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <machine/asm.h>
#include "atomic_op_asm.h"
RCSID("$NetBSD: atomic_add.S,v 1.4 2012/03/14 16:50:34 christos Exp $")
RCSID("$NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
.text
.set noreorder
@ -46,12 +46,16 @@ RCSID("$NetBSD: atomic_add.S,v 1.4 2012/03/14 16:50:34 christos Exp $")
LEAF(_atomic_add_32)
#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
saa a1, (a0)
#else
1: INT_LL t0, 0(a0)
nop
INT_ADDU t0, a1
INT_SC t0, 0(a0)
beq t0, zero, 1b
nop
#endif
j ra
nop
END(_atomic_add_32)
@ -72,12 +76,16 @@ ATOMIC_OP_ALIAS(atomic_add_32_nv, _atomic_add_32_nv)
#if !defined(__mips_o32)
LEAF(_atomic_add_64)
#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
saad a1, (a0)
#else
1: REG_LL t0, 0(a0)
nop
REG_ADDU t0, a1
REG_SC t0, 0(a0)
beq t0, zero, 1b
nop
#endif
j ra
nop
END(_atomic_add_64)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_cas.S,v 1.3 2012/03/14 16:50:34 christos Exp $ */
/* $NetBSD: atomic_cas.S,v 1.4 2015/06/01 23:16:54 matt Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <machine/asm.h>
#include "atomic_op_asm.h"
RCSID("$NetBSD: atomic_cas.S,v 1.3 2012/03/14 16:50:34 christos Exp $")
RCSID("$NetBSD: atomic_cas.S,v 1.4 2015/06/01 23:16:54 matt Exp $")
.text
.set noat
@ -46,6 +46,9 @@ LEAF(_atomic_cas_32)
beq t0, zero, 1b
nop
move v0, a1
#ifdef _MIPS_ARCH_OCTEONP
syncw
#endif
2:
j ra
nop
@ -63,6 +66,9 @@ LEAF(_atomic_cas_64)
beq t0, zero, 1b
nop
move v0, a1
#ifdef _MIPS_ARCH_OCTEONP
syncw
#endif
2:
j ra
nop

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_dec.S,v 1.4 2012/03/14 16:50:34 christos Exp $ */
/* $NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <machine/asm.h>
#include "atomic_op_asm.h"
RCSID("$NetBSD: atomic_dec.S,v 1.4 2012/03/14 16:50:34 christos Exp $")
RCSID("$NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
.text
.set noreorder
@ -45,12 +45,17 @@ RCSID("$NetBSD: atomic_dec.S,v 1.4 2012/03/14 16:50:34 christos Exp $")
#endif /* _KERNEL_OPT */
LEAF(_atomic_dec_32)
#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
li t0, -1
saa t0, (a0)
#else
1: INT_LL t0, 0(a0)
nop
INT_ADDU t0, -1
INT_SC t0, 0(a0)
beq t0, zero, 1b
nop
#endif
j ra
nop
END(_atomic_dec_32)
@ -71,12 +76,17 @@ ATOMIC_OP_ALIAS(atomic_dec_32_nv, _atomic_dec_32_nv)
#if !defined(__mips_o32)
LEAF(_atomic_dec_64)
#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
li t0, -1
saad t0, (a0)
#else
1: REG_LL t0, 0(a0)
nop
REG_ADDU t0, -1
REG_SC t0, 0(a0)
beq t0, zero, 1b
nop
#endif
j ra
nop
END(_atomic_dec_64)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_inc.S,v 1.4 2012/03/14 16:50:34 christos Exp $ */
/* $NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <machine/asm.h>
#include "atomic_op_asm.h"
RCSID("$NetBSD: atomic_inc.S,v 1.4 2012/03/14 16:50:34 christos Exp $")
RCSID("$NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
.text
.set noreorder
@ -46,12 +46,17 @@ RCSID("$NetBSD: atomic_inc.S,v 1.4 2012/03/14 16:50:34 christos Exp $")
LEAF(_atomic_inc_32)
#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
li t0, 1
saa t0, (a0)
#else
1: INT_LL t0, 0(a0)
nop
INT_ADDU t0, 1
INT_SC t0, 0(a0)
beq t0, zero, 1b
nop
#endif
j ra
nop
END(_atomic_inc_32)
@ -72,12 +77,17 @@ ATOMIC_OP_ALIAS(atomic_inc_32_nv, _atomic_inc_32_nv)
#if !defined(__mips_o32)
LEAF(_atomic_inc_64)
#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
li t0, 1
saad t0, (a0)
#else
1: REG_LL t0, 0(a0)
nop
REG_ADDU t0, 1
REG_SC t0, 0(a0)
beq t0, zero, 1b
nop
#endif
j ra
nop
END(_atomic_inc_64)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_op_asm.h,v 1.2 2008/04/28 20:22:52 martin Exp $ */
/* $NetBSD: atomic_op_asm.h,v 1.3 2015/06/01 23:16:54 matt Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -44,4 +44,10 @@
#endif /* _KERNEL */
#ifdef __OCTEON__
#define SYNCW syncw
#else
#define SYNCW nop
#endif
#endif /* _ATOMIC_OP_ASM_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_swap.S,v 1.4 2012/03/14 16:50:34 christos Exp $ */
/* $NetBSD: atomic_swap.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <machine/asm.h>
#include "atomic_op_asm.h"
RCSID("$NetBSD: atomic_swap.S,v 1.4 2012/03/14 16:50:34 christos Exp $")
RCSID("$NetBSD: atomic_swap.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
.text
.set noreorder
@ -54,7 +54,7 @@ LEAF(_atomic_swap_32)
nop
2:
j ra
nop
SYNCW
END(_atomic_swap_32)
ATOMIC_OP_ALIAS(atomic_swap_32, _atomic_swap_32)
@ -68,7 +68,7 @@ LEAF(_atomic_swap_64)
nop
2:
j ra
nop
SYNCW
END(_atomic_swap_64)
ATOMIC_OP_ALIAS(atomic_swap_64, _atomic_swap_64)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: membar_ops.S,v 1.5 2012/08/03 06:06:44 matt Exp $ */
/* $NetBSD: membar_ops.S,v 1.6 2015/06/01 23:16:54 matt Exp $ */
/*-
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@ -61,18 +61,35 @@ LEAF(_membar_sync)
#endif
END(_membar_sync)
#ifdef __OCTEON__
LEAF(_membar_producer)
j ra
syncw
END(_membar_producer)
#endif
#ifdef _KERNEL
STRONG_ALIAS(mb_read, _membar_sync)
#ifdef __OCTEON__
STRONG_ALIAS(mb_write, _membar_producer)
#else
STRONG_ALIAS(mb_write, _membar_sync)
#endif
STRONG_ALIAS(mb_memory, _membar_sync)
#endif
ATOMIC_OP_ALIAS(membar_sync,_membar_sync)
ATOMIC_OP_ALIAS(membar_enter,_membar_sync)
STRONG_ALIAS(_membar_enter,_membar_sync)
#ifdef __OCTEON__
ATOMIC_OP_ALIAS(membar_exit,_membar_producer)
STRONG_ALIAS(_membar_exit,_membar_producer)
STRONG_ALIAS(membar_producer,_membar_producer)
#else
ATOMIC_OP_ALIAS(membar_exit,_membar_sync)
STRONG_ALIAS(_membar_exit,_membar_sync)
ATOMIC_OP_ALIAS(membar_producer,_membar_sync)
STRONG_ALIAS(_membar_producer,_membar_sync)
#endif
ATOMIC_OP_ALIAS(membar_consumer,_membar_sync)
STRONG_ALIAS(_membar_consumer,_membar_sync)