Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef __LINUX_CACHE_H |
2 | #define __LINUX_CACHE_H |
||
3 | |||
4 | #include <linux/kernel.h> |
||
5 | #include <linux/config.h> |
||
6 | #include <asm/cache.h> |
||
7 | |||
8 | #ifndef L1_CACHE_ALIGN |
||
9 | #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES) |
||
10 | #endif |
||
11 | |||
12 | #ifndef SMP_CACHE_BYTES |
||
13 | #define SMP_CACHE_BYTES L1_CACHE_BYTES |
||
14 | #endif |
||
15 | |||
16 | #ifndef ____cacheline_aligned |
||
17 | #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) |
||
18 | #endif |
||
19 | |||
20 | #ifndef ____cacheline_aligned_in_smp |
||
21 | #ifdef CONFIG_SMP |
||
22 | #define ____cacheline_aligned_in_smp ____cacheline_aligned |
||
23 | #else |
||
24 | #define ____cacheline_aligned_in_smp |
||
25 | #endif /* CONFIG_SMP */ |
||
26 | #endif |
||
27 | |||
28 | #ifndef __cacheline_aligned |
||
29 | #ifdef MODULE |
||
30 | #define __cacheline_aligned ____cacheline_aligned |
||
31 | #else |
||
32 | #define __cacheline_aligned \ |
||
33 | __attribute__((__aligned__(SMP_CACHE_BYTES), \ |
||
34 | __section__(".data.cacheline_aligned"))) |
||
35 | #endif |
||
36 | #endif /* __cacheline_aligned */ |
||
37 | |||
38 | #ifndef __cacheline_aligned_in_smp |
||
39 | #ifdef CONFIG_SMP |
||
40 | #define __cacheline_aligned_in_smp __cacheline_aligned |
||
41 | #else |
||
42 | #define __cacheline_aligned_in_smp |
||
43 | #endif /* CONFIG_SMP */ |
||
44 | #endif |
||
45 | |||
46 | #if !defined(____cacheline_maxaligned_in_smp) |
||
47 | #if defined(CONFIG_SMP) |
||
48 | #define ____cacheline_maxaligned_in_smp \ |
||
49 | __attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX)))) |
||
50 | #else |
||
51 | #define ____cacheline_maxaligned_in_smp |
||
52 | #endif |
||
53 | #endif |
||
54 | |||
55 | #endif /* __LINUX_CACHE_H */ |