Paul Gortmaker | e683014 | 2016-07-13 20:18:57 -0400 | [diff] [blame] | 1 | #include <linux/types.h> |
| 2 | #include <linux/export.h> |
Borislav Petkov | 99f925c | 2015-11-23 11:12:21 +0100 | [diff] [blame] | 3 | |
| 4 | unsigned int x86_family(unsigned int sig) |
| 5 | { |
| 6 | unsigned int x86; |
| 7 | |
| 8 | x86 = (sig >> 8) & 0xf; |
| 9 | |
| 10 | if (x86 == 0xf) |
| 11 | x86 += (sig >> 20) & 0xff; |
| 12 | |
| 13 | return x86; |
| 14 | } |
| 15 | EXPORT_SYMBOL_GPL(x86_family); |
| 16 | |
| 17 | unsigned int x86_model(unsigned int sig) |
| 18 | { |
| 19 | unsigned int fam, model; |
| 20 | |
Jia Zhang | b399151 | 2018-01-01 09:52:10 +0800 | [diff] [blame] | 21 | fam = x86_family(sig); |
Borislav Petkov | 99f925c | 2015-11-23 11:12:21 +0100 | [diff] [blame] | 22 | |
| 23 | model = (sig >> 4) & 0xf; |
| 24 | |
| 25 | if (fam >= 0x6) |
| 26 | model += ((sig >> 16) & 0xf) << 4; |
| 27 | |
| 28 | return model; |
| 29 | } |
| 30 | EXPORT_SYMBOL_GPL(x86_model); |
| 31 | |
| 32 | unsigned int x86_stepping(unsigned int sig) |
| 33 | { |
| 34 | return sig & 0xf; |
| 35 | } |
| 36 | EXPORT_SYMBOL_GPL(x86_stepping); |