2008-10-23 12:26:29 +07:00
|
|
|
#ifndef _ASM_X86_MICROCODE_H
|
|
|
|
#define _ASM_X86_MICROCODE_H
|
2008-08-20 05:22:26 +07:00
|
|
|
|
2008-09-23 17:08:44 +07:00
|
|
|
struct cpu_signature {
|
|
|
|
unsigned int sig;
|
|
|
|
unsigned int pf;
|
|
|
|
unsigned int rev;
|
|
|
|
};
|
2008-07-28 23:44:21 +07:00
|
|
|
|
2008-09-12 04:27:52 +07:00
|
|
|
struct device;
|
2008-08-20 05:22:26 +07:00
|
|
|
|
2009-05-12 04:48:27 +07:00
|
|
|
enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND };
|
|
|
|
|
2008-07-28 23:44:20 +07:00
|
|
|
struct microcode_ops {
|
2009-05-12 04:48:27 +07:00
|
|
|
enum ucode_state (*request_microcode_user) (int cpu,
|
|
|
|
const void __user *buf, size_t size);
|
2008-09-12 04:27:52 +07:00
|
|
|
|
2012-07-26 20:51:00 +07:00
|
|
|
enum ucode_state (*request_microcode_fw) (int cpu, struct device *,
|
|
|
|
bool refresh_fw);
|
2008-09-12 04:27:52 +07:00
|
|
|
|
|
|
|
void (*microcode_fini_cpu) (int cpu);
|
2009-05-12 04:48:27 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The generic 'microcode_core' part guarantees that
|
|
|
|
* the callbacks below run on a target cpu when they
|
|
|
|
* are being called.
|
|
|
|
* See also the "Synchronization" section in microcode_core.c.
|
|
|
|
*/
|
|
|
|
int (*apply_microcode) (int cpu);
|
|
|
|
int (*collect_cpu_info) (int cpu, struct cpu_signature *csig);
|
2008-07-28 23:44:20 +07:00
|
|
|
};
|
|
|
|
|
2008-08-20 05:22:26 +07:00
|
|
|
struct ucode_cpu_info {
|
2009-05-12 04:48:27 +07:00
|
|
|
struct cpu_signature cpu_sig;
|
|
|
|
int valid;
|
|
|
|
void *mc;
|
2008-07-28 23:44:15 +07:00
|
|
|
};
|
2008-08-20 05:22:26 +07:00
|
|
|
extern struct ucode_cpu_info ucode_cpu_info[];
|
|
|
|
|
2008-09-23 17:08:44 +07:00
|
|
|
#ifdef CONFIG_MICROCODE_INTEL
|
|
|
|
extern struct microcode_ops * __init init_intel_microcode(void);
|
|
|
|
#else
|
|
|
|
static inline struct microcode_ops * __init init_intel_microcode(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_MICROCODE_INTEL */
|
|
|
|
|
|
|
|
#ifdef CONFIG_MICROCODE_AMD
|
|
|
|
extern struct microcode_ops * __init init_amd_microcode(void);
|
2011-12-02 22:50:04 +07:00
|
|
|
extern void __exit exit_amd_microcode(void);
|
2008-09-23 17:08:44 +07:00
|
|
|
#else
|
|
|
|
static inline struct microcode_ops * __init init_amd_microcode(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-12-02 22:50:04 +07:00
|
|
|
static inline void __exit exit_amd_microcode(void) {}
|
2008-09-23 17:08:44 +07:00
|
|
|
#endif
|
|
|
|
|
2012-12-21 14:44:25 +07:00
|
|
|
#ifdef CONFIG_MICROCODE_EARLY
|
|
|
|
#define MAX_UCODE_COUNT 128
|
|
|
|
extern void __init load_ucode_bsp(void);
|
|
|
|
extern __init void load_ucode_ap(void);
|
|
|
|
extern int __init save_microcode_in_initrd(void);
|
|
|
|
#else
|
|
|
|
static inline void __init load_ucode_bsp(void) {}
|
|
|
|
static inline __init void load_ucode_ap(void) {}
|
|
|
|
static inline int __init save_microcode_in_initrd(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-10-23 12:26:29 +07:00
|
|
|
#endif /* _ASM_X86_MICROCODE_H */
|