blob: 62058e9c8b4ed9951468a8ca91815aeb948e30e6 [file] [log] [blame]
Peter Oruba80cc9f12008-07-28 18:44:22 +02001/*
2 * AMD CPU Microcode Update Driver for Linux
3 * Copyright (C) 2008 Advanced Micro Devices Inc.
4 *
5 * Author: Peter Oruba <peter.oruba@amd.com>
6 *
7 * Based on work by:
8 * Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
9 *
10 * This driver allows to upgrade microcode on AMD
11 * family 0x10 and 0x11 processors.
12 *
13 * Licensed unter the terms of the GNU General Public
14 * License version 2. See file COPYING for details.
15*/
16
17#include <linux/capability.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/sched.h>
21#include <linux/cpumask.h>
22#include <linux/module.h>
23#include <linux/slab.h>
24#include <linux/vmalloc.h>
25#include <linux/miscdevice.h>
26#include <linux/spinlock.h>
27#include <linux/mm.h>
28#include <linux/fs.h>
29#include <linux/mutex.h>
30#include <linux/cpu.h>
31#include <linux/firmware.h>
32#include <linux/platform_device.h>
33#include <linux/pci.h>
34#include <linux/pci_ids.h>
35
36#include <asm/msr.h>
37#include <asm/uaccess.h>
38#include <asm/processor.h>
39#include <asm/microcode.h>
40
41MODULE_DESCRIPTION("AMD Microcode Update Driver");
42MODULE_AUTHOR("Peter Oruba <peter.oruba@amd.com>");
Ingo Molnar5d7b6052008-07-29 10:07:36 +020043MODULE_LICENSE("GPL v2");
Peter Oruba80cc9f12008-07-28 18:44:22 +020044
45#define UCODE_MAGIC 0x00414d44
46#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
47#define UCODE_UCODE_TYPE 0x00000001
48
Dmitry Adamushko18dbc912008-09-23 12:08:44 +020049struct equiv_cpu_entry {
50 unsigned int installed_cpu;
51 unsigned int fixed_errata_mask;
52 unsigned int fixed_errata_compare;
53 unsigned int equiv_cpu;
54};
55
56struct microcode_header_amd {
57 unsigned int data_code;
58 unsigned int patch_id;
59 unsigned char mc_patch_data_id[2];
60 unsigned char mc_patch_data_len;
61 unsigned char init_flag;
62 unsigned int mc_patch_data_checksum;
63 unsigned int nb_dev_id;
64 unsigned int sb_dev_id;
65 unsigned char processor_rev_id[2];
66 unsigned char nb_rev_id;
67 unsigned char sb_rev_id;
68 unsigned char bios_api_rev;
69 unsigned char reserved1[3];
70 unsigned int match_reg[8];
71};
72
73struct microcode_amd {
74 struct microcode_header_amd hdr;
75 unsigned int mpb[0];
76};
77
Peter Oruba80cc9f12008-07-28 18:44:22 +020078#define UCODE_MAX_SIZE (2048)
Peter Orubaa0ac87d2008-07-29 17:41:04 +020079#define DEFAULT_UCODE_DATASIZE (896)
80#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd))
81#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE)
Peter Oruba80cc9f12008-07-28 18:44:22 +020082#define DWSIZE (sizeof(u32))
83/* For now we support a fixed ucode total size only */
84#define get_totalsize(mc) \
85 ((((struct microcode_amd *)mc)->hdr.mc_patch_data_len * 28) \
86 + MC_HEADER_SIZE)
87
Peter Oruba80cc9f12008-07-28 18:44:22 +020088/* serialize access to the physical write */
89static DEFINE_SPINLOCK(microcode_update_lock);
90
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020091static struct equiv_cpu_entry *equiv_cpu_table;
Peter Oruba80cc9f12008-07-28 18:44:22 +020092
Dmitry Adamushkod45de402008-08-20 00:22:26 +020093static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
Peter Oruba80cc9f12008-07-28 18:44:22 +020094{
95 struct cpuinfo_x86 *c = &cpu_data(cpu);
Peter Oruba80cc9f12008-07-28 18:44:22 +020096
Dmitry Adamushkod45de402008-08-20 00:22:26 +020097 memset(csig, 0, sizeof(*csig));
Peter Oruba80cc9f12008-07-28 18:44:22 +020098
99 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
100 printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n",
101 cpu);
Dmitry Adamushkod45de402008-08-20 00:22:26 +0200102 return -1;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200103 }
104
105 asm volatile("movl %1, %%ecx; rdmsr"
Dmitry Adamushkod45de402008-08-20 00:22:26 +0200106 : "=a" (csig->rev)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200107 : "i" (0x0000008B) : "ecx");
108
109 printk(KERN_INFO "microcode: collect_cpu_info_amd : patch_id=0x%x\n",
Dmitry Adamushkod45de402008-08-20 00:22:26 +0200110 csig->rev);
111
112 return 0;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200113}
114
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200115static int get_matching_microcode(int cpu, void *mc, int rev)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200116{
Peter Oruba80cc9f12008-07-28 18:44:22 +0200117 struct microcode_header_amd *mc_header = mc;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200118 struct pci_dev *nb_pci_dev, *sb_pci_dev;
119 unsigned int current_cpu_id;
120 unsigned int equiv_cpu_id = 0x00;
121 unsigned int i = 0;
122
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200123 /*
Ingo Molnara1c75cc2008-09-14 14:50:26 +0200124 * FIXME! dimm: do we need this? Why an update via /dev/... is different
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200125 * from the one via firmware?
126 *
127 * This is a tricky part. We might be called from a write operation
128 * to the device file instead of the usual process of firmware
129 * loading. This routine needs to be able to distinguish both
130 * cases. This is done by checking if there alread is a equivalent
131 * CPU table installed. If not, we're written through
132 * /dev/cpu/microcode.
133 * Since we ignore all checks. The error case in which going through
134 * firmware loading and that table is not loaded has already been
135 * checked earlier.
136 */
137 BUG_ON(equiv_cpu_table == NULL);
138#if 0
Peter Oruba80cc9f12008-07-28 18:44:22 +0200139 if (equiv_cpu_table == NULL) {
140 printk(KERN_INFO "microcode: CPU%d microcode update with "
141 "version 0x%x (current=0x%x)\n",
Dmitry Adamushkod45de402008-08-20 00:22:26 +0200142 cpu, mc_header->patch_id, uci->cpu_sig.rev);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200143 goto out;
144 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200145#endif
Peter Oruba80cc9f12008-07-28 18:44:22 +0200146 current_cpu_id = cpuid_eax(0x00000001);
147
148 while (equiv_cpu_table[i].installed_cpu != 0) {
149 if (current_cpu_id == equiv_cpu_table[i].installed_cpu) {
150 equiv_cpu_id = equiv_cpu_table[i].equiv_cpu;
151 break;
152 }
153 i++;
154 }
155
156 if (!equiv_cpu_id) {
157 printk(KERN_ERR "microcode: CPU%d cpu_id "
158 "not found in equivalent cpu table \n", cpu);
159 return 0;
160 }
161
162 if ((mc_header->processor_rev_id[0]) != (equiv_cpu_id & 0xff)) {
163 printk(KERN_ERR
164 "microcode: CPU%d patch does not match "
165 "(patch is %x, cpu extended is %x) \n",
166 cpu, mc_header->processor_rev_id[0],
167 (equiv_cpu_id & 0xff));
168 return 0;
169 }
170
171 if ((mc_header->processor_rev_id[1]) != ((equiv_cpu_id >> 16) & 0xff)) {
172 printk(KERN_ERR "microcode: CPU%d patch does not match "
173 "(patch is %x, cpu base id is %x) \n",
174 cpu, mc_header->processor_rev_id[1],
175 ((equiv_cpu_id >> 16) & 0xff));
176
177 return 0;
178 }
179
180 /* ucode may be northbridge specific */
181 if (mc_header->nb_dev_id) {
182 nb_pci_dev = pci_get_device(PCI_VENDOR_ID_AMD,
183 (mc_header->nb_dev_id & 0xff),
184 NULL);
185 if ((!nb_pci_dev) ||
186 (mc_header->nb_rev_id != nb_pci_dev->revision)) {
187 printk(KERN_ERR "microcode: CPU%d NB mismatch \n", cpu);
188 pci_dev_put(nb_pci_dev);
189 return 0;
190 }
191 pci_dev_put(nb_pci_dev);
192 }
193
194 /* ucode may be southbridge specific */
195 if (mc_header->sb_dev_id) {
196 sb_pci_dev = pci_get_device(PCI_VENDOR_ID_AMD,
197 (mc_header->sb_dev_id & 0xff),
198 NULL);
199 if ((!sb_pci_dev) ||
200 (mc_header->sb_rev_id != sb_pci_dev->revision)) {
201 printk(KERN_ERR "microcode: CPU%d SB mismatch \n", cpu);
202 pci_dev_put(sb_pci_dev);
203 return 0;
204 }
205 pci_dev_put(sb_pci_dev);
206 }
207
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200208 if (mc_header->patch_id <= rev)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200209 return 0;
210
Peter Oruba80cc9f12008-07-28 18:44:22 +0200211 return 1;
212}
213
214static void apply_microcode_amd(int cpu)
215{
216 unsigned long flags;
217 unsigned int eax, edx;
218 unsigned int rev;
219 int cpu_num = raw_smp_processor_id();
220 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200221 struct microcode_amd *mc_amd = uci->mc;
Randy Dunlap5b792d32008-08-21 13:43:51 -0700222 unsigned long addr;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200223
224 /* We should bind the task to the CPU */
225 BUG_ON(cpu_num != cpu);
226
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200227 if (mc_amd == NULL)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200228 return;
229
230 spin_lock_irqsave(&microcode_update_lock, flags);
231
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200232 addr = (unsigned long)&mc_amd->hdr.data_code;
Randy Dunlap5b792d32008-08-21 13:43:51 -0700233 edx = (unsigned int)(((unsigned long)upper_32_bits(addr)));
234 eax = (unsigned int)(((unsigned long)lower_32_bits(addr)));
Peter Oruba80cc9f12008-07-28 18:44:22 +0200235
236 asm volatile("movl %0, %%ecx; wrmsr" :
237 : "i" (0xc0010020), "a" (eax), "d" (edx) : "ecx");
238
239 /* get patch id after patching */
240 asm volatile("movl %1, %%ecx; rdmsr"
241 : "=a" (rev)
242 : "i" (0x0000008B) : "ecx");
243
244 spin_unlock_irqrestore(&microcode_update_lock, flags);
245
246 /* check current patch id and patch's id for match */
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200247 if (rev != mc_amd->hdr.patch_id) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200248 printk(KERN_ERR "microcode: CPU%d update from revision "
249 "0x%x to 0x%x failed\n", cpu_num,
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200250 mc_amd->hdr.patch_id, rev);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200251 return;
252 }
253
254 printk(KERN_INFO "microcode: CPU%d updated from revision "
255 "0x%x to 0x%x \n",
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200256 cpu_num, uci->cpu_sig.rev, mc_amd->hdr.patch_id);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200257
Dmitry Adamushkod45de402008-08-20 00:22:26 +0200258 uci->cpu_sig.rev = rev;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200259}
260
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200261static void * get_next_ucode(u8 *buf, unsigned int size,
262 int (*get_ucode_data)(void *, const void *, size_t),
263 unsigned int *mc_size)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200264{
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200265 unsigned int total_size;
266#define UCODE_UNKNOWN_HDR 8
267 u8 hdr[UCODE_UNKNOWN_HDR];
268 void *mc;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200269
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200270 if (get_ucode_data(hdr, buf, UCODE_UNKNOWN_HDR))
271 return NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200272
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200273 if (hdr[0] != UCODE_UCODE_TYPE) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200274 printk(KERN_ERR "microcode: error! "
275 "Wrong microcode payload type field\n");
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200276 return NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200277 }
278
Ingo Molnara1c75cc2008-09-14 14:50:26 +0200279 /* FIXME! dimm: Why not by means of get_totalsize(hdr)? */
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200280 total_size = (unsigned long) (hdr[4] + (hdr[5] << 8));
Peter Oruba80cc9f12008-07-28 18:44:22 +0200281
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200282 printk(KERN_INFO "microcode: size %u, total_size %u\n",
283 size, total_size);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200284
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200285 if (total_size > size || total_size > UCODE_MAX_SIZE) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200286 printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200287 return NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200288 }
289
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200290 mc = vmalloc(UCODE_MAX_SIZE);
291 if (mc) {
292 memset(mc, 0, UCODE_MAX_SIZE);
293 if (get_ucode_data(mc, buf + UCODE_UNKNOWN_HDR, total_size)) {
294 vfree(mc);
295 mc = NULL;
296 } else
297 *mc_size = total_size + UCODE_UNKNOWN_HDR;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200298 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200299#undef UCODE_UNKNOWN_HDR
300 return mc;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200301}
302
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200303
304static int install_equiv_cpu_table(u8 *buf,
305 int (*get_ucode_data)(void *, const void *, size_t))
Peter Oruba80cc9f12008-07-28 18:44:22 +0200306{
Peter Orubab6cffde2008-09-17 15:05:52 +0200307#define UCODE_CONTAINER_HEADER_SIZE 12
308 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE];
309 unsigned int *buf_pos = (unsigned int *)container_hdr;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200310 unsigned long size;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200311
Peter Orubab6cffde2008-09-17 15:05:52 +0200312 if (get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE))
Peter Oruba80cc9f12008-07-28 18:44:22 +0200313 return 0;
314
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200315 size = buf_pos[2];
Peter Oruba80cc9f12008-07-28 18:44:22 +0200316
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200317 if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200318 printk(KERN_ERR "microcode: error! "
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200319 "Wrong microcode equivalnet cpu table\n");
Peter Oruba80cc9f12008-07-28 18:44:22 +0200320 return 0;
321 }
322
323 equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
324 if (!equiv_cpu_table) {
325 printk(KERN_ERR "microcode: error, can't allocate memory for equiv CPU table\n");
326 return 0;
327 }
328
Peter Orubab6cffde2008-09-17 15:05:52 +0200329 buf += UCODE_CONTAINER_HEADER_SIZE;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200330 if (get_ucode_data(equiv_cpu_table, buf, size)) {
331 vfree(equiv_cpu_table);
332 return 0;
333 }
Peter Oruba80cc9f12008-07-28 18:44:22 +0200334
Peter Orubab6cffde2008-09-17 15:05:52 +0200335 return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */
336#undef UCODE_CONTAINER_HEADER_SIZE
Peter Oruba80cc9f12008-07-28 18:44:22 +0200337}
338
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200339static void free_equiv_cpu_table(void)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200340{
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200341 if (equiv_cpu_table) {
342 vfree(equiv_cpu_table);
343 equiv_cpu_table = NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200344 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200345}
Peter Oruba80cc9f12008-07-28 18:44:22 +0200346
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200347static int generic_load_microcode(int cpu, void *data, size_t size,
348 int (*get_ucode_data)(void *, const void *, size_t))
349{
350 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
351 u8 *ucode_ptr = data, *new_mc = NULL, *mc;
352 int new_rev = uci->cpu_sig.rev;
353 unsigned int leftover;
354 unsigned long offset;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200355
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200356 offset = install_equiv_cpu_table(ucode_ptr, get_ucode_data);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200357 if (!offset) {
358 printk(KERN_ERR "microcode: installing equivalent cpu table failed\n");
359 return -EINVAL;
360 }
361
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200362 ucode_ptr += offset;
363 leftover = size - offset;
364
365 while (leftover) {
366 unsigned int mc_size;
367 struct microcode_header_amd *mc_header;
368
369 mc = get_next_ucode(ucode_ptr, leftover, get_ucode_data, &mc_size);
370 if (!mc)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200371 break;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200372
373 mc_header = (struct microcode_header_amd *)mc;
374 if (get_matching_microcode(cpu, mc, new_rev)) {
Ingo Molnara1c75cc2008-09-14 14:50:26 +0200375 if (new_mc)
376 vfree(new_mc);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200377 new_rev = mc_header->patch_id;
378 new_mc = mc;
379 } else
380 vfree(mc);
381
382 ucode_ptr += mc_size;
383 leftover -= mc_size;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200384 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200385
386 if (new_mc) {
387 if (!leftover) {
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200388 if (uci->mc)
389 vfree(uci->mc);
390 uci->mc = new_mc;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200391 pr_debug("microcode: CPU%d found a matching microcode update with"
392 " version 0x%x (current=0x%x)\n",
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200393 cpu, new_rev, uci->cpu_sig.rev);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200394 } else
395 vfree(new_mc);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200396 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200397
398 free_equiv_cpu_table();
399
400 return (int)leftover;
401}
402
403static int get_ucode_fw(void *to, const void *from, size_t n)
404{
405 memcpy(to, from, n);
406 return 0;
407}
408
409static int request_microcode_fw(int cpu, struct device *device)
410{
411 const char *fw_name = "amd-ucode/microcode_amd.bin";
412 const struct firmware *firmware;
413 int ret;
414
415 /* We should bind the task to the CPU */
416 BUG_ON(cpu != raw_smp_processor_id());
417
418 ret = request_firmware(&firmware, fw_name, device);
419 if (ret) {
420 printk(KERN_ERR "microcode: ucode data file %s load failed\n", fw_name);
421 return ret;
422 }
423
424 ret = generic_load_microcode(cpu, (void*)firmware->data, firmware->size,
425 &get_ucode_fw);
426
Peter Oruba80cc9f12008-07-28 18:44:22 +0200427 release_firmware(firmware);
428
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200429 return ret;
430}
431
432static int get_ucode_user(void *to, const void *from, size_t n)
433{
434 return copy_from_user(to, from, n);
435}
436
437static int request_microcode_user(int cpu, const void __user *buf, size_t size)
438{
439 /* We should bind the task to the CPU */
440 BUG_ON(cpu != raw_smp_processor_id());
441
442 return generic_load_microcode(cpu, (void*)buf, size, &get_ucode_user);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200443}
444
Peter Oruba80cc9f12008-07-28 18:44:22 +0200445static void microcode_fini_cpu_amd(int cpu)
446{
447 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
448
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200449 vfree(uci->mc);
450 uci->mc = NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200451}
452
453static struct microcode_ops microcode_amd_ops = {
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200454 .request_microcode_user = request_microcode_user,
455 .request_microcode_fw = request_microcode_fw,
Peter Oruba80cc9f12008-07-28 18:44:22 +0200456 .collect_cpu_info = collect_cpu_info_amd,
457 .apply_microcode = apply_microcode_amd,
458 .microcode_fini_cpu = microcode_fini_cpu_amd,
459};
460
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200461struct microcode_ops * __init init_amd_microcode(void)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200462{
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200463 return &microcode_amd_ops;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200464}