mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 19:23:57 +08:00
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>
This commit is contained in:
parent
9f15226e75
commit
8cc2361bd0
@ -34,6 +34,7 @@ MODULE_LICENSE("GPL v2");
|
|||||||
#define UCODE_UCODE_TYPE 0x00000001
|
#define UCODE_UCODE_TYPE 0x00000001
|
||||||
|
|
||||||
const struct firmware *firmware;
|
const struct firmware *firmware;
|
||||||
|
static int supported_cpu;
|
||||||
|
|
||||||
struct equiv_cpu_entry {
|
struct equiv_cpu_entry {
|
||||||
u32 installed_cpu;
|
u32 installed_cpu;
|
||||||
@ -73,15 +74,12 @@ static struct equiv_cpu_entry *equiv_cpu_table;
|
|||||||
|
|
||||||
static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
|
static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
|
||||||
{
|
{
|
||||||
struct cpuinfo_x86 *c = &cpu_data(cpu);
|
|
||||||
u32 dummy;
|
u32 dummy;
|
||||||
|
|
||||||
memset(csig, 0, sizeof(*csig));
|
if (!supported_cpu)
|
||||||
if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
|
|
||||||
pr_warning("microcode: CPU%d: AMD CPU family 0x%x not "
|
|
||||||
"supported\n", cpu, c->x86);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
memset(csig, 0, sizeof(*csig));
|
||||||
rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
|
rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
|
||||||
pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev);
|
pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev);
|
||||||
return 0;
|
return 0;
|
||||||
@ -331,6 +329,17 @@ static void microcode_fini_cpu_amd(int cpu)
|
|||||||
void init_microcode_amd(struct device *device)
|
void init_microcode_amd(struct device *device)
|
||||||
{
|
{
|
||||||
const char *fw_name = "amd-ucode/microcode_amd.bin";
|
const char *fw_name = "amd-ucode/microcode_amd.bin";
|
||||||
|
struct cpuinfo_x86 *c = &boot_cpu_data;
|
||||||
|
|
||||||
|
WARN_ON(c->x86_vendor != X86_VENDOR_AMD);
|
||||||
|
|
||||||
|
if (c->x86 < 0x10) {
|
||||||
|
pr_warning("microcode: AMD CPU family 0x%x not supported\n",
|
||||||
|
c->x86);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
supported_cpu = 1;
|
||||||
|
|
||||||
if (request_firmware(&firmware, fw_name, device))
|
if (request_firmware(&firmware, fw_name, device))
|
||||||
pr_err("microcode: failed to load file %s\n", fw_name);
|
pr_err("microcode: failed to load file %s\n", fw_name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user