blob: 874ff45d81982dea134be5266d80edeca4fcb66a [file] [log] [blame]
Naresh Solanki08135332022-12-05 11:42:10 +01001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <arch/cpu.h>
4#include <console/console.h>
5#include <cpu/intel/cpu_ids.h>
6#include <cpu/intel/microcode.h>
7#include <cpu/x86/msr.h>
8#include <cpu/x86/name.h>
9#include <soc/bootblock.h>
10
11static struct {
12 u32 cpuid;
13 const char *name;
14} cpu_table[] = {
15 { CPUID_COOPERLAKE_SP_A0, "Cooper Lake A0" },
16 { CPUID_COOPERLAKE_SP_A1, "Cooper Lake A1" },
17 { CPUID_SKYLAKE_SP_A0_A1, "SkyLake-SP A0/A1" },
18 { CPUID_SKYLAKE_SP_B0, "SkyLake-SP B0" },
19 { CPUID_SKYLAKE_SP_4, "SkyLake-SP 4" },
20 { CPUID_SAPPHIRERAPIDS_SP_A, "Sapphire Rapids A" },
21 { CPUID_SAPPHIRERAPIDS_SP_B, "Sapphire Rapids B" },
22 { CPUID_SAPPHIRERAPIDS_SP_C, "Sapphire Rapids C" },
23 { CPUID_SAPPHIRERAPIDS_SP_D, "Sapphire Rapids D" },
24 { CPUID_SAPPHIRERAPIDS_SP_E0, "Sapphire Rapids E0" },
25 { CPUID_SAPPHIRERAPIDS_SP_E2, "Sapphire Rapids E2" },
26 { CPUID_SAPPHIRERAPIDS_SP_E3, "Sapphire Rapids E3" },
27 { CPUID_SAPPHIRERAPIDS_SP_E4, "Sapphire Rapids E4" },
28 { CPUID_SAPPHIRERAPIDS_SP_Ex, "Sapphire Rapids Ex" },
29};
30
31static void report_cpu_info(void)
32{
33 u32 cpu_id, cpu_feature_flag;
34 char cpu_name[49];
35 int vt, txt, aes;
36 static const char *const mode[] = {"NOT ", ""};
37 const char *cpu_type = "Unknown";
38 size_t i;
39
40 fill_processor_name(cpu_name);
41 cpu_id = cpu_get_cpuid();
42
43 /* Look for string to match the name */
44 for (i = 0; i < ARRAY_SIZE(cpu_table); i++) {
45 if (cpu_table[i].cpuid == cpu_id) {
46 cpu_type = cpu_table[i].name;
47 break;
48 }
49 }
50
51 printk(BIOS_DEBUG, "CPU: %s\n", cpu_name);
52 printk(BIOS_DEBUG, "CPU: ID %x, %s, ucode: %08x\n",
53 cpu_id, cpu_type, get_current_microcode_rev());
54
55 cpu_feature_flag = cpu_get_feature_flags_ecx();
56 aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0;
57 txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0;
58 vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0;
59 printk(BIOS_DEBUG,
60 "CPU: AES %ssupported, TXT %ssupported, VT %ssupported\n",
61 mode[aes], mode[txt], mode[vt]);
62}
63
64void report_platform_info(void)
65{
66 report_cpu_info();
67}