Peter Oruba | 8d86f39 | 2008-07-28 18:44:21 +0200 | [diff] [blame] | 1 | extern int microcode_init(void *opaque, struct module *module); |
| 2 | extern void microcode_exit(void); |
| 3 | |
Peter Oruba | 26bf7a4 | 2008-07-28 18:44:20 +0200 | [diff] [blame] | 4 | struct microcode_ops { |
| 5 | long (*get_next_ucode)(void **mc, long offset); |
| 6 | long (*microcode_get_next_ucode)(void **mc, long offset); |
| 7 | int (*get_matching_microcode)(void *mc, int cpu); |
| 8 | int (*apply_microcode_check_cpu)(int cpu); |
| 9 | int (*microcode_sanity_check)(void *mc); |
| 10 | int (*cpu_request_microcode)(int cpu); |
| 11 | void (*collect_cpu_info)(int cpu_num); |
| 12 | void (*apply_microcode)(int cpu); |
| 13 | void (*microcode_fini_cpu)(int cpu); |
| 14 | void (*clear_patch)(void *data); |
| 15 | }; |
| 16 | |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 17 | struct microcode_header_intel { |
Peter Oruba | 9a56a0f | 2008-07-28 18:44:13 +0200 | [diff] [blame] | 18 | unsigned int hdrver; |
| 19 | unsigned int rev; |
| 20 | unsigned int date; |
| 21 | unsigned int sig; |
| 22 | unsigned int cksum; |
| 23 | unsigned int ldrver; |
| 24 | unsigned int pf; |
| 25 | unsigned int datasize; |
| 26 | unsigned int totalsize; |
| 27 | unsigned int reserved[3]; |
| 28 | }; |
| 29 | |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 30 | struct microcode_intel { |
| 31 | struct microcode_header_intel hdr; |
Peter Oruba | 9a56a0f | 2008-07-28 18:44:13 +0200 | [diff] [blame] | 32 | unsigned int bits[0]; |
| 33 | }; |
| 34 | |
Peter Oruba | 9a56a0f | 2008-07-28 18:44:13 +0200 | [diff] [blame] | 35 | /* microcode format is extended from prescott processors */ |
| 36 | struct extended_signature { |
| 37 | unsigned int sig; |
| 38 | unsigned int pf; |
| 39 | unsigned int cksum; |
| 40 | }; |
| 41 | |
| 42 | struct extended_sigtable { |
| 43 | unsigned int count; |
| 44 | unsigned int cksum; |
| 45 | unsigned int reserved[3]; |
| 46 | struct extended_signature sigs[0]; |
| 47 | }; |
Peter Oruba | c3b71bc | 2008-07-28 18:44:15 +0200 | [diff] [blame] | 48 | |
Peter Oruba | 9835fd4 | 2008-07-28 18:44:19 +0200 | [diff] [blame] | 49 | struct equiv_cpu_entry { |
| 50 | unsigned int installed_cpu; |
| 51 | unsigned int fixed_errata_mask; |
| 52 | unsigned int fixed_errata_compare; |
| 53 | unsigned int equiv_cpu; |
| 54 | }; |
| 55 | |
| 56 | struct microcode_header_amd { |
| 57 | unsigned int data_code; |
| 58 | unsigned int patch_id; |
| 59 | unsigned char mc_patch_data_id[2]; |
| 60 | unsigned char mc_patch_data_len; |
| 61 | unsigned char init_flag; |
| 62 | unsigned int mc_patch_data_checksum; |
| 63 | unsigned int nb_dev_id; |
| 64 | unsigned int sb_dev_id; |
| 65 | unsigned char processor_rev_id[2]; |
| 66 | unsigned char nb_rev_id; |
| 67 | unsigned char sb_rev_id; |
| 68 | unsigned char bios_api_rev; |
| 69 | unsigned char reserved1[3]; |
| 70 | unsigned int match_reg[8]; |
| 71 | }; |
| 72 | |
| 73 | struct microcode_amd { |
| 74 | struct microcode_header_amd hdr; |
| 75 | unsigned int mpb[0]; |
| 76 | }; |
| 77 | |
Peter Oruba | c3b71bc | 2008-07-28 18:44:15 +0200 | [diff] [blame] | 78 | struct ucode_cpu_info { |
| 79 | int valid; |
| 80 | unsigned int sig; |
| 81 | unsigned int pf; |
| 82 | unsigned int rev; |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 83 | union { |
| 84 | struct microcode_intel *mc_intel; |
Peter Oruba | 9835fd4 | 2008-07-28 18:44:19 +0200 | [diff] [blame] | 85 | struct microcode_amd *mc_amd; |
Peter Oruba | d4ee366 | 2008-07-28 18:44:18 +0200 | [diff] [blame] | 86 | } mc; |
Peter Oruba | c3b71bc | 2008-07-28 18:44:15 +0200 | [diff] [blame] | 87 | }; |