Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
| 4 | #include <arch/cpu.h> |
Subrata Banik | b7db12b | 2020-08-04 18:01:27 +0530 | [diff] [blame] | 5 | #include <cpu/intel/microcode.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 6 | #include <string.h> |
Elyes HAOUAS | 21b71ce6 | 2018-06-16 18:43:52 +0200 | [diff] [blame] | 7 | #include <southbridge/intel/lynxpoint/pch.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 8 | #include <device/pci_ops.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 9 | #include <cpu/x86/msr.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 10 | #include "haswell.h" |
| 11 | |
| 12 | static void report_cpu_info(void) |
| 13 | { |
| 14 | struct cpuid_result cpuidr; |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 15 | u32 i, index, cpu_id, cpu_feature_flag; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 16 | char cpu_string[50], *cpu_name = cpu_string; /* 48 bytes are reported */ |
| 17 | int vt, txt, aes; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 18 | const char *mode[] = {"NOT ", ""}; |
| 19 | |
| 20 | index = 0x80000000; |
| 21 | cpuidr = cpuid(index); |
| 22 | if (cpuidr.eax < 0x80000004) { |
| 23 | strcpy(cpu_string, "Platform info not available"); |
| 24 | } else { |
Elyes Haouas | 3a99807 | 2022-11-18 15:11:02 +0100 | [diff] [blame] | 25 | u32 *p = (u32 *)cpu_string; |
Elyes HAOUAS | 7db506c | 2016-10-02 11:56:39 +0200 | [diff] [blame] | 26 | for (i = 2; i <= 4; i++) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 27 | cpuidr = cpuid(index + i); |
| 28 | *p++ = cpuidr.eax; |
| 29 | *p++ = cpuidr.ebx; |
| 30 | *p++ = cpuidr.ecx; |
| 31 | *p++ = cpuidr.edx; |
| 32 | } |
| 33 | } |
| 34 | /* Skip leading spaces in CPU name string */ |
| 35 | while (cpu_name[0] == ' ') |
| 36 | cpu_name++; |
| 37 | |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 38 | cpu_id = cpu_get_cpuid(); |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 39 | printk(BIOS_DEBUG, "CPU id(%x) ucode:%08x %s\n", cpu_id, |
Subrata Banik | b7db12b | 2020-08-04 18:01:27 +0530 | [diff] [blame] | 40 | get_current_microcode_rev(), cpu_name); |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 41 | |
| 42 | cpu_feature_flag = cpu_get_feature_flags_ecx(); |
| 43 | aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0; |
| 44 | txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0; |
| 45 | vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 46 | printk(BIOS_DEBUG, "AES %ssupported, TXT %ssupported, VT %ssupported\n", |
| 47 | mode[aes], mode[txt], mode[vt]); |
| 48 | } |
| 49 | |
| 50 | /* The PCI id name match comes from Intel document 472178 */ |
| 51 | static struct { |
| 52 | u16 dev_id; |
| 53 | const char *dev_name; |
| 54 | } pch_table [] = { |
| 55 | {0x8c41, "Mobile Engineering Sample"}, |
| 56 | {0x8c42, "Desktop Engineering Sample"}, |
Aaron Durbin | f72ad02 | 2012-11-02 09:19:43 -0500 | [diff] [blame] | 57 | {0x8c44, "Z87"}, |
| 58 | {0x8c46, "Z85"}, |
| 59 | {0x8c49, "HM86"}, |
| 60 | {0x8c4a, "H87"}, |
| 61 | {0x8c4b, "HM87"}, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 62 | {0x8c4c, "Q85"}, |
| 63 | {0x8c4e, "Q87"}, |
| 64 | {0x8c4f, "QM87"}, |
| 65 | {0x8c50, "B85"}, |
| 66 | {0x8c52, "C222"}, |
| 67 | {0x8c54, "C224"}, |
| 68 | {0x8c56, "C226"}, |
| 69 | {0x8c5c, "H81"}, |
Angel Pons | 72de822 | 2022-11-06 16:10:43 +0100 | [diff] [blame] | 70 | {0x8cc1, "Mobile Engineering Sample (9 series)"}, |
| 71 | {0x8cc2, "Desktop Engineering Sample (9 series)"}, |
| 72 | {0x8cc3, "HM97"}, |
| 73 | {0x8cc4, "Z97"}, |
| 74 | {0x8cc6, "H97"}, |
Duncan Laurie | ce36b12 | 2013-01-10 13:23:48 -0800 | [diff] [blame] | 75 | {0x9c41, "LP Full Featured Engineering Sample"}, |
| 76 | {0x9c43, "LP Premium"}, |
| 77 | {0x9c45, "LP Mainstream"}, |
| 78 | {0x9c47, "LP Value"}, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | static void report_pch_info(void) |
| 82 | { |
| 83 | int i; |
| 84 | u16 dev_id = pci_read_config16(PCH_LPC_DEV, 2); |
| 85 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 86 | const char *pch_type = "Unknown"; |
| 87 | for (i = 0; i < ARRAY_SIZE(pch_table); i++) { |
| 88 | if (pch_table[i].dev_id == dev_id) { |
| 89 | pch_type = pch_table[i].dev_name; |
| 90 | break; |
| 91 | } |
| 92 | } |
Elyes Haouas | 9d450b2 | 2023-09-10 10:30:29 +0200 | [diff] [blame] | 93 | printk(BIOS_DEBUG, "PCH type: %s, device id: %x, rev id %x\n", |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 94 | pch_type, dev_id, pci_read_config8(PCH_LPC_DEV, 8)); |
| 95 | } |
| 96 | |
| 97 | void report_platform_info(void) |
| 98 | { |
| 99 | report_cpu_info(); |
| 100 | report_pch_info(); |
| 101 | } |