venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 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; |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 12 | u64 subtree_max_end; |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 13 | unsigned long type; |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 14 | struct rb_node rb; |
| 15 | }; |
| 16 | |
| 17 | static inline char *cattr_name(unsigned long flags) |
| 18 | { |
| 19 | switch (flags & _PAGE_CACHE_MASK) { |
| 20 | case _PAGE_CACHE_UC: return "uncached"; |
| 21 | case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; |
| 22 | case _PAGE_CACHE_WB: return "write-back"; |
| 23 | case _PAGE_CACHE_WC: return "write-combining"; |
| 24 | default: return "broken"; |
| 25 | } |
| 26 | } |
| 27 | |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 28 | #ifdef CONFIG_X86_PAT |
| 29 | extern int rbt_memtype_check_insert(struct memtype *new, |
| 30 | unsigned long *new_type); |
Xiaotian Feng | 20413f2 | 2010-05-26 09:51:10 +0800 | [diff] [blame] | 31 | extern struct memtype *rbt_memtype_erase(u64 start, u64 end); |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 32 | extern struct memtype *rbt_memtype_lookup(u64 addr); |
| 33 | extern int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos); |
| 34 | #else |
| 35 | static inline int rbt_memtype_check_insert(struct memtype *new, |
| 36 | unsigned long *new_type) |
| 37 | { return 0; } |
Xiaotian Feng | 20413f2 | 2010-05-26 09:51:10 +0800 | [diff] [blame] | 38 | static inline struct memtype *rbt_memtype_erase(u64 start, u64 end) |
| 39 | { return NULL; } |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 40 | static inline struct memtype *rbt_memtype_lookup(u64 addr) |
| 41 | { return NULL; } |
| 42 | static inline int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos) |
| 43 | { return 0; } |
| 44 | #endif |
| 45 | |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 46 | #endif /* __PAT_INTERNAL_H_ */ |