aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/microcode_amd.c
diff options
context:
space:
mode:
authorAndreas Herrmann <andreas.herrmann3@amd.com>2008-12-16 13:14:05 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-16 13:58:03 -0500
commit0657d9ebff186dcdb17e582dcb909028775a7707 (patch)
tree2430fdf53b2e1e6a888c7380bb7a17d9c5c335e0 /arch/x86/kernel/microcode_amd.c
parent8c135206c826095c852c16d94a0a74eeaf05c90d (diff)
x86: microcode_amd: don't pass superfluous function pointer for get_ucode_data
Impact: cleanup Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/microcode_amd.c')
-rw-r--r--arch/x86/kernel/microcode_amd.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 89b386c901fd..c7f225c7e481 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -225,9 +225,14 @@ static void apply_microcode_amd(int cpu)
225 uci->cpu_sig.rev = rev; 225 uci->cpu_sig.rev = rev;
226} 226}
227 227
228static int get_ucode_data(void *to, const u8 *from, size_t n)
229{
230 memcpy(to, from, n);
231 return 0;
232}
233
228static void *get_next_ucode(const u8 *buf, unsigned int size, 234static void *get_next_ucode(const u8 *buf, unsigned int size,
229 int (*get_ucode_data)(void *, const u8 *, size_t), 235 unsigned int *mc_size)
230 unsigned int *mc_size)
231{ 236{
232 unsigned int total_size; 237 unsigned int total_size;
233#define UCODE_CONTAINER_SECTION_HDR 8 238#define UCODE_CONTAINER_SECTION_HDR 8
@@ -268,8 +273,7 @@ static void *get_next_ucode(const u8 *buf, unsigned int size,
268} 273}
269 274
270 275
271static int install_equiv_cpu_table(const u8 *buf, 276static int install_equiv_cpu_table(const u8 *buf)
272 int (*get_ucode_data)(void *, const u8 *, size_t))
273{ 277{
274#define UCODE_CONTAINER_HEADER_SIZE 12 278#define UCODE_CONTAINER_HEADER_SIZE 12
275 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE]; 279 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE];
@@ -311,8 +315,7 @@ static void free_equiv_cpu_table(void)
311 } 315 }
312} 316}
313 317
314static int generic_load_microcode(int cpu, const u8 *data, size_t size, 318static int generic_load_microcode(int cpu, const u8 *data, size_t size)
315 int (*get_ucode_data)(void *, const u8 *, size_t))
316{ 319{
317 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 320 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
318 const u8 *ucode_ptr = data; 321 const u8 *ucode_ptr = data;
@@ -322,7 +325,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size,
322 unsigned int leftover; 325 unsigned int leftover;
323 unsigned long offset; 326 unsigned long offset;
324 327
325 offset = install_equiv_cpu_table(ucode_ptr, get_ucode_data); 328 offset = install_equiv_cpu_table(ucode_ptr);
326 if (!offset) { 329 if (!offset) {
327 printk(KERN_ERR "microcode: installing equivalent cpu table failed\n"); 330 printk(KERN_ERR "microcode: installing equivalent cpu table failed\n");
328 return -EINVAL; 331 return -EINVAL;
@@ -335,8 +338,7 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size,
335 unsigned int uninitialized_var(mc_size); 338 unsigned int uninitialized_var(mc_size);
336 struct microcode_header_amd *mc_header; 339 struct microcode_header_amd *mc_header;
337 340
338 mc = get_next_ucode(ucode_ptr, leftover, get_ucode_data, 341 mc = get_next_ucode(ucode_ptr, leftover, &mc_size);
339 &mc_size);
340 if (!mc) 342 if (!mc)
341 break; 343 break;
342 344
@@ -370,12 +372,6 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size,
370 return (int)leftover; 372 return (int)leftover;
371} 373}
372 374
373static int get_ucode_fw(void *to, const u8 *from, size_t n)
374{
375 memcpy(to, from, n);
376 return 0;
377}
378
379static int request_microcode_fw(int cpu, struct device *device) 375static int request_microcode_fw(int cpu, struct device *device)
380{ 376{
381 const char *fw_name = "amd-ucode/microcode_amd.bin"; 377 const char *fw_name = "amd-ucode/microcode_amd.bin";
@@ -392,8 +388,7 @@ static int request_microcode_fw(int cpu, struct device *device)
392 return ret; 388 return ret;
393 } 389 }
394 390
395 ret = generic_load_microcode(cpu, firmware->data, firmware->size, 391 ret = generic_load_microcode(cpu, firmware->data, firmware->size);
396 &get_ucode_fw);
397 392
398 release_firmware(firmware); 393 release_firmware(firmware);
399 394