blob: c24ca9a56458e029da2e3c107f9a0fc2c80908eb [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_MICROCODE_H
2#define _ASM_X86_MICROCODE_H
Dmitry Adamushkod45de402008-08-20 00:22:26 +02003
Dmitry Adamushko18dbc912008-09-23 12:08:44 +02004struct cpu_signature {
5 unsigned int sig;
6 unsigned int pf;
7 unsigned int rev;
8};
Peter Oruba8d86f392008-07-28 18:44:21 +02009
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020010struct device;
Dmitry Adamushkod45de402008-08-20 00:22:26 +020011
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020012enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND };
13
Peter Oruba26bf7a42008-07-28 18:44:20 +020014struct microcode_ops {
Andreas Herrmannd1c84f72009-11-10 12:07:23 +010015 void (*init)(struct device *device);
16 void (*fini)(void);
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020017 enum ucode_state (*request_microcode_user) (int cpu,
18 const void __user *buf, size_t size);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020019
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020020 enum ucode_state (*request_microcode_fw) (int cpu,
21 struct device *device);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020022
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020023 void (*microcode_fini_cpu) (int cpu);
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020024
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);
Peter Oruba26bf7a42008-07-28 18:44:20 +020033};
34
Dmitry Adamushkod45de402008-08-20 00:22:26 +020035struct ucode_cpu_info {
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020036 struct cpu_signature cpu_sig;
37 int valid;
38 void *mc;
Peter Orubac3b71bc2008-07-28 18:44:15 +020039};
Dmitry Adamushkod45de402008-08-20 00:22:26 +020040extern struct ucode_cpu_info ucode_cpu_info[];
41
Dmitry Adamushko18dbc912008-09-23 12:08:44 +020042#ifdef CONFIG_MICROCODE_INTEL
43extern struct microcode_ops * __init init_intel_microcode(void);
44#else
45static 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
52extern struct microcode_ops * __init init_amd_microcode(void);
53#else
54static inline struct microcode_ops * __init init_amd_microcode(void)
55{
56 return NULL;
57}
58#endif
59
H. Peter Anvin1965aae2008-10-22 22:26:29 -070060#endif /* _ASM_X86_MICROCODE_H */