microcode_intel.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _ASM_X86_MICROCODE_INTEL_H
  2. #define _ASM_X86_MICROCODE_INTEL_H
  3. #include <asm/microcode.h>
  4. struct microcode_header_intel {
  5. unsigned int hdrver;
  6. unsigned int rev;
  7. unsigned int date;
  8. unsigned int sig;
  9. unsigned int cksum;
  10. unsigned int ldrver;
  11. unsigned int pf;
  12. unsigned int datasize;
  13. unsigned int totalsize;
  14. unsigned int reserved[3];
  15. };
  16. struct microcode_intel {
  17. struct microcode_header_intel hdr;
  18. unsigned int bits[0];
  19. };
  20. /* microcode format is extended from prescott processors */
  21. struct extended_signature {
  22. unsigned int sig;
  23. unsigned int pf;
  24. unsigned int cksum;
  25. };
  26. struct extended_sigtable {
  27. unsigned int count;
  28. unsigned int cksum;
  29. unsigned int reserved[3];
  30. struct extended_signature sigs[0];
  31. };
  32. #define DEFAULT_UCODE_DATASIZE (2000)
  33. #define MC_HEADER_SIZE (sizeof(struct microcode_header_intel))
  34. #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE)
  35. #define EXT_HEADER_SIZE (sizeof(struct extended_sigtable))
  36. #define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature))
  37. #define DWSIZE (sizeof(u32))
  38. #define get_totalsize(mc) \
  39. (((struct microcode_intel *)mc)->hdr.totalsize ? \
  40. ((struct microcode_intel *)mc)->hdr.totalsize : \
  41. DEFAULT_UCODE_TOTALSIZE)
  42. #define get_datasize(mc) \
  43. (((struct microcode_intel *)mc)->hdr.datasize ? \
  44. ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE)
  45. #define sigmatch(s1, s2, p1, p2) \
  46. (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0))))
  47. #define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE)
  48. extern int
  49. get_matching_microcode(unsigned int csig, int cpf, void *mc, int rev);
  50. extern int microcode_sanity_check(void *mc, int print_err);
  51. extern int get_matching_sig(unsigned int csig, int cpf, void *mc, int rev);
  52. extern int
  53. update_match_revision(struct microcode_header_intel *mc_header, int rev);
  54. #ifdef CONFIG_MICROCODE_INTEL_EARLY
  55. extern void __init load_ucode_intel_bsp(void);
  56. extern void __cpuinit load_ucode_intel_ap(void);
  57. extern void show_ucode_info_early(void);
  58. #else
  59. static inline __init void load_ucode_intel_bsp(void) {}
  60. static inline __cpuinit void load_ucode_intel_ap(void) {}
  61. static inline void show_ucode_info_early(void) {}
  62. #endif
  63. #if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU)
  64. extern int save_mc_for_early(u8 *mc);
  65. #else
  66. static inline int save_mc_for_early(u8 *mc)
  67. {
  68. return 0;
  69. }
  70. #endif
  71. #endif /* _ASM_X86_MICROCODE_INTEL_H */