Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 1 | #ifndef ASM_X86__MICROCODE_H |
| 2 | #define ASM_X86__MICROCODE_H |
| 3 | |
Peter Oruba | 8d86f39 | 2008-07-28 18:44:21 +0200 | [diff] [blame] | 4 | extern int microcode_init(void *opaque, struct module *module); |
| 5 | extern void microcode_exit(void); |
| 6 | |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 7 | struct cpu_signature; |
Dmitry Adamushko | a0a29b6 | 2008-09-11 23:27:52 +0200 | [diff] [blame^] | 8 | struct device; |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 9 | |
Peter Oruba | 26bf7a4 | 2008-07-28 18:44:20 +0200 | [diff] [blame] | 10 | struct microcode_ops { |
Dmitry Adamushko | a0a29b6 | 2008-09-11 23:27:52 +0200 | [diff] [blame^] | 11 | int (*request_microcode_user) (int cpu, const void __user *buf, size_t size); |
| 12 | int (*request_microcode_fw) (int cpu, struct device *device); |
| 13 | |
| 14 | void (*apply_microcode) (int cpu); |
| 15 | |
| 16 | int (*collect_cpu_info) (int cpu, struct cpu_signature *csig); |
| 17 | void (*microcode_fini_cpu) (int cpu); |
Peter Oruba | 26bf7a4 | 2008-07-28 18:44:20 +0200 | [diff] [blame] | 18 | }; |
| 19 | |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 20 | struct microcode_header_intel { |
Peter Oruba | 9a56a0f | 2008-07-28 18:44:13 +0200 | [diff] [blame] | 21 | unsigned int hdrver; |
| 22 | unsigned int rev; |
| 23 | unsigned int date; |
| 24 | unsigned int sig; |
| 25 | unsigned int cksum; |
| 26 | unsigned int ldrver; |
| 27 | unsigned int pf; |
| 28 | unsigned int datasize; |
| 29 | unsigned int totalsize; |
| 30 | unsigned int reserved[3]; |
| 31 | }; |
| 32 | |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 33 | struct microcode_intel { |
| 34 | struct microcode_header_intel hdr; |
Peter Oruba | 9a56a0f | 2008-07-28 18:44:13 +0200 | [diff] [blame] | 35 | unsigned int bits[0]; |
| 36 | }; |
| 37 | |
Peter Oruba | 9a56a0f | 2008-07-28 18:44:13 +0200 | [diff] [blame] | 38 | /* microcode format is extended from prescott processors */ |
| 39 | struct extended_signature { |
| 40 | unsigned int sig; |
| 41 | unsigned int pf; |
| 42 | unsigned int cksum; |
| 43 | }; |
| 44 | |
| 45 | struct extended_sigtable { |
| 46 | unsigned int count; |
| 47 | unsigned int cksum; |
| 48 | unsigned int reserved[3]; |
| 49 | struct extended_signature sigs[0]; |
| 50 | }; |
Peter Oruba | c3b71bc | 2008-07-28 18:44:15 +0200 | [diff] [blame] | 51 | |
Peter Oruba | 9835fd4 | 2008-07-28 18:44:19 +0200 | [diff] [blame] | 52 | struct equiv_cpu_entry { |
| 53 | unsigned int installed_cpu; |
| 54 | unsigned int fixed_errata_mask; |
| 55 | unsigned int fixed_errata_compare; |
| 56 | unsigned int equiv_cpu; |
| 57 | }; |
| 58 | |
| 59 | struct microcode_header_amd { |
| 60 | unsigned int data_code; |
| 61 | unsigned int patch_id; |
| 62 | unsigned char mc_patch_data_id[2]; |
| 63 | unsigned char mc_patch_data_len; |
| 64 | unsigned char init_flag; |
| 65 | unsigned int mc_patch_data_checksum; |
| 66 | unsigned int nb_dev_id; |
| 67 | unsigned int sb_dev_id; |
| 68 | unsigned char processor_rev_id[2]; |
| 69 | unsigned char nb_rev_id; |
| 70 | unsigned char sb_rev_id; |
| 71 | unsigned char bios_api_rev; |
| 72 | unsigned char reserved1[3]; |
| 73 | unsigned int match_reg[8]; |
| 74 | }; |
| 75 | |
| 76 | struct microcode_amd { |
| 77 | struct microcode_header_amd hdr; |
| 78 | unsigned int mpb[0]; |
| 79 | }; |
| 80 | |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 81 | struct cpu_signature { |
Peter Oruba | c3b71bc | 2008-07-28 18:44:15 +0200 | [diff] [blame] | 82 | unsigned int sig; |
| 83 | unsigned int pf; |
| 84 | unsigned int rev; |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | struct ucode_cpu_info { |
| 88 | struct cpu_signature cpu_sig; |
| 89 | int valid; |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 90 | union { |
| 91 | struct microcode_intel *mc_intel; |
Peter Oruba | 9835fd4 | 2008-07-28 18:44:19 +0200 | [diff] [blame] | 92 | struct microcode_amd *mc_amd; |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 93 | void *valid_mc; |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 94 | } mc; |
Peter Oruba | c3b71bc | 2008-07-28 18:44:15 +0200 | [diff] [blame] | 95 | }; |
Dmitry Adamushko | d45de40 | 2008-08-20 00:22:26 +0200 | [diff] [blame] | 96 | extern struct ucode_cpu_info ucode_cpu_info[]; |
| 97 | |
| 98 | #endif /* ASM_X86__MICROCODE_H */ |