[PATCH] Add DRM_CAS for mips32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Aleksey Kuleshov <rndfax@xxxxxxxxx>
---
 xf86drm.h | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/xf86drm.h b/xf86drm.h
index 40c55c9..2ba75d9 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -462,6 +462,27 @@ do {	register unsigned int __old __asm("o0");		\
 		: "cr0", "memory");			\
 	} while (0)
 
+#elif defined(__mips__)
+
+#define DRM_CAS(lock, old, new, ret)				\
+	do {							\
+		int tmp;					\
+		asm volatile(					\
+			".set push;"				\
+			".set noreorder;"			\
+			".set mips32;"				\
+			"ll	%[_tmp], %[_lock];"		\
+			"bne	%[_tmp], %[_old], 1f;"		\
+			"li	%[_ret], 1;"			\
+			"sc	%[_new], %[_lock];"		\
+			"xori	%[_ret], %[_new], 1;"		\
+			"1:"					\
+			".set pop;"				\
+		: [_lock] "=m" (__drm_dummy_lock(lock)),	\
+		  [_tmp] "=&r" (tmp), [_ret] "=&r" (ret)	\
+		: [_old] "r" (old), [_new] "r" (new));		\
+	} while (0)
+
 #endif /* architecture */
 #endif /* __GNUC__ >= 2 */
 
@@ -471,7 +492,7 @@ do {	register unsigned int __old __asm("o0");		\
 
 #if defined(__alpha__)
 #define DRM_CAS_RESULT(_result)		long _result
-#elif defined(__powerpc__)
+#elif defined(__powerpc__) || defined(__mips__)
 #define DRM_CAS_RESULT(_result)		int _result
 #else
 #define DRM_CAS_RESULT(_result)		char _result
-- 
2.1.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux