blob: beab7822c82d461d10e1eea722358cad6864e4fa [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 Banikb7db12b2020-08-04 18:01:27 +05306#include <cpu/intel/microcode.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +05307#include <cpu/x86/msr.h>
Usha Pa5f9a4a2020-07-15 14:25:14 +05308#include <cpu/x86/name.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +05309#include <device/pci.h>
10#include <device/pci_ids.h>
11#include <intelblocks/mp_init.h>
12#include <soc/bootblock.h>
13#include <soc/pch.h>
14#include <soc/pci_devs.h>
15#include <string.h>
16
Aamir Bohradd7acaa2020-03-25 11:36:22 +053017static struct {
18 u32 cpuid;
19 const char *name;
20} cpu_table[] = {
Aamir Bohradd7acaa2020-03-25 11:36:22 +053021 { CPUID_JASPERLAKE_A0, "Jasperlake A0" },
22};
23
24static struct {
25 u16 mchid;
26 const char *name;
27} mch_table[] = {
Maulik V Vaghela8745a272020-04-22 12:13:40 +053028 { PCI_DEVICE_ID_INTEL_JSL_ID_1, "Jasperlake SKU4-1" },
29 { PCI_DEVICE_ID_INTEL_JSL_ID_2, "Jasperlake SKU4-2" },
30 { PCI_DEVICE_ID_INTEL_JSL_ID_3, "Jasperlake SKU2-1" },
31 { PCI_DEVICE_ID_INTEL_JSL_ID_4, "Jasperlake SKU2-2" },
Krishna Prasad Bhat20f580b2020-09-17 19:42:39 +053032 { PCI_DEVICE_ID_INTEL_JSL_ID_5, "Jasperlake SKU4-3" },
Aamir Bohradd7acaa2020-03-25 11:36:22 +053033};
34
35static struct {
36 u16 espiid;
37 const char *name;
38} pch_table[] = {
Aamir Bohradd7acaa2020-03-25 11:36:22 +053039 { PCI_DEVICE_ID_INTEL_JSP_SUPER_ESPI, "Jasperlake Super" },
Aamir Bohradd7acaa2020-03-25 11:36:22 +053040};
41
42static struct {
43 u16 igdid;
44 const char *name;
45} igd_table[] = {
Aamir Bohradd7acaa2020-03-25 11:36:22 +053046 { PCI_DEVICE_ID_INTEL_JSL_GT1, "Jasperlake GT1" },
47 { PCI_DEVICE_ID_INTEL_JSL_GT2, "Jasperlake GT2" },
Krishna Prasad Bhat166d9302020-07-28 20:46:39 +053048 { PCI_DEVICE_ID_INTEL_JSL_GT3, "Jasperlake GT3" },
Krishna Prasad Bhat20f580b2020-09-17 19:42:39 +053049 { PCI_DEVICE_ID_INTEL_JSL_GT4, "Jasperlake GT4" },
Aamir Bohradd7acaa2020-03-25 11:36:22 +053050};
51
52static inline uint8_t get_dev_revision(pci_devfn_t dev)
53{
54 return pci_read_config8(dev, PCI_REVISION_ID);
55}
56
57static inline uint16_t get_dev_id(pci_devfn_t dev)
58{
59 return pci_read_config16(dev, PCI_DEVICE_ID);
60}
61
62static void report_cpu_info(void)
63{
Usha Pa5f9a4a2020-07-15 14:25:14 +053064 u32 i, cpu_id, cpu_feature_flag;
65 char cpu_name[49];
Aamir Bohradd7acaa2020-03-25 11:36:22 +053066 int vt, txt, aes;
Aamir Bohradd7acaa2020-03-25 11:36:22 +053067 static const char *const mode[] = {"NOT ", ""};
68 const char *cpu_type = "Unknown";
Aamir Bohradd7acaa2020-03-25 11:36:22 +053069
Usha Pa5f9a4a2020-07-15 14:25:14 +053070 fill_processor_name(cpu_name);
Aamir Bohradd7acaa2020-03-25 11:36:22 +053071 cpu_id = cpu_get_cpuid();
Aamir Bohradd7acaa2020-03-25 11:36:22 +053072
73 /* Look for string to match the name */
74 for (i = 0; i < ARRAY_SIZE(cpu_table); i++) {
75 if (cpu_table[i].cpuid == cpu_id) {
76 cpu_type = cpu_table[i].name;
77 break;
78 }
79 }
80
81 printk(BIOS_DEBUG, "CPU: %s\n", cpu_name);
82 printk(BIOS_DEBUG, "CPU: ID %x, %s, ucode: %08x\n",
Subrata Banikb7db12b2020-08-04 18:01:27 +053083 cpu_id, cpu_type, get_current_microcode_rev());
Aamir Bohradd7acaa2020-03-25 11:36:22 +053084
85 cpu_feature_flag = cpu_get_feature_flags_ecx();
86 aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0;
87 txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0;
88 vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0;
89 printk(BIOS_DEBUG,
90 "CPU: AES %ssupported, TXT %ssupported, VT %ssupported\n",
91 mode[aes], mode[txt], mode[vt]);
92}
93
94static void report_mch_info(void)
95{
96 int i;
97 pci_devfn_t dev = SA_DEV_ROOT;
98 uint16_t mchid = get_dev_id(dev);
99 uint8_t mch_revision = get_dev_revision(dev);
100 const char *mch_type = "Unknown";
101
102 for (i = 0; i < ARRAY_SIZE(mch_table); i++) {
103 if (mch_table[i].mchid == mchid) {
104 mch_type = mch_table[i].name;
105 break;
106 }
107 }
108
109 printk(BIOS_DEBUG, "MCH: device id %04x (rev %02x) is %s\n",
110 mchid, mch_revision, mch_type);
111}
112
113static void report_pch_info(void)
114{
115 int i;
116 pci_devfn_t dev = PCH_DEV_ESPI;
117 uint16_t espiid = get_dev_id(dev);
118 const char *pch_type = "Unknown";
119
120 for (i = 0; i < ARRAY_SIZE(pch_table); i++) {
121 if (pch_table[i].espiid == espiid) {
122 pch_type = pch_table[i].name;
123 break;
124 }
125 }
126 printk(BIOS_DEBUG, "PCH: device id %04x (rev %02x) is %s\n",
127 espiid, get_dev_revision(dev), pch_type);
128}
129
130static void report_igd_info(void)
131{
132 int i;
133 pci_devfn_t dev = SA_DEV_IGD;
134 uint16_t igdid = get_dev_id(dev);
135 const char *igd_type = "Unknown";
136
137 for (i = 0; i < ARRAY_SIZE(igd_table); i++) {
138 if (igd_table[i].igdid == igdid) {
139 igd_type = igd_table[i].name;
140 break;
141 }
142 }
143 printk(BIOS_DEBUG, "IGD: device id %04x (rev %02x) is %s\n",
144 igdid, get_dev_revision(dev), igd_type);
145}
146
147void report_platform_info(void)
148{
149 report_cpu_info();
150 report_mch_info();
151 report_pch_info();
152 report_igd_info();
153}