mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
b399151cb4
x86_mask is a confusing name which is hard to associate with the processor's stepping. Additionally, correct an indent issue in lib/cpu.c. Signed-off-by: Jia Zhang <qianyue.zj@alibaba-inc.com> [ Updated it to more recent kernels. ] Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: bp@alien8.de Cc: tony.luck@intel.com Link: http://lkml.kernel.org/r/1514771530-70829-1-git-send-email-qianyue.zj@alibaba-inc.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
37 lines
562 B
C
37 lines
562 B
C
#include <linux/types.h>
|
|
#include <linux/export.h>
|
|
|
|
unsigned int x86_family(unsigned int sig)
|
|
{
|
|
unsigned int x86;
|
|
|
|
x86 = (sig >> 8) & 0xf;
|
|
|
|
if (x86 == 0xf)
|
|
x86 += (sig >> 20) & 0xff;
|
|
|
|
return x86;
|
|
}
|
|
EXPORT_SYMBOL_GPL(x86_family);
|
|
|
|
unsigned int x86_model(unsigned int sig)
|
|
{
|
|
unsigned int fam, model;
|
|
|
|
fam = x86_family(sig);
|
|
|
|
model = (sig >> 4) & 0xf;
|
|
|
|
if (fam >= 0x6)
|
|
model += ((sig >> 16) & 0xf) << 4;
|
|
|
|
return model;
|
|
}
|
|
EXPORT_SYMBOL_GPL(x86_model);
|
|
|
|
unsigned int x86_stepping(unsigned int sig)
|
|
{
|
|
return sig & 0xf;
|
|
}
|
|
EXPORT_SYMBOL_GPL(x86_stepping);
|