2010-02-10 22:57:06 +03:00
# ifndef __PAT_INTERNAL_H_
# define __PAT_INTERNAL_H_
extern int pat_debug_enable ;
# define dprintk(fmt, arg...) \
2015-05-26 11:28:11 +03:00
do { if ( pat_debug_enable ) pr_info ( " x86/PAT: " fmt , # # arg ) ; } while ( 0 )
2010-02-10 22:57:06 +03:00
struct memtype {
u64 start ;
u64 end ;
2010-02-11 02:26:07 +03:00
u64 subtree_max_end ;
2014-11-03 16:01:59 +03:00
enum page_cache_mode type ;
2010-02-10 22:57:06 +03:00
struct rb_node rb ;
} ;
2014-11-03 16:01:59 +03:00
static inline char * cattr_name ( enum page_cache_mode pcm )
2010-02-10 22:57:06 +03:00
{
2014-11-03 16:01:59 +03:00
switch ( pcm ) {
case _PAGE_CACHE_MODE_UC : return " uncached " ;
case _PAGE_CACHE_MODE_UC_MINUS : return " uncached-minus " ;
case _PAGE_CACHE_MODE_WB : return " write-back " ;
case _PAGE_CACHE_MODE_WC : return " write-combining " ;
case _PAGE_CACHE_MODE_WT : return " write-through " ;
case _PAGE_CACHE_MODE_WP : return " write-protected " ;
default : return " broken " ;
2010-02-10 22:57:06 +03:00
}
}
2010-02-11 02:26:07 +03:00
# ifdef CONFIG_X86_PAT
extern int rbt_memtype_check_insert ( struct memtype * new ,
2014-11-03 16:01:59 +03:00
enum page_cache_mode * new_type ) ;
2010-05-26 05:51:10 +04:00
extern struct memtype * rbt_memtype_erase ( u64 start , u64 end ) ;
2010-02-11 02:26:07 +03:00
extern struct memtype * rbt_memtype_lookup ( u64 addr ) ;
extern int rbt_memtype_copy_nth_element ( struct memtype * out , loff_t pos ) ;
# else
static inline int rbt_memtype_check_insert ( struct memtype * new ,
2014-11-03 16:01:59 +03:00
enum page_cache_mode * new_type )
2010-02-11 02:26:07 +03:00
{ return 0 ; }
2010-05-26 05:51:10 +04:00
static inline struct memtype * rbt_memtype_erase ( u64 start , u64 end )
{ return NULL ; }
2010-02-11 02:26:07 +03:00
static inline struct memtype * rbt_memtype_lookup ( u64 addr )
{ return NULL ; }
static inline int rbt_memtype_copy_nth_element ( struct memtype * out , loff_t pos )
{ return 0 ; }
# endif
2010-02-10 22:57:06 +03:00
# endif /* __PAT_INTERNAL_H_ */