Debian Codegraph @

src/northbridge/intel/haswell/report_platform.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <arch/cpu.h>
5 #include <cpu/intel/microcode.h>
6 #include <string.h>
7 #include <southbridge/intel/lynxpoint/pch.h>
8 #include <device/pci_ops.h>
9 #include <cpu/x86/msr.h>
10 #include "haswell.h"
11
12 static void report_cpu_info(void)
13 {
14 struct cpuid_result cpuidr;
15 u32 i, index, cpu_id, cpu_feature_flag;
16 char cpu_string[50], *cpu_name = cpu_string; /* 48 bytes are reported */
17 int vt, txt, aes;
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 {
25 u32 *p = (u32 *)cpu_string;
26 for (i = 2; i <= 4; i++) {
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
38 cpu_id = cpu_get_cpuid();
39 printk(BIOS_DEBUG, "CPU id(%x) ucode:%08x %s\n", cpu_id,
40 get_current_microcode_rev(), cpu_name);
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;
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"},
57 {0x8c44, "Z87"},
58 {0x8c46, "Z85"},
59 {0x8c49, "HM86"},
60 {0x8c4a, "H87"},
61 {0x8c4b, "HM87"},
62 {0x8c4c, "Q85"},
63 {0x8c4e, "Q87"},
64 {0x8c4f, "QM87"},
65 {0x8c50, "B85"},
66 {0x8c52, "C222"},
67 {0x8c54, "C224"},
68 {0x8c56, "C226"},
69 {0x8c5c, "H81"},
70 {0x8cc1, "Mobile Engineering Sample (9 series)"},
71 {0x8cc2, "Desktop Engineering Sample (9 series)"},
72 {0x8cc3, "HM97"},
73 {0x8cc4, "Z97"},
74 {0x8cc6, "H97"},
75 {0x9c41, "LP Full Featured Engineering Sample"},
76 {0x9c43, "LP Premium"},
77 {0x9c45, "LP Mainstream"},
78 {0x9c47, "LP Value"},
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
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 }
93 printk(BIOS_DEBUG, "PCH type: %s, device id: %x, rev id %x\n",
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 }