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...) \ |
Luis R. Rodriguez | 9e76561 | 2015-05-26 10:28:11 +0200 | [diff] [blame] | 7 | do { if (pat_debug_enable) pr_info("x86/PAT: " fmt, ##arg); } while (0) |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 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; |
Juergen Gross | e00c8cc | 2014-11-03 14:01:59 +0100 | [diff] [blame] | 13 | enum page_cache_mode type; |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 14 | struct rb_node rb; |
| 15 | }; |
| 16 | |
Juergen Gross | e00c8cc | 2014-11-03 14:01:59 +0100 | [diff] [blame] | 17 | static inline char *cattr_name(enum page_cache_mode pcm) |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 18 | { |
Juergen Gross | e00c8cc | 2014-11-03 14:01:59 +0100 | [diff] [blame] | 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"; |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 27 | } |
| 28 | } |
| 29 | |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 30 | #ifdef CONFIG_X86_PAT |
| 31 | extern int rbt_memtype_check_insert(struct memtype *new, |
Juergen Gross | e00c8cc | 2014-11-03 14:01:59 +0100 | [diff] [blame] | 32 | enum page_cache_mode *new_type); |
Xiaotian Feng | 20413f2 | 2010-05-26 09:51:10 +0800 | [diff] [blame] | 33 | extern struct memtype *rbt_memtype_erase(u64 start, u64 end); |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 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, |
Juergen Gross | e00c8cc | 2014-11-03 14:01:59 +0100 | [diff] [blame] | 38 | enum page_cache_mode *new_type) |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 39 | { return 0; } |
Xiaotian Feng | 20413f2 | 2010-05-26 09:51:10 +0800 | [diff] [blame] | 40 | static inline struct memtype *rbt_memtype_erase(u64 start, u64 end) |
| 41 | { return NULL; } |
Pallipadi, Venkatesh | 9e41a49 | 2010-02-10 15:26:07 -0800 | [diff] [blame] | 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 | |
venkatesh.pallipadi@intel.com | be5a0c1 | 2010-02-10 11:57:06 -0800 | [diff] [blame] | 48 | #endif /* __PAT_INTERNAL_H_ */ |