pat_internal.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef __PAT_INTERNAL_H_
  2. #define __PAT_INTERNAL_H_
  3. extern int pat_debug_enable;
  4. #define dprintk(fmt, arg...) \
  5. do { if (pat_debug_enable) printk(KERN_INFO fmt, ##arg); } while (0)
  6. struct memtype {
  7. u64 start;
  8. u64 end;
  9. u64 subtree_max_end;
  10. unsigned long type;
  11. struct rb_node rb;
  12. };
  13. static inline char *cattr_name(unsigned long flags)
  14. {
  15. switch (flags & _PAGE_CACHE_MASK) {
  16. case _PAGE_CACHE_UC: return "uncached";
  17. case _PAGE_CACHE_UC_MINUS: return "uncached-minus";
  18. case _PAGE_CACHE_WB: return "write-back";
  19. case _PAGE_CACHE_WC: return "write-combining";
  20. default: return "broken";
  21. }
  22. }
  23. #ifdef CONFIG_X86_PAT
  24. extern int rbt_memtype_check_insert(struct memtype *new,
  25. unsigned long *new_type);
  26. extern struct memtype *rbt_memtype_erase(u64 start, u64 end);
  27. extern struct memtype *rbt_memtype_lookup(u64 addr);
  28. extern int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos);
  29. #else
  30. static inline int rbt_memtype_check_insert(struct memtype *new,
  31. unsigned long *new_type)
  32. { return 0; }
  33. static inline struct memtype *rbt_memtype_erase(u64 start, u64 end)
  34. { return NULL; }
  35. static inline struct memtype *rbt_memtype_lookup(u64 addr)
  36. { return NULL; }
  37. static inline int rbt_memtype_copy_nth_element(struct memtype *out, loff_t pos)
  38. { return 0; }
  39. #endif
  40. #endif /* __PAT_INTERNAL_H_ */