blob: 28d2f01323f13363102e58d5799b34584ee164fc [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
3#include <console/console.h>
4#include <arch/cpu.h>
Subrata Banikb7db12b2020-08-04 18:01:27 +05305#include <cpu/intel/microcode.h>
Aaron Durbin76c37002012-10-30 09:03:43 -05006#include <string.h>
Elyes HAOUAS21b71ce62018-06-16 18:43:52 +02007#include <southbridge/intel/lynxpoint/pch.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02008#include <device/pci_ops.h>
Aaron Durbin76c37002012-10-30 09:03:43 -05009#include <cpu/x86/msr.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050010#include "haswell.h"
11
12static void report_cpu_info(void)
13{
14 struct cpuid_result cpuidr;
Subrata Banik53b08c32018-12-10 14:11:35 +053015 u32 i, index, cpu_id, cpu_feature_flag;
Aaron Durbin76c37002012-10-30 09:03:43 -050016 char cpu_string[50], *cpu_name = cpu_string; /* 48 bytes are reported */
17 int vt, txt, aes;
Aaron Durbin76c37002012-10-30 09:03:43 -050018 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 Haouas3a998072022-11-18 15:11:02 +010025 u32 *p = (u32 *)cpu_string;
Elyes HAOUAS7db506c2016-10-02 11:56:39 +020026 for (i = 2; i <= 4; i++) {
Aaron Durbin76c37002012-10-30 09:03:43 -050027 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 Banik53b08c32018-12-10 14:11:35 +053038 cpu_id = cpu_get_cpuid();
Subrata Banik53b08c32018-12-10 14:11:35 +053039 printk(BIOS_DEBUG, "CPU id(%x) ucode:%08x %s\n", cpu_id,
Subrata Banikb7db12b2020-08-04 18:01:27 +053040 get_current_microcode_rev(), cpu_name);
Subrata Banik53b08c32018-12-10 14:11:35 +053041
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 Durbin76c37002012-10-30 09:03:43 -050046 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 */
51static struct {
52 u16 dev_id;
53 const char *dev_name;
54} pch_table [] = {
55 {0x8c41, "Mobile Engineering Sample"},
56 {0x8c42, "Desktop Engineering Sample"},
Aaron Durbinf72ad022012-11-02 09:19:43 -050057 {0x8c44, "Z87"},
58 {0x8c46, "Z85"},
59 {0x8c49, "HM86"},
60 {0x8c4a, "H87"},
61 {0x8c4b, "HM87"},
Aaron Durbin76c37002012-10-30 09:03:43 -050062 {0x8c4c, "Q85"},
63 {0x8c4e, "Q87"},
64 {0x8c4f, "QM87"},
65 {0x8c50, "B85"},
66 {0x8c52, "C222"},
67 {0x8c54, "C224"},
68 {0x8c56, "C226"},
69 {0x8c5c, "H81"},
Angel Pons72de8222022-11-06 16:10:43 +010070 {0x8cc1, "Mobile Engineering Sample (9 series)"},
71 {0x8cc2, "Desktop Engineering Sample (9 series)"},
72 {0x8cc3, "HM97"},
73 {0x8cc4, "Z97"},
74 {0x8cc6, "H97"},
Duncan Lauriece36b122013-01-10 13:23:48 -080075 {0x9c41, "LP Full Featured Engineering Sample"},
76 {0x9c43, "LP Premium"},
77 {0x9c45, "LP Mainstream"},
78 {0x9c47, "LP Value"},
Aaron Durbin76c37002012-10-30 09:03:43 -050079};
80
81static void report_pch_info(void)
82{
83 int i;
84 u16 dev_id = pci_read_config16(PCH_LPC_DEV, 2);
85
Aaron Durbin76c37002012-10-30 09:03:43 -050086 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 Haouas9d450b22023-09-10 10:30:29 +020093 printk(BIOS_DEBUG, "PCH type: %s, device id: %x, rev id %x\n",
Aaron Durbin76c37002012-10-30 09:03:43 -050094 pch_type, dev_id, pci_read_config8(PCH_LPC_DEV, 8));
95}
96
97void report_platform_info(void)
98{
99 report_cpu_info();
100 report_pch_info();
101}