Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224063
b: refs/heads/master
c: c7657ac
h: refs/heads/master
i:
  224061: 5171030
  224059: 795c6d7
  224055: a7d0373
  224047: 036e8ed
  224031: a570207
  223999: 643b982
v: v3
  • Loading branch information
Borislav Petkov committed Nov 10, 2010
1 parent 3dcda2d commit 6b96c5a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1ea6be212eea5ce1e8fabadacb0c639ad87b2f00
refs/heads/master: c7657ac0c3e4d4ab569296911164b7a2b0ff871a
6 changes: 6 additions & 0 deletions trunk/arch/x86/include/asm/microcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ static inline struct microcode_ops * __init init_intel_microcode(void)

#ifdef CONFIG_MICROCODE_AMD
extern struct microcode_ops * __init init_amd_microcode(void);

static inline void get_ucode_data(void *to, const u8 *from, size_t n)
{
memcpy(to, from, n);
}

#else
static inline struct microcode_ops * __init init_amd_microcode(void)
{
Expand Down
25 changes: 5 additions & 20 deletions trunk/arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,14 @@ static int apply_microcode_amd(int cpu)
return 0;
}

static int get_ucode_data(void *to, const u8 *from, size_t n)
{
memcpy(to, from, n);
return 0;
}

static void *
get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
{
unsigned int total_size;
u8 section_hdr[UCODE_CONTAINER_SECTION_HDR];
void *mc;

if (get_ucode_data(section_hdr, buf, UCODE_CONTAINER_SECTION_HDR))
return NULL;
get_ucode_data(section_hdr, buf, UCODE_CONTAINER_SECTION_HDR);

if (section_hdr[0] != UCODE_UCODE_TYPE) {
pr_err("error: invalid type field in container file section header\n");
Expand All @@ -187,12 +180,8 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
if (!mc)
return NULL;

if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size)) {
vfree(mc);
mc = NULL;
} else {
*mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
}
get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size);
*mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;

return mc;
}
Expand All @@ -203,8 +192,7 @@ static int install_equiv_cpu_table(const u8 *buf)
unsigned int *buf_pos = (unsigned int *)container_hdr;
unsigned long size;

if (get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE))
return 0;
get_ucode_data(&container_hdr, buf, UCODE_CONTAINER_HEADER_SIZE);

size = buf_pos[2];

Expand All @@ -220,10 +208,7 @@ static int install_equiv_cpu_table(const u8 *buf)
}

buf += UCODE_CONTAINER_HEADER_SIZE;
if (get_ucode_data(equiv_cpu_table, buf, size)) {
vfree(equiv_cpu_table);
return 0;
}
get_ucode_data(equiv_cpu_table, buf, size);

return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */
}
Expand Down

0 comments on commit 6b96c5a

Please sign in to comment.