blob: 37501b7efb275c7ee06ed9c960f13c1eac21d7ef [file] [log] [blame]
Usha Paaf28d22020-02-17 15:14:18 +05301/*
2 * This file is part of the coreboot project.
3 *
Usha Paaf28d22020-02-17 15:14:18 +05304 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <arch/cpu.h>
16#include <device/pci_ops.h>
17#include <console/console.h>
18#include <cpu/x86/msr.h>
19#include <cpu/x86/name.h>
20#include <device/pci.h>
21#include <device/pci_ids.h>
22#include <intelblocks/mp_init.h>
23#include <soc/romstage.h>
24#include <soc/pci_devs.h>
25
26static struct {
27 u32 cpuid;
28 const char *name;
29} cpu_table[] = {
30 { CPUID_APOLLOLAKE_A0, "Apollolake A0" },
31 { CPUID_APOLLOLAKE_B0, "Apollolake B0" },
32 { CPUID_APOLLOLAKE_E0, "Apollolake E0" },
33 { CPUID_GLK_A0, "Geminilake A0" },
34 { CPUID_GLK_B0, "Geminilake B0" },
35 { CPUID_GLK_R0, "Geminilake R0" },
36};
37
38static struct {
39 u16 mchid;
40 const char *name;
41} mch_table[] = {
42 { PCI_DEVICE_ID_INTEL_GLK_NB, "Geminilake" },
43 { PCI_DEVICE_ID_INTEL_APL_NB, "Apollolake" },
44};
45
46static struct {
47 u16 lpcid;
48 const char *name;
49} pch_table[] = {
50 { PCI_DEVICE_ID_INTEL_APL_LPC, "Apollolake" },
51 { PCI_DEVICE_ID_INTEL_GLK_LPC, "Geminilake" },
52 { PCI_DEVICE_ID_INTEL_GLK_ESPI, "Geminilake" },
53};
54
55static struct {
56 u16 igdid;
57 const char *name;
58} igd_table[] = {
59 { PCI_DEVICE_ID_INTEL_APL_IGD_HD_505, "Apollolake HD 505" },
60 { PCI_DEVICE_ID_INTEL_APL_IGD_HD_500, "Aplollolake HD 500" },
61 { PCI_DEVICE_ID_INTEL_GLK_IGD, "Geminilake" },
62 { PCI_DEVICE_ID_INTEL_GLK_IGD_EU12, "Geminilake EU12" },
63};
64
65static uint8_t get_dev_revision(pci_devfn_t dev)
66{
67 return pci_read_config8(dev, PCI_REVISION_ID);
68}
69
70static uint16_t get_dev_id(pci_devfn_t dev)
71{
72 return pci_read_config16(dev, PCI_DEVICE_ID);
73}
74
75static void report_cpu_info(void)
76{
77 uint32_t i, cpu_id, cpu_feature_flag;
78 char cpu_name[49];
79 msr_t microcode_ver;
80 const char *support = "Supported";
81 const char *no_support = "Not Supported";
82 const char *cpu_type = "Unknown";
83
84 fill_processor_name(cpu_name);
85
86 microcode_ver.lo = 0;
87 microcode_ver.hi = 0;
88 wrmsr(IA32_BIOS_SIGN_ID, microcode_ver);
89 cpu_id = cpu_get_cpuid();
90 microcode_ver = rdmsr(IA32_BIOS_SIGN_ID);
91
92 /* Look for string to match the name */
93 for (i = 0; i < ARRAY_SIZE(cpu_table); i++) {
94 if (cpu_table[i].cpuid == cpu_id) {
95 cpu_type = cpu_table[i].name;
96 break;
97 }
98 }
99
100 printk(BIOS_INFO, "CPU: %s\n", cpu_name);
101 printk(BIOS_INFO, "CPU: ID %x, %s, ucode: %08x\n", cpu_id, cpu_type, microcode_ver.hi);
102
103 cpu_feature_flag = cpu_get_feature_flags_ecx();
104 printk(BIOS_INFO, "CPU: AES %s, TXT %s, VT %s\n",
105 (cpu_feature_flag & CPUID_AES) ? support : no_support,
106 (cpu_feature_flag & CPUID_SMX) ? support : no_support,
107 (cpu_feature_flag & CPUID_VMX) ? support : no_support);
108}
109
110static void report_mch_info(void)
111{
112 uint32_t i;
113 pci_devfn_t dev = SA_DEV_ROOT;
114 uint16_t mchid = get_dev_id(dev);
115 uint8_t mch_revision = get_dev_revision(dev);
116 const char *mch_type = "Unknown";
117
118 for (i = 0; i < ARRAY_SIZE(mch_table); i++) {
119 if (mch_table[i].mchid == mchid) {
120 mch_type = mch_table[i].name;
121 break;
122 }
123 }
124
125 printk(BIOS_INFO, "MCH: device id %04x (rev %02x) is %s\n",
126 mchid, mch_revision, mch_type);
127}
128
129static void report_pch_info(void)
130{
131 uint32_t i;
132 pci_devfn_t dev = PCH_DEV_LPC;
133 uint16_t lpcid = get_dev_id(dev);
134 const char *pch_type = "Unknown";
135
136 for (i = 0; i < ARRAY_SIZE(pch_table); i++) {
137 if (pch_table[i].lpcid == lpcid) {
138 pch_type = pch_table[i].name;
139 break;
140 }
141 }
142 printk(BIOS_INFO, "PCH: device id %04x (rev %02x) is %s\n",
143 lpcid, get_dev_revision(dev), pch_type);
144}
145
146static void report_igd_info(void)
147{
148 uint32_t i;
149 pci_devfn_t dev = SA_DEV_IGD;
150 uint16_t igdid = get_dev_id(dev);
151 const char *igd_type = "Unknown";
152
153 for (i = 0; i < ARRAY_SIZE(igd_table); i++) {
154 if (igd_table[i].igdid == igdid) {
155 igd_type = igd_table[i].name;
156 break;
157 }
158 }
159 printk(BIOS_INFO, "IGD: device id %04x (rev %02x) is %s\n",
160 igdid, get_dev_revision(dev), igd_type);
161}
162
163void report_platform_info(void)
164{
165 report_cpu_info();
166 report_mch_info();
167 report_pch_info();
168 report_igd_info();
169}