blob: e68e723490a30cc3cc3e0d5ff9bc13748e4b75b0 [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 *
Andreas Herrmann2a3282a72008-12-16 19:08:53 +010013 * Licensed under the terms of the GNU General Public
Peter Oruba80cc9f12008-07-28 18:44:22 +020014 * 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>
Andreas Herrmannbe957762008-12-16 19:11:23 +010035#include <linux/uaccess.h>
Peter Oruba80cc9f12008-07-28 18:44:22 +020036
37#include <asm/msr.h>
Peter Oruba80cc9f12008-07-28 18:44:22 +020038#include <asm/processor.h>
39#include <asm/microcode.h>
40
41MODULE_DESCRIPTION("AMD Microcode Update Driver");
Peter Oruba3c522042008-10-17 15:30:38 +020042MODULE_AUTHOR("Peter Oruba");
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;
Andreas Herrmann3c763fd2008-12-16 19:07:47 +010065 u16 processor_rev_id;
Dmitry Adamushko18dbc912008-09-23 12:08:44 +020066 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
Andreas Herrmann6cc9b6d2008-12-16 19:17:45 +010078#define UCODE_MAX_SIZE 2048
79#define UCODE_CONTAINER_SECTION_HDR 8
80#define UCODE_CONTAINER_HEADER_SIZE 12
Peter Oruba80cc9f12008-07-28 18:44:22 +020081
Peter Oruba80cc9f12008-07-28 18:44:22 +020082/* serialize access to the physical write */
83static DEFINE_SPINLOCK(microcode_update_lock);
84
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020085static struct equiv_cpu_entry *equiv_cpu_table;
Peter Oruba80cc9f12008-07-28 18:44:22 +020086
Dmitry Adamushkod45de402008-08-20 00:22:26 +020087static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
Peter Oruba80cc9f12008-07-28 18:44:22 +020088{
89 struct cpuinfo_x86 *c = &cpu_data(cpu);
Andreas Herrmann29d08872008-12-16 19:16:34 +010090 u32 dummy;
Peter Oruba80cc9f12008-07-28 18:44:22 +020091
Dmitry Adamushkod45de402008-08-20 00:22:26 +020092 memset(csig, 0, sizeof(*csig));
Peter Oruba80cc9f12008-07-28 18:44:22 +020093
94 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
95 printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n",
96 cpu);
Dmitry Adamushkod45de402008-08-20 00:22:26 +020097 return -1;
Peter Oruba80cc9f12008-07-28 18:44:22 +020098 }
99
Andreas Herrmann29d08872008-12-16 19:16:34 +0100100 rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200101
102 printk(KERN_INFO "microcode: collect_cpu_info_amd : patch_id=0x%x\n",
Dmitry Adamushkod45de402008-08-20 00:22:26 +0200103 csig->rev);
104
105 return 0;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200106}
107
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200108static int get_matching_microcode(int cpu, void *mc, int rev)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200109{
Peter Oruba80cc9f12008-07-28 18:44:22 +0200110 struct microcode_header_amd *mc_header = mc;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200111 struct pci_dev *nb_pci_dev, *sb_pci_dev;
112 unsigned int current_cpu_id;
113 unsigned int equiv_cpu_id = 0x00;
114 unsigned int i = 0;
115
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200116 BUG_ON(equiv_cpu_table == NULL);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200117 current_cpu_id = cpuid_eax(0x00000001);
118
119 while (equiv_cpu_table[i].installed_cpu != 0) {
120 if (current_cpu_id == equiv_cpu_table[i].installed_cpu) {
Andreas Herrmann3c763fd2008-12-16 19:07:47 +0100121 equiv_cpu_id = equiv_cpu_table[i].equiv_cpu & 0xffff;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200122 break;
123 }
124 i++;
125 }
126
127 if (!equiv_cpu_id) {
128 printk(KERN_ERR "microcode: CPU%d cpu_id "
Andreas Herrmann2a3282a72008-12-16 19:08:53 +0100129 "not found in equivalent cpu table\n", cpu);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200130 return 0;
131 }
132
Andreas Herrmann3c763fd2008-12-16 19:07:47 +0100133 if (mc_header->processor_rev_id != equiv_cpu_id) {
134 printk(KERN_ERR "microcode: CPU%d patch does not match "
135 "(processor_rev_id: %x, eqiv_cpu_id: %x)\n",
136 cpu, mc_header->processor_rev_id, equiv_cpu_id);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200137 return 0;
138 }
139
140 /* ucode may be northbridge specific */
141 if (mc_header->nb_dev_id) {
142 nb_pci_dev = pci_get_device(PCI_VENDOR_ID_AMD,
143 (mc_header->nb_dev_id & 0xff),
144 NULL);
145 if ((!nb_pci_dev) ||
146 (mc_header->nb_rev_id != nb_pci_dev->revision)) {
Andreas Herrmann2a3282a72008-12-16 19:08:53 +0100147 printk(KERN_ERR "microcode: CPU%d NB mismatch\n", cpu);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200148 pci_dev_put(nb_pci_dev);
149 return 0;
150 }
151 pci_dev_put(nb_pci_dev);
152 }
153
154 /* ucode may be southbridge specific */
155 if (mc_header->sb_dev_id) {
156 sb_pci_dev = pci_get_device(PCI_VENDOR_ID_AMD,
157 (mc_header->sb_dev_id & 0xff),
158 NULL);
159 if ((!sb_pci_dev) ||
160 (mc_header->sb_rev_id != sb_pci_dev->revision)) {
Andreas Herrmann2a3282a72008-12-16 19:08:53 +0100161 printk(KERN_ERR "microcode: CPU%d SB mismatch\n", cpu);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200162 pci_dev_put(sb_pci_dev);
163 return 0;
164 }
165 pci_dev_put(sb_pci_dev);
166 }
167
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200168 if (mc_header->patch_id <= rev)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200169 return 0;
170
Peter Oruba80cc9f12008-07-28 18:44:22 +0200171 return 1;
172}
173
174static void apply_microcode_amd(int cpu)
175{
176 unsigned long flags;
Andreas Herrmann29d08872008-12-16 19:16:34 +0100177 u32 rev, dummy;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200178 int cpu_num = raw_smp_processor_id();
179 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200180 struct microcode_amd *mc_amd = uci->mc;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200181
182 /* We should bind the task to the CPU */
183 BUG_ON(cpu_num != cpu);
184
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200185 if (mc_amd == NULL)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200186 return;
187
188 spin_lock_irqsave(&microcode_update_lock, flags);
Andreas Herrmann29d08872008-12-16 19:16:34 +0100189 wrmsrl(MSR_AMD64_PATCH_LOADER, &mc_amd->hdr.data_code);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200190 /* get patch id after patching */
Andreas Herrmann29d08872008-12-16 19:16:34 +0100191 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200192 spin_unlock_irqrestore(&microcode_update_lock, flags);
193
194 /* check current patch id and patch's id for match */
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200195 if (rev != mc_amd->hdr.patch_id) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200196 printk(KERN_ERR "microcode: CPU%d update from revision "
197 "0x%x to 0x%x failed\n", cpu_num,
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200198 mc_amd->hdr.patch_id, rev);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200199 return;
200 }
201
202 printk(KERN_INFO "microcode: CPU%d updated from revision "
Andreas Herrmann2a3282a72008-12-16 19:08:53 +0100203 "0x%x to 0x%x\n",
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200204 cpu_num, uci->cpu_sig.rev, mc_amd->hdr.patch_id);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200205
Dmitry Adamushkod45de402008-08-20 00:22:26 +0200206 uci->cpu_sig.rev = rev;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200207}
208
Andreas Herrmann0657d9e2008-12-16 19:14:05 +0100209static int get_ucode_data(void *to, const u8 *from, size_t n)
210{
211 memcpy(to, from, n);
212 return 0;
213}
214
Andreas Herrmann8c135202008-12-16 19:13:00 +0100215static void *get_next_ucode(const u8 *buf, unsigned int size,
Andreas Herrmann0657d9e2008-12-16 19:14:05 +0100216 unsigned int *mc_size)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200217{
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200218 unsigned int total_size;
Peter Orubad4738792008-09-17 15:39:18 +0200219 u8 section_hdr[UCODE_CONTAINER_SECTION_HDR];
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200220 void *mc;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200221
Peter Orubad4738792008-09-17 15:39:18 +0200222 if (get_ucode_data(section_hdr, buf, UCODE_CONTAINER_SECTION_HDR))
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200223 return NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200224
Peter Orubad4738792008-09-17 15:39:18 +0200225 if (section_hdr[0] != UCODE_UCODE_TYPE) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200226 printk(KERN_ERR "microcode: error! "
227 "Wrong microcode payload type field\n");
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200228 return NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200229 }
230
Peter Orubad4738792008-09-17 15:39:18 +0200231 total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
Peter Oruba80cc9f12008-07-28 18:44:22 +0200232
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200233 printk(KERN_INFO "microcode: size %u, total_size %u\n",
234 size, total_size);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200235
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200236 if (total_size > size || total_size > UCODE_MAX_SIZE) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200237 printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200238 return NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200239 }
240
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200241 mc = vmalloc(UCODE_MAX_SIZE);
242 if (mc) {
243 memset(mc, 0, UCODE_MAX_SIZE);
Andreas Herrmannbe957762008-12-16 19:11:23 +0100244 if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR,
245 total_size)) {
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200246 vfree(mc);
247 mc = NULL;
248 } else
Peter Orubad4738792008-09-17 15:39:18 +0200249 *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200250 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200251 return mc;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200252}
253
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200254
Andreas Herrmann0657d9e2008-12-16 19:14:05 +0100255static int install_equiv_cpu_table(const u8 *buf)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200256{
Peter Orubab6cffde2008-09-17 15:05:52 +0200257 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE];
258 unsigned int *buf_pos = (unsigned int *)container_hdr;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200259 unsigned long size;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200260
Peter Orubab6cffde2008-09-17 15:05:52 +0200261 if (get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE))
Peter Oruba80cc9f12008-07-28 18:44:22 +0200262 return 0;
263
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200264 size = buf_pos[2];
Peter Oruba80cc9f12008-07-28 18:44:22 +0200265
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200266 if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) {
Peter Oruba80cc9f12008-07-28 18:44:22 +0200267 printk(KERN_ERR "microcode: error! "
Andreas Herrmann2a3282a72008-12-16 19:08:53 +0100268 "Wrong microcode equivalent cpu table\n");
Peter Oruba80cc9f12008-07-28 18:44:22 +0200269 return 0;
270 }
271
272 equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
273 if (!equiv_cpu_table) {
274 printk(KERN_ERR "microcode: error, can't allocate memory for equiv CPU table\n");
275 return 0;
276 }
277
Peter Orubab6cffde2008-09-17 15:05:52 +0200278 buf += UCODE_CONTAINER_HEADER_SIZE;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200279 if (get_ucode_data(equiv_cpu_table, buf, size)) {
280 vfree(equiv_cpu_table);
281 return 0;
282 }
Peter Oruba80cc9f12008-07-28 18:44:22 +0200283
Peter Orubab6cffde2008-09-17 15:05:52 +0200284 return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */
Peter Oruba80cc9f12008-07-28 18:44:22 +0200285}
286
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200287static void free_equiv_cpu_table(void)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200288{
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200289 if (equiv_cpu_table) {
290 vfree(equiv_cpu_table);
291 equiv_cpu_table = NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200292 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200293}
Peter Oruba80cc9f12008-07-28 18:44:22 +0200294
Andreas Herrmann0657d9e2008-12-16 19:14:05 +0100295static int generic_load_microcode(int cpu, const u8 *data, size_t size)
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200296{
297 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
Andreas Herrmann8c135202008-12-16 19:13:00 +0100298 const u8 *ucode_ptr = data;
299 void *new_mc = NULL;
300 void *mc;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200301 int new_rev = uci->cpu_sig.rev;
302 unsigned int leftover;
303 unsigned long offset;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200304
Andreas Herrmann0657d9e2008-12-16 19:14:05 +0100305 offset = install_equiv_cpu_table(ucode_ptr);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200306 if (!offset) {
307 printk(KERN_ERR "microcode: installing equivalent cpu table failed\n");
308 return -EINVAL;
309 }
310
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200311 ucode_ptr += offset;
312 leftover = size - offset;
313
314 while (leftover) {
Dmitry Adamushko2f9284e2008-09-23 22:56:35 +0200315 unsigned int uninitialized_var(mc_size);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200316 struct microcode_header_amd *mc_header;
317
Andreas Herrmann0657d9e2008-12-16 19:14:05 +0100318 mc = get_next_ucode(ucode_ptr, leftover, &mc_size);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200319 if (!mc)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200320 break;
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200321
322 mc_header = (struct microcode_header_amd *)mc;
323 if (get_matching_microcode(cpu, mc, new_rev)) {
Ingo Molnara1c75cc2008-09-14 14:50:26 +0200324 if (new_mc)
325 vfree(new_mc);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200326 new_rev = mc_header->patch_id;
327 new_mc = mc;
Andreas Herrmannbe957762008-12-16 19:11:23 +0100328 } else
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200329 vfree(mc);
330
331 ucode_ptr += mc_size;
332 leftover -= mc_size;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200333 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200334
335 if (new_mc) {
336 if (!leftover) {
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200337 if (uci->mc)
338 vfree(uci->mc);
339 uci->mc = new_mc;
Andreas Herrmannbe957762008-12-16 19:11:23 +0100340 pr_debug("microcode: CPU%d found a matching microcode "
341 "update with version 0x%x (current=0x%x)\n",
342 cpu, new_rev, uci->cpu_sig.rev);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200343 } else
344 vfree(new_mc);
Peter Oruba80cc9f12008-07-28 18:44:22 +0200345 }
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200346
347 free_equiv_cpu_table();
348
349 return (int)leftover;
350}
351
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200352static int request_microcode_fw(int cpu, struct device *device)
353{
354 const char *fw_name = "amd-ucode/microcode_amd.bin";
355 const struct firmware *firmware;
356 int ret;
357
358 /* We should bind the task to the CPU */
359 BUG_ON(cpu != raw_smp_processor_id());
360
361 ret = request_firmware(&firmware, fw_name, device);
362 if (ret) {
Andreas Herrmannbe957762008-12-16 19:11:23 +0100363 printk(KERN_ERR "microcode: ucode data file %s load failed\n",
364 fw_name);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200365 return ret;
366 }
367
Andreas Herrmann0657d9e2008-12-16 19:14:05 +0100368 ret = generic_load_microcode(cpu, firmware->data, firmware->size);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200369
Peter Oruba80cc9f12008-07-28 18:44:22 +0200370 release_firmware(firmware);
371
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200372 return ret;
373}
374
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200375static int request_microcode_user(int cpu, const void __user *buf, size_t size)
376{
Andreas Herrmannbe957762008-12-16 19:11:23 +0100377 printk(KERN_WARNING "microcode: AMD microcode update via "
378 "/dev/cpu/microcode is not supported\n");
Dmitry Adamushko2f9284e2008-09-23 22:56:35 +0200379 return -1;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200380}
381
Peter Oruba80cc9f12008-07-28 18:44:22 +0200382static void microcode_fini_cpu_amd(int cpu)
383{
384 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
385
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200386 vfree(uci->mc);
387 uci->mc = NULL;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200388}
389
390static struct microcode_ops microcode_amd_ops = {
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +0200391 .request_microcode_user = request_microcode_user,
392 .request_microcode_fw = request_microcode_fw,
Peter Oruba80cc9f12008-07-28 18:44:22 +0200393 .collect_cpu_info = collect_cpu_info_amd,
394 .apply_microcode = apply_microcode_amd,
395 .microcode_fini_cpu = microcode_fini_cpu_amd,
396};
397
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200398struct microcode_ops * __init init_amd_microcode(void)
Peter Oruba80cc9f12008-07-28 18:44:22 +0200399{
Dmitry Adamushko18dbc912008-09-23 12:08:44 +0200400 return &microcode_amd_ops;
Peter Oruba80cc9f12008-07-28 18:44:22 +0200401}