x86, mtrr: replace MTRRdefType_MSR with msr-index's MSR_MTRRdefType
[linux-2.6/mini2440.git] / arch / x86 / kernel / cpu / mtrr / mtrr.h
blob7538b767f2060ed4727bb992f665b87e629b1bc5
1 /*
2 * local mtrr defines.
3 */
5 #include <linux/types.h>
6 #include <linux/stddef.h>
8 #define MTRR_CHANGE_MASK_FIXED 0x01
9 #define MTRR_CHANGE_MASK_VARIABLE 0x02
10 #define MTRR_CHANGE_MASK_DEFTYPE 0x04
12 extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
14 struct mtrr_ops {
15 u32 vendor;
16 u32 use_intel_if;
17 // void (*init)(void);
18 void (*set)(unsigned int reg, unsigned long base,
19 unsigned long size, mtrr_type type);
20 void (*set_all)(void);
22 void (*get)(unsigned int reg, unsigned long *base,
23 unsigned long *size, mtrr_type * type);
24 int (*get_free_region)(unsigned long base, unsigned long size,
25 int replace_reg);
26 int (*validate_add_page)(unsigned long base, unsigned long size,
27 unsigned int type);
28 int (*have_wrcomb)(void);
31 extern int generic_get_free_region(unsigned long base, unsigned long size,
32 int replace_reg);
33 extern int generic_validate_add_page(unsigned long base, unsigned long size,
34 unsigned int type);
36 extern struct mtrr_ops generic_mtrr_ops;
38 extern int positive_have_wrcomb(void);
40 /* library functions for processor-specific routines */
41 struct set_mtrr_context {
42 unsigned long flags;
43 unsigned long cr4val;
44 u32 deftype_lo;
45 u32 deftype_hi;
46 u32 ccr3;
49 void set_mtrr_done(struct set_mtrr_context *ctxt);
50 void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
51 void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
53 void fill_mtrr_var_range(unsigned int index,
54 u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);
55 void get_mtrr_state(void);
57 extern void set_mtrr_ops(struct mtrr_ops * ops);
59 extern u64 size_or_mask, size_and_mask;
60 extern struct mtrr_ops * mtrr_if;
62 #define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
63 #define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1)
65 extern unsigned int num_var_ranges;
66 extern u64 mtrr_tom2;
67 extern struct mtrr_state_type mtrr_state;
69 void mtrr_state_warn(void);
70 const char *mtrr_attrib_to_str(int x);
71 void mtrr_wrmsr(unsigned, unsigned, unsigned);
73 /* CPU specific mtrr init functions */
74 int amd_init_mtrr(void);
75 int cyrix_init_mtrr(void);
76 int centaur_init_mtrr(void);
78 extern int changed_by_mtrr_cleanup;
79 extern int mtrr_cleanup(unsigned address_bits);