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
];
17 void (*set
)(unsigned int reg
, unsigned long base
,
18 unsigned long size
, mtrr_type type
);
19 void (*set_all
)(void);
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
,
25 int (*validate_add_page
)(unsigned long base
, unsigned long size
,
27 int (*have_wrcomb
)(void);
30 extern int generic_get_free_region(unsigned long base
, unsigned long size
,
32 extern int generic_validate_add_page(unsigned long base
, unsigned long size
,
35 extern const struct mtrr_ops generic_mtrr_ops
;
37 extern int positive_have_wrcomb(void);
39 /* library functions for processor-specific routines */
40 struct set_mtrr_context
{
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
);
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);
56 extern void set_mtrr_ops(const struct mtrr_ops
*ops
);
58 extern u64 size_or_mask
, size_and_mask
;
59 extern const struct mtrr_ops
*mtrr_if
;
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)
64 extern unsigned int num_var_ranges
;
66 extern struct mtrr_state_type mtrr_state
;
68 void mtrr_state_warn(void);
69 const char *mtrr_attrib_to_str(int x
);
70 void mtrr_wrmsr(unsigned, unsigned, unsigned);
72 /* CPU specific mtrr init functions */
73 int amd_init_mtrr(void);
74 int cyrix_init_mtrr(void);
75 int centaur_init_mtrr(void);
77 extern int changed_by_mtrr_cleanup
;
78 extern int mtrr_cleanup(unsigned address_bits
);