atmel_serial: fix bugs in probe() error path and remove()
[pv_ops_mirror.git] / arch / x86 / kernel / cpu / mtrr / mtrr.h
blob2cc77eb6fea36967f7defdbae74359ebaac14ebb
1 /*
2 * local mtrr defines.
3 */
5 #include <linux/types.h>
6 #include <linux/stddef.h>
8 #define MTRRcap_MSR 0x0fe
9 #define MTRRdefType_MSR 0x2ff
11 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
12 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
14 #define NUM_FIXED_RANGES 88
15 #define MAX_VAR_RANGES 256
16 #define MTRRfix64K_00000_MSR 0x250
17 #define MTRRfix16K_80000_MSR 0x258
18 #define MTRRfix16K_A0000_MSR 0x259
19 #define MTRRfix4K_C0000_MSR 0x268
20 #define MTRRfix4K_C8000_MSR 0x269
21 #define MTRRfix4K_D0000_MSR 0x26a
22 #define MTRRfix4K_D8000_MSR 0x26b
23 #define MTRRfix4K_E0000_MSR 0x26c
24 #define MTRRfix4K_E8000_MSR 0x26d
25 #define MTRRfix4K_F0000_MSR 0x26e
26 #define MTRRfix4K_F8000_MSR 0x26f
28 #define MTRR_CHANGE_MASK_FIXED 0x01
29 #define MTRR_CHANGE_MASK_VARIABLE 0x02
30 #define MTRR_CHANGE_MASK_DEFTYPE 0x04
32 /* In the Intel processor's MTRR interface, the MTRR type is always held in
33 an 8 bit field: */
34 typedef u8 mtrr_type;
36 extern unsigned int mtrr_usage_table[MAX_VAR_RANGES];
38 struct mtrr_ops {
39 u32 vendor;
40 u32 use_intel_if;
41 // void (*init)(void);
42 void (*set)(unsigned int reg, unsigned long base,
43 unsigned long size, mtrr_type type);
44 void (*set_all)(void);
46 void (*get)(unsigned int reg, unsigned long *base,
47 unsigned long *size, mtrr_type * type);
48 int (*get_free_region)(unsigned long base, unsigned long size,
49 int replace_reg);
50 int (*validate_add_page)(unsigned long base, unsigned long size,
51 unsigned int type);
52 int (*have_wrcomb)(void);
55 extern int generic_get_free_region(unsigned long base, unsigned long size,
56 int replace_reg);
57 extern int generic_validate_add_page(unsigned long base, unsigned long size,
58 unsigned int type);
60 extern struct mtrr_ops generic_mtrr_ops;
62 extern int positive_have_wrcomb(void);
64 /* library functions for processor-specific routines */
65 struct set_mtrr_context {
66 unsigned long flags;
67 unsigned long cr4val;
68 u32 deftype_lo;
69 u32 deftype_hi;
70 u32 ccr3;
73 struct mtrr_var_range {
74 u32 base_lo;
75 u32 base_hi;
76 u32 mask_lo;
77 u32 mask_hi;
80 void set_mtrr_done(struct set_mtrr_context *ctxt);
81 void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
82 void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
84 void get_mtrr_state(void);
86 extern void set_mtrr_ops(struct mtrr_ops * ops);
88 extern u64 size_or_mask, size_and_mask;
89 extern struct mtrr_ops * mtrr_if;
91 #define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
92 #define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1)
94 extern unsigned int num_var_ranges;
96 void mtrr_state_warn(void);
97 const char *mtrr_attrib_to_str(int x);
98 void mtrr_wrmsr(unsigned, unsigned, unsigned);
100 /* CPU specific mtrr init functions */
101 int amd_init_mtrr(void);
102 int cyrix_init_mtrr(void);
103 int centaur_init_mtrr(void);