xref: /openbmc/linux/arch/x86/lib/cpu.c (revision b830f94f)
1 // SPDX-License-Identifier: GPL-2.0-only
2 #include <linux/types.h>
3 #include <linux/export.h>
4 
5 unsigned int x86_family(unsigned int sig)
6 {
7 	unsigned int x86;
8 
9 	x86 = (sig >> 8) & 0xf;
10 
11 	if (x86 == 0xf)
12 		x86 += (sig >> 20) & 0xff;
13 
14 	return x86;
15 }
16 EXPORT_SYMBOL_GPL(x86_family);
17 
18 unsigned int x86_model(unsigned int sig)
19 {
20 	unsigned int fam, model;
21 
22 	fam = x86_family(sig);
23 
24 	model = (sig >> 4) & 0xf;
25 
26 	if (fam >= 0x6)
27 		model += ((sig >> 16) & 0xf) << 4;
28 
29 	return model;
30 }
31 EXPORT_SYMBOL_GPL(x86_model);
32 
33 unsigned int x86_stepping(unsigned int sig)
34 {
35 	return sig & 0xf;
36 }
37 EXPORT_SYMBOL_GPL(x86_stepping);
38