summaryrefslogtreecommitdiffstats
path: root/include/asm-sparc
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-04-05 04:55:58 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-04-05 04:55:58 +0000
commit74a9f2e1b4d3ab45a9f72cb5b556c9f521524ab3 (patch)
tree7c4cdb103ab1b388c9852a88bd6fb1e73eba0b5c /include/asm-sparc
parentee6374c8b0d333c08061c6a97bc77090d7461225 (diff)
Merge with Linux 2.4.3.
Note that mingetty does no longer work with serial console, you have to switch to another getty like getty_ps. This commit also includes a fix for a setitimer bug which did prevent getty_ps from working on older kernels.
Diffstat (limited to 'include/asm-sparc')
-rw-r--r--include/asm-sparc/atomic.h69
-rw-r--r--include/asm-sparc/semaphore.h32
-rw-r--r--include/asm-sparc/smp.h1
3 files changed, 34 insertions, 68 deletions
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
index 1e07b88f7..6c8c16bf4 100644
--- a/include/asm-sparc/atomic.h
+++ b/include/asm-sparc/atomic.h
@@ -1,6 +1,7 @@
/* atomic.h: These still suck, but the I-cache hit rate is higher.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au)
*/
#ifndef __ARCH_SPARC_ATOMIC__
@@ -47,51 +48,12 @@ static __inline__ int atomic_read(atomic_t *v)
#define atomic_set(v, i) (((v)->counter) = ((i) << 8))
#endif
-/* Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-#define __atomic_fool_gcc(x) ((struct { int a[100]; } *)x)
-
-static __inline__ void atomic_add(int i, atomic_t *v)
-{
- register atomic_t *ptr asm("g1");
- register int increment asm("g2");
- ptr = (atomic_t *) __atomic_fool_gcc(v);
- increment = i;
-
- __asm__ __volatile__("
- mov %%o7, %%g4
- call ___atomic_add
- add %%o7, 8, %%o7
-" : "=&r" (increment)
- : "0" (increment), "r" (ptr)
- : "g3", "g4", "g7", "memory", "cc");
-}
-
-static __inline__ void atomic_sub(int i, atomic_t *v)
+static __inline__ int __atomic_add(int i, atomic_t *v)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
register int increment asm("g2");
- ptr = (atomic_t *) __atomic_fool_gcc(v);
- increment = i;
-
- __asm__ __volatile__("
- mov %%o7, %%g4
- call ___atomic_sub
- add %%o7, 8, %%o7
-" : "=&r" (increment)
- : "0" (increment), "r" (ptr)
- : "g3", "g4", "g7", "memory", "cc");
-}
-
-static __inline__ int atomic_add_return(int i, atomic_t *v)
-{
- register atomic_t *ptr asm("g1");
- register int increment asm("g2");
-
- ptr = (atomic_t *) __atomic_fool_gcc(v);
+ ptr = &v->counter;
increment = i;
__asm__ __volatile__("
@@ -105,12 +67,12 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
return increment;
}
-static __inline__ int atomic_sub_return(int i, atomic_t *v)
+static __inline__ int __atomic_sub(int i, atomic_t *v)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
register int increment asm("g2");
- ptr = (atomic_t *) __atomic_fool_gcc(v);
+ ptr = &v->counter;
increment = i;
__asm__ __volatile__("
@@ -124,16 +86,19 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
return increment;
}
-#define atomic_dec_return(v) atomic_sub_return(1,(v))
-#define atomic_inc_return(v) atomic_add_return(1,(v))
+#define atomic_add(i, v) ((void)__atomic_add((i), (v)))
+#define atomic_sub(i, v) ((void)__atomic_sub((i), (v)))
+
+#define atomic_dec_return(v) __atomic_sub(1, (v))
+#define atomic_inc_return(v) __atomic_add(1, (v))
-#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+#define atomic_sub_and_test(i, v) (__atomic_sub((i), (v)) == 0)
+#define atomic_dec_and_test(v) (__atomic_sub(1, (v)) == 0)
-#define atomic_inc(v) atomic_add(1,(v))
-#define atomic_dec(v) atomic_sub(1,(v))
+#define atomic_inc(v) ((void)__atomic_add(1, (v)))
+#define atomic_dec(v) ((void)__atomic_sub(1, (v)))
-#define atomic_add_negative(i, v) (atomic_add_return((i), (v)) < 0)
+#define atomic_add_negative(i, v) (__atomic_add((i), (v)) < 0)
#endif /* !(__KERNEL__) */
diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h
index cee9745b6..5a5fc7c33 100644
--- a/include/asm-sparc/semaphore.h
+++ b/include/asm-sparc/semaphore.h
@@ -64,14 +64,14 @@ extern void __up(struct semaphore * sem);
static inline void down(struct semaphore * sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
register int increment asm("g2");
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &(sem->count.counter);
increment = 1;
__asm__ __volatile__("
@@ -99,14 +99,14 @@ static inline void down(struct semaphore * sem)
static inline int down_interruptible(struct semaphore * sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
register int increment asm("g2");
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &(sem->count.counter);
increment = 1;
__asm__ __volatile__("
@@ -137,14 +137,14 @@ static inline int down_interruptible(struct semaphore * sem)
static inline int down_trylock(struct semaphore * sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
register int increment asm("g2");
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &(sem->count.counter);
increment = 1;
__asm__ __volatile__("
@@ -175,14 +175,14 @@ static inline int down_trylock(struct semaphore * sem)
static inline void up(struct semaphore * sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
register int increment asm("g2");
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &(sem->count.counter);
increment = 1;
__asm__ __volatile__("
@@ -284,13 +284,13 @@ extern void ___up_write(/* Special calling convention */ void);
static inline void down_read(struct rw_semaphore *sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &sem->count;
__asm__ __volatile__("
mov %%o7, %%g4
@@ -310,13 +310,13 @@ static inline void down_read(struct rw_semaphore *sem)
static inline void down_write(struct rw_semaphore *sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &sem->count;
__asm__ __volatile__("
mov %%o7, %%g4
@@ -344,9 +344,9 @@ static inline void down_write(struct rw_semaphore *sem)
*/
static inline void __up_read(struct rw_semaphore *sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &sem->count;
__asm__ __volatile__("
mov %%o7, %%g4
@@ -362,9 +362,9 @@ static inline void __up_read(struct rw_semaphore *sem)
*/
static inline void __up_write(struct rw_semaphore *sem)
{
- register atomic_t *ptr asm("g1");
+ register volatile int *ptr asm("g1");
- ptr = (atomic_t *) __atomic_fool_gcc(sem);
+ ptr = &sem->count;
__asm__ __volatile__("
mov %%o7, %%g4
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index f6504165d..31507b7bc 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -51,6 +51,7 @@ extern unsigned long cpu_offset[NR_CPUS];
extern int smp_found_cpus;
extern unsigned char boot_cpu_id;
extern unsigned long cpu_present_map;
+#define cpu_online_map cpu_present_map
typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long);