aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/microcode_amd.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/microcode_amd.c')
-rw-r--r--arch/x86/kernel/microcode_amd.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index a8a0ec60055..89b386c901f 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -225,8 +225,8 @@ static void apply_microcode_amd(int cpu)
225 uci->cpu_sig.rev = rev; 225 uci->cpu_sig.rev = rev;
226} 226}
227 227
228static void *get_next_ucode(u8 *buf, unsigned int size, 228static void *get_next_ucode(const u8 *buf, unsigned int size,
229 int (*get_ucode_data)(void *, const void *, size_t), 229 int (*get_ucode_data)(void *, const u8 *, size_t),
230 unsigned int *mc_size) 230 unsigned int *mc_size)
231{ 231{
232 unsigned int total_size; 232 unsigned int total_size;
@@ -268,8 +268,8 @@ static void *get_next_ucode(u8 *buf, unsigned int size,
268} 268}
269 269
270 270
271static int install_equiv_cpu_table(u8 *buf, 271static int install_equiv_cpu_table(const u8 *buf,
272 int (*get_ucode_data)(void *, const void *, size_t)) 272 int (*get_ucode_data)(void *, const u8 *, size_t))
273{ 273{
274#define UCODE_CONTAINER_HEADER_SIZE 12 274#define UCODE_CONTAINER_HEADER_SIZE 12
275 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE]; 275 u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE];
@@ -311,11 +311,13 @@ static void free_equiv_cpu_table(void)
311 } 311 }
312} 312}
313 313
314static int generic_load_microcode(int cpu, void *data, size_t size, 314static int generic_load_microcode(int cpu, const u8 *data, size_t size,
315 int (*get_ucode_data)(void *, const void *, size_t)) 315 int (*get_ucode_data)(void *, const u8 *, size_t))
316{ 316{
317 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 317 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
318 u8 *ucode_ptr = data, *new_mc = NULL, *mc; 318 const u8 *ucode_ptr = data;
319 void *new_mc = NULL;
320 void *mc;
319 int new_rev = uci->cpu_sig.rev; 321 int new_rev = uci->cpu_sig.rev;
320 unsigned int leftover; 322 unsigned int leftover;
321 unsigned long offset; 323 unsigned long offset;
@@ -368,7 +370,7 @@ static int generic_load_microcode(int cpu, void *data, size_t size,
368 return (int)leftover; 370 return (int)leftover;
369} 371}
370 372
371static int get_ucode_fw(void *to, const void *from, size_t n) 373static int get_ucode_fw(void *to, const u8 *from, size_t n)
372{ 374{
373 memcpy(to, from, n); 375 memcpy(to, from, n);
374 return 0; 376 return 0;
@@ -390,7 +392,7 @@ static int request_microcode_fw(int cpu, struct device *device)
390 return ret; 392 return ret;
391 } 393 }
392 394
393 ret = generic_load_microcode(cpu, (void*)firmware->data, firmware->size, 395 ret = generic_load_microcode(cpu, firmware->data, firmware->size,
394 &get_ucode_fw); 396 &get_ucode_fw);
395 397
396 release_firmware(firmware); 398 release_firmware(firmware);