blob: a739bfc40690b77537ca774b74092fe1beefdcce [file] [log] [blame]
venkatesh.pallipadi@intel.combe5a0c12010-02-10 11:57:06 -08001#ifndef __PAT_INTERNAL_H_
2#define __PAT_INTERNAL_H_
3
4extern int pat_debug_enable;
5
6#define dprintk(fmt, arg...) \
Luis R. Rodriguez9e765612015-05-26 10:28:11 +02007 do { if (pat_debug_enable) pr_info("x86/PAT: " fmt, ##arg); } while (0)
venkatesh.pallipadi@intel.combe5a0c12010-02-10 11:57:06 -08008
9struct memtype {
10 u64 start;
11 u64 end;
Pallipadi, Venkatesh9e41a492010-02-10 15:26:07 -080012 u64 subtree_max_end;
Juergen Grosse00c8cc2014-11-03 14:01:59 +010013 enum page_cache_mode type;
venkatesh.pallipadi@intel.combe5a0c12010-02-10 11:57:06 -080014 struct rb_node rb;
15};
16
Juergen Grosse00c8cc2014-11-03 14:01:59 +010017static inline char *cattr_name(enum page_cache_mode pcm)
venkatesh.pallipadi@intel.combe5a0c12010-02-10 11:57:06 -080018{
Juergen Grosse00c8cc2014-11-03 14:01:59 +010019 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.combe5a0c12010-02-10 11:57:06 -080027 }
28}
29
Pallipadi, Venkatesh9e41a492010-02-10 15:26:07 -080030#ifdef CONFIG_X86_PAT
31extern int rbt_memtype_check_insert(struct memtype *new,
Juergen Grosse00c8cc2014-11-03 14:01:59 +010032 enum page_cache_mode *new_type);
Xiaotian Feng20413f22010-05-26 09:51:10 +080033extern struct memtype *rbt_memtype_erase(u64 start, u64 end);
Pallipadi, Venkatesh9e41a492010-02-10 15:26:07 -080034extern struct memtype *rbt_memtype_lookup(u64 addr);
35extern int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos);
36#else
37static inline int rbt_memtype_check_insert(struct memtype *new,
Juergen Grosse00c8cc2014-11-03 14:01:59 +010038 enum page_cache_mode *new_type)
Pallipadi, Venkatesh9e41a492010-02-10 15:26:07 -080039{ return 0; }
Xiaotian Feng20413f22010-05-26 09:51:10 +080040static inline struct memtype *rbt_memtype_erase(u64 start, u64 end)
41{ return NULL; }
Pallipadi, Venkatesh9e41a492010-02-10 15:26:07 -080042static inline struct memtype *rbt_memtype_lookup(u64 addr)
43{ return NULL; }
44static inline int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos)
45{ return 0; }
46#endif
47
venkatesh.pallipadi@intel.combe5a0c12010-02-10 11:57:06 -080048#endif /* __PAT_INTERNAL_H_ */