H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 1 | #ifndef _ASM_X86_MICROCODE_H |
| 2 | #define _ASM_X86_MICROCODE_H |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 3 | |
Dmitry Adamushko | 18dbc91 | 2008-09-23 12:08:44 +0200 | [diff] [blame] | 4 | struct cpu_signature { |
| 5 | unsigned int sig; |
| 6 | unsigned int pf; |
| 7 | unsigned int rev; |
| 8 | }; |
Peter Oruba | 8d86f39 | 2008-07-28 18:44:21 +0200 | [diff] [blame] | 9 | |
Dmitry Adamushko | a0a29b6 | 2008-09-11 23:27:52 +0200 | [diff] [blame] | 10 | struct device; |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 11 | |
Dmitry Adamushko | 871b72d | 2009-05-11 23:48:27 +0200 | [diff] [blame] | 12 | enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND }; |
| 13 | |
Peter Oruba | 26bf7a4 | 2008-07-28 18:44:20 +0200 | [diff] [blame] | 14 | struct microcode_ops { |
Dmitry Adamushko | 871b72d | 2009-05-11 23:48:27 +0200 | [diff] [blame] | 15 | enum ucode_state (*request_microcode_user) (int cpu, |
| 16 | const void __user *buf, size_t size); |
Dmitry Adamushko | a0a29b6 | 2008-09-11 23:27:52 +0200 | [diff] [blame] | 17 | |
Dmitry Adamushko | 871b72d | 2009-05-11 23:48:27 +0200 | [diff] [blame] | 18 | enum ucode_state (*request_microcode_fw) (int cpu, |
| 19 | struct device *device); |
Dmitry Adamushko | a0a29b6 | 2008-09-11 23:27:52 +0200 | [diff] [blame] | 20 | |
Dmitry Adamushko | a0a29b6 | 2008-09-11 23:27:52 +0200 | [diff] [blame] | 21 | void (*microcode_fini_cpu) (int cpu); |
Dmitry Adamushko | 871b72d | 2009-05-11 23:48:27 +0200 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * The generic 'microcode_core' part guarantees that |
| 25 | * the callbacks below run on a target cpu when they |
| 26 | * are being called. |
| 27 | * See also the "Synchronization" section in microcode_core.c. |
| 28 | */ |
| 29 | int (*apply_microcode) (int cpu); |
| 30 | int (*collect_cpu_info) (int cpu, struct cpu_signature *csig); |
Peter Oruba | 26bf7a4 | 2008-07-28 18:44:20 +0200 | [diff] [blame] | 31 | }; |
| 32 | |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 33 | struct ucode_cpu_info { |
Dmitry Adamushko | 871b72d | 2009-05-11 23:48:27 +0200 | [diff] [blame] | 34 | struct cpu_signature cpu_sig; |
| 35 | int valid; |
| 36 | void *mc; |
Peter Oruba | c3b71bc | 2008-07-28 18:44:15 +0200 | [diff] [blame] | 37 | }; |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 38 | extern struct ucode_cpu_info ucode_cpu_info[]; |
| 39 | |
Dmitry Adamushko | 18dbc91 | 2008-09-23 12:08:44 +0200 | [diff] [blame] | 40 | #ifdef CONFIG_MICROCODE_INTEL |
| 41 | extern struct microcode_ops * __init init_intel_microcode(void); |
| 42 | #else |
| 43 | static inline struct microcode_ops * __init init_intel_microcode(void) |
| 44 | { |
| 45 | return NULL; |
| 46 | } |
| 47 | #endif /* CONFIG_MICROCODE_INTEL */ |
| 48 | |
| 49 | #ifdef CONFIG_MICROCODE_AMD |
| 50 | extern struct microcode_ops * __init init_amd_microcode(void); |
| 51 | #else |
| 52 | static inline struct microcode_ops * __init init_amd_microcode(void) |
| 53 | { |
| 54 | return NULL; |
| 55 | } |
| 56 | #endif |
| 57 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 58 | #endif /* _ASM_X86_MICROCODE_H */ |