summaryrefslogtreecommitdiffstats
path: root/include/asm-s390/sfp-util.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2007-02-05 21:18:31 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-02-05 21:18:31 +0100
commit31ee4b2f40994e8b21691f85cdd4052551a789b7 (patch)
tree1bb167e720e25a2ea9a5168b21cc882f85b18fa8 /include/asm-s390/sfp-util.h
parent31cb4bd31a48f62105d037ad53192b94d4c08f53 (diff)
downloadblackbird-op-linux-31ee4b2f40994e8b21691f85cdd4052551a789b7.tar.gz
blackbird-op-linux-31ee4b2f40994e8b21691f85cdd4052551a789b7.zip
[S390] Calibrate delay and bogomips.
Preset the bogomips number to the cpu capacity value reported by store system information in SYSIB 1.2.2. This value is constant for a particular machine model and can be used to determine relative performance differences between machines. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include/asm-s390/sfp-util.h')
-rw-r--r--include/asm-s390/sfp-util.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/include/asm-s390/sfp-util.h b/include/asm-s390/sfp-util.h
new file mode 100644
index 000000000000..8cabcd23d976
--- /dev/null
+++ b/include/asm-s390/sfp-util.h
@@ -0,0 +1,66 @@
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) ({ \
+ unsigned int __sh = (ah); \
+ unsigned int __sl = (al); \
+ asm volatile( \
+ " alr %1,%3\n" \
+ " brc 12,0f\n" \
+ " ahi %0,1\n" \
+ "0: alr %0,%2" \
+ : "+&d" (__sh), "+d" (__sl) \
+ : "d" (bh), "d" (bl) : "cc"); \
+ (sh) = __sh; \
+ (sl) = __sl; \
+})
+
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) ({ \
+ unsigned int __sh = (ah); \
+ unsigned int __sl = (al); \
+ asm volatile( \
+ " slr %1,%3\n" \
+ " brc 3,0f\n" \
+ " ahi %0,-1\n" \
+ "0: slr %0,%2" \
+ : "+&d" (__sh), "+d" (__sl) \
+ : "d" (bh), "d" (bl) : "cc"); \
+ (sh) = __sh; \
+ (sl) = __sl; \
+})
+
+/* a umul b = a mul b + (a>=2<<31) ? b<<32:0 + (b>=2<<31) ? a<<32:0 */
+#define umul_ppmm(wh, wl, u, v) ({ \
+ unsigned int __wh = u; \
+ unsigned int __wl = v; \
+ asm volatile( \
+ " ltr 1,%0\n" \
+ " mr 0,%1\n" \
+ " jnm 0f\n" \
+ " alr 0,%1\n" \
+ "0: ltr %1,%1\n" \
+ " jnm 1f\n" \
+ " alr 0,%0\n" \
+ "1: lr %0,0\n" \
+ " lr %1,1\n" \
+ : "+d" (__wh), "+d" (__wl) \
+ : : "0", "1", "cc"); \
+ wh = __wh; \
+ wl = __wl; \
+})
+
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { unsigned int __r; \
+ (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
+ (r) = __r; \
+ } while (0)
+extern unsigned long __udiv_qrnnd (unsigned int *, unsigned int,
+ unsigned int , unsigned int);
+
+#define UDIV_NEEDS_NORMALIZATION 0
+
+#define abort() return 0
+
+#define __BYTE_ORDER __BIG_ENDIAN
OpenPOWER on IntegriCloud