diff options
author | Andreas Herrmann <herrmann.der.user@googlemail.com> | 2009-11-17 02:06:38 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-17 04:10:40 -0500 |
commit | 8cc2361bd00e87aab2827a3996a71fe9b2c9f9c4 (patch) | |
tree | ba7be300bdea4a9eb041805f88727889e7247283 | |
parent | 9f15226e75583547aaf542c6be4bdac1060dd425 (diff) |
x86: ucode-amd: Move family check to microcde_amd.c's init function
... to avoid useless trial to load firmware on systems with
unsupported AMD CPUs.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: Mike Travis <travis@sgi.com>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Jack Steiner <steiner@sgi.com>
LKML-Reference: <20091117070638.GA27691@alberich.amd.com>
[ v2: changed BUG_ON() to WARN_ON() ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/microcode_amd.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 26e33bd8485b..63123d902103 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
@@ -34,6 +34,7 @@ MODULE_LICENSE("GPL v2"); | |||
34 | #define UCODE_UCODE_TYPE 0x00000001 | 34 | #define UCODE_UCODE_TYPE 0x00000001 |
35 | 35 | ||
36 | const struct firmware *firmware; | 36 | const struct firmware *firmware; |
37 | static int supported_cpu; | ||
37 | 38 | ||
38 | struct equiv_cpu_entry { | 39 | struct equiv_cpu_entry { |
39 | u32 installed_cpu; | 40 | u32 installed_cpu; |
@@ -73,15 +74,12 @@ static struct equiv_cpu_entry *equiv_cpu_table; | |||
73 | 74 | ||
74 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) | 75 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) |
75 | { | 76 | { |
76 | struct cpuinfo_x86 *c = &cpu_data(cpu); | ||
77 | u32 dummy; | 77 | u32 dummy; |
78 | 78 | ||
79 | memset(csig, 0, sizeof(*csig)); | 79 | if (!supported_cpu) |
80 | if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { | ||
81 | pr_warning("microcode: CPU%d: AMD CPU family 0x%x not " | ||
82 | "supported\n", cpu, c->x86); | ||
83 | return -1; | 80 | return -1; |
84 | } | 81 | |
82 | memset(csig, 0, sizeof(*csig)); | ||
85 | rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy); | 83 | rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy); |
86 | pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev); | 84 | pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev); |
87 | return 0; | 85 | return 0; |
@@ -331,6 +329,17 @@ static void microcode_fini_cpu_amd(int cpu) | |||
331 | void init_microcode_amd(struct device *device) | 329 | void init_microcode_amd(struct device *device) |
332 | { | 330 | { |
333 | const char *fw_name = "amd-ucode/microcode_amd.bin"; | 331 | const char *fw_name = "amd-ucode/microcode_amd.bin"; |
332 | struct cpuinfo_x86 *c = &boot_cpu_data; | ||
333 | |||
334 | WARN_ON(c->x86_vendor != X86_VENDOR_AMD); | ||
335 | |||
336 | if (c->x86 < 0x10) { | ||
337 | pr_warning("microcode: AMD CPU family 0x%x not supported\n", | ||
338 | c->x86); | ||
339 | return; | ||
340 | } | ||
341 | supported_cpu = 1; | ||
342 | |||
334 | if (request_firmware(&firmware, fw_name, device)) | 343 | if (request_firmware(&firmware, fw_name, device)) |
335 | pr_err("microcode: failed to load file %s\n", fw_name); | 344 | pr_err("microcode: failed to load file %s\n", fw_name); |
336 | } | 345 | } |