Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
/*
2
 *  Generic cache management functions. Everything is arch-specific,  
3
 *  but this header exists to make sure the defines/functions can be
4
 *  used in a generic way.
5
 *
6
 *  2000-11-13  Arjan van de Ven   <arjan@fenrus.demon.nl>
7
 *
8
 */
9
 
10
#ifndef _LINUX_PREFETCH_H
11
#define _LINUX_PREFETCH_H
12
 
13
#include <asm/processor.h>
14
#include <asm/cache.h>
15
 
16
/*
17
        prefetch(x) attempts to pre-emptively get the memory pointed to
18
        by address "x" into the CPU L1 cache.
19
        prefetch(x) should not cause any kind of exception, prefetch(0) is
20
        specifically ok.
21
 
22
        prefetch() should be defined by the architecture, if not, the
23
        #define below provides a no-op define. 
24
 
25
        There are 3 prefetch() macros:
26
 
27
        prefetch(x)     - prefetches the cacheline at "x" for read
28
        prefetchw(x)    - prefetches the cacheline at "x" for write
29
        spin_lock_prefetch(x) - prefectches the spinlock *x for taking
30
 
31
        there is also PREFETCH_STRIDE which is the architecure-prefered
32
        "lookahead" size for prefetching streamed operations.
33
 
34
*/
35
 
36
/*
37
 *      These cannot be do{}while(0) macros. See the mental gymnastics in
38
 *      the loop macro.
39
 */
40
 
41
#ifndef ARCH_HAS_PREFETCH
42
static inline void prefetch(const void *x) {;}
43
#endif
44
 
45
#ifndef ARCH_HAS_PREFETCHW
46
static inline void prefetchw(const void *x) {;}
47
#endif
48
 
49
#ifndef ARCH_HAS_SPINLOCK_PREFETCH
50
#define spin_lock_prefetch(x) prefetchw(x)
51
#endif
52
 
53
#ifndef PREFETCH_STRIDE
54
#define PREFETCH_STRIDE (4*L1_CACHE_BYTES)
55
#endif
56
 
57
#endif