]>
Commit | Line | Data |
---|---|---|
be5a0c12 | 1 | #ifndef __PAT_INTERNAL_H_ |
2 | #define __PAT_INTERNAL_H_ | |
3 | ||
4 | extern int pat_debug_enable; | |
5 | ||
6 | #define dprintk(fmt, arg...) \ | |
7 | do { if (pat_debug_enable) printk(KERN_INFO fmt, ##arg); } while (0) | |
8 | ||
9 | struct memtype { | |
10 | u64 start; | |
11 | u64 end; | |
9e41a49a | 12 | u64 subtree_max_end; |
e00c8cc9 | 13 | enum page_cache_mode type; |
be5a0c12 | 14 | struct rb_node rb; |
15 | }; | |
16 | ||
e00c8cc9 | 17 | static inline char *cattr_name(enum page_cache_mode pcm) |
be5a0c12 | 18 | { |
e00c8cc9 JG |
19 | switch (pcm) { |
20 | case _PAGE_CACHE_MODE_UC: return "uncached"; | |
21 | case _PAGE_CACHE_MODE_UC_MINUS: return "uncached-minus"; | |
22 | case _PAGE_CACHE_MODE_WB: return "write-back"; | |
23 | case _PAGE_CACHE_MODE_WC: return "write-combining"; | |
24 | case _PAGE_CACHE_MODE_WT: return "write-through"; | |
25 | case _PAGE_CACHE_MODE_WP: return "write-protected"; | |
26 | default: return "broken"; | |
be5a0c12 | 27 | } |
28 | } | |
29 | ||
9e41a49a PV |
30 | #ifdef CONFIG_X86_PAT |
31 | extern int rbt_memtype_check_insert(struct memtype *new, | |
e00c8cc9 | 32 | enum page_cache_mode *new_type); |
20413f27 | 33 | extern struct memtype *rbt_memtype_erase(u64 start, u64 end); |
9e41a49a PV |
34 | extern struct memtype *rbt_memtype_lookup(u64 addr); |
35 | extern int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos); | |
36 | #else | |
37 | static inline int rbt_memtype_check_insert(struct memtype *new, | |
e00c8cc9 | 38 | enum page_cache_mode *new_type) |
9e41a49a | 39 | { return 0; } |
20413f27 XF |
40 | static inline struct memtype *rbt_memtype_erase(u64 start, u64 end) |
41 | { return NULL; } | |
9e41a49a PV |
42 | static inline struct memtype *rbt_memtype_lookup(u64 addr) |
43 | { return NULL; } | |
44 | static inline int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos) | |
45 | { return 0; } | |
46 | #endif | |
47 | ||
be5a0c12 | 48 | #endif /* __PAT_INTERNAL_H_ */ |