diff options
Diffstat (limited to 'arch/x86/kernel/cpu/mtrr/mtrr.h')
-rw-r--r-- | arch/x86/kernel/cpu/mtrr/mtrr.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h new file mode 100644 index 000000000000..289dfe6030e3 --- /dev/null +++ b/arch/x86/kernel/cpu/mtrr/mtrr.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * local mtrr defines. | ||
3 | */ | ||
4 | |||
5 | #ifndef TRUE | ||
6 | #define TRUE 1 | ||
7 | #define FALSE 0 | ||
8 | #endif | ||
9 | |||
10 | #define MTRRcap_MSR 0x0fe | ||
11 | #define MTRRdefType_MSR 0x2ff | ||
12 | |||
13 | #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) | ||
14 | #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1) | ||
15 | |||
16 | #define NUM_FIXED_RANGES 88 | ||
17 | #define MTRRfix64K_00000_MSR 0x250 | ||
18 | #define MTRRfix16K_80000_MSR 0x258 | ||
19 | #define MTRRfix16K_A0000_MSR 0x259 | ||
20 | #define MTRRfix4K_C0000_MSR 0x268 | ||
21 | #define MTRRfix4K_C8000_MSR 0x269 | ||
22 | #define MTRRfix4K_D0000_MSR 0x26a | ||
23 | #define MTRRfix4K_D8000_MSR 0x26b | ||
24 | #define MTRRfix4K_E0000_MSR 0x26c | ||
25 | #define MTRRfix4K_E8000_MSR 0x26d | ||
26 | #define MTRRfix4K_F0000_MSR 0x26e | ||
27 | #define MTRRfix4K_F8000_MSR 0x26f | ||
28 | |||
29 | #define MTRR_CHANGE_MASK_FIXED 0x01 | ||
30 | #define MTRR_CHANGE_MASK_VARIABLE 0x02 | ||
31 | #define MTRR_CHANGE_MASK_DEFTYPE 0x04 | ||
32 | |||
33 | /* In the Intel processor's MTRR interface, the MTRR type is always held in | ||
34 | an 8 bit field: */ | ||
35 | typedef u8 mtrr_type; | ||
36 | |||
37 | struct mtrr_ops { | ||
38 | u32 vendor; | ||
39 | u32 use_intel_if; | ||
40 | // void (*init)(void); | ||
41 | void (*set)(unsigned int reg, unsigned long base, | ||
42 | unsigned long size, mtrr_type type); | ||
43 | void (*set_all)(void); | ||
44 | |||
45 | void (*get)(unsigned int reg, unsigned long *base, | ||
46 | unsigned long *size, mtrr_type * type); | ||
47 | int (*get_free_region)(unsigned long base, unsigned long size, | ||
48 | int replace_reg); | ||
49 | int (*validate_add_page)(unsigned long base, unsigned long size, | ||
50 | unsigned int type); | ||
51 | int (*have_wrcomb)(void); | ||
52 | }; | ||
53 | |||
54 | extern int generic_get_free_region(unsigned long base, unsigned long size, | ||
55 | int replace_reg); | ||
56 | extern int generic_validate_add_page(unsigned long base, unsigned long size, | ||
57 | unsigned int type); | ||
58 | |||
59 | extern struct mtrr_ops generic_mtrr_ops; | ||
60 | |||
61 | extern int positive_have_wrcomb(void); | ||
62 | |||
63 | /* library functions for processor-specific routines */ | ||
64 | struct set_mtrr_context { | ||
65 | unsigned long flags; | ||
66 | unsigned long cr4val; | ||
67 | u32 deftype_lo; | ||
68 | u32 deftype_hi; | ||
69 | u32 ccr3; | ||
70 | }; | ||
71 | |||
72 | struct mtrr_var_range { | ||
73 | u32 base_lo; | ||
74 | u32 base_hi; | ||
75 | u32 mask_lo; | ||
76 | u32 mask_hi; | ||
77 | }; | ||
78 | |||
79 | void set_mtrr_done(struct set_mtrr_context *ctxt); | ||
80 | void set_mtrr_cache_disable(struct set_mtrr_context *ctxt); | ||
81 | void set_mtrr_prepare_save(struct set_mtrr_context *ctxt); | ||
82 | |||
83 | void get_mtrr_state(void); | ||
84 | |||
85 | extern void set_mtrr_ops(struct mtrr_ops * ops); | ||
86 | |||
87 | extern u64 size_or_mask, size_and_mask; | ||
88 | extern struct mtrr_ops * mtrr_if; | ||
89 | |||
90 | #define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd) | ||
91 | #define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1) | ||
92 | |||
93 | extern unsigned int num_var_ranges; | ||
94 | |||
95 | void mtrr_state_warn(void); | ||
96 | const char *mtrr_attrib_to_str(int x); | ||
97 | void mtrr_wrmsr(unsigned, unsigned, unsigned); | ||
98 | |||