Prepend `cpu_' to the machine-dependent atomic locking primitivies.

This commit is contained in:
thorpej 1999-07-27 21:45:39 +00:00
parent d17dfae658
commit c1ee8f0a8c
4 changed files with 39 additions and 52 deletions

View File

@ -1,7 +1,7 @@
/* $NetBSD: lock_machdep.c,v 1.1 1998/09/24 22:32:35 thorpej Exp $ */
/* $NetBSD: lock_machdep.c,v 1.2 1999/07/27 21:45:41 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: lock_machdep.c,v 1.1 1998/09/24 22:32:35 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: lock_machdep.c,v 1.2 1999/07/27 21:45:41 thorpej Exp $");
/*
* Machine-dependent spin lock operations.
@ -51,40 +51,42 @@ __KERNEL_RCSID(0, "$NetBSD: lock_machdep.c,v 1.1 1998/09/24 22:32:35 thorpej Exp
#include <machine/alpha_cpu.h>
void
simple_lock_init(alp)
cpu_simple_lock_init(alp)
__volatile struct simplelock *alp;
{
alp->lock_data = 0;
alp->lock_data = SIMPLELOCK_UNLOCKED;
alpha_mb();
}
void
simple_lock(alp)
cpu_simple_lock(alp)
__volatile struct simplelock *alp;
{
/* atomic operation performs barrier */
while (alpha_atomic_testset_l((unsigned int *)&alp->lock_data, 1) == 0)
while (alpha_atomic_testset_l((unsigned int *)&alp->lock_data,
SIMPLELOCK_LOCKED) == 0)
/* spin */ ;
}
int
simple_lock_try(alp)
cpu_simple_lock_try(alp)
__volatile struct simplelock *alp;
{
/* atomic operation performs barrier */
if (alpha_atomic_testset_l((unsigned int *)&alp->lock_data, 1))
if (alpha_atomic_testset_l((unsigned int *)&alp->lock_data,
SIMPLELOCK_LOCKED))
return (1);
return (0);
}
void
simple_unlock(alp)
cpu_simple_unlock(alp)
__volatile struct simplelock *alp;
{
alp->lock_data = 0;
alp->lock_data = SIMPLELOCK_UNLOCKED;
alpha_mb();
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: lock.h,v 1.2 1998/11/04 06:19:55 chs Exp $ */
/* $NetBSD: lock.h,v 1.3 1999/07/27 21:45:39 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -42,13 +42,8 @@
*/
#if defined(_KERNEL)
void simple_lock_init __P((__volatile struct simplelock *));
void simple_lock __P((__volatile struct simplelock *));
int simple_lock_try __P((__volatile struct simplelock *));
void simple_unlock __P((__volatile struct simplelock *));
#if defined(LOCKDEBUG)
#define simple_lock_dump()
#define simple_lock_freecheck(start, end)
#endif /* LOCKDEBUG */
void cpu_simple_lock_init __P((__volatile struct simplelock *));
void cpu_simple_lock __P((__volatile struct simplelock *));
int cpu_simple_lock_try __P((__volatile struct simplelock *));
void cpu_simple_unlock __P((__volatile struct simplelock *));
#endif /* _KERNEL */

View File

@ -1,7 +1,7 @@
/* $NetBSD: lock.h,v 1.3 1998/11/04 06:19:55 chs Exp $ */
/* $NetBSD: lock.h,v 1.4 1999/07/27 21:45:41 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -47,13 +47,13 @@
#include <sparc/sparc/asm.h>
static void simple_lock_init __P((__volatile struct simplelock *));
static void simple_lock __P((__volatile struct simplelock *));
static int simple_lock_try __P((__volatile struct simplelock *));
static void simple_unlock __P((__volatile struct simplelock *));
static void cpu_simple_lock_init __P((__volatile struct simplelock *));
static void cpu_simple_lock __P((__volatile struct simplelock *));
static int cpu_simple_lock_try __P((__volatile struct simplelock *));
static void cpu_simple_unlock __P((__volatile struct simplelock *));
static __inline__ void
simple_lock_init (alp)
cpu_simple_lock_init (alp)
__volatile struct simplelock *alp;
{
@ -61,7 +61,7 @@ simple_lock_init (alp)
}
static __inline__ void
simple_lock (alp)
cpu_simple_lock (alp)
__volatile struct simplelock *alp;
{
@ -79,7 +79,7 @@ simple_lock (alp)
}
static __inline__ int
simple_lock_try (alp)
cpu_simple_lock_try (alp)
__volatile struct simplelock *alp;
{
@ -87,18 +87,13 @@ simple_lock_try (alp)
}
static __inline__ void
simple_unlock (alp)
cpu_simple_unlock (alp)
__volatile struct simplelock *alp;
{
alp->lock_data = 0;
}
#if defined(LOCKDEBUG)
#define simple_lock_dump()
#define simple_lock_freecheck(start, end)
#endif /* LOCKDEBUG */
#endif /* _KERNEL */
#endif /* _MACHINE_LOCK_H */

View File

@ -1,7 +1,7 @@
/* $NetBSD: lock.h,v 1.1 1999/05/30 18:57:27 eeh Exp $ */
/* $NetBSD: lock.h,v 1.2 1999/07/27 21:45:41 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -47,13 +47,13 @@
#include <sparc64/sparc64/asm.h>
static void simple_lock_init __P((__volatile struct simplelock *));
static void simple_lock __P((__volatile struct simplelock *));
static int simple_lock_try __P((__volatile struct simplelock *));
static void simple_unlock __P((__volatile struct simplelock *));
static void cpu_simple_lock_init __P((__volatile struct simplelock *));
static void cpu_simple_lock __P((__volatile struct simplelock *));
static int cpu_simple_lock_try __P((__volatile struct simplelock *));
static void cpu_simple_unlock __P((__volatile struct simplelock *));
static __inline__ void
simple_lock_init (alp)
cpu_simple_lock_init (alp)
__volatile struct simplelock *alp;
{
@ -61,7 +61,7 @@ simple_lock_init (alp)
}
static __inline__ void
simple_lock (alp)
cpu_simple_lock (alp)
__volatile struct simplelock *alp;
{
@ -79,7 +79,7 @@ simple_lock (alp)
}
static __inline__ int
simple_lock_try (alp)
cpu_simple_lock_try (alp)
__volatile struct simplelock *alp;
{
@ -87,18 +87,13 @@ simple_lock_try (alp)
}
static __inline__ void
simple_unlock (alp)
cpu_simple_unlock (alp)
__volatile struct simplelock *alp;
{
alp->lock_data = 0;
}
#if defined(LOCKDEBUG)
#define simple_lock_dump()
#define simple_lock_freecheck(start, end)
#endif /* LOCKDEBUG */
#endif /* _KERNEL */
#endif /* _MACHINE_LOCK_H */