1 #ifndef _ASM_X86_MICROCODE_H 2 #define _ASM_X86_MICROCODE_H 3 4 struct cpu_signature { 5 unsigned int sig; 6 unsigned int pf; 7 unsigned int rev; 8 }; 9 10 struct device; 11 12 enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND }; 13 14 struct microcode_ops { 15 void (*init)(struct device *device); 16 void (*fini)(void); 17 enum ucode_state (*request_microcode_user) (int cpu, 18 const void __user *buf, size_t size); 19 20 enum ucode_state (*request_microcode_fw) (int cpu, 21 struct device *device); 22 23 void (*microcode_fini_cpu) (int cpu); 24 25 /* 26 * The generic 'microcode_core' part guarantees that 27 * the callbacks below run on a target cpu when they 28 * are being called. 29 * See also the "Synchronization" section in microcode_core.c. 30 */ 31 int (*apply_microcode) (int cpu); 32 int (*collect_cpu_info) (int cpu, struct cpu_signature *csig); 33 }; 34 35 struct ucode_cpu_info { 36 struct cpu_signature cpu_sig; 37 int valid; 38 void *mc; 39 }; 40 extern struct ucode_cpu_info ucode_cpu_info[]; 41 42 #ifdef CONFIG_MICROCODE_INTEL 43 extern struct microcode_ops * __init init_intel_microcode(void); 44 #else 45 static inline struct microcode_ops * __init init_intel_microcode(void) 46 { 47 return NULL; 48 } 49 #endif /* CONFIG_MICROCODE_INTEL */ 50 51 #ifdef CONFIG_MICROCODE_AMD 52 extern struct microcode_ops * __init init_amd_microcode(void); 53 #else 54 static inline struct microcode_ops * __init init_amd_microcode(void) 55 { 56 return NULL; 57 } 58 #endif 59 60 #endif /* _ASM_X86_MICROCODE_H */ 61