diff options
author | Jacob Shin <jacob.shin@amd.com> | 2013-05-30 19:09:18 (GMT) |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-05-31 03:19:25 (GMT) |
commit | a76096a6571d5389376753c2e18b30a9791fa072 (patch) | |
tree | 1ca270330019b9d46ad6f499a7fa5bb69f56ba40 /arch/x86/include/asm/microcode_amd.h | |
parent | f2b3ee820a9f2368d7f8842ad7da062dfe86e199 (diff) | |
download | linux-fsl-qoriq-a76096a6571d5389376753c2e18b30a9791fa072.tar.xz |
x86, microcode, amd: Refactor functions to prepare for early loading
In preparation work for early loading, refactor some common functions
that will be shared, and move some struct defines to a common header file.
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Link: http://lkml.kernel.org/r/1369940959-2077-4-git-send-email-jacob.shin@amd.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Diffstat (limited to 'arch/x86/include/asm/microcode_amd.h')
-rw-r--r-- | arch/x86/include/asm/microcode_amd.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h new file mode 100644 index 0000000..a57d9b7 --- /dev/null +++ b/arch/x86/include/asm/microcode_amd.h @@ -0,0 +1,64 @@ +#ifndef _ASM_X86_MICROCODE_AMD_H +#define _ASM_X86_MICROCODE_AMD_H + +#include <asm/microcode.h> + +#define UCODE_MAGIC 0x00414d44 +#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000 +#define UCODE_UCODE_TYPE 0x00000001 + +#define SECTION_HDR_SIZE 8 +#define CONTAINER_HDR_SZ 12 + +struct equiv_cpu_entry { + u32 installed_cpu; + u32 fixed_errata_mask; + u32 fixed_errata_compare; + u16 equiv_cpu; + u16 res; +} __attribute__((packed)); + +struct microcode_header_amd { + u32 data_code; + u32 patch_id; + u16 mc_patch_data_id; + u8 mc_patch_data_len; + u8 init_flag; + u32 mc_patch_data_checksum; + u32 nb_dev_id; + u32 sb_dev_id; + u16 processor_rev_id; + u8 nb_rev_id; + u8 sb_rev_id; + u8 bios_api_rev; + u8 reserved1[3]; + u32 match_reg[8]; +} __attribute__((packed)); + +struct microcode_amd { + struct microcode_header_amd hdr; + unsigned int mpb[0]; +}; + +static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table, + unsigned int sig) +{ + int i = 0; + + if (!equiv_cpu_table) + return 0; + + while (equiv_cpu_table[i].installed_cpu != 0) { + if (sig == equiv_cpu_table[i].installed_cpu) + return equiv_cpu_table[i].equiv_cpu; + + i++; + } + return 0; +} + +extern int __apply_microcode_amd(struct microcode_amd *mc_amd); +extern int apply_microcode_amd(int cpu); +extern enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size); + +#endif /* _ASM_X86_MICROCODE_AMD_H */ |