5 #include <linux/types.h>
6 #include <linux/stddef.h>
8 #define MTRRdefType_MSR 0x2ff
10 #define MTRRfix16K_A0000_MSR 0x259
11 #define MTRRfix4K_C0000_MSR 0x268
12 #define MTRRfix4K_C8000_MSR 0x269
13 #define MTRRfix4K_D0000_MSR 0x26a
14 #define MTRRfix4K_D8000_MSR 0x26b
15 #define MTRRfix4K_E0000_MSR 0x26c
16 #define MTRRfix4K_E8000_MSR 0x26d
17 #define MTRRfix4K_F0000_MSR 0x26e
18 #define MTRRfix4K_F8000_MSR 0x26f
20 #define MTRR_CHANGE_MASK_FIXED 0x01
21 #define MTRR_CHANGE_MASK_VARIABLE 0x02
22 #define MTRR_CHANGE_MASK_DEFTYPE 0x04
24 extern unsigned int mtrr_usage_table
[MTRR_MAX_VAR_RANGES
];
29 // void (*init)(void);
30 void (*set
)(unsigned int reg
, unsigned long base
,
31 unsigned long size
, mtrr_type type
);
32 void (*set_all
)(void);
34 void (*get
)(unsigned int reg
, unsigned long *base
,
35 unsigned long *size
, mtrr_type
* type
);
36 int (*get_free_region
)(unsigned long base
, unsigned long size
,
38 int (*validate_add_page
)(unsigned long base
, unsigned long size
,
40 int (*have_wrcomb
)(void);
43 extern int generic_get_free_region(unsigned long base
, unsigned long size
,
45 extern int generic_validate_add_page(unsigned long base
, unsigned long size
,
48 extern struct mtrr_ops generic_mtrr_ops
;
50 extern int positive_have_wrcomb(void);
52 /* library functions for processor-specific routines */
53 struct set_mtrr_context
{
61 void set_mtrr_done(struct set_mtrr_context
*ctxt
);
62 void set_mtrr_cache_disable(struct set_mtrr_context
*ctxt
);
63 void set_mtrr_prepare_save(struct set_mtrr_context
*ctxt
);
65 void fill_mtrr_var_range(unsigned int index
,
66 u32 base_lo
, u32 base_hi
, u32 mask_lo
, u32 mask_hi
);
67 void get_mtrr_state(void);
69 extern void set_mtrr_ops(struct mtrr_ops
* ops
);
71 extern u64 size_or_mask
, size_and_mask
;
72 extern struct mtrr_ops
* mtrr_if
;
74 #define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
75 #define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1)
77 extern unsigned int num_var_ranges
;
79 extern struct mtrr_state_type mtrr_state
;
81 void mtrr_state_warn(void);
82 const char *mtrr_attrib_to_str(int x
);
83 void mtrr_wrmsr(unsigned, unsigned, unsigned);
85 /* CPU specific mtrr init functions */
86 int amd_init_mtrr(void);
87 int cyrix_init_mtrr(void);
88 int centaur_init_mtrr(void);
90 extern int changed_by_mtrr_cleanup
;
91 extern int mtrr_cleanup(unsigned address_bits
);