2 * Intel CPU Microcode Update Driver for Linux
4 * Copyright (C) 2000-2006 Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
5 * 2006 Shaohua Li <shaohua.li@intel.com>
7 * This driver allows to upgrade microcode on Intel processors
8 * belonging to IA-32 family - PentiumPro, Pentium II,
9 * Pentium III, Xeon, Pentium 4, etc.
11 * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture
12 * Software Developer's Manual
13 * Order Number 253668 or free download from:
15 * http://developer.intel.com/design/pentium4/manuals/253668.htm
17 * For more information, go to http://www.urbanmyth.org/microcode
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
24 * 1.0 16 Feb 2000, Tigran Aivazian <tigran@sco.com>
26 * 1.01 18 Feb 2000, Tigran Aivazian <tigran@sco.com>
27 * Added read() support + cleanups.
28 * 1.02 21 Feb 2000, Tigran Aivazian <tigran@sco.com>
29 * Added 'device trimming' support. open(O_WRONLY) zeroes
30 * and frees the saved copy of applied microcode.
31 * 1.03 29 Feb 2000, Tigran Aivazian <tigran@sco.com>
32 * Made to use devfs (/dev/cpu/microcode) + cleanups.
33 * 1.04 06 Jun 2000, Simon Trimmer <simon@veritas.com>
34 * Added misc device support (now uses both devfs and misc).
35 * Added MICROCODE_IOCFREE ioctl to clear memory.
36 * 1.05 09 Jun 2000, Simon Trimmer <simon@veritas.com>
37 * Messages for error cases (non Intel & no suitable microcode).
38 * 1.06 03 Aug 2000, Tigran Aivazian <tigran@veritas.com>
39 * Removed ->release(). Removed exclusive open and status bitmap.
40 * Added microcode_rwsem to serialize read()/write()/ioctl().
41 * Removed global kernel lock usage.
42 * 1.07 07 Sep 2000, Tigran Aivazian <tigran@veritas.com>
43 * Write 0 to 0x8B msr and then cpuid before reading revision,
44 * so that it works even if there were no update done by the
45 * BIOS. Otherwise, reading from 0x8B gives junk (which happened
46 * to be 0 on my machine which is why it worked even when I
47 * disabled update by the BIOS)
48 * Thanks to Eric W. Biederman <ebiederman@lnxi.com> for the fix.
49 * 1.08 11 Dec 2000, Richard Schaal <richard.schaal@intel.com> and
50 * Tigran Aivazian <tigran@veritas.com>
51 * Intel Pentium 4 processor support and bugfixes.
52 * 1.09 30 Oct 2001, Tigran Aivazian <tigran@veritas.com>
53 * Bugfix for HT (Hyper-Threading) enabled processors
54 * whereby processor resources are shared by all logical processors
55 * in a single CPU package.
56 * 1.10 28 Feb 2002 Asit K Mallick <asit.k.mallick@intel.com> and
57 * Tigran Aivazian <tigran@veritas.com>,
58 * Serialize updates as required on HT processors due to speculative
59 * nature of implementation.
60 * 1.11 22 Mar 2002 Tigran Aivazian <tigran@veritas.com>
61 * Fix the panic when writing zero-length microcode chunk.
62 * 1.12 29 Sep 2003 Nitin Kamble <nitin.a.kamble@intel.com>,
63 * Jun Nakajima <jun.nakajima@intel.com>
64 * Support for the microcode updates in the new format.
65 * 1.13 10 Oct 2003 Tigran Aivazian <tigran@veritas.com>
66 * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl
67 * because we no longer hold a copy of applied microcode
69 * 1.14 25 Jun 2004 Tigran Aivazian <tigran@veritas.com>
70 * Fix sigmatch() macro to handle old CPUs with pf == 0.
71 * Thanks to Stuart Swales for pointing out this bug.
74 //#define DEBUG /* pr_debug */
75 #include <linux/capability.h>
76 #include <linux/kernel.h>
77 #include <linux/init.h>
78 #include <linux/sched.h>
79 #include <linux/smp_lock.h>
80 #include <linux/cpumask.h>
81 #include <linux/module.h>
82 #include <linux/slab.h>
83 #include <linux/vmalloc.h>
84 #include <linux/miscdevice.h>
85 #include <linux/spinlock.h>
88 #include <linux/mutex.h>
89 #include <linux/cpu.h>
90 #include <linux/firmware.h>
91 #include <linux/platform_device.h>
94 #include <asm/uaccess.h>
95 #include <asm/processor.h>
96 #include <asm/microcode.h>
98 MODULE_DESCRIPTION("Intel CPU (IA-32) Microcode Update Driver");
99 MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>");
100 MODULE_LICENSE("GPL");
102 #define MICROCODE_VERSION "1.14a"
104 #define DEFAULT_UCODE_DATASIZE (2000) /* 2000 bytes */
105 #define MC_HEADER_SIZE (sizeof (struct microcode_header)) /* 48 bytes */
106 #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) /* 2048 bytes */
107 #define EXT_HEADER_SIZE (sizeof (struct extended_sigtable)) /* 20 bytes */
108 #define EXT_SIGNATURE_SIZE (sizeof (struct extended_signature)) /* 12 bytes */
109 #define DWSIZE (sizeof (u32))
110 #define get_totalsize(mc) \
111 (((struct microcode *)mc)->hdr.totalsize ? \
112 ((struct microcode *)mc)->hdr.totalsize : DEFAULT_UCODE_TOTALSIZE)
113 #define get_datasize(mc) \
114 (((struct microcode *)mc)->hdr.datasize ? \
115 ((struct microcode *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE)
117 #define sigmatch(s1, s2, p1, p2) \
118 (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0))))
120 #define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE)
122 /* serialize access to the physical write to MSR 0x79 */
123 static DEFINE_SPINLOCK(microcode_update_lock);
125 /* no concurrent ->write()s are allowed on /dev/cpu/microcode */
126 static DEFINE_MUTEX(microcode_mutex);
128 static struct ucode_cpu_info ucode_cpu_info[NR_CPUS];
130 static void collect_cpu_info(int cpu_num)
132 struct cpuinfo_x86 *c = &cpu_data(cpu_num);
133 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
136 /* We should bind the task to the CPU */
137 BUG_ON(raw_smp_processor_id() != cpu_num);
138 uci->pf = uci->rev = 0;
142 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
143 cpu_has(c, X86_FEATURE_IA64)) {
144 printk(KERN_ERR "microcode: CPU%d not a capable Intel "
145 "processor\n", cpu_num);
150 uci->sig = cpuid_eax(0x00000001);
152 if ((c->x86_model >= 5) || (c->x86 > 6)) {
153 /* get processor flags from MSR 0x17 */
154 rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
155 uci->pf = 1 << ((val[1] >> 18) & 7);
158 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
159 /* see notes above for revision 1.07. Apparent chip bug */
161 /* get the current revision from MSR 0x8B */
162 rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev);
163 pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n",
164 uci->sig, uci->pf, uci->rev);
167 static inline int microcode_update_match(int cpu_num,
168 struct microcode_header *mc_header, int sig, int pf)
170 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
172 if (!sigmatch(sig, uci->sig, pf, uci->pf)
173 || mc_header->rev <= uci->rev)
178 static int microcode_sanity_check(void *mc)
180 struct microcode_header *mc_header = mc;
181 struct extended_sigtable *ext_header = NULL;
182 struct extended_signature *ext_sig;
183 unsigned long total_size, data_size, ext_table_size;
184 int sum, orig_sum, ext_sigcount = 0, i;
186 total_size = get_totalsize(mc_header);
187 data_size = get_datasize(mc_header);
188 if (data_size + MC_HEADER_SIZE > total_size) {
189 printk(KERN_ERR "microcode: error! "
190 "Bad data size in microcode data file\n");
194 if (mc_header->ldrver != 1 || mc_header->hdrver != 1) {
195 printk(KERN_ERR "microcode: error! "
196 "Unknown microcode update format\n");
199 ext_table_size = total_size - (MC_HEADER_SIZE + data_size);
200 if (ext_table_size) {
201 if ((ext_table_size < EXT_HEADER_SIZE)
202 || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) {
203 printk(KERN_ERR "microcode: error! "
204 "Small exttable size in microcode data file\n");
207 ext_header = mc + MC_HEADER_SIZE + data_size;
208 if (ext_table_size != exttable_size(ext_header)) {
209 printk(KERN_ERR "microcode: error! "
210 "Bad exttable size in microcode data file\n");
213 ext_sigcount = ext_header->count;
216 /* check extended table checksum */
217 if (ext_table_size) {
218 int ext_table_sum = 0;
219 int *ext_tablep = (int *)ext_header;
221 i = ext_table_size / DWSIZE;
223 ext_table_sum += ext_tablep[i];
225 printk(KERN_WARNING "microcode: aborting, "
226 "bad extended signature table checksum\n");
231 /* calculate the checksum */
233 i = (MC_HEADER_SIZE + data_size) / DWSIZE;
235 orig_sum += ((int *)mc)[i];
237 printk(KERN_ERR "microcode: aborting, bad checksum\n");
242 /* check extended signature checksum */
243 for (i = 0; i < ext_sigcount; i++) {
244 ext_sig = (void *)ext_header + EXT_HEADER_SIZE +
245 EXT_SIGNATURE_SIZE * i;
247 - (mc_header->sig + mc_header->pf + mc_header->cksum)
248 + (ext_sig->sig + ext_sig->pf + ext_sig->cksum);
250 printk(KERN_ERR "microcode: aborting, bad checksum\n");
258 * return 0 - no update found
259 * return 1 - found update
262 static int get_maching_microcode(void *mc, int cpu)
264 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
265 struct microcode_header *mc_header = mc;
266 struct extended_sigtable *ext_header;
267 unsigned long total_size = get_totalsize(mc_header);
269 struct extended_signature *ext_sig;
272 if (microcode_update_match(cpu, mc_header,
273 mc_header->sig, mc_header->pf))
276 if (total_size <= get_datasize(mc_header) + MC_HEADER_SIZE)
279 ext_header = mc + get_datasize(mc_header) + MC_HEADER_SIZE;
280 ext_sigcount = ext_header->count;
281 ext_sig = (void *)ext_header + EXT_HEADER_SIZE;
282 for (i = 0; i < ext_sigcount; i++) {
283 if (microcode_update_match(cpu, mc_header,
284 ext_sig->sig, ext_sig->pf))
290 pr_debug("microcode: CPU%d found a matching microcode update with"
291 " version 0x%x (current=0x%x)\n", cpu, mc_header->rev,uci->rev);
292 new_mc = vmalloc(total_size);
294 printk(KERN_ERR "microcode: error! Can not allocate memory\n");
298 /* free previous update file */
301 memcpy(new_mc, mc, total_size);
306 static void apply_microcode(int cpu)
310 int cpu_num = raw_smp_processor_id();
311 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
313 /* We should bind the task to the CPU */
314 BUG_ON(cpu_num != cpu);
319 /* serialize access to the physical write to MSR 0x79 */
320 spin_lock_irqsave(µcode_update_lock, flags);
322 /* write microcode via MSR 0x79 */
323 wrmsr(MSR_IA32_UCODE_WRITE,
324 (unsigned long) uci->mc->bits,
325 (unsigned long) uci->mc->bits >> 16 >> 16);
326 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
328 /* see notes above for revision 1.07. Apparent chip bug */
331 /* get the current revision from MSR 0x8B */
332 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
334 spin_unlock_irqrestore(µcode_update_lock, flags);
335 if (val[1] != uci->mc->hdr.rev) {
336 printk(KERN_ERR "microcode: CPU%d update from revision "
337 "0x%x to 0x%x failed\n", cpu_num, uci->rev, val[1]);
340 printk(KERN_INFO "microcode: CPU%d updated from revision "
341 "0x%x to 0x%x, date = %08x \n",
342 cpu_num, uci->rev, val[1], uci->mc->hdr.date);
346 #ifdef CONFIG_MICROCODE_OLD_INTERFACE
347 static void __user *user_buffer; /* user area microcode data buffer */
348 static unsigned int user_buffer_size; /* it's size */
350 static long get_next_ucode(void **mc, long offset)
352 struct microcode_header mc_header;
353 unsigned long total_size;
356 if (offset >= user_buffer_size)
358 if (copy_from_user(&mc_header, user_buffer + offset, MC_HEADER_SIZE)) {
359 printk(KERN_ERR "microcode: error! Can not read user data\n");
362 total_size = get_totalsize(&mc_header);
363 if (offset + total_size > user_buffer_size) {
364 printk(KERN_ERR "microcode: error! Bad total size in microcode "
368 *mc = vmalloc(total_size);
371 if (copy_from_user(*mc, user_buffer + offset, total_size)) {
372 printk(KERN_ERR "microcode: error! Can not read user data\n");
376 return offset + total_size;
379 static int do_microcode_update (void)
386 cpumask_of_cpu_ptr_declare(newmask);
388 old = current->cpus_allowed;
390 while ((cursor = get_next_ucode(&new_mc, cursor)) > 0) {
391 error = microcode_sanity_check(new_mc);
395 * It's possible the data file has multiple matching ucode,
396 * lets keep searching till the latest version
398 for_each_online_cpu(cpu) {
399 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
403 cpumask_of_cpu_ptr_next(newmask, cpu);
404 set_cpus_allowed_ptr(current, newmask);
405 error = get_maching_microcode(new_mc, cpu);
409 apply_microcode(cpu);
418 set_cpus_allowed_ptr(current, &old);
422 static int microcode_open (struct inode *unused1, struct file *unused2)
425 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
428 static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos)
432 if ((len >> PAGE_SHIFT) > num_physpages) {
433 printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
438 mutex_lock(µcode_mutex);
440 user_buffer = (void __user *) buf;
441 user_buffer_size = (int) len;
443 ret = do_microcode_update();
447 mutex_unlock(µcode_mutex);
453 static const struct file_operations microcode_fops = {
454 .owner = THIS_MODULE,
455 .write = microcode_write,
456 .open = microcode_open,
459 static struct miscdevice microcode_dev = {
460 .minor = MICROCODE_MINOR,
462 .fops = µcode_fops,
465 static int __init microcode_dev_init (void)
469 error = misc_register(µcode_dev);
472 "microcode: can't misc_register on minor=%d\n",
480 static void microcode_dev_exit (void)
482 misc_deregister(µcode_dev);
485 MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
487 #define microcode_dev_init() 0
488 #define microcode_dev_exit() do { } while(0)
491 static long get_next_ucode_from_buffer(void **mc, const u8 *buf,
492 unsigned long size, long offset)
494 struct microcode_header *mc_header;
495 unsigned long total_size;
500 mc_header = (struct microcode_header *)(buf + offset);
501 total_size = get_totalsize(mc_header);
503 if (offset + total_size > size) {
504 printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
508 *mc = vmalloc(total_size);
510 printk(KERN_ERR "microcode: error! Can not allocate memory\n");
513 memcpy(*mc, buf + offset, total_size);
514 return offset + total_size;
517 /* fake device for request_firmware */
518 static struct platform_device *microcode_pdev;
520 static int cpu_request_microcode(int cpu)
523 struct cpuinfo_x86 *c = &cpu_data(cpu);
524 const struct firmware *firmware;
531 /* We should bind the task to the CPU */
532 BUG_ON(cpu != raw_smp_processor_id());
533 sprintf(name,"intel-ucode/%02x-%02x-%02x",
534 c->x86, c->x86_model, c->x86_mask);
535 error = request_firmware(&firmware, name, µcode_pdev->dev);
537 pr_debug("microcode: data file %s load failed\n", name);
540 buf = firmware->data;
541 size = firmware->size;
542 while ((offset = get_next_ucode_from_buffer(&mc, buf, size, offset))
544 error = microcode_sanity_check(mc);
547 error = get_maching_microcode(mc, cpu);
551 * It's possible the data file has multiple matching ucode,
552 * lets keep searching till the latest version
555 apply_microcode(cpu);
564 release_firmware(firmware);
569 static int apply_microcode_check_cpu(int cpu)
571 struct cpuinfo_x86 *c = &cpu_data(cpu);
572 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
574 cpumask_of_cpu_ptr(newmask, cpu);
578 /* Check if the microcode is available */
582 old = current->cpus_allowed;
583 set_cpus_allowed_ptr(current, newmask);
585 /* Check if the microcode we have in memory matches the CPU */
586 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
587 cpu_has(c, X86_FEATURE_IA64) || uci->sig != cpuid_eax(0x00000001))
590 if (!err && ((c->x86_model >= 5) || (c->x86 > 6))) {
591 /* get processor flags from MSR 0x17 */
592 rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
593 if (uci->pf != (1 << ((val[1] >> 18) & 7)))
598 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
599 /* see notes above for revision 1.07. Apparent chip bug */
601 /* get the current revision from MSR 0x8B */
602 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
603 if (uci->rev != val[1])
608 apply_microcode(cpu);
610 printk(KERN_ERR "microcode: Could not apply microcode to CPU%d:"
611 " sig=0x%x, pf=0x%x, rev=0x%x\n",
612 cpu, uci->sig, uci->pf, uci->rev);
614 set_cpus_allowed_ptr(current, &old);
618 static void microcode_init_cpu(int cpu, int resume)
621 cpumask_of_cpu_ptr(newmask, cpu);
622 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
624 old = current->cpus_allowed;
626 set_cpus_allowed_ptr(current, newmask);
627 mutex_lock(µcode_mutex);
628 collect_cpu_info(cpu);
629 if (uci->valid && system_state == SYSTEM_RUNNING && !resume)
630 cpu_request_microcode(cpu);
631 mutex_unlock(µcode_mutex);
632 set_cpus_allowed_ptr(current, &old);
635 static void microcode_fini_cpu(int cpu)
637 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
639 mutex_lock(µcode_mutex);
643 mutex_unlock(µcode_mutex);
646 static ssize_t reload_store(struct sys_device *dev,
647 struct sysdev_attribute *attr,
648 const char *buf, size_t sz)
650 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
652 unsigned long val = simple_strtoul(buf, &end, 0);
660 cpumask_of_cpu_ptr(newmask, cpu);
662 old = current->cpus_allowed;
665 set_cpus_allowed_ptr(current, newmask);
667 mutex_lock(µcode_mutex);
669 err = cpu_request_microcode(cpu);
670 mutex_unlock(µcode_mutex);
672 set_cpus_allowed_ptr(current, &old);
679 static ssize_t version_show(struct sys_device *dev,
680 struct sysdev_attribute *attr, char *buf)
682 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
684 return sprintf(buf, "0x%x\n", uci->rev);
687 static ssize_t pf_show(struct sys_device *dev,
688 struct sysdev_attribute *attr, char *buf)
690 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
692 return sprintf(buf, "0x%x\n", uci->pf);
695 static SYSDEV_ATTR(reload, 0200, NULL, reload_store);
696 static SYSDEV_ATTR(version, 0400, version_show, NULL);
697 static SYSDEV_ATTR(processor_flags, 0400, pf_show, NULL);
699 static struct attribute *mc_default_attrs[] = {
702 &attr_processor_flags.attr,
706 static struct attribute_group mc_attr_group = {
707 .attrs = mc_default_attrs,
711 static int __mc_sysdev_add(struct sys_device *sys_dev, int resume)
713 int err, cpu = sys_dev->id;
714 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
716 if (!cpu_online(cpu))
719 pr_debug("microcode: CPU%d added\n", cpu);
720 memset(uci, 0, sizeof(*uci));
722 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
726 microcode_init_cpu(cpu, resume);
731 static int mc_sysdev_add(struct sys_device *sys_dev)
733 return __mc_sysdev_add(sys_dev, 0);
736 static int mc_sysdev_remove(struct sys_device *sys_dev)
738 int cpu = sys_dev->id;
740 if (!cpu_online(cpu))
743 pr_debug("microcode: CPU%d removed\n", cpu);
744 microcode_fini_cpu(cpu);
745 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
749 static int mc_sysdev_resume(struct sys_device *dev)
753 if (!cpu_online(cpu))
755 pr_debug("microcode: CPU%d resumed\n", cpu);
756 /* only CPU 0 will apply ucode here */
761 static struct sysdev_driver mc_sysdev_driver = {
762 .add = mc_sysdev_add,
763 .remove = mc_sysdev_remove,
764 .resume = mc_sysdev_resume,
768 mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
770 unsigned int cpu = (unsigned long)hcpu;
771 struct sys_device *sys_dev;
773 sys_dev = get_cpu_sysdev(cpu);
775 case CPU_UP_CANCELED_FROZEN:
776 /* The CPU refused to come up during a system resume */
777 microcode_fini_cpu(cpu);
780 case CPU_DOWN_FAILED:
781 mc_sysdev_add(sys_dev);
783 case CPU_ONLINE_FROZEN:
784 /* System-wide resume is in progress, try to apply microcode */
785 if (apply_microcode_check_cpu(cpu)) {
786 /* The application of microcode failed */
787 microcode_fini_cpu(cpu);
788 __mc_sysdev_add(sys_dev, 1);
791 case CPU_DOWN_FAILED_FROZEN:
792 if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group))
793 printk(KERN_ERR "microcode: Failed to create the sysfs "
794 "group for CPU%d\n", cpu);
796 case CPU_DOWN_PREPARE:
797 mc_sysdev_remove(sys_dev);
799 case CPU_DOWN_PREPARE_FROZEN:
800 /* Suspend is in progress, only remove the interface */
801 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
807 static struct notifier_block __refdata mc_cpu_notifier = {
808 .notifier_call = mc_cpu_callback,
811 static int __init microcode_init (void)
816 "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " <tigran@aivazian.fsnet.co.uk>\n");
818 error = microcode_dev_init();
821 microcode_pdev = platform_device_register_simple("microcode", -1,
823 if (IS_ERR(microcode_pdev)) {
824 microcode_dev_exit();
825 return PTR_ERR(microcode_pdev);
829 error = sysdev_driver_register(&cpu_sysdev_class, &mc_sysdev_driver);
832 microcode_dev_exit();
833 platform_device_unregister(microcode_pdev);
837 register_hotcpu_notifier(&mc_cpu_notifier);
841 static void __exit microcode_exit (void)
843 microcode_dev_exit();
845 unregister_hotcpu_notifier(&mc_cpu_notifier);
848 sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver);
851 platform_device_unregister(microcode_pdev);
854 module_init(microcode_init)
855 module_exit(microcode_exit)