gettime: print 64-bit variable with ULL
[fio.git] / arch / arch-ppc.h
CommitLineData
ebac4655
JA
1#ifndef ARCH_PPC_H
2#define ARCH_PPH_H
3
cca84643 4#define FIO_ARCH (arch_ppc)
ebac4655
JA
5
6#ifndef __NR_ioprio_set
7#define __NR_ioprio_set 273
8#define __NR_ioprio_get 274
9#endif
10
11#ifndef __NR_fadvise64
12#define __NR_fadvise64 233
13#endif
14
8756e4d4
JA
15#ifndef __NR_sys_splice
16#define __NR_sys_splice 283
17#define __NR_sys_tee 284
18#define __NR_sys_vmsplice 285
19#endif
20
ebac4655
JA
21#define nop do { } while (0)
22
db6defc7 23#ifdef __powerpc64__
44c47feb 24#define read_barrier() __asm__ __volatile__ ("lwsync" : : : "memory")
db6defc7 25#else
44c47feb 26#define read_barrier() __asm__ __volatile__ ("sync" : : : "memory")
db6defc7
JA
27#endif
28
44c47feb
JA
29#define write_barrier() __asm__ __volatile__ ("sync" : : : "memory")
30
8f7e39dd
JA
31static inline int __ilog2(unsigned long bitmask)
32{
33 int lz;
34
35 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bitmask));
36 return 31 - lz;
37}
38
39static inline int arch_ffz(unsigned long bitmask)
40{
41 if ((bitmask = ~bitmask) == 0)
42 return 32;
43 return __ilog2(bitmask & -bitmask);
44}
5f39d8f7
CC
45
46static inline unsigned long long get_cpu_clock(void)
47{
2995607f
JA
48 unsigned int tbl, tbu0, tbu1;
49 unsigned long long ret;
5f39d8f7 50
2995607f
JA
51 do {
52 __asm__ __volatile__ ("mftbu %0" : "=r"(tbu0));
53 __asm__ __volatile__ ("mftb %0" : "=r"(tbl) );
54 __asm__ __volatile__ ("mftbu %0" : "=r"(tbu1));
55 } while (tbu0 != tbu1);
5f39d8f7 56
2995607f
JA
57 ret = (((unsigned long long)tbu0) << 32) | tbl;
58 return ret;
5f39d8f7
CC
59}
60
1b745f55
JA
61#define ARCH_HAVE_INIT
62extern int tsc_reliable;
63static inline int arch_init(char *envp[])
64{
65 tsc_reliable = 1;
d20b2ca6 66 return 0;
1b745f55
JA
67}
68
8f7e39dd 69#define ARCH_HAVE_FFZ
5f39d8f7 70#define ARCH_HAVE_CPU_CLOCK
8f7e39dd 71
ebac4655 72#endif