Merge master.kernel.org:/home/rmk/linux-2.6-arm
[deliverable/linux.git] / arch / x86 / kernel / microcode_amd.c
index f4c538b681cad13734aae36da2fdcda167fbdf67..e1af7c055c7d0c86c7e3a1fe789e597825185892 100644 (file)
@@ -13,6 +13,9 @@
  *  Licensed under the terms of the GNU General Public
  *  License version 2. See file COPYING for details.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/firmware.h>
 #include <linux/pci_ids.h>
 #include <linux/uaccess.h>
@@ -76,12 +79,12 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
 
        memset(csig, 0, sizeof(*csig));
        if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
-               printk(KERN_WARNING "microcode: CPU%d: AMD CPU family 0x%x not "
-                      "supported\n", cpu, c->x86);
+               pr_warning("microcode: CPU%d: AMD CPU family 0x%x not "
+                          "supported\n", cpu, c->x86);
                return -1;
        }
        rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
-       printk(KERN_INFO "microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev);
+       pr_info("CPU%d: patch_level=0x%x\n", cpu, csig->rev);
        return 0;
 }
 
@@ -103,23 +106,16 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
                i++;
        }
 
-       if (!equiv_cpu_id) {
-               printk(KERN_WARNING "microcode: CPU%d: cpu revision "
-                      "not listed in equivalent cpu table\n", cpu);
+       if (!equiv_cpu_id)
                return 0;
-       }
 
-       if (mc_header->processor_rev_id != equiv_cpu_id) {
-               printk(KERN_ERR "microcode: CPU%d: patch mismatch "
-                      "(processor_rev_id: %x, equiv_cpu_id: %x)\n",
-                      cpu, mc_header->processor_rev_id, equiv_cpu_id);
+       if (mc_header->processor_rev_id != equiv_cpu_id)
                return 0;
-       }
 
        /* ucode might be chipset specific -- currently we don't support this */
        if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
-               printk(KERN_ERR "microcode: CPU%d: loading of chipset "
-                      "specific code not yet supported\n", cpu);
+               pr_err("CPU%d: loading of chipset specific code not yet supported\n",
+                      cpu);
                return 0;
        }
 
@@ -148,14 +144,12 @@ static int apply_microcode_amd(int cpu)
 
        /* check current patch id and patch's id for match */
        if (rev != mc_amd->hdr.patch_id) {
-               printk(KERN_ERR "microcode: CPU%d: update failed "
-                      "(for patch_level=0x%x)\n", cpu, mc_amd->hdr.patch_id);
+               pr_err("CPU%d: update failed (for patch_level=0x%x)\n",
+                      cpu, mc_amd->hdr.patch_id);
                return -1;
        }
 
-       printk(KERN_INFO "microcode: CPU%d: updated (new patch_level=0x%x)\n",
-              cpu, rev);
-
+       pr_info("CPU%d: updated (new patch_level=0x%x)\n", cpu, rev);
        uci->cpu_sig.rev = rev;
 
        return 0;
@@ -178,18 +172,14 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
                return NULL;
 
        if (section_hdr[0] != UCODE_UCODE_TYPE) {
-               printk(KERN_ERR "microcode: error: invalid type field in "
-                      "container file section header\n");
+               pr_err("error: invalid type field in container file section header\n");
                return NULL;
        }
 
        total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
 
-       printk(KERN_DEBUG "microcode: size %u, total_size %u\n",
-              size, total_size);
-
        if (total_size > size || total_size > UCODE_MAX_SIZE) {
-               printk(KERN_ERR "microcode: error: size mismatch\n");
+               pr_err("error: size mismatch\n");
                return NULL;
        }
 
@@ -218,15 +208,13 @@ static int install_equiv_cpu_table(const u8 *buf)
        size = buf_pos[2];
 
        if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) {
-               printk(KERN_ERR "microcode: error: invalid type field in "
-                      "container file section header\n");
+               pr_err("error: invalid type field in container file section header\n");
                return 0;
        }
 
        equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
        if (!equiv_cpu_table) {
-               printk(KERN_ERR "microcode: failed to allocate "
-                      "equivalent CPU table\n");
+               pr_err("failed to allocate equivalent CPU table\n");
                return 0;
        }
 
@@ -259,8 +247,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
 
        offset = install_equiv_cpu_table(ucode_ptr);
        if (!offset) {
-               printk(KERN_ERR "microcode: failed to create "
-                      "equivalent cpu table\n");
+               pr_err("failed to create equivalent cpu table\n");
                return UCODE_ERROR;
        }
 
@@ -291,8 +278,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
                if (!leftover) {
                        vfree(uci->mc);
                        uci->mc = new_mc;
-                       pr_debug("microcode: CPU%d found a matching microcode "
-                                "update with version 0x%x (current=0x%x)\n",
+                       pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n",
                                 cpu, new_rev, uci->cpu_sig.rev);
                } else {
                        vfree(new_mc);
@@ -318,7 +304,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
        }
 
        if (*(u32 *)firmware->data != UCODE_MAGIC) {
-               printk(KERN_ERR "microcode: invalid UCODE_MAGIC (0x%08x)\n",
+               pr_err("invalid UCODE_MAGIC (0x%08x)\n",
                       *(u32 *)firmware->data);
                return UCODE_ERROR;
        }
@@ -333,8 +319,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
 static enum ucode_state
 request_microcode_user(int cpu, const void __user *buf, size_t size)
 {
-       printk(KERN_INFO "microcode: AMD microcode update via "
-              "/dev/cpu/microcode not supported\n");
+       pr_info("AMD microcode update via /dev/cpu/microcode not supported\n");
        return UCODE_ERROR;
 }
 
This page took 0.056349 seconds and 5 git commands to generate.