aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/microcode.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/microcode.h')
-rw-r--r--arch/x86/include/asm/microcode.h39
1 files changed, 7 insertions, 32 deletions
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 34e62b1dcfce..1e1b07a5a738 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_X86_MICROCODE_H 1#ifndef _ASM_X86_MICROCODE_H
2#define _ASM_X86_MICROCODE_H 2#define _ASM_X86_MICROCODE_H
3 3
4#include <asm/cpu.h>
4#include <linux/earlycpio.h> 5#include <linux/earlycpio.h>
5 6
6#define native_rdmsr(msr, val1, val2) \ 7#define native_rdmsr(msr, val1, val2) \
@@ -95,14 +96,14 @@ static inline void __exit exit_amd_microcode(void) {}
95 96
96/* 97/*
97 * In early loading microcode phase on BSP, boot_cpu_data is not set up yet. 98 * In early loading microcode phase on BSP, boot_cpu_data is not set up yet.
98 * x86_vendor() gets vendor id for BSP. 99 * x86_cpuid_vendor() gets vendor id for BSP.
99 * 100 *
100 * In 32 bit AP case, accessing boot_cpu_data needs linear address. To simplify 101 * In 32 bit AP case, accessing boot_cpu_data needs linear address. To simplify
101 * coding, we still use x86_vendor() to get vendor id for AP. 102 * coding, we still use x86_cpuid_vendor() to get vendor id for AP.
102 * 103 *
103 * x86_vendor() gets vendor information directly from CPUID. 104 * x86_cpuid_vendor() gets vendor information directly from CPUID.
104 */ 105 */
105static inline int x86_vendor(void) 106static inline int x86_cpuid_vendor(void)
106{ 107{
107 u32 eax = 0x00000000; 108 u32 eax = 0x00000000;
108 u32 ebx, ecx = 0, edx; 109 u32 ebx, ecx = 0, edx;
@@ -118,40 +119,14 @@ static inline int x86_vendor(void)
118 return X86_VENDOR_UNKNOWN; 119 return X86_VENDOR_UNKNOWN;
119} 120}
120 121
121static inline unsigned int __x86_family(unsigned int sig) 122static inline unsigned int x86_cpuid_family(void)
122{
123 unsigned int x86;
124
125 x86 = (sig >> 8) & 0xf;
126
127 if (x86 == 0xf)
128 x86 += (sig >> 20) & 0xff;
129
130 return x86;
131}
132
133static inline unsigned int x86_family(void)
134{ 123{
135 u32 eax = 0x00000001; 124 u32 eax = 0x00000001;
136 u32 ebx, ecx = 0, edx; 125 u32 ebx, ecx = 0, edx;
137 126
138 native_cpuid(&eax, &ebx, &ecx, &edx); 127 native_cpuid(&eax, &ebx, &ecx, &edx);
139 128
140 return __x86_family(eax); 129 return x86_family(eax);
141}
142
143static inline unsigned int x86_model(unsigned int sig)
144{
145 unsigned int x86, model;
146
147 x86 = __x86_family(sig);
148
149 model = (sig >> 4) & 0xf;
150
151 if (x86 == 0x6 || x86 == 0xf)
152 model += ((sig >> 16) & 0xf) << 4;
153
154 return model;
155} 130}
156 131
157#ifdef CONFIG_MICROCODE 132#ifdef CONFIG_MICROCODE