1 #ifndef _ASM_X86_MICROCODE_AMD_H
2 #define _ASM_X86_MICROCODE_AMD_H
4 #include <asm/microcode.h>
6 #define UCODE_MAGIC 0x00414d44
7 #define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
8 #define UCODE_UCODE_TYPE 0x00000001
10 #define SECTION_HDR_SIZE 8
11 #define CONTAINER_HDR_SZ 12
13 struct equiv_cpu_entry
{
15 u32 fixed_errata_mask
;
16 u32 fixed_errata_compare
;
19 } __attribute__((packed
));
21 struct microcode_header_amd
{
27 u32 mc_patch_data_checksum
;
36 } __attribute__((packed
));
38 struct microcode_amd
{
39 struct microcode_header_amd hdr
;
43 static inline u16
find_equiv_id(struct equiv_cpu_entry
*equiv_cpu_table
,
51 while (equiv_cpu_table
[i
].installed_cpu
!= 0) {
52 if (sig
== equiv_cpu_table
[i
].installed_cpu
)
53 return equiv_cpu_table
[i
].equiv_cpu
;
60 extern int __apply_microcode_amd(struct microcode_amd
*mc_amd
);
61 extern int apply_microcode_amd(int cpu
);
62 extern enum ucode_state
load_microcode_amd(int cpu
, const u8
*data
, size_t size
);
64 #ifdef CONFIG_MICROCODE_AMD_EARLY
66 #define MPB_MAX_SIZE PAGE_SIZE
67 extern u8 amd_bsp_mpb
[MPB_MAX_SIZE
];
69 extern void __init
load_ucode_amd_bsp(void);
70 extern void load_ucode_amd_ap(void);
71 extern int __init
save_microcode_in_initrd_amd(void);
73 static inline void __init
load_ucode_amd_bsp(void) {}
74 static inline void load_ucode_amd_ap(void) {}
75 static inline int __init
save_microcode_in_initrd_amd(void) { return -EINVAL
; }
78 #endif /* _ASM_X86_MICROCODE_AMD_H */