aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/microcode.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
commit95d465fd750897ab32462a6702fbfe1b122cbbc0 (patch)
tree65c38b2f11c51bb6932e44dd6c92f15b0091abfe /arch/i386/kernel/microcode.c
parent642fde17dceceb56c7ba2762733ac688666ae657 (diff)
parent683aa4012f53b2ada0f430487e05d37b0d94e90a (diff)
Manual merge with Linus.
Conflicts: arch/powerpc/kernel/setup-common.c drivers/input/keyboard/hil_kbd.c drivers/input/mouse/hil_ptr.c
Diffstat (limited to 'arch/i386/kernel/microcode.c')
-rw-r--r--arch/i386/kernel/microcode.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 5390b521aca0..e7c138f66c5a 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -81,6 +81,7 @@
81#include <linux/miscdevice.h> 81#include <linux/miscdevice.h>
82#include <linux/spinlock.h> 82#include <linux/spinlock.h>
83#include <linux/mm.h> 83#include <linux/mm.h>
84#include <linux/mutex.h>
84 85
85#include <asm/msr.h> 86#include <asm/msr.h>
86#include <asm/uaccess.h> 87#include <asm/uaccess.h>
@@ -114,7 +115,7 @@ MODULE_LICENSE("GPL");
114static DEFINE_SPINLOCK(microcode_update_lock); 115static DEFINE_SPINLOCK(microcode_update_lock);
115 116
116/* no concurrent ->write()s are allowed on /dev/cpu/microcode */ 117/* no concurrent ->write()s are allowed on /dev/cpu/microcode */
117static DECLARE_MUTEX(microcode_sem); 118static DEFINE_MUTEX(microcode_mutex);
118 119
119static void __user *user_buffer; /* user area microcode data buffer */ 120static void __user *user_buffer; /* user area microcode data buffer */
120static unsigned int user_buffer_size; /* it's size */ 121static unsigned int user_buffer_size; /* it's size */
@@ -202,8 +203,6 @@ static inline void mark_microcode_update (int cpu_num, microcode_header_t *mc_he
202 } else if (mc_header->rev == uci->rev) { 203 } else if (mc_header->rev == uci->rev) {
203 /* notify the caller of success on this cpu */ 204 /* notify the caller of success on this cpu */
204 uci->err = MC_SUCCESS; 205 uci->err = MC_SUCCESS;
205 printk(KERN_ERR "microcode: CPU%d already at revision"
206 " 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
207 goto out; 206 goto out;
208 } 207 }
209 208
@@ -369,7 +368,6 @@ static void do_update_one (void * unused)
369 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 368 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
370 369
371 if (uci->mc == NULL) { 370 if (uci->mc == NULL) {
372 printk(KERN_INFO "microcode: No new microcode data for CPU%d\n", cpu_num);
373 return; 371 return;
374 } 372 }
375 373
@@ -447,7 +445,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
447 return -EINVAL; 445 return -EINVAL;
448 } 446 }
449 447
450 down(&microcode_sem); 448 mutex_lock(&microcode_mutex);
451 449
452 user_buffer = (void __user *) buf; 450 user_buffer = (void __user *) buf;
453 user_buffer_size = (int) len; 451 user_buffer_size = (int) len;
@@ -456,31 +454,14 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
456 if (!ret) 454 if (!ret)
457 ret = (ssize_t)len; 455 ret = (ssize_t)len;
458 456
459 up(&microcode_sem); 457 mutex_unlock(&microcode_mutex);
460 458
461 return ret; 459 return ret;
462} 460}
463 461
464static int microcode_ioctl (struct inode *inode, struct file *file,
465 unsigned int cmd, unsigned long arg)
466{
467 switch (cmd) {
468 /*
469 * XXX: will be removed after microcode_ctl
470 * is updated to ignore failure of this ioctl()
471 */
472 case MICROCODE_IOCFREE:
473 return 0;
474 default:
475 return -EINVAL;
476 }
477 return -EINVAL;
478}
479
480static struct file_operations microcode_fops = { 462static struct file_operations microcode_fops = {
481 .owner = THIS_MODULE, 463 .owner = THIS_MODULE,
482 .write = microcode_write, 464 .write = microcode_write,
483 .ioctl = microcode_ioctl,
484 .open = microcode_open, 465 .open = microcode_open,
485}; 466};
486 467
@@ -511,7 +492,6 @@ static int __init microcode_init (void)
511static void __exit microcode_exit (void) 492static void __exit microcode_exit (void)
512{ 493{
513 misc_deregister(&microcode_dev); 494 misc_deregister(&microcode_dev);
514 printk(KERN_INFO "IA-32 Microcode Update Driver v" MICROCODE_VERSION " unregistered\n");
515} 495}
516 496
517module_init(microcode_init) 497module_init(microcode_init)