blob: 0d2fe432fb309061ad132fb2a5c2d1b643fd92bd [file] [log] [blame]
Angel Ponsfabfe9d2020-04-05 15:47:07 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aamir Bohradd7acaa2020-03-25 11:36:22 +05302
Aamir Bohradd7acaa2020-03-25 11:36:22 +05303#include <arch/cpu.h>
4#include <device/pci_ops.h>
5#include <console/console.h>
Subrata Banik94f94f82021-07-16 13:35:00 +05306#include <cpu/intel/cpu_ids.h>
Subrata Banikb7db12b2020-08-04 18:01:27 +05307#include <cpu/intel/microcode.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +05308#include <cpu/x86/msr.h>
Usha Pa5f9a4a2020-07-15 14:25:14 +05309#include <cpu/x86/name.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +053010#include <device/pci.h>
11#include <device/pci_ids.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +053012#include <soc/bootblock.h>
13#include <soc/pch.h>
14#include <soc/pci_devs.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +053015
Aamir Bohradd7acaa2020-03-25 11:36:22 +053016static struct {
17 u32 cpuid;
18 const char *name;
19} cpu_table[] = {
Aamir Bohradd7acaa2020-03-25 11:36:22 +053020 { CPUID_JASPERLAKE_A0, "Jasperlake A0" },
21};
22
23static struct {
24 u16 mchid;
25 const char *name;
26} mch_table[] = {
Felix Singer43b7f412022-03-07 04:34:52 +010027 { PCI_DID_INTEL_JSL_ID_1, "Jasperlake SKU4-1" },
28 { PCI_DID_INTEL_JSL_ID_2, "Jasperlake SKU4-2" },
29 { PCI_DID_INTEL_JSL_ID_3, "Jasperlake SKU2-1" },
30 { PCI_DID_INTEL_JSL_ID_4, "Jasperlake SKU2-2" },
31 { PCI_DID_INTEL_JSL_ID_5, "Jasperlake SKU4-3" },
Aamir Bohradd7acaa2020-03-25 11:36:22 +053032};
33
34static struct {
35 u16 espiid;
36 const char *name;
37} pch_table[] = {
Felix Singer43b7f412022-03-07 04:34:52 +010038 { PCI_DID_INTEL_JSP_SUPER_ESPI, "Jasperlake Super" },
Aamir Bohradd7acaa2020-03-25 11:36:22 +053039};
40
41static struct {
42 u16 igdid;
43 const char *name;
44} igd_table[] = {
Felix Singer43b7f412022-03-07 04:34:52 +010045 { PCI_DID_INTEL_JSL_GT1, "Jasperlake GT1" },
46 { PCI_DID_INTEL_JSL_GT2, "Jasperlake GT2" },
47 { PCI_DID_INTEL_JSL_GT3, "Jasperlake GT3" },
48 { PCI_DID_INTEL_JSL_GT4, "Jasperlake GT4" },
Aamir Bohradd7acaa2020-03-25 11:36:22 +053049};
50
51static inline uint8_t get_dev_revision(pci_devfn_t dev)
52{
53 return pci_read_config8(dev, PCI_REVISION_ID);
54}
55
56static inline uint16_t get_dev_id(pci_devfn_t dev)
57{
58 return pci_read_config16(dev, PCI_DEVICE_ID);
59}
60
61static void report_cpu_info(void)
62{
Usha Pa5f9a4a2020-07-15 14:25:14 +053063 u32 i, cpu_id, cpu_feature_flag;
64 char cpu_name[49];
Aamir Bohradd7acaa2020-03-25 11:36:22 +053065 int vt, txt, aes;
Aamir Bohradd7acaa2020-03-25 11:36:22 +053066 static const char *const mode[] = {"NOT ", ""};
67 const char *cpu_type = "Unknown";
Aamir Bohradd7acaa2020-03-25 11:36:22 +053068
Usha Pa5f9a4a2020-07-15 14:25:14 +053069 fill_processor_name(cpu_name);
Aamir Bohradd7acaa2020-03-25 11:36:22 +053070 cpu_id = cpu_get_cpuid();
Aamir Bohradd7acaa2020-03-25 11:36:22 +053071
72 /* Look for string to match the name */
73 for (i = 0; i < ARRAY_SIZE(cpu_table); i++) {
74 if (cpu_table[i].cpuid == cpu_id) {
75 cpu_type = cpu_table[i].name;
76 break;
77 }
78 }
79
80 printk(BIOS_DEBUG, "CPU: %s\n", cpu_name);
81 printk(BIOS_DEBUG, "CPU: ID %x, %s, ucode: %08x\n",
Subrata Banikb7db12b2020-08-04 18:01:27 +053082 cpu_id, cpu_type, get_current_microcode_rev());
Aamir Bohradd7acaa2020-03-25 11:36:22 +053083
84 cpu_feature_flag = cpu_get_feature_flags_ecx();
85 aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0;
86 txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0;
87 vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0;
88 printk(BIOS_DEBUG,
89 "CPU: AES %ssupported, TXT %ssupported, VT %ssupported\n",
90 mode[aes], mode[txt], mode[vt]);
91}
92
93static void report_mch_info(void)
94{
95 int i;
96 pci_devfn_t dev = SA_DEV_ROOT;
97 uint16_t mchid = get_dev_id(dev);
98 uint8_t mch_revision = get_dev_revision(dev);
99 const char *mch_type = "Unknown";
100
101 for (i = 0; i < ARRAY_SIZE(mch_table); i++) {
102 if (mch_table[i].mchid == mchid) {
103 mch_type = mch_table[i].name;
104 break;
105 }
106 }
107
108 printk(BIOS_DEBUG, "MCH: device id %04x (rev %02x) is %s\n",
109 mchid, mch_revision, mch_type);
110}
111
112static void report_pch_info(void)
113{
114 int i;
115 pci_devfn_t dev = PCH_DEV_ESPI;
116 uint16_t espiid = get_dev_id(dev);
117 const char *pch_type = "Unknown";
118
119 for (i = 0; i < ARRAY_SIZE(pch_table); i++) {
120 if (pch_table[i].espiid == espiid) {
121 pch_type = pch_table[i].name;
122 break;
123 }
124 }
125 printk(BIOS_DEBUG, "PCH: device id %04x (rev %02x) is %s\n",
126 espiid, get_dev_revision(dev), pch_type);
127}
128
129static void report_igd_info(void)
130{
131 int i;
132 pci_devfn_t dev = SA_DEV_IGD;
133 uint16_t igdid = get_dev_id(dev);
134 const char *igd_type = "Unknown";
135
136 for (i = 0; i < ARRAY_SIZE(igd_table); i++) {
137 if (igd_table[i].igdid == igdid) {
138 igd_type = igd_table[i].name;
139 break;
140 }
141 }
142 printk(BIOS_DEBUG, "IGD: device id %04x (rev %02x) is %s\n",
143 igdid, get_dev_revision(dev), igd_type);
144}
145
146void report_platform_info(void)
147{
148 report_cpu_info();
149 report_mch_info();
150 report_pch_info();
151 report_igd_info();
152}