PageRenderTime 12ms CodeModel.GetById 5ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/x86/kernel/cpu/mtrr/mtrr.h

https://bitbucket.org/thekraven/iscream_thunderc-2.6.35
C++ Header | 78 lines | 55 code | 18 blank | 5 comment | 4 complexity | c4449b8571ffabe71bf07ed849ee777c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
 1/*
 2 * local MTRR defines.
 3 */
 4
 5#include <linux/types.h>
 6#include <linux/stddef.h>
 7
 8#define MTRR_CHANGE_MASK_FIXED     0x01
 9#define MTRR_CHANGE_MASK_VARIABLE  0x02
10#define MTRR_CHANGE_MASK_DEFTYPE   0x04
11
12extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
13
14struct mtrr_ops {
15	u32	vendor;
16	u32	use_intel_if;
17	void	(*set)(unsigned int reg, unsigned long base,
18		       unsigned long size, mtrr_type type);
19	void	(*set_all)(void);
20
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,
24				   int replace_reg);
25	int	(*validate_add_page)(unsigned long base, unsigned long size,
26				     unsigned int type);
27	int	(*have_wrcomb)(void);
28};
29
30extern int generic_get_free_region(unsigned long base, unsigned long size,
31				   int replace_reg);
32extern int generic_validate_add_page(unsigned long base, unsigned long size,
33				     unsigned int type);
34
35extern const struct mtrr_ops generic_mtrr_ops;
36
37extern int positive_have_wrcomb(void);
38
39/* library functions for processor-specific routines */
40struct set_mtrr_context {
41	unsigned long	flags;
42	unsigned long	cr4val;
43	u32		deftype_lo;
44	u32		deftype_hi;
45	u32		ccr3;
46};
47
48void set_mtrr_done(struct set_mtrr_context *ctxt);
49void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
50void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
51
52void fill_mtrr_var_range(unsigned int index,
53		u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);
54void get_mtrr_state(void);
55
56extern void set_mtrr_ops(const struct mtrr_ops *ops);
57
58extern u64 size_or_mask, size_and_mask;
59extern const struct mtrr_ops *mtrr_if;
60
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)
63
64extern unsigned int num_var_ranges;
65extern u64 mtrr_tom2;
66extern struct mtrr_state_type mtrr_state;
67
68void mtrr_state_warn(void);
69const char *mtrr_attrib_to_str(int x);
70void mtrr_wrmsr(unsigned, unsigned, unsigned);
71
72/* CPU specific mtrr init functions */
73int amd_init_mtrr(void);
74int cyrix_init_mtrr(void);
75int centaur_init_mtrr(void);
76
77extern int changed_by_mtrr_cleanup;
78extern int mtrr_cleanup(unsigned address_bits);