Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mtrr.h
Go to the documentation of this file.
1 /*
2  * local MTRR defines.
3  */
4 
5 #include <linux/types.h>
6 #include <linux/stddef.h>
7 
8 #define MTRR_CHANGE_MASK_FIXED 0x01
9 #define MTRR_CHANGE_MASK_VARIABLE 0x02
10 #define MTRR_CHANGE_MASK_DEFTYPE 0x04
11 
12 extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
13 
14 struct mtrr_ops {
17  void (*set)(unsigned int reg, unsigned long base,
18  unsigned long size, mtrr_type type);
20 
21  void (*get)(unsigned int reg, unsigned long *base,
22  unsigned long *size, mtrr_type *type);
23  int (*get_free_region)(unsigned long base, unsigned long size,
24  int replace_reg);
25  int (*validate_add_page)(unsigned long base, unsigned long size,
26  unsigned int type);
28 };
29 
30 extern int generic_get_free_region(unsigned long base, unsigned long size,
31  int replace_reg);
32 extern int generic_validate_add_page(unsigned long base, unsigned long size,
33  unsigned int type);
34 
35 extern const struct mtrr_ops generic_mtrr_ops;
36 
37 extern int positive_have_wrcomb(void);
38 
39 /* library functions for processor-specific routines */
41  unsigned long flags;
42  unsigned long cr4val;
46 };
47 
48 void set_mtrr_done(struct set_mtrr_context *ctxt);
49 void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
50 void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
51 
52 void fill_mtrr_var_range(unsigned int index,
53  u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);
54 void get_mtrr_state(void);
55 
56 extern void set_mtrr_ops(const struct mtrr_ops *ops);
57 
59 extern const struct mtrr_ops *mtrr_if;
60 
61 #define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
62 #define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1)
63 
64 extern unsigned int num_var_ranges;
65 extern u64 mtrr_tom2;
66 extern struct mtrr_state_type mtrr_state;
67 
68 void mtrr_state_warn(void);
69 const char *mtrr_attrib_to_str(int x);
70 void mtrr_wrmsr(unsigned, unsigned, unsigned);
71 
72 /* CPU specific mtrr init functions */
73 int amd_init_mtrr(void);
74 int cyrix_init_mtrr(void);
75 int centaur_init_mtrr(void);
76 
77 extern int changed_by_mtrr_cleanup;
78 extern int mtrr_cleanup(unsigned address_bits);