X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fi386%2Fkernel%2Fmicrocode.c;h=aca20edc5ea1cebb69364dd726b09306742596cb;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=553164fbfbb702edc05cc0060cfdfc7c549626d9;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index 553164fbf..aca20edc5 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c @@ -1,7 +1,7 @@ /* - * Intel CPU Microcode Update driver for Linux + * Intel CPU Microcode Update Driver for Linux * - * Copyright (C) 2000 Tigran Aivazian + * Copyright (C) 2000-2004 Tigran Aivazian * * This driver allows to upgrade microcode on Intel processors * belonging to IA-32 family - PentiumPro, Pentium II, @@ -32,7 +32,7 @@ * Added misc device support (now uses both devfs and misc). * Added MICROCODE_IOCFREE ioctl to clear memory. * 1.05 09 Jun 2000, Simon Trimmer - * Messages for error cases (non intel & no suitable microcode). + * Messages for error cases (non Intel & no suitable microcode). * 1.06 03 Aug 2000, Tigran Aivazian * Removed ->release(). Removed exclusive open and status bitmap. * Added microcode_rwsem to serialize read()/write()/ioctl(). @@ -64,6 +64,9 @@ * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl * because we no longer hold a copy of applied microcode * in kernel memory. + * 1.14 25 Jun 2004 Tigran Aivazian + * Fix sigmatch() macro to handle old CPUs with pf == 0. + * Thanks to Stuart Swales for pointing out this bug. */ @@ -80,11 +83,11 @@ #include #include -MODULE_DESCRIPTION("Intel CPU (IA-32) microcode update driver"); +MODULE_DESCRIPTION("Intel CPU (IA-32) Microcode Update Driver"); MODULE_AUTHOR("Tigran Aivazian "); MODULE_LICENSE("GPL"); -#define MICROCODE_VERSION "1.13" +#define MICROCODE_VERSION "1.14" #define MICRO_DEBUG 0 #if MICRO_DEBUG #define dprintk(x...) printk(KERN_INFO x) @@ -104,7 +107,10 @@ MODULE_LICENSE("GPL"); #define get_datasize(mc) \ (((microcode_t *)mc)->hdr.datasize ? \ ((microcode_t *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) -#define sigmatch(s1, s2, p1, p2) (((s1) == (s2)) && ((p1) & (p2))) + +#define sigmatch(s1, s2, p1, p2) \ + (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0)))) + #define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) /* serialize access to the physical write to MSR 0x79 */ @@ -113,7 +119,7 @@ static spinlock_t microcode_update_lock = SPIN_LOCK_UNLOCKED; /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ static DECLARE_MUTEX(microcode_sem); -static void *user_buffer; /* user area microcode data buffer */ +static void __user *user_buffer; /* user area microcode data buffer */ static unsigned int user_buffer_size; /* it's size */ typedef enum mc_error_code { @@ -363,7 +369,7 @@ static void do_update_one (void * unused) struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; if (uci->mc == NULL) { - printk(KERN_INFO "microcode: No suitable data for cpu %d\n", cpu_num); + printk(KERN_INFO "microcode: No suitable data for CPU%d\n", cpu_num); return; } @@ -425,7 +431,7 @@ out: return error; } -static ssize_t microcode_write (struct file *file, const char *buf, size_t len, loff_t *ppos) +static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos) { ssize_t ret; @@ -441,7 +447,7 @@ static ssize_t microcode_write (struct file *file, const char *buf, size_t len, down(µcode_sem); - user_buffer = (void *) buf; + user_buffer = (void __user *) buf; user_buffer_size = (int) len; ret = do_microcode_update(); @@ -479,6 +485,7 @@ static struct file_operations microcode_fops = { static struct miscdevice microcode_dev = { .minor = MICROCODE_MINOR, .name = "microcode", + .devfs_name = "cpu/microcode", .fops = µcode_fops, }; @@ -495,16 +502,14 @@ static int __init microcode_init (void) } printk(KERN_INFO - "IA-32 Microcode Update Driver: v%s \n", - MICROCODE_VERSION); + "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " \n"); return 0; } static void __exit microcode_exit (void) { misc_deregister(µcode_dev); - printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n", - MICROCODE_VERSION); + printk(KERN_INFO "IA-32 Microcode Update Driver v" MICROCODE_VERSION " unregistered\n"); } module_init(microcode_init)