cpu.h 2.1 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
2 3
#ifndef ARCH_X86_CPU_H
#define ARCH_X86_CPU_H
L
Linus Torvalds 已提交
4 5 6

/* attempt to consolidate cpu attributes */
struct cpu_dev {
J
Jaswinder Singh Rajput 已提交
7
	const char	*c_vendor;
L
Linus Torvalds 已提交
8 9

	/* some have two possibilities for cpuid string */
J
Jaswinder Singh Rajput 已提交
10
	const char	*c_ident[2];
L
Linus Torvalds 已提交
11

J
Jaswinder Singh Rajput 已提交
12
	void            (*c_early_init)(struct cpuinfo_x86 *);
B
Borislav Petkov 已提交
13
	void		(*c_bsp_init)(struct cpuinfo_x86 *);
J
Jaswinder Singh Rajput 已提交
14 15
	void		(*c_init)(struct cpuinfo_x86 *);
	void		(*c_identify)(struct cpuinfo_x86 *);
16
	void		(*c_detect_tlb)(struct cpuinfo_x86 *);
17
	void		(*c_bsp_resume)(struct cpuinfo_x86 *);
J
Jaswinder Singh Rajput 已提交
18
	int		c_x86_vendor;
19 20 21 22 23 24 25 26 27 28 29
#ifdef CONFIG_X86_32
	/* Optional vendor specific routine to obtain the cache size. */
	unsigned int	(*legacy_cache_size)(struct cpuinfo_x86 *,
					     unsigned int);

	/* Family/stepping-based lookup table for model names. */
	struct legacy_cpu_model_info {
		int		family;
		const char	*model_names[16];
	}		legacy_models[5];
#endif
L
Linus Torvalds 已提交
30 31
};

32 33 34 35 36 37 38 39
struct _tlb_table {
	unsigned char descriptor;
	char tlb_type;
	unsigned int entries;
	/* unsigned int ways; */
	char info[128];
};

Y
Yinghai Lu 已提交
40
#define cpu_dev_register(cpu_devX) \
41
	static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \
Y
Yinghai Lu 已提交
42 43
	__attribute__((__section__(".x86_cpu_dev.init"))) = \
	&cpu_devX;
L
Linus Torvalds 已提交
44

45 46
extern const struct cpu_dev *const __x86_cpu_dev_start[],
			    *const __x86_cpu_dev_end[];
47

48
extern void get_cpu_cap(struct cpuinfo_x86 *c);
49
extern void get_cpu_address_sizes(struct cpuinfo_x86 *c);
50
extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c);
51 52 53 54
extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
extern u32 get_scattered_cpuid_leaf(unsigned int level,
				    unsigned int sub_leaf,
				    enum cpuid_regs_idx reg);
55
extern void init_intel_cacheinfo(struct cpuinfo_x86 *c);
56 57
extern void init_amd_cacheinfo(struct cpuinfo_x86 *c);

58
extern void detect_num_cpu_cores(struct cpuinfo_x86 *c);
59
extern int detect_extended_topology_early(struct cpuinfo_x86 *c);
60
extern int detect_extended_topology(struct cpuinfo_x86 *c);
61
extern int detect_ht_early(struct cpuinfo_x86 *c);
62
extern void detect_ht(struct cpuinfo_x86 *c);
63 64 65

unsigned int aperfmperf_get_khz(int cpu);

66 67
extern void x86_spec_ctrl_setup_ap(void);

68 69
extern u64 x86_read_arch_cap_msr(void);

70
#endif /* ARCH_X86_CPU_H */