microcode.h 1.4 KB

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