summaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64/smp_lock.h
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
committerMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
commite2819e52a162873ff5061de81bb749831bdb5de9 (patch)
tree6067ea700202750ba335a423696f2972700e5f76 /include/asm-sparc64/smp_lock.h
parent17a005074429bbf143e40401f405ae4363e56828 (diff)
Merge to 2.1.38.
IMPORTANT NOTE: I could not figure out what information is the one that should be used for the following files (ie, those that were in our tree, or those that came from Linus' patch), please, check these: include/asm-mips/jazz.h include/asm-mips/jazzdma.h include/asm-mips/ioctls.h
Diffstat (limited to 'include/asm-sparc64/smp_lock.h')
-rw-r--r--include/asm-sparc64/smp_lock.h64
1 files changed, 63 insertions, 1 deletions
diff --git a/include/asm-sparc64/smp_lock.h b/include/asm-sparc64/smp_lock.h
index 12821b215..3012ed6bb 100644
--- a/include/asm-sparc64/smp_lock.h
+++ b/include/asm-sparc64/smp_lock.h
@@ -18,7 +18,69 @@
#define reacquire_kernel_lock(task, cpu, depth) do { } while(0)
#else
-#error SMP on sparc64 not supported yet
+
+#include <asm/hardirq.h>
+
+/* Release global kernel lock and global interrupt lock */
+#define release_kernel_lock(task, cpu, depth) \
+do { \
+ if((depth = (task)->lock_depth) != 0) { \
+ __cli(); \
+ (task)->lock_depth = 0; \
+ klock_info.akp = NO_PROC_ID; \
+ klock_info.kernel_flag = 0; \
+ } \
+ release_irqlock(cpu); \
+ __sti(); \
+} while(0)
+
+/* Do not fuck with this without consulting arch/sparc64/lib/locks.S first! */
+#define reacquire_kernel_lock(task, cpu, depth) \
+do { \
+ if(depth) { \
+ register struct klock_info *klip asm("g1"); \
+ klip = &klock_info; \
+ __asm__ __volatile__("mov %%o7, %%g5\n\t" \
+ "call ___lock_reacquire_kernel\n\t" \
+ " mov %1, %%g2" \
+ : /* No outputs. */ \
+ : "r" (klip), "r" (depth) \
+ : "g2", "g3", "g5", "g7", "memory", "cc"); \
+ } \
+} while(0)
+
+/* The following acquire and release the master kernel global lock,
+ * the idea is that the usage of this mechanmism becomes less and less
+ * as time goes on, to the point where they are no longer needed at all
+ * and can thus disappear.
+ */
+
+/* Do not fuck with this without consulting arch/sparc64/lib/locks.S first! */
+extern __inline__ void lock_kernel(void)
+{
+ register struct klock_info *klip asm("g1");
+ klip = &klock_info;
+ __asm__ __volatile__("
+ mov %%o7, %%g5
+ call ___lock_kernel
+ ld [%%g6 + %0], %%g2
+" : : "i" (AOFF_task_lock_depth), "r" (klip)
+ : "g2", "g3", "g5", "g7", "memory", "cc");
+}
+
+/* Release kernel global lock. */
+extern __inline__ void unlock_kernel(void)
+{
+ register struct klock_info *klip asm("g1");
+ klip = &klock_info;
+ __asm__ __volatile__("
+ mov %%o7, %%g5
+ call ___unlock_kernel
+ ld [%%g6 + %0], %%g2
+" : : "i" (AOFF_task_lock_depth), "r" (klip)
+ : "g2", "g3", "g5", "memory", "cc");
+}
+
#endif /* (__SMP__) */
#endif /* !(__SPARC64_SMPLOCK_H) */