blob: ef51b501e22a6e53bf4ae7e2d9e2566760f72ee1 [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 {
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020015 enum ucode_state (*request_microcode_user) (int cpu,
16 const void __user *buf, size_t size);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020017
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020018 enum ucode_state (*request_microcode_fw) (int cpu,
19 struct device *device);
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020020
Dmitry Adamushkoa0a29b62008-09-11 23:27:52 +020021 void (*microcode_fini_cpu) (int cpu);
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020022
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 Oruba26bf7a42008-07-28 18:44:20 +020031};
32
Dmitry Adamushkod45de402008-08-20 00:22:26 +020033struct ucode_cpu_info {
Dmitry Adamushko871b72d2009-05-11 23:48:27 +020034 struct cpu_signature cpu_sig;
35 int valid;
36 void *mc;
Peter Orubac3b71bc2008-07-28 18:44:15 +020037};
Dmitry Adamushkod45de402008-08-20 00:22:26 +020038extern struct ucode_cpu_info ucode_cpu_info[];
39
Dmitry Adamushko18dbc912008-09-23 12:08:44 +020040#ifdef CONFIG_MICROCODE_INTEL
41extern struct microcode_ops * __init init_intel_microcode(void);
42#else
43static 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
50extern struct microcode_ops * __init init_amd_microcode(void);
51#else
52static inline struct microcode_ops * __init init_amd_microcode(void)
53{
54 return NULL;
55}
56#endif
57
H. Peter Anvin1965aae2008-10-22 22:26:29 -070058#endif /* _ASM_X86_MICROCODE_H */