diff options
| -rw-r--r-- | arch/x86/kernel/microcode_amd.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 2856955ddab1..e68e723490a3 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
| @@ -75,15 +75,9 @@ struct microcode_amd { | |||
| 75 | unsigned int mpb[0]; | 75 | unsigned int mpb[0]; |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | #define UCODE_MAX_SIZE (2048) | 78 | #define UCODE_MAX_SIZE 2048 |
| 79 | #define DEFAULT_UCODE_DATASIZE (896) | 79 | #define UCODE_CONTAINER_SECTION_HDR 8 |
| 80 | #define MC_HEADER_SIZE (sizeof(struct microcode_header_amd)) | 80 | #define UCODE_CONTAINER_HEADER_SIZE 12 |
| 81 | #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) | ||
| 82 | #define DWSIZE (sizeof(u32)) | ||
| 83 | /* For now we support a fixed ucode total size only */ | ||
| 84 | #define get_totalsize(mc) \ | ||
| 85 | ((((struct microcode_amd *)mc)->hdr.mc_patch_data_len * 28) \ | ||
| 86 | + MC_HEADER_SIZE) | ||
| 87 | 81 | ||
| 88 | /* serialize access to the physical write */ | 82 | /* serialize access to the physical write */ |
| 89 | static DEFINE_SPINLOCK(microcode_update_lock); | 83 | static DEFINE_SPINLOCK(microcode_update_lock); |
| @@ -222,7 +216,6 @@ static void *get_next_ucode(const u8 *buf, unsigned int size, | |||
| 222 | unsigned int *mc_size) | 216 | unsigned int *mc_size) |
| 223 | { | 217 | { |
| 224 | unsigned int total_size; | 218 | unsigned int total_size; |
| 225 | #define UCODE_CONTAINER_SECTION_HDR 8 | ||
| 226 | u8 section_hdr[UCODE_CONTAINER_SECTION_HDR]; | 219 | u8 section_hdr[UCODE_CONTAINER_SECTION_HDR]; |
| 227 | void *mc; | 220 | void *mc; |
| 228 | 221 | ||
| @@ -255,14 +248,12 @@ static void *get_next_ucode(const u8 *buf, unsigned int size, | |||
| 255 | } else | 248 | } else |
| 256 | *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR; | 249 | *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR; |
| 257 | } | 250 | } |
| 258 | #undef UCODE_CONTAINER_SECTION_HDR | ||
| 259 | return mc; | 251 | return mc; |
| 260 | } | 252 | } |
| 261 | 253 | ||
| 262 | 254 | ||
| 263 | static int install_equiv_cpu_table(const u8 *buf) | 255 | static int install_equiv_cpu_table(const u8 *buf) |
| 264 | { | 256 | { |
| 265 | #define UCODE_CONTAINER_HEADER_SIZE 12 | ||
| 266 | u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE]; | 257 | u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE]; |
| 267 | unsigned int *buf_pos = (unsigned int *)container_hdr; | 258 | unsigned int *buf_pos = (unsigned int *)container_hdr; |
| 268 | unsigned long size; | 259 | unsigned long size; |
| @@ -291,7 +282,6 @@ static int install_equiv_cpu_table(const u8 *buf) | |||
| 291 | } | 282 | } |
| 292 | 283 | ||
| 293 | return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */ | 284 | return size + UCODE_CONTAINER_HEADER_SIZE; /* add header length */ |
| 294 | #undef UCODE_CONTAINER_HEADER_SIZE | ||
| 295 | } | 285 | } |
| 296 | 286 | ||
| 297 | static void free_equiv_cpu_table(void) | 287 | static void free_equiv_cpu_table(void) |
