2 * X86 CPU microcode early update for Linux
4 * Copyright (C) 2012 Fenghua Yu <fenghua.yu@intel.com>
5 * H Peter Anvin" <hpa@zytor.com>
7 * This driver allows to early upgrade microcode on Intel processors
8 * belonging to IA-32 family - PentiumPro, Pentium II,
9 * Pentium III, Xeon, Pentium 4, etc.
11 * Reference: Section 9.11 of Volume 3, IA-32 Intel Architecture
12 * Software Developer's Manual.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
19 #include <linux/module.h>
20 #include <asm/microcode.h>
21 #include <asm/microcode_intel.h>
22 #include <asm/microcode_amd.h>
23 #include <asm/processor.h>
24 #include <asm/cmdline.h>
26 static bool __init
check_loader_disabled_bsp(void)
29 const char *cmdline
= (const char *)__pa_nodebug(boot_command_line
);
30 const char *opt
= "dis_ucode_ldr";
31 const char *option
= (const char *)__pa_nodebug(opt
);
32 bool *res
= (bool *)__pa_nodebug(&dis_ucode_ldr
);
34 #else /* CONFIG_X86_64 */
35 const char *cmdline
= boot_command_line
;
36 const char *option
= "dis_ucode_ldr";
37 bool *res
= &dis_ucode_ldr
;
40 if (cmdline_find_option_bool(cmdline
, option
))
46 void __init
load_ucode_bsp(void)
50 if (check_loader_disabled_bsp())
56 vendor
= x86_vendor();
57 family
= x86_family();
60 case X86_VENDOR_INTEL
:
62 load_ucode_intel_bsp();
73 static bool check_loader_disabled_ap(void)
76 return *((bool *)__pa_nodebug(&dis_ucode_ldr
));
82 void load_ucode_ap(void)
86 if (check_loader_disabled_ap())
92 vendor
= x86_vendor();
93 family
= x86_family();
96 case X86_VENDOR_INTEL
:
98 load_ucode_intel_ap();
109 int __init
save_microcode_in_initrd(void)
111 struct cpuinfo_x86
*c
= &boot_cpu_data
;
113 switch (c
->x86_vendor
) {
114 case X86_VENDOR_INTEL
:
116 save_microcode_in_initrd_intel();
120 save_microcode_in_initrd_amd();
129 void reload_early_microcode(void)
133 vendor
= x86_vendor();
134 family
= x86_family();
137 case X86_VENDOR_INTEL
:
139 reload_ucode_intel();