Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1 | #ifndef ARCH_PPC_H |
| 2 | #define ARCH_PPH_H |
| 3 | |
| 4 | #define ARCH (arch_ppc) |
| 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 | |
Jens Axboe | 8756e4d | 2006-05-27 20:24:53 +0200 | [diff] [blame] | 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 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 21 | #define nop do { } while (0) |
| 22 | |
Jens Axboe | db6defc | 2007-12-11 08:55:53 +0100 | [diff] [blame^] | 23 | #ifdef __powerpc64__ |
| 24 | #define read_barrier() \ |
| 25 | __asm__ __volatile__ ("lwsync" : : : "memory") |
| 26 | #else |
| 27 | #define read_barrier() \ |
| 28 | __asm__ __volatile__ ("sync" : : : "memory") |
| 29 | #endif |
| 30 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 31 | static 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 | |
Jens Axboe | b12ebc6 | 2007-05-21 11:42:33 +0200 | [diff] [blame] | 39 | static inline int fio_ffz(unsigned long bitmask) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 40 | { |
| 41 | if ((bitmask = ~bitmask) == 0) |
| 42 | return 32; |
| 43 | return __ilog2(bitmask & -bitmask); |
| 44 | } |
| 45 | |
| 46 | #endif |