| 1 |
|
| 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 |
|
| 11 |
static 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 |
{ CPUID_EMERALDRAPIDS, "Emerald Rapids" }, |
| 30 |
}; |
| 31 |
|
| 32 |
static void report_cpu_info(void) |
| 33 |
{ |
| 34 |
u32 cpu_id, cpu_feature_flag; |
| 35 |
char cpu_name[49]; |
| 36 |
int vt, txt, aes; |
| 37 |
static const char *const mode[] = {"NOT ", ""}; |
| 38 |
const char *cpu_type = "Unknown"; |
| 39 |
size_t i; |
| 40 |
|
| 41 |
fill_processor_name(cpu_name); |
| 42 |
cpu_id = cpu_get_cpuid(); |
| 43 |
|
| 44 |
|
| 45 |
for (i = 0; i < ARRAY_SIZE(cpu_table); i++) { |
| 46 |
if (cpu_table[i].cpuid == cpu_id) { |
| 47 |
cpu_type = cpu_table[i].name; |
| 48 |
break; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
printk(BIOS_DEBUG, "CPU: %s\n", cpu_name); |
| 53 |
printk(BIOS_DEBUG, "CPU: ID %x, %s, ucode: %08x\n", |
| 54 |
cpu_id, cpu_type, get_current_microcode_rev()); |
| 55 |
|
| 56 |
cpu_feature_flag = cpu_get_feature_flags_ecx(); |
| 57 |
aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0; |
| 58 |
txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0; |
| 59 |
vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0; |
| 60 |
printk(BIOS_DEBUG, |
| 61 |
"CPU: AES %ssupported, TXT %ssupported, VT %ssupported\n", |
| 62 |
mode[aes], mode[txt], mode[vt]); |
| 63 |
} |
| 64 |
|
| 65 |
void report_platform_info(void) |
| 66 |
{ |
| 67 |
report_cpu_info(); |
| 68 |
} |