1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* This file is part of the coreboot project. */
5 #include <device/pci_ops.h>
6 #include <console/console.h>
7 #include <cpu/x86/msr.h>
8 #include <device/pci.h>
9 #include <device/pci_ids.h>
10 #include <intelblocks/mp_init.h>
11 #include <soc/bootblock.h>
13 #include <soc/pci_devs.h>
16 #define BIOS_SIGN_ID 0x8B
22 { CPUID_JASPERLAKE_A0
, "Jasperlake A0" },
29 { PCI_DEVICE_ID_INTEL_JSL_ID_1
, "Jasperlake SKU4-1" },
30 { PCI_DEVICE_ID_INTEL_JSL_ID_2
, "Jasperlake SKU4-2" },
31 { PCI_DEVICE_ID_INTEL_JSL_ID_3
, "Jasperlake SKU2-1" },
32 { PCI_DEVICE_ID_INTEL_JSL_ID_4
, "Jasperlake SKU2-2" },
39 { PCI_DEVICE_ID_INTEL_JSP_SUPER_ESPI
, "Jasperlake Super" },
46 { PCI_DEVICE_ID_INTEL_JSL_GT1
, "Jasperlake GT1" },
47 { PCI_DEVICE_ID_INTEL_JSL_GT2
, "Jasperlake GT2" },
50 static inline uint8_t get_dev_revision(pci_devfn_t dev
)
52 return pci_read_config8(dev
, PCI_REVISION_ID
);
55 static inline uint16_t get_dev_id(pci_devfn_t dev
)
57 return pci_read_config16(dev
, PCI_DEVICE_ID
);
60 static void report_cpu_info(void)
62 struct cpuid_result cpuidr
;
63 u32 i
, index
, cpu_id
, cpu_feature_flag
;
64 const char cpu_not_found
[] = "Platform info not available";
65 const char *cpu_name
= cpu_not_found
; /* 48 bytes are reported */
68 static const char *const mode
[] = {"NOT ", ""};
69 const char *cpu_type
= "Unknown";
73 cpuidr
= cpuid(index
);
74 if (cpuidr
.eax
>= 0x80000004) {
77 for (i
= 2; i
<= 4; i
++) {
78 cpuidr
= cpuid(index
+ i
);
87 /* Skip leading spaces in CPU name string */
88 while (cpu_name
[0] == ' ' && strlen(cpu_name
) > 0)
94 wrmsr(BIOS_SIGN_ID
, microcode_ver
);
95 cpu_id
= cpu_get_cpuid();
96 microcode_ver
= rdmsr(BIOS_SIGN_ID
);
98 /* Look for string to match the name */
99 for (i
= 0; i
< ARRAY_SIZE(cpu_table
); i
++) {
100 if (cpu_table
[i
].cpuid
== cpu_id
) {
101 cpu_type
= cpu_table
[i
].name
;
106 printk(BIOS_DEBUG
, "CPU: %s\n", cpu_name
);
107 printk(BIOS_DEBUG
, "CPU: ID %x, %s, ucode: %08x\n",
108 cpu_id
, cpu_type
, microcode_ver
.hi
);
110 cpu_feature_flag
= cpu_get_feature_flags_ecx();
111 aes
= (cpu_feature_flag
& CPUID_AES
) ? 1 : 0;
112 txt
= (cpu_feature_flag
& CPUID_SMX
) ? 1 : 0;
113 vt
= (cpu_feature_flag
& CPUID_VMX
) ? 1 : 0;
115 "CPU: AES %ssupported, TXT %ssupported, VT %ssupported\n",
116 mode
[aes
], mode
[txt
], mode
[vt
]);
119 static void report_mch_info(void)
122 pci_devfn_t dev
= SA_DEV_ROOT
;
123 uint16_t mchid
= get_dev_id(dev
);
124 uint8_t mch_revision
= get_dev_revision(dev
);
125 const char *mch_type
= "Unknown";
127 for (i
= 0; i
< ARRAY_SIZE(mch_table
); i
++) {
128 if (mch_table
[i
].mchid
== mchid
) {
129 mch_type
= mch_table
[i
].name
;
134 printk(BIOS_DEBUG
, "MCH: device id %04x (rev %02x) is %s\n",
135 mchid
, mch_revision
, mch_type
);
138 static void report_pch_info(void)
141 pci_devfn_t dev
= PCH_DEV_ESPI
;
142 uint16_t espiid
= get_dev_id(dev
);
143 const char *pch_type
= "Unknown";
145 for (i
= 0; i
< ARRAY_SIZE(pch_table
); i
++) {
146 if (pch_table
[i
].espiid
== espiid
) {
147 pch_type
= pch_table
[i
].name
;
151 printk(BIOS_DEBUG
, "PCH: device id %04x (rev %02x) is %s\n",
152 espiid
, get_dev_revision(dev
), pch_type
);
155 static void report_igd_info(void)
158 pci_devfn_t dev
= SA_DEV_IGD
;
159 uint16_t igdid
= get_dev_id(dev
);
160 const char *igd_type
= "Unknown";
162 for (i
= 0; i
< ARRAY_SIZE(igd_table
); i
++) {
163 if (igd_table
[i
].igdid
== igdid
) {
164 igd_type
= igd_table
[i
].name
;
168 printk(BIOS_DEBUG
, "IGD: device id %04x (rev %02x) is %s\n",
169 igdid
, get_dev_revision(dev
), igd_type
);
172 void report_platform_info(void)