Commit 6bcb675b2f6a3251d0107673949988c619ec18ec
Committed by
Bin Meng
1 parent
f7d35bc148
Exists in
v2017.01-smarct4x
and in
29 other branches
x86: Record the CPU details when starting each core
As each core starts up, record its microcode version and CPU ID so these can be presented with the 'cpu detail' command. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Showing 3 changed files with 20 additions and 1 deletions Side-by-side Diff
arch/x86/cpu/intel_common/microcode.c
... | ... | @@ -64,8 +64,12 @@ |
64 | 64 | return 0; |
65 | 65 | } |
66 | 66 | |
67 | -static inline uint32_t microcode_read_rev(void) | |
67 | +int microcode_read_rev(void) | |
68 | 68 | { |
69 | + /* Quark does not have microcode MSRs */ | |
70 | +#ifdef CONFIG_INTEL_QUARK | |
71 | + return 0; | |
72 | +#else | |
69 | 73 | /* |
70 | 74 | * Some Intel CPUs can be very finicky about the CPUID sequence used. |
71 | 75 | * So this is implemented in assembly so that it works reliably. |
... | ... | @@ -90,6 +94,7 @@ |
90 | 94 | ); |
91 | 95 | |
92 | 96 | return high; |
97 | +#endif | |
93 | 98 | } |
94 | 99 | |
95 | 100 | static void microcode_read_cpu(struct microcode_update *cpu) |
arch/x86/cpu/mp_init.c
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | #include <asm/cpu.h> |
16 | 16 | #include <asm/interrupt.h> |
17 | 17 | #include <asm/lapic.h> |
18 | +#include <asm/microcode.h> | |
18 | 19 | #include <asm/mp.h> |
19 | 20 | #include <asm/msr.h> |
20 | 21 | #include <asm/mtrr.h> |
21 | 22 | |
... | ... | @@ -560,12 +561,16 @@ |
560 | 561 | |
561 | 562 | int mp_init_cpu(struct udevice *cpu, void *unused) |
562 | 563 | { |
564 | + struct cpu_platdata *plat = dev_get_parent_platdata(cpu); | |
565 | + | |
563 | 566 | /* |
564 | 567 | * Multiple APs are brought up simultaneously and they may get the same |
565 | 568 | * seq num in the uclass_resolve_seq() during device_probe(). To avoid |
566 | 569 | * this, set req_seq to the reg number in the device tree in advance. |
567 | 570 | */ |
568 | 571 | cpu->req_seq = fdtdec_get_int(gd->fdt_blob, cpu->of_offset, "reg", -1); |
572 | + plat->ucode_version = microcode_read_rev(); | |
573 | + plat->device_id = gd->arch.x86_device; | |
569 | 574 | |
570 | 575 | return device_probe(cpu); |
571 | 576 | } |
arch/x86/include/asm/microcode.h
... | ... | @@ -18,6 +18,15 @@ |
18 | 18 | * not updates were found, -EINVAL if an update was invalid |
19 | 19 | */ |
20 | 20 | int microcode_update_intel(void); |
21 | + | |
22 | +/** | |
23 | + * microcode_read_rev() - Read the microcode version | |
24 | + * | |
25 | + * This reads the microcode version of the currently running CPU | |
26 | + * | |
27 | + * @return microcode version number | |
28 | + */ | |
29 | +int microcode_read_rev(void); | |
21 | 30 | #endif /* __ASSEMBLY__ */ |
22 | 31 | |
23 | 32 | #endif |