diff options
| -rw-r--r-- | arch/x86/kernel/microcode_amd.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 94ecdaa24052..03ed5af7053d 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
| @@ -78,6 +78,36 @@ static struct equiv_cpu_entry *equiv_cpu_table; | |||
| 78 | /* page-sized ucode patch buffer */ | 78 | /* page-sized ucode patch buffer */ |
| 79 | void *patch; | 79 | void *patch; |
| 80 | 80 | ||
| 81 | static u16 find_equiv_id(unsigned int cpu) | ||
| 82 | { | ||
| 83 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | ||
| 84 | int i = 0; | ||
| 85 | |||
| 86 | BUG_ON(equiv_cpu_table == NULL); | ||
| 87 | |||
| 88 | while (equiv_cpu_table[i].installed_cpu != 0) { | ||
| 89 | if (uci->cpu_sig.sig == equiv_cpu_table[i].installed_cpu) | ||
| 90 | return equiv_cpu_table[i].equiv_cpu; | ||
| 91 | |||
| 92 | i++; | ||
| 93 | } | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | static u32 find_cpu_family_by_equiv_cpu(u16 equiv_cpu) | ||
| 98 | { | ||
| 99 | int i = 0; | ||
| 100 | |||
| 101 | BUG_ON(!equiv_cpu_table); | ||
| 102 | |||
| 103 | while (equiv_cpu_table[i].equiv_cpu != 0) { | ||
| 104 | if (equiv_cpu == equiv_cpu_table[i].equiv_cpu) | ||
| 105 | return equiv_cpu_table[i].installed_cpu; | ||
| 106 | i++; | ||
| 107 | } | ||
| 108 | return 0; | ||
| 109 | } | ||
| 110 | |||
| 81 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) | 111 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) |
| 82 | { | 112 | { |
| 83 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 113 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| @@ -119,22 +149,6 @@ static unsigned int verify_ucode_size(int cpu, u32 patch_size, | |||
| 119 | return patch_size; | 149 | return patch_size; |
| 120 | } | 150 | } |
| 121 | 151 | ||
| 122 | static u16 find_equiv_id(unsigned int cpu) | ||
| 123 | { | ||
| 124 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | ||
| 125 | int i = 0; | ||
| 126 | |||
| 127 | BUG_ON(equiv_cpu_table == NULL); | ||
| 128 | |||
| 129 | while (equiv_cpu_table[i].installed_cpu != 0) { | ||
| 130 | if (uci->cpu_sig.sig == equiv_cpu_table[i].installed_cpu) | ||
| 131 | return equiv_cpu_table[i].equiv_cpu; | ||
| 132 | |||
| 133 | i++; | ||
| 134 | } | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | |||
| 138 | /* | 152 | /* |
| 139 | * we signal a good patch is found by returning its size > 0 | 153 | * we signal a good patch is found by returning its size > 0 |
| 140 | */ | 154 | */ |
