This patch in addition to "PPC64 cpuinfo change" provides udapl support on PPC64 platform.<br>
<br>
Added PPC64 dependent code to dapl_os_atomic_inc, dapl_os_atomic_dec, dapl_os_atomic_assign and DT_Mdep_GetTimeStamp.<br>
Also added PPC64 to platform checks.<br>
<br>
Signed-off-by: Todd Bowman <<a href="mailto:twbowman@gmail.com">twbowman@gmail.com</a>><br>
<br>
Index: userspace/dapl/dapl/udapl/linux/dapl_osd.h<br>
===================================================================<br>
--- userspace/dapl/dapl/udapl/linux/dapl_osd.h (revision 3547)<br>
+++ userspace/dapl/dapl/udapl/linux/dapl_osd.h (working copy)<br>
@@ -49,7 +49,7 @@<br>
#error UNDEFINED OS TYPE<br>
#endif /* __linux__ */<br>
<br>
-#if !defined (__i386__) && !defined (__ia64__) && !defined(__x86_64__)<br>
+#if !defined (__i386__) && !defined (__ia64__) && !defined(__x86_64__) && !defined(__PPC64__)<br>
#error UNDEFINED ARCH<br>
#endif<br>
<br>
@@ -78,7 +78,7 @@<br>
#include <sys/socket.h><br>
#include <ctype.h><br>
<br>
-#ifdef __ia64__<br>
+#if defined(__ia64__) || defined(__PPC64__)<br>
#include <asm/atomic.h><br>
#include <asm/system.h><br>
#endif<br>
@@ -162,6 +160,8 @@<br>
IA64_FETCHADD (old_value,v,1,4);<br>
#endif<br>
<br>
+#elif defined(__PPC64__)<br>
+ atomic_inc((atomic_t *) v);<br>
#else /* !__ia64__ */<br>
__asm__ __volatile__ (<br>
"lock;" "incl %0"<br>
@@ -190,6 +190,9 @@<br>
IA64_FETCHADD (old_value,v,-1,4);<br>
#endif<br>
<br>
+#elif defined (__PPC64__)<br>
+ atomic_dec((atomic_t *)v);<br>
+<br>
#else /* !__ia64__ */<br>
__asm__ __volatile__ (<br>
"lock;" "decl %0"<br>
@@ -230,6 +233,22 @@<br>
<br>
current_value = ia64_cmpxchg("acq",v,match_value,new_value,4);<br>
<br>
+#elif defined(__PPC64__)<br>
+<br>
+ __asm__ __volatile__ (<br>
+ EIEIO_ON_SMP<br>
+"1: lwarx %0,0,%2 # __cmpxchg_u64\n\<br>
+ cmpd 0,%0,%3\n\<br>
+ bne- 2f\n\<br>
+ stwcx. %4,0,%2\n\<br>
+ bne- 1b"<br>
+ ISYNC_ON_SMP<br>
+ "\n\<br>
+2:"<br>
+ : "=&r" (current_value), "=m" (*v)<br>
+ : "r" (v), "r" (match_value), "r" (new_value), "m" (*v)<br>
+ : "cc", "memory");<br>
+<br>
#else<br>
__asm__ __volatile__ (<br>
"lock; cmpxchgl %1, %2"<br>
Index: userspace/dapl/test/dapltest/mdep/linux/dapl_mdep_user.h<br>
===================================================================<br>
--- userspace/dapl/test/dapltest/mdep/linux/dapl_mdep_user.h (revision 3547)<br>
+++ userspace/dapl/test/dapltest/mdep/linux/dapl_mdep_user.h (working copy)<br>
@@ -128,10 +128,20 @@<br>
<br>
x = get_cycles ();<br>
return x;<br>
+#else<br>
+#if defined(__PPC64__)<br>
+ unsigned int tbl, tbu0, tbu1;<br>
+ do {<br>
+ __asm__ __volatile__ ("mftbu %0" : "=r"(tbu0));<br>
+ __asm__ __volatile__ ("mftb %0" : "=r"(tbl));<br>
+ __asm__ __volatile__ ("mftbu %0" : "=r"(tbu1));<br>
+ } while (tbu0 != tbu1);<br>
+ return (((unsigned long long)tbu0) << 32) | tbl;<br>
#else<br>
-#error "Non-Pentium Linux - unimplemented"<br>
+#error "Non-Pentium and Non-PPC Linux - unimplemented"<br>
#endif<br>
#endif<br>
+#endif<br>
}<br>
<br>
/*<br>
<br>