aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/microcode_amd.c
diff options
context:
space:
mode:
authorAndreas Herrmann <andreas.herrmann3@amd.com>2008-12-16 13:07:47 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-16 13:58:00 -0500
commit3c763fd77e66e55d029052da31df0abd9920cb1e (patch)
tree9c490ea8fc965f4bce2dd62708fcccbcad430bc9 /arch/x86/kernel/microcode_amd.c
parent5279585ff2bedc8180da5bdf8aa3ff1736466de2 (diff)
x86: microcode_amd: fix wrong handling of equivalent CPU id
Impact: fix bug resulting in non-loaded AMD microcode mc_header->processor_rev_id is a 2 byte value. Similar is true for equiv_cpu in an equiv_cpu_entry -- only 2 bytes are of interest. Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/microcode_amd.c')
-rw-r--r--arch/x86/kernel/microcode_amd.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 5f8e5d75a254..b5bc81470bcf 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -62,7 +62,7 @@ struct microcode_header_amd {
62 unsigned int mc_patch_data_checksum; 62 unsigned int mc_patch_data_checksum;
63 unsigned int nb_dev_id; 63 unsigned int nb_dev_id;
64 unsigned int sb_dev_id; 64 unsigned int sb_dev_id;
65 unsigned char processor_rev_id[2]; 65 u16 processor_rev_id;
66 unsigned char nb_rev_id; 66 unsigned char nb_rev_id;
67 unsigned char sb_rev_id; 67 unsigned char sb_rev_id;
68 unsigned char bios_api_rev; 68 unsigned char bios_api_rev;
@@ -125,7 +125,7 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
125 125
126 while (equiv_cpu_table[i].installed_cpu != 0) { 126 while (equiv_cpu_table[i].installed_cpu != 0) {
127 if (current_cpu_id == equiv_cpu_table[i].installed_cpu) { 127 if (current_cpu_id == equiv_cpu_table[i].installed_cpu) {
128 equiv_cpu_id = equiv_cpu_table[i].equiv_cpu; 128 equiv_cpu_id = equiv_cpu_table[i].equiv_cpu & 0xffff;
129 break; 129 break;
130 } 130 }
131 i++; 131 i++;
@@ -137,21 +137,10 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
137 return 0; 137 return 0;
138 } 138 }
139 139
140 if ((mc_header->processor_rev_id[0]) != (equiv_cpu_id & 0xff)) { 140 if (mc_header->processor_rev_id != equiv_cpu_id) {
141 printk(KERN_ERR 141 printk(KERN_ERR "microcode: CPU%d patch does not match "
142 "microcode: CPU%d patch does not match " 142 "(processor_rev_id: %x, eqiv_cpu_id: %x)\n",
143 "(patch is %x, cpu extended is %x) \n", 143 cpu, mc_header->processor_rev_id, equiv_cpu_id);
144 cpu, mc_header->processor_rev_id[0],
145 (equiv_cpu_id & 0xff));
146 return 0;
147 }
148
149 if ((mc_header->processor_rev_id[1]) != ((equiv_cpu_id >> 16) & 0xff)) {
150 printk(KERN_ERR "microcode: CPU%d patch does not match "
151 "(patch is %x, cpu base id is %x) \n",
152 cpu, mc_header->processor_rev_id[1],
153 ((equiv_cpu_id >> 16) & 0xff));
154
155 return 0; 144 return 0;
156 } 145 }
157 146