From 6a1f698ed277890441501d21be9a5277d1b8616d Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Wed, 1 Aug 2012 14:55:01 +0200 Subject: [PATCH] --- yaml --- r: 324041 b: refs/heads/master c: c96d2c0905cc48e34f2b37b775b59932c416b343 h: refs/heads/master i: 324039: 2cc48f9f4cb96b2c0b9389996a3c7c61f7c9de0d v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/microcode_amd.c | 46 +++++++++++++++++---------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 9ed629c5428c..8ca9cdfa14b8 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 48e30685caa8bdc4b8d4417d8ac31db59689742c +refs/heads/master: c96d2c0905cc48e34f2b37b775b59932c416b343 diff --git a/trunk/arch/x86/kernel/microcode_amd.c b/trunk/arch/x86/kernel/microcode_amd.c index 94ecdaa24052..03ed5af7053d 100644 --- a/trunk/arch/x86/kernel/microcode_amd.c +++ b/trunk/arch/x86/kernel/microcode_amd.c @@ -78,6 +78,36 @@ static struct equiv_cpu_entry *equiv_cpu_table; /* page-sized ucode patch buffer */ void *patch; +static u16 find_equiv_id(unsigned int cpu) +{ + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + int i = 0; + + BUG_ON(equiv_cpu_table == NULL); + + while (equiv_cpu_table[i].installed_cpu != 0) { + if (uci->cpu_sig.sig == equiv_cpu_table[i].installed_cpu) + return equiv_cpu_table[i].equiv_cpu; + + i++; + } + return 0; +} + +static u32 find_cpu_family_by_equiv_cpu(u16 equiv_cpu) +{ + int i = 0; + + BUG_ON(!equiv_cpu_table); + + while (equiv_cpu_table[i].equiv_cpu != 0) { + if (equiv_cpu == equiv_cpu_table[i].equiv_cpu) + return equiv_cpu_table[i].installed_cpu; + i++; + } + return 0; +} + static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) { struct cpuinfo_x86 *c = &cpu_data(cpu); @@ -119,22 +149,6 @@ static unsigned int verify_ucode_size(int cpu, u32 patch_size, return patch_size; } -static u16 find_equiv_id(unsigned int cpu) -{ - struct ucode_cpu_info *uci = ucode_cpu_info + cpu; - int i = 0; - - BUG_ON(equiv_cpu_table == NULL); - - while (equiv_cpu_table[i].installed_cpu != 0) { - if (uci->cpu_sig.sig == equiv_cpu_table[i].installed_cpu) - return equiv_cpu_table[i].equiv_cpu; - - i++; - } - return 0; -} - /* * we signal a good patch is found by returning its size > 0 */