Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame^] | 1 | /** |
| 2 | * @file op_cache.h |
| 3 | * Cache definitions for compatibility |
| 4 | * |
| 5 | * @remark Copyright 2002 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author Philippe Elie |
| 9 | * @author John Levon |
| 10 | */ |
| 11 | |
| 12 | #ifndef OP_CACHE_H |
| 13 | #define OP_CACHE_H |
| 14 | |
| 15 | #include <asm/cache.h> |
| 16 | |
| 17 | #ifndef L1_CACHE_ALIGN |
| 18 | #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) |
| 19 | #endif |
| 20 | |
| 21 | #ifndef SMP_CACHE_BYTES |
| 22 | #define SMP_CACHE_BYTES L1_CACHE_BYTES |
| 23 | #endif |
| 24 | |
| 25 | /* 2.4.0 introduced __cacheline_aligned */ |
| 26 | #ifndef ____cacheline_aligned |
| 27 | #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) |
| 28 | #endif |
| 29 | |
| 30 | #ifndef __cacheline_aligned |
| 31 | #ifdef MODULE |
| 32 | #define __cacheline_aligned ____cacheline_aligned |
| 33 | #else |
| 34 | #define __cacheline_aligned \ |
| 35 | __attribute__((__aligned__(SMP_CACHE_BYTES), \ |
| 36 | __section__(".data.cacheline_aligned"))) |
| 37 | #endif |
| 38 | #endif /* __cacheline_aligned */ |
| 39 | |
| 40 | /* 2.4.10 introduced ___cacheline_aligned_in_smp */ |
| 41 | #ifndef ____cacheline_aligned_in_smp |
| 42 | #ifdef CONFIG_SMP |
| 43 | #define ____cacheline_aligned_in_smp ____cacheline_aligned |
| 44 | #else |
| 45 | #define ____cacheline_aligned_in_smp |
| 46 | #endif /* CONFIG_SMP */ |
| 47 | #endif |
| 48 | |
| 49 | #ifndef __cacheline_aligned_in_smp |
| 50 | #ifdef CONFIG_SMP |
| 51 | #define __cacheline_aligned_in_smp __cacheline_aligned |
| 52 | #else |
| 53 | #define __cacheline_aligned_in_smp |
| 54 | #endif /* CONFIG_SMP */ |
| 55 | #endif |
| 56 | |
| 57 | #endif /* !OP_CACHE_H */ |