Angel Pons | 3bd1e3d | 2020-04-05 15:47:17 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 3 | |
| 4 | #include <arch/cpu.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 5 | #include <device/pci_ops.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 6 | #include <console/console.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 7 | #include <cpu/x86/msr.h> |
Usha P | 65a8c2e | 2019-11-14 11:58:53 +0530 | [diff] [blame] | 8 | #include <cpu/x86/name.h> |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 9 | #include <device/pci.h> |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 10 | #include <device/pci_ids.h> |
Barnali Sarkar | 7327386 | 2017-06-13 20:22:33 +0530 | [diff] [blame] | 11 | #include <intelblocks/mp_init.h> |
Naresh G Solanki | ecd9a94 | 2016-08-11 14:56:28 +0530 | [diff] [blame] | 12 | #include <soc/bootblock.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 13 | #include <soc/cpu.h> |
| 14 | #include <soc/pch.h> |
| 15 | #include <soc/pci_devs.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 16 | #include <soc/systemagent.h> |
| 17 | |
| 18 | static struct { |
| 19 | u32 cpuid; |
| 20 | const char *name; |
| 21 | } cpu_table[] = { |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 22 | { CPUID_SKYLAKE_C0, "Skylake C0" }, |
| 23 | { CPUID_SKYLAKE_D0, "Skylake D0" }, |
| 24 | { CPUID_SKYLAKE_HQ0, "Skylake H Q0" }, |
| 25 | { CPUID_SKYLAKE_HR0, "Skylake H R0" }, |
| 26 | { CPUID_KABYLAKE_G0, "Kabylake G0" }, |
| 27 | { CPUID_KABYLAKE_H0, "Kabylake H0" }, |
| 28 | { CPUID_KABYLAKE_Y0, "Kabylake Y0" }, |
| 29 | { CPUID_KABYLAKE_HA0, "Kabylake H A0" }, |
| 30 | { CPUID_KABYLAKE_HB0, "Kabylake H B0" }, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | static struct { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 34 | u16 mchid; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 35 | const char *name; |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 36 | } mch_table[] = { |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 37 | { PCI_DEVICE_ID_INTEL_SKL_ID_U, "Skylake-U" }, |
| 38 | { PCI_DEVICE_ID_INTEL_SKL_ID_Y, "Skylake-Y" }, |
| 39 | { PCI_DEVICE_ID_INTEL_SKL_ID_ULX, "Skylake-ULX" }, |
Maxim Polyakov | dde937c | 2019-09-09 15:50:03 +0300 | [diff] [blame] | 40 | { PCI_DEVICE_ID_INTEL_SKL_ID_H_4, "Skylake-H (4 Core)" }, |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 41 | { PCI_DEVICE_ID_INTEL_SKL_ID_H_EM, "Skylake-H Embedded" }, |
Keno Fischer | 1044eba | 2019-06-07 01:55:56 -0400 | [diff] [blame] | 42 | { PCI_DEVICE_ID_INTEL_SKL_ID_H_2, "Skylake-H (2 Core)" }, |
| 43 | { PCI_DEVICE_ID_INTEL_SKL_ID_S_2, "Skylake-S (2 Core)" }, |
Maxim Polyakov | a0cd4b1 | 2019-08-27 15:58:04 +0300 | [diff] [blame] | 44 | { PCI_DEVICE_ID_INTEL_SKL_ID_S_4, "Skylake-S (4 Core) / Skylake-DT" }, |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 45 | { PCI_DEVICE_ID_INTEL_KBL_ID_U, "Kabylake-U" }, |
| 46 | { PCI_DEVICE_ID_INTEL_KBL_U_R, "Kabylake-R ULT"}, |
| 47 | { PCI_DEVICE_ID_INTEL_KBL_ID_Y, "Kabylake-Y" }, |
| 48 | { PCI_DEVICE_ID_INTEL_KBL_ID_H, "Kabylake-H" }, |
Gaggery Tsai | e415a4c | 2018-03-21 22:36:18 +0800 | [diff] [blame] | 49 | { PCI_DEVICE_ID_INTEL_KBL_ID_S, "Kabylake-S" }, |
V Sowmya | acc2a48 | 2018-01-23 15:27:23 +0530 | [diff] [blame] | 50 | { PCI_DEVICE_ID_INTEL_KBL_ID_DT, "Kabylake DT" }, |
Christian Walter | 3d84038 | 2019-05-17 19:37:16 +0200 | [diff] [blame] | 51 | { PCI_DEVICE_ID_INTEL_KBL_ID_DT_2, "Kabylake DT 2" }, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | static struct { |
| 55 | u16 lpcid; |
| 56 | const char *name; |
| 57 | } pch_table[] = { |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 58 | { PCI_DEVICE_ID_INTEL_SPT_LP_SAMPLE, "Skylake LP Sample" }, |
| 59 | { PCI_DEVICE_ID_INTEL_SPT_LP_U_BASE, "Skylake-U Base" }, |
| 60 | { PCI_DEVICE_ID_INTEL_SPT_LP_U_PREMIUM, "Skylake-U Premium" }, |
| 61 | { PCI_DEVICE_ID_INTEL_SPT_LP_Y_PREMIUM, "Skylake-Y Premium" }, |
Maxim Polyakov | 7a732b4 | 2019-02-25 10:48:39 +0300 | [diff] [blame] | 62 | { PCI_DEVICE_ID_INTEL_SPT_H_H110, "Skylake PCH-H H110" }, |
Marius Genheimer | 4998bec | 2019-04-30 00:04:32 +0200 | [diff] [blame] | 63 | { PCI_DEVICE_ID_INTEL_SPT_H_H170, "Skylake PCH-H H170" }, |
| 64 | { PCI_DEVICE_ID_INTEL_SPT_H_Z170, "Skylake PCH-H Z170" }, |
| 65 | { PCI_DEVICE_ID_INTEL_SPT_H_Q170, "Skylake PCH-H Q170" }, |
| 66 | { PCI_DEVICE_ID_INTEL_SPT_H_Q150, "Skylake PCH-H Q150" }, |
| 67 | { PCI_DEVICE_ID_INTEL_SPT_H_B150, "Skylake PCH-H B150" }, |
V Sowmya | 7c15047 | 2018-01-23 14:44:45 +0530 | [diff] [blame] | 68 | { PCI_DEVICE_ID_INTEL_SPT_H_C236, "Skylake PCH-H C236" }, |
Felix Singer | c3244cc | 2019-07-29 22:54:09 +0200 | [diff] [blame] | 69 | { PCI_DEVICE_ID_INTEL_SPT_H_C232, "Skylake PCH-H C232" }, |
V Sowmya | 7c15047 | 2018-01-23 14:44:45 +0530 | [diff] [blame] | 70 | { PCI_DEVICE_ID_INTEL_SPT_H_QM170, "Skylake PCH-H QM170" }, |
Felix Singer | c3244cc | 2019-07-29 22:54:09 +0200 | [diff] [blame] | 71 | { PCI_DEVICE_ID_INTEL_SPT_H_HM170, "Skylake PCH-H HM170" }, |
| 72 | { PCI_DEVICE_ID_INTEL_SPT_H_CM236, "Skylake PCH-H CM236" }, |
Praveen hodagatta pranesh | 523d669 | 2018-11-03 01:21:14 +0800 | [diff] [blame] | 73 | { PCI_DEVICE_ID_INTEL_SPT_H_HM175, "Skylake PCH-H HM175" }, |
| 74 | { PCI_DEVICE_ID_INTEL_SPT_H_QM175, "Skylake PCH-H QM175" }, |
| 75 | { PCI_DEVICE_ID_INTEL_SPT_H_CM238, "Skylake PCH-H CM238" }, |
Maxim Polyakov | 571d07d | 2019-08-22 13:11:32 +0300 | [diff] [blame] | 76 | { PCI_DEVICE_ID_INTEL_LWB_C621, "Lewisburg PCH C621" }, |
| 77 | { PCI_DEVICE_ID_INTEL_LWB_C622, "Lewisburg PCH C622" }, |
| 78 | { PCI_DEVICE_ID_INTEL_LWB_C624, "Lewisburg PCH C624" }, |
| 79 | { PCI_DEVICE_ID_INTEL_LWB_C625, "Lewisburg PCH C625" }, |
| 80 | { PCI_DEVICE_ID_INTEL_LWB_C626, "Lewisburg PCH C626" }, |
| 81 | { PCI_DEVICE_ID_INTEL_LWB_C627, "Lewisburg PCH C627" }, |
| 82 | { PCI_DEVICE_ID_INTEL_LWB_C628, "Lewisburg PCH C628" }, |
| 83 | { PCI_DEVICE_ID_INTEL_LWB_C629, "Lewisburg PCH C629" }, |
| 84 | { PCI_DEVICE_ID_INTEL_LWB_C624_SUPER, "Lewisburg PCH C624 Super SKU" }, |
| 85 | { PCI_DEVICE_ID_INTEL_LWB_C627_SUPER_1, "Lewisburg PCH C627 Super SKU" }, |
| 86 | { PCI_DEVICE_ID_INTEL_LWB_C621_SUPER, "Lewisburg PCH C621 Super SKU" }, |
| 87 | { PCI_DEVICE_ID_INTEL_LWB_C627_SUPER_2, "Lewisburg PCH C627 Super SKU" }, |
| 88 | { PCI_DEVICE_ID_INTEL_LWB_C628_SUPER, "Lewisburg PCH C628 Super SKU" }, |
V Sowmya | acc2a48 | 2018-01-23 15:27:23 +0530 | [diff] [blame] | 89 | { PCI_DEVICE_ID_INTEL_KBP_H_Q270, "Kabylake-H Q270" }, |
Gaggery Tsai | e415a4c | 2018-03-21 22:36:18 +0800 | [diff] [blame] | 90 | { PCI_DEVICE_ID_INTEL_KBP_H_H270, "Kabylake-H H270" }, |
| 91 | { PCI_DEVICE_ID_INTEL_KBP_H_Z270, "Kabylake-H Z270" }, |
| 92 | { PCI_DEVICE_ID_INTEL_KBP_H_B250, "Kabylake-H B250" }, |
| 93 | { PCI_DEVICE_ID_INTEL_KBP_H_Q250, "Kabylake-H Q250" }, |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 94 | { PCI_DEVICE_ID_INTEL_KBP_LP_U_PREMIUM, "Kabylake-U Premium" }, |
| 95 | { PCI_DEVICE_ID_INTEL_KBP_LP_Y_PREMIUM, "Kabylake-Y Premium" }, |
| 96 | { PCI_DEVICE_ID_INTEL_KBP_LP_SUPER_SKU, "Kabylake Super Sku" }, |
| 97 | { PCI_DEVICE_ID_INTEL_SPT_LP_Y_PREMIUM_HDCP22, |
| 98 | "Kabylake-Y iHDCP 2.2 Premium" }, |
| 99 | { PCI_DEVICE_ID_INTEL_SPT_LP_U_PREMIUM_HDCP22, |
| 100 | "Kabylake-U iHDCP 2.2 Premium" }, |
Gaggery Tsai | e2592be | 2017-09-20 22:46:39 +0800 | [diff] [blame] | 101 | { PCI_DEVICE_ID_INTEL_SPT_LP_U_BASE_HDCP22, |
| 102 | "Kabylake-U iHDCP 2.2 Base" }, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | static struct { |
| 106 | u16 igdid; |
| 107 | const char *name; |
| 108 | } igd_table[] = { |
Maxim Polyakov | 9563681 | 2019-09-20 22:06:57 +0300 | [diff] [blame] | 109 | { PCI_DEVICE_ID_INTEL_SKL_GT1F_DT2, "Skylake DT GT1F" }, |
| 110 | { PCI_DEVICE_ID_INTEL_SKL_GT1_SULTM, "Skylake ULT GT1" }, |
| 111 | { PCI_DEVICE_ID_INTEL_SKL_GT1F_SHALM, "Skylake HALO GT1F" }, |
Maxim Polyakov | 46e6852 | 2019-02-25 10:46:18 +0300 | [diff] [blame] | 112 | { PCI_DEVICE_ID_INTEL_SKL_GT2_DT2P1, "Skylake DT GT2" }, |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 113 | { PCI_DEVICE_ID_INTEL_SKL_GT2_SULTM, "Skylake ULT GT2" }, |
| 114 | { PCI_DEVICE_ID_INTEL_SKL_GT2_SHALM, "Skylake HALO GT2" }, |
Maxim Polyakov | 9563681 | 2019-09-20 22:06:57 +0300 | [diff] [blame] | 115 | { PCI_DEVICE_ID_INTEL_SKL_GT2_SWKSM, "Skylake Mobile Xeon GT2"}, |
| 116 | { PCI_DEVICE_ID_INTEL_SKL_GT2_SULXM, "Skylake ULX GT2" }, |
| 117 | { PCI_DEVICE_ID_INTEL_SKL_GT3_SULTM, "Skylake ULT GT3" }, |
| 118 | { PCI_DEVICE_ID_INTEL_SKL_GT3E_SULTM_1, "Skylake ULT (15W) GT3E" }, |
| 119 | { PCI_DEVICE_ID_INTEL_SKL_GT3E_SULTM_2, "Skylake ULT (28W) GT3E" }, |
| 120 | { PCI_DEVICE_ID_INTEL_SKL_GT3FE_SSRVM, "Skylake Media Server GT3FE" }, |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 121 | { PCI_DEVICE_ID_INTEL_SKL_GT4_SHALM, "Skylake HALO GT4" }, |
Maxim Polyakov | 9563681 | 2019-09-20 22:06:57 +0300 | [diff] [blame] | 122 | { PCI_DEVICE_ID_INTEL_SKL_GT4E_SWSTM, "Skylake Workstation GT4E" }, |
Maxim Polyakov | 8595469 | 2019-09-23 16:08:41 +0300 | [diff] [blame] | 123 | { PCI_DEVICE_ID_INTEL_KBL_GT1F_DT2, "Kaby Lake DT GT1F" }, |
| 124 | { PCI_DEVICE_ID_INTEL_KBL_GT1_SULTM, "Kaby Lake ULT GT1" }, |
| 125 | { PCI_DEVICE_ID_INTEL_KBL_GT1_SHALM_1, "Kaby Lake HALO GT1" }, |
| 126 | { PCI_DEVICE_ID_INTEL_KBL_GT1_SHALM_2, "Kaby Lake HALO GT1" }, |
| 127 | { PCI_DEVICE_ID_INTEL_KBL_GT1_SSRVM, "Kaby Lake SRV GT1" }, |
| 128 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SSRVM, "Kaby Lake Media Server GT2" }, |
| 129 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SWSTM, "Kaby Lake Workstation GT2" }, |
| 130 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SULXM, "Kaby Lake ULX GT2" }, |
| 131 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SULTM, "Kaby Lake ULT GT2" }, |
| 132 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SULTMR, "Kaby Lake-R ULT GT2" }, |
| 133 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SHALM, "Kaby Lake HALO GT2" }, |
| 134 | { PCI_DEVICE_ID_INTEL_KBL_GT2_DT2P2, "Kaby Lake DT GT2" }, |
| 135 | { PCI_DEVICE_ID_INTEL_KBL_GT2F_SULTM, "Kaby Lake ULT GT2F" }, |
| 136 | { PCI_DEVICE_ID_INTEL_KBL_GT3E_SULTM_1, "Kaby Lake ULT (15W) GT3E" }, |
| 137 | { PCI_DEVICE_ID_INTEL_KBL_GT3E_SULTM_2, "Kaby Lake ULT (28W) GT3E" }, |
| 138 | { PCI_DEVICE_ID_INTEL_KBL_GT4_SHALM, "Kaby Lake HALO GT4" }, |
Gaggery Tsai | 8aee7f7 | 2018-08-03 11:40:55 -0700 | [diff] [blame] | 139 | { PCI_DEVICE_ID_INTEL_AML_GT2_ULX, "Amberlake ULX GT2" }, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 140 | }; |
| 141 | |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 142 | static uint8_t get_dev_revision(pci_devfn_t dev) |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 143 | { |
| 144 | return pci_read_config8(dev, PCI_REVISION_ID); |
| 145 | } |
| 146 | |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 147 | static uint16_t get_dev_id(pci_devfn_t dev) |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 148 | { |
| 149 | return pci_read_config16(dev, PCI_DEVICE_ID); |
| 150 | } |
| 151 | |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 152 | static void report_cpu_info(void) |
| 153 | { |
Usha P | 65a8c2e | 2019-11-14 11:58:53 +0530 | [diff] [blame] | 154 | u32 i, cpu_id, cpu_feature_flag; |
| 155 | char cpu_name[49]; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 156 | int vt, txt, aes; |
| 157 | msr_t microcode_ver; |
Elyes HAOUAS | 39303d5 | 2018-07-08 12:40:45 +0200 | [diff] [blame] | 158 | static const char *const mode[] = {"NOT ", ""}; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 159 | const char *cpu_type = "Unknown"; |
| 160 | |
Usha P | 65a8c2e | 2019-11-14 11:58:53 +0530 | [diff] [blame] | 161 | fill_processor_name(cpu_name); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 162 | |
| 163 | microcode_ver.lo = 0; |
| 164 | microcode_ver.hi = 0; |
Elyes HAOUAS | 603963e | 2018-09-28 09:06:43 +0200 | [diff] [blame] | 165 | wrmsr(IA32_BIOS_SIGN_ID, microcode_ver); |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 166 | cpu_id = cpu_get_cpuid(); |
Elyes HAOUAS | 603963e | 2018-09-28 09:06:43 +0200 | [diff] [blame] | 167 | microcode_ver = rdmsr(IA32_BIOS_SIGN_ID); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 168 | |
| 169 | /* Look for string to match the name */ |
| 170 | for (i = 0; i < ARRAY_SIZE(cpu_table); i++) { |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 171 | if (cpu_table[i].cpuid == cpu_id) { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 172 | cpu_type = cpu_table[i].name; |
| 173 | break; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | printk(BIOS_DEBUG, "CPU: %s\n", cpu_name); |
| 178 | printk(BIOS_DEBUG, "CPU: ID %x, %s, ucode: %08x\n", |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 179 | cpu_id, cpu_type, microcode_ver.hi); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 180 | |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 181 | cpu_feature_flag = cpu_get_feature_flags_ecx(); |
| 182 | aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0; |
| 183 | txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0; |
| 184 | vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0; |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 185 | printk(BIOS_DEBUG, |
| 186 | "CPU: AES %ssupported, TXT %ssupported, VT %ssupported\n", |
| 187 | mode[aes], mode[txt], mode[vt]); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | static void report_mch_info(void) |
| 191 | { |
| 192 | int i; |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 193 | pci_devfn_t dev = SA_DEV_ROOT; |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 194 | uint16_t mchid = get_dev_id(dev); |
| 195 | uint8_t mch_revision = get_dev_revision(dev); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 196 | const char *mch_type = "Unknown"; |
| 197 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 198 | for (i = 0; i < ARRAY_SIZE(mch_table); i++) { |
| 199 | if (mch_table[i].mchid == mchid) { |
| 200 | mch_type = mch_table[i].name; |
| 201 | break; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 202 | } |
| 203 | } |
| 204 | |
| 205 | printk(BIOS_DEBUG, "MCH: device id %04x (rev %02x) is %s\n", |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 206 | mchid, mch_revision, mch_type); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | static void report_pch_info(void) |
| 210 | { |
| 211 | int i; |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 212 | pci_devfn_t dev = PCH_DEV_LPC; |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 213 | uint16_t lpcid = get_dev_id(dev); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 214 | const char *pch_type = "Unknown"; |
| 215 | |
| 216 | for (i = 0; i < ARRAY_SIZE(pch_table); i++) { |
| 217 | if (pch_table[i].lpcid == lpcid) { |
| 218 | pch_type = pch_table[i].name; |
| 219 | break; |
| 220 | } |
| 221 | } |
| 222 | printk(BIOS_DEBUG, "PCH: device id %04x (rev %02x) is %s\n", |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 223 | lpcid, get_dev_revision(dev), pch_type); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | static void report_igd_info(void) |
| 227 | { |
| 228 | int i; |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 229 | pci_devfn_t dev = SA_DEV_IGD; |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 230 | uint16_t igdid = get_dev_id(dev); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 231 | const char *igd_type = "Unknown"; |
| 232 | |
| 233 | for (i = 0; i < ARRAY_SIZE(igd_table); i++) { |
| 234 | if (igd_table[i].igdid == igdid) { |
| 235 | igd_type = igd_table[i].name; |
| 236 | break; |
| 237 | } |
| 238 | } |
| 239 | printk(BIOS_DEBUG, "IGD: device id %04x (rev %02x) is %s\n", |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 240 | igdid, get_dev_revision(dev), igd_type); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | void report_platform_info(void) |
| 244 | { |
| 245 | report_cpu_info(); |
| 246 | report_mch_info(); |
| 247 | report_pch_info(); |
| 248 | report_igd_info(); |
| 249 | } |
| 250 | |
| 251 | /* |
| 252 | * Dump in the log memory controller configuration as read from the memory |
| 253 | * controller registers. |
| 254 | */ |
| 255 | void report_memory_config(void) |
| 256 | { |
| 257 | u32 addr_decoder_common, addr_decode_ch[2]; |
| 258 | int i; |
| 259 | |
| 260 | addr_decoder_common = MCHBAR32(0x5000); |
| 261 | addr_decode_ch[0] = MCHBAR32(0x5004); |
| 262 | addr_decode_ch[1] = MCHBAR32(0x5008); |
| 263 | |
| 264 | printk(BIOS_DEBUG, "memcfg DDR3 clock %d MHz\n", |
| 265 | (MCHBAR32(0x5e04) * 13333 * 2 + 50)/100); |
| 266 | printk(BIOS_DEBUG, "memcfg channel assignment: A: %d, B % d, C % d\n", |
| 267 | addr_decoder_common & 3, |
| 268 | (addr_decoder_common >> 2) & 3, |
| 269 | (addr_decoder_common >> 4) & 3); |
| 270 | |
| 271 | for (i = 0; i < ARRAY_SIZE(addr_decode_ch); i++) { |
| 272 | u32 ch_conf = addr_decode_ch[i]; |
| 273 | printk(BIOS_DEBUG, "memcfg channel[%d] config (%8.8x):\n", |
| 274 | i, ch_conf); |
| 275 | printk(BIOS_DEBUG, " enhanced interleave mode %s\n", |
| 276 | ((ch_conf >> 22) & 1) ? "on" : "off"); |
| 277 | printk(BIOS_DEBUG, " rank interleave %s\n", |
| 278 | ((ch_conf >> 21) & 1) ? "on" : "off"); |
| 279 | printk(BIOS_DEBUG, " DIMMA %d MB width %s %s rank%s\n", |
| 280 | ((ch_conf >> 0) & 0xff) * 256, |
| 281 | ((ch_conf >> 19) & 1) ? "x16" : "x8 or x32", |
| 282 | ((ch_conf >> 17) & 1) ? "dual" : "single", |
| 283 | ((ch_conf >> 16) & 1) ? "" : ", selected"); |
| 284 | printk(BIOS_DEBUG, " DIMMB %d MB width %s %s rank%s\n", |
| 285 | ((ch_conf >> 8) & 0xff) * 256, |
| 286 | ((ch_conf >> 19) & 1) ? "x16" : "x8 or x32", |
| 287 | ((ch_conf >> 18) & 1) ? "dual" : "single", |
| 288 | ((ch_conf >> 16) & 1) ? ", selected" : ""); |
| 289 | } |
| 290 | } |