summaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
commitdb7d4daea91e105e3859cf461d7e53b9b77454b2 (patch)
tree9bb65b95440af09e8aca63abe56970dd3360cc57 /include/asm-mips
parent9c1c01ead627bdda9211c9abd5b758d6c687d8ac (diff)
Merge with Linux 2.2.8.
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/cache.h2
-rw-r--r--include/asm-mips/keyboard.h4
-rw-r--r--include/asm-mips/offset.h46
-rw-r--r--include/asm-mips/pgtable.h3
-rw-r--r--include/asm-mips/semaphore-helper.h125
-rw-r--r--include/asm-mips/semaphore.h75
-rw-r--r--include/asm-mips/siginfo.h4
-rw-r--r--include/asm-mips/system.h8
-rw-r--r--include/asm-mips/termios.h1
9 files changed, 205 insertions, 63 deletions
diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h
index 83211ad98..1ed0b0833 100644
--- a/include/asm-mips/cache.h
+++ b/include/asm-mips/cache.h
@@ -9,4 +9,6 @@
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
+#define SMP_CACHE_BYTES L1_CACHE_BYTES
+
#endif /* __ASM_MIPS_CACHE_H */
diff --git a/include/asm-mips/keyboard.h b/include/asm-mips/keyboard.h
index 2b1901a9e..9b30c45c2 100644
--- a/include/asm-mips/keyboard.h
+++ b/include/asm-mips/keyboard.h
@@ -5,7 +5,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * $Id: keyboard.h,v 1.11 1998/09/19 19:19:37 ralf Exp $
+ * $Id: keyboard.h,v 1.12 1999/01/04 16:09:22 ralf Exp $
*/
#ifndef __ASM_MIPS_KEYBOARD_H
#define __ASM_MIPS_KEYBOARD_H
@@ -21,7 +21,6 @@
extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
extern int pckbd_getkeycode(unsigned int scancode);
-extern int pckbd_pretranslate(unsigned char scancode, char raw_mode);
extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode);
extern char pckbd_unexpected_up(unsigned char keycode);
@@ -31,7 +30,6 @@ extern unsigned char pckbd_sysrq_xlate[128];
#define kbd_setkeycode pckbd_setkeycode
#define kbd_getkeycode pckbd_getkeycode
-#define kbd_pretranslate pckbd_pretranslate
#define kbd_translate pckbd_translate
#define kbd_unexpected_up pckbd_unexpected_up
#define kbd_leds pckbd_leds
diff --git a/include/asm-mips/offset.h b/include/asm-mips/offset.h
index 73ec088ba..a6d698336 100644
--- a/include/asm-mips/offset.h
+++ b/include/asm-mips/offset.h
@@ -51,31 +51,31 @@
#define TASK_NEED_RESCHED 20
#define TASK_COUNTER 24
#define TASK_PRIORITY 28
-#define TASK_MM 928
+#define TASK_MM 920
/* MIPS specific thread_struct offsets. */
-#define THREAD_REG16 568
-#define THREAD_REG17 572
-#define THREAD_REG18 576
-#define THREAD_REG19 580
-#define THREAD_REG20 584
-#define THREAD_REG21 588
-#define THREAD_REG22 592
-#define THREAD_REG23 596
-#define THREAD_REG29 600
-#define THREAD_REG30 604
-#define THREAD_REG31 608
-#define THREAD_STATUS 612
-#define THREAD_FPU 616
-#define THREAD_BVADDR 880
-#define THREAD_BUADDR 884
-#define THREAD_ECODE 888
-#define THREAD_TRAPNO 892
-#define THREAD_PGDIR 896
-#define THREAD_MFLAGS 900
-#define THREAD_CURDS 904
-#define THREAD_TRAMP 908
-#define THREAD_OLDCTX 912
+#define THREAD_REG16 560
+#define THREAD_REG17 564
+#define THREAD_REG18 568
+#define THREAD_REG19 572
+#define THREAD_REG20 576
+#define THREAD_REG21 580
+#define THREAD_REG22 584
+#define THREAD_REG23 588
+#define THREAD_REG29 592
+#define THREAD_REG30 596
+#define THREAD_REG31 600
+#define THREAD_STATUS 604
+#define THREAD_FPU 608
+#define THREAD_BVADDR 872
+#define THREAD_BUADDR 876
+#define THREAD_ECODE 880
+#define THREAD_TRAPNO 884
+#define THREAD_PGDIR 888
+#define THREAD_MFLAGS 892
+#define THREAD_CURDS 896
+#define THREAD_TRAMP 900
+#define THREAD_OLDCTX 904
/* Linux mm_struct offsets. */
#define MM_COUNT 16
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index e21766bb0..521778afb 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.17 1998/09/16 21:37:38 tsbogend Exp $
+/* $Id: pgtable.h,v 1.18 1999/02/15 02:22:11 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -589,6 +589,7 @@ extern void (*update_mmu_cache)(struct vm_area_struct *vma,
/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
#define PageSkip(page) (0)
+#define kern_addr_valid(addr) (1)
/* TLB operations. */
extern inline void tlb_probe(void)
diff --git a/include/asm-mips/semaphore-helper.h b/include/asm-mips/semaphore-helper.h
new file mode 100644
index 000000000..63103c514
--- /dev/null
+++ b/include/asm-mips/semaphore-helper.h
@@ -0,0 +1,125 @@
+/* $Id: semaphore-helper.h,v 1.2 1999/06/10 08:02:41 ralf Exp $
+ *
+ * SMP- and interrupt-safe semaphores helper functions.
+ *
+ * (C) Copyright 1996 Linus Torvalds
+ * (C) Copyright 1999 Andrea Arcangeli
+ * (C) Copyright 1999 Ralf Baechle
+ */
+#ifndef __ASM_MIPS_SEMAPHORE_HELPER_H
+#define __ASM_MIPS_SEMAPHORE_HELPER_H
+
+/*
+ * These two _must_ execute atomically wrt each other.
+ */
+static inline void wake_one_more(struct semaphore * sem)
+{
+ atomic_inc(&sem->waking);
+}
+
+static inline int
+waking_non_zero(struct semaphore *sem)
+{
+ int ret, tmp;
+
+ __asm__ __volatile__(
+ "1:\tll\t%1,%2\n\t"
+ "blez\t%1,2f\n\t"
+ "subu\t%0,%1,1\n\t"
+ "sc\t%0,%2\n\t"
+ "beqz\t%0,1b\n\t"
+ "2:"
+ ".text"
+ : "=r"(ret), "=r"(tmp), "=m"(__atomic_fool_gcc(&sem->waking))
+ : "0"(0));
+
+ return ret;
+}
+
+/*
+ * waking_non_zero_interruptible:
+ * 1 got the lock
+ * 0 go to sleep
+ * -EINTR interrupted
+ *
+ * We must undo the sem->count down_interruptible decrement
+ * simultaneously and atomicly with the sem->waking adjustment,
+ * otherwise we can race with wake_one_more.
+ *
+ * This is accomplished by doing a 64-bit ll/sc on the 2 32-bit words.
+ *
+ * This is crazy. Normally it stricly forbidden to use 64-bit operation
+ * in the 32-bit MIPS kernel. In this case it's however ok because if an
+ * interrupt has destroyed the upper half of registers sc will fail.
+ */
+static inline int
+waking_non_zero_interruptible(struct semaphore *sem, struct task_struct *tsk)
+{
+ long ret, tmp;
+
+#ifdef __MIPSEL__
+ __asm__ __volatile__("
+ .set mips3
+ .set push
+ .set noat
+0: lld %1,%2
+ li %0,0
+
+ bltz %1, 1f
+ dli $1, 0xffffffff00000000
+ daddu %1, $1
+ li %0, 1
+ b 2f
+1:
+
+ beqz %3, 1f
+ addiu $1, %1, 1
+ dsll32 $1, $1, 0
+ dsrl32 $1, $1, 0
+ dsrl32 %1, %1, 0
+ dsll32 %1, %1, 0
+ or %1, $1
+ li %0, %4
+ b 2f
+1:
+ scd %1, %2
+2:
+ beqz %1,0b
+ .set pop
+ .set mips0"
+ : "=&r"(ret), "=&r"(tmp), "=m"(*sem)
+ : "r"(signal_pending(tsk)), "i"(-EINTR));
+#endif
+
+#ifdef __MIPSEL__
+#error "FIXME: waking_non_zero_interruptible doesn't support little endian machines yet."
+#endif
+
+ return ret;
+}
+
+/*
+ * waking_non_zero_trylock:
+ * 1 failed to lock
+ * 0 got the lock
+ *
+ * XXX SMP ALERT
+ */
+#ifdef __SMP__
+#error FIXME, waking_non_zero_trylock is broken for SMP.
+#endif
+static inline int waking_non_zero_trylock(struct semaphore *sem)
+{
+ int ret = 1;
+
+ if (atomic_read(&sem->waking) <= 0)
+ atomic_inc(&sem->count);
+ else {
+ atomic_dec(&sem->waking);
+ ret = 0;
+ }
+
+ return ret;
+}
+
+#endif /* __ASM_MIPS_SEMAPHORE_HELPER_H */
diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h
index b1ac4ecce..88c726546 100644
--- a/include/asm-mips/semaphore.h
+++ b/include/asm-mips/semaphore.h
@@ -25,42 +25,13 @@ struct semaphore {
asmlinkage void __down(struct semaphore * sem);
asmlinkage int __down_interruptible(struct semaphore * sem);
+asmlinkage int __down_trylock(struct semaphore * sem);
asmlinkage void __up(struct semaphore * sem);
extern spinlock_t semaphore_wake_lock;
#define sema_init(sem, val) atomic_set(&((sem)->count), val)
-/*
- * These two _must_ execute atomically wrt each other.
- *
- * This is trivially done with load_locked/store_cond,
- * which we have. Let the rest of the losers suck eggs.
- */
-
-static inline void wake_one_more(struct semaphore * sem)
-{
- atomic_inc(&sem->waking);
-}
-
-static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk)
-{
- int ret, tmp;
-
- __asm__ __volatile__(
- "1:\tll\t%1,%2\n"
- "blez\t%1,2f\n\t"
- "subu\t%0,%1,1\n\t"
- "sc\t%0,%2\n\t"
- "beqz\t%0,1b\n\t"
- "2:"
- ".text"
- : "=r"(ret), "=r"(tmp), "=m"(__atomic_fool_gcc(&sem->waking))
- : "0"(0));
-
- return ret;
-}
-
extern inline void down(struct semaphore * sem)
{
if (atomic_dec_return(&sem->count) < 0)
@@ -76,6 +47,50 @@ extern inline int down_interruptible(struct semaphore * sem)
}
/*
+ * down_trylock returns 0 on success, 1 if we failed to get the lock.
+ *
+ * We must manipulate count and waking simultaneously and atomically.
+ * Do this by using ll/sc on the pair of 32-bit words.
+ */
+extern inline int down_trylock(struct semaphore * sem)
+{
+ long ret, tmp, tmp2, sub;
+
+#ifdef __MIPSEB__
+ __asm__ __volatile__("
+ .set mips3
+ 0: lld %1, %4
+ dli %3, 0x0000000100000000
+ sltu %0, %1, $0
+
+ bltz %1, 1f
+ move %3, $0
+ 1:
+
+ sltu %2, %1, $0
+ and %0, %0, %2
+ bnez %0, 2f
+
+ subu %0, %3
+ scd %1, %4
+
+ beqz %1, 0b
+ 2:
+
+ .set mips0"
+ : "=&r"(ret), "=&r"(tmp), "=&r"(tmp2), "=&r"(sub)
+ : "m"(*sem)
+ : "memory");
+#endif
+
+#ifdef __MIPSEL__
+#error "FIXME: down_trylock doesn't support little endian machines yet."
+#endif
+
+ return ret;
+}
+
+/*
* Note! This is subtle. We jump to wake people up only if
* the semaphore was negative (== somebody was waiting on it).
*/
diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h
index eca5b65dd..5eb837e00 100644
--- a/include/asm-mips/siginfo.h
+++ b/include/asm-mips/siginfo.h
@@ -1,4 +1,4 @@
-/* $Id: siginfo.h,v 1.4 1998/08/28 16:23:06 ralf Exp $
+/* $Id: siginfo.h,v 1.3 1998/09/19 19:19:39 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -146,7 +146,7 @@ typedef struct siginfo {
*/
#define TRAP_BRKPT 1 /* process breakpoint */
#define TRAP_TRACE 2 /* process trace trap */
-#define NSIGTRAP
+#define NSIGTRAP 2
/*
* SIGCHLD si_codes
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 6e41a7635..d47580a11 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.8 1999/02/15 02:22:13 ralf Exp $
+/* $Id: system.h,v 1.9 1999/05/01 10:08:19 harald Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -134,12 +134,12 @@ __asm__ __volatile__( \
* switch_to(n) should switch tasks to task nr n, first
* checking that n isn't the current task, in which case it does nothing.
*/
-extern asmlinkage void (*resume)(void *tsk);
+extern asmlinkage void *(*resume)(void *last, void *next);
#endif /* !defined (_LANGUAGE_ASSEMBLY) */
-#define switch_to(prev,next) \
+#define switch_to(prev,next,last) \
do { \
- resume(next); \
+ (last) = resume(prev, next); \
} while(0)
/*
diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h
index 62e3882a3..e06bde493 100644
--- a/include/asm-mips/termios.h
+++ b/include/asm-mips/termios.h
@@ -98,6 +98,7 @@ struct termio {
#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
+#define N_HDLC 13 /* synchronous HDLC */
#ifdef __KERNEL__