Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2014 Google Inc. |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 5 | * Copyright (C) 2015 Intel Corporation. |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/cpu.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 18 | #include <device/pci_ops.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 19 | #include <console/console.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 20 | #include <cpu/x86/msr.h> |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 21 | #include <device/pci.h> |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 22 | #include <device/pci_ids.h> |
Barnali Sarkar | 7327386 | 2017-06-13 20:22:33 +0530 | [diff] [blame] | 23 | #include <intelblocks/mp_init.h> |
Naresh G Solanki | ecd9a94 | 2016-08-11 14:56:28 +0530 | [diff] [blame] | 24 | #include <soc/bootblock.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 25 | #include <soc/cpu.h> |
| 26 | #include <soc/pch.h> |
| 27 | #include <soc/pci_devs.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 28 | #include <soc/systemagent.h> |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 29 | #include <string.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 30 | |
| 31 | static struct { |
| 32 | u32 cpuid; |
| 33 | const char *name; |
| 34 | } cpu_table[] = { |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 35 | { CPUID_SKYLAKE_C0, "Skylake C0" }, |
| 36 | { CPUID_SKYLAKE_D0, "Skylake D0" }, |
| 37 | { CPUID_SKYLAKE_HQ0, "Skylake H Q0" }, |
| 38 | { CPUID_SKYLAKE_HR0, "Skylake H R0" }, |
| 39 | { CPUID_KABYLAKE_G0, "Kabylake G0" }, |
| 40 | { CPUID_KABYLAKE_H0, "Kabylake H0" }, |
| 41 | { CPUID_KABYLAKE_Y0, "Kabylake Y0" }, |
| 42 | { CPUID_KABYLAKE_HA0, "Kabylake H A0" }, |
| 43 | { CPUID_KABYLAKE_HB0, "Kabylake H B0" }, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | static struct { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 47 | u16 mchid; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 48 | const char *name; |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 49 | } mch_table[] = { |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 50 | { PCI_DEVICE_ID_INTEL_SKL_ID_U, "Skylake-U" }, |
| 51 | { PCI_DEVICE_ID_INTEL_SKL_ID_Y, "Skylake-Y" }, |
| 52 | { PCI_DEVICE_ID_INTEL_SKL_ID_ULX, "Skylake-ULX" }, |
| 53 | { PCI_DEVICE_ID_INTEL_SKL_ID_H, "Skylake-H" }, |
| 54 | { PCI_DEVICE_ID_INTEL_SKL_ID_H_EM, "Skylake-H Embedded" }, |
Keno Fischer | 1044eba | 2019-06-07 01:55:56 -0400 | [diff] [blame] | 55 | { PCI_DEVICE_ID_INTEL_SKL_ID_H_2, "Skylake-H (2 Core)" }, |
| 56 | { PCI_DEVICE_ID_INTEL_SKL_ID_S_2, "Skylake-S (2 Core)" }, |
Maxim Polyakov | a0cd4b1 | 2019-08-27 15:58:04 +0300 | [diff] [blame^] | 57 | { 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] | 58 | { PCI_DEVICE_ID_INTEL_KBL_ID_U, "Kabylake-U" }, |
| 59 | { PCI_DEVICE_ID_INTEL_KBL_U_R, "Kabylake-R ULT"}, |
| 60 | { PCI_DEVICE_ID_INTEL_KBL_ID_Y, "Kabylake-Y" }, |
| 61 | { PCI_DEVICE_ID_INTEL_KBL_ID_H, "Kabylake-H" }, |
Gaggery Tsai | e415a4c | 2018-03-21 22:36:18 +0800 | [diff] [blame] | 62 | { PCI_DEVICE_ID_INTEL_KBL_ID_S, "Kabylake-S" }, |
V Sowmya | acc2a48 | 2018-01-23 15:27:23 +0530 | [diff] [blame] | 63 | { PCI_DEVICE_ID_INTEL_KBL_ID_DT, "Kabylake DT" }, |
Christian Walter | 3d84038 | 2019-05-17 19:37:16 +0200 | [diff] [blame] | 64 | { PCI_DEVICE_ID_INTEL_KBL_ID_DT_2, "Kabylake DT 2" }, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | static struct { |
| 68 | u16 lpcid; |
| 69 | const char *name; |
| 70 | } pch_table[] = { |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 71 | { PCI_DEVICE_ID_INTEL_SPT_LP_SAMPLE, "Skylake LP Sample" }, |
| 72 | { PCI_DEVICE_ID_INTEL_SPT_LP_U_BASE, "Skylake-U Base" }, |
| 73 | { PCI_DEVICE_ID_INTEL_SPT_LP_U_PREMIUM, "Skylake-U Premium" }, |
| 74 | { PCI_DEVICE_ID_INTEL_SPT_LP_Y_PREMIUM, "Skylake-Y Premium" }, |
Maxim Polyakov | 7a732b4 | 2019-02-25 10:48:39 +0300 | [diff] [blame] | 75 | { PCI_DEVICE_ID_INTEL_SPT_H_H110, "Skylake PCH-H H110" }, |
Marius Genheimer | 4998bec | 2019-04-30 00:04:32 +0200 | [diff] [blame] | 76 | { PCI_DEVICE_ID_INTEL_SPT_H_H170, "Skylake PCH-H H170" }, |
| 77 | { PCI_DEVICE_ID_INTEL_SPT_H_Z170, "Skylake PCH-H Z170" }, |
| 78 | { PCI_DEVICE_ID_INTEL_SPT_H_Q170, "Skylake PCH-H Q170" }, |
| 79 | { PCI_DEVICE_ID_INTEL_SPT_H_Q150, "Skylake PCH-H Q150" }, |
| 80 | { PCI_DEVICE_ID_INTEL_SPT_H_B150, "Skylake PCH-H B150" }, |
V Sowmya | 7c15047 | 2018-01-23 14:44:45 +0530 | [diff] [blame] | 81 | { PCI_DEVICE_ID_INTEL_SPT_H_C236, "Skylake PCH-H C236" }, |
Felix Singer | c3244cc | 2019-07-29 22:54:09 +0200 | [diff] [blame] | 82 | { PCI_DEVICE_ID_INTEL_SPT_H_C232, "Skylake PCH-H C232" }, |
V Sowmya | 7c15047 | 2018-01-23 14:44:45 +0530 | [diff] [blame] | 83 | { PCI_DEVICE_ID_INTEL_SPT_H_QM170, "Skylake PCH-H QM170" }, |
Felix Singer | c3244cc | 2019-07-29 22:54:09 +0200 | [diff] [blame] | 84 | { PCI_DEVICE_ID_INTEL_SPT_H_HM170, "Skylake PCH-H HM170" }, |
| 85 | { PCI_DEVICE_ID_INTEL_SPT_H_CM236, "Skylake PCH-H CM236" }, |
Praveen hodagatta pranesh | 523d669 | 2018-11-03 01:21:14 +0800 | [diff] [blame] | 86 | { PCI_DEVICE_ID_INTEL_SPT_H_HM175, "Skylake PCH-H HM175" }, |
| 87 | { PCI_DEVICE_ID_INTEL_SPT_H_QM175, "Skylake PCH-H QM175" }, |
| 88 | { PCI_DEVICE_ID_INTEL_SPT_H_CM238, "Skylake PCH-H CM238" }, |
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[] = { |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 109 | { PCI_DEVICE_ID_INTEL_SKL_GT1_SULTM, "Skylake ULT GT1"}, |
Maxim Polyakov | 46e6852 | 2019-02-25 10:46:18 +0300 | [diff] [blame] | 110 | { PCI_DEVICE_ID_INTEL_SKL_GT2_DT2P1, "Skylake DT GT2" }, |
Subrata Banik | c216567 | 2017-06-02 17:52:44 +0530 | [diff] [blame] | 111 | { PCI_DEVICE_ID_INTEL_SKL_GT2_SULXM, "Skylake ULX GT2" }, |
| 112 | { PCI_DEVICE_ID_INTEL_SKL_GT2_SULTM, "Skylake ULT GT2" }, |
| 113 | { PCI_DEVICE_ID_INTEL_SKL_GT2_SHALM, "Skylake HALO GT2" }, |
| 114 | { PCI_DEVICE_ID_INTEL_SKL_GT4_SHALM, "Skylake HALO GT4" }, |
| 115 | { PCI_DEVICE_ID_INTEL_KBL_GT1_SULTM, "Kabylake ULT GT1"}, |
| 116 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SULXM, "Kabylake ULX GT2" }, |
| 117 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SULTM, "Kabylake ULT GT2" }, |
| 118 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SULTMR, "Kabylake-R ULT GT2"}, |
| 119 | { PCI_DEVICE_ID_INTEL_KBL_GT2_SHALM, "Kabylake HALO GT2" }, |
V Sowmya | acc2a48 | 2018-01-23 15:27:23 +0530 | [diff] [blame] | 120 | { PCI_DEVICE_ID_INTEL_KBL_GT2_DT2P2, "Kabylake DT GT2" }, |
Gaggery Tsai | 8aee7f7 | 2018-08-03 11:40:55 -0700 | [diff] [blame] | 121 | { PCI_DEVICE_ID_INTEL_AML_GT2_ULX, "Amberlake ULX GT2" }, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 124 | static uint8_t get_dev_revision(pci_devfn_t dev) |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 125 | { |
| 126 | return pci_read_config8(dev, PCI_REVISION_ID); |
| 127 | } |
| 128 | |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 129 | static uint16_t get_dev_id(pci_devfn_t dev) |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 130 | { |
| 131 | return pci_read_config16(dev, PCI_DEVICE_ID); |
| 132 | } |
| 133 | |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 134 | static void report_cpu_info(void) |
| 135 | { |
| 136 | struct cpuid_result cpuidr; |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 137 | u32 i, index, cpu_id, cpu_feature_flag; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 138 | char cpu_string[50], *cpu_name = cpu_string; /* 48 bytes are reported */ |
| 139 | int vt, txt, aes; |
| 140 | msr_t microcode_ver; |
Elyes HAOUAS | 39303d5 | 2018-07-08 12:40:45 +0200 | [diff] [blame] | 141 | static const char *const mode[] = {"NOT ", ""}; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 142 | const char *cpu_type = "Unknown"; |
| 143 | |
| 144 | index = 0x80000000; |
| 145 | cpuidr = cpuid(index); |
| 146 | if (cpuidr.eax < 0x80000004) { |
| 147 | strcpy(cpu_string, "Platform info not available"); |
| 148 | } else { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 149 | u32 *p = (u32 *) cpu_string; |
| 150 | for (i = 2; i <= 4; i++) { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 151 | cpuidr = cpuid(index + i); |
| 152 | *p++ = cpuidr.eax; |
| 153 | *p++ = cpuidr.ebx; |
| 154 | *p++ = cpuidr.ecx; |
| 155 | *p++ = cpuidr.edx; |
| 156 | } |
| 157 | } |
| 158 | /* Skip leading spaces in CPU name string */ |
| 159 | while (cpu_name[0] == ' ') |
| 160 | cpu_name++; |
| 161 | |
| 162 | microcode_ver.lo = 0; |
| 163 | microcode_ver.hi = 0; |
Elyes HAOUAS | 603963e | 2018-09-28 09:06:43 +0200 | [diff] [blame] | 164 | wrmsr(IA32_BIOS_SIGN_ID, microcode_ver); |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 165 | cpu_id = cpu_get_cpuid(); |
Elyes HAOUAS | 603963e | 2018-09-28 09:06:43 +0200 | [diff] [blame] | 166 | microcode_ver = rdmsr(IA32_BIOS_SIGN_ID); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 167 | |
| 168 | /* Look for string to match the name */ |
| 169 | for (i = 0; i < ARRAY_SIZE(cpu_table); i++) { |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 170 | if (cpu_table[i].cpuid == cpu_id) { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 171 | cpu_type = cpu_table[i].name; |
| 172 | break; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | printk(BIOS_DEBUG, "CPU: %s\n", cpu_name); |
| 177 | printk(BIOS_DEBUG, "CPU: ID %x, %s, ucode: %08x\n", |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 178 | cpu_id, cpu_type, microcode_ver.hi); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 179 | |
Subrata Banik | 53b08c3 | 2018-12-10 14:11:35 +0530 | [diff] [blame] | 180 | cpu_feature_flag = cpu_get_feature_flags_ecx(); |
| 181 | aes = (cpu_feature_flag & CPUID_AES) ? 1 : 0; |
| 182 | txt = (cpu_feature_flag & CPUID_SMX) ? 1 : 0; |
| 183 | vt = (cpu_feature_flag & CPUID_VMX) ? 1 : 0; |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 184 | printk(BIOS_DEBUG, |
| 185 | "CPU: AES %ssupported, TXT %ssupported, VT %ssupported\n", |
| 186 | mode[aes], mode[txt], mode[vt]); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | static void report_mch_info(void) |
| 190 | { |
| 191 | int i; |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 192 | pci_devfn_t dev = SA_DEV_ROOT; |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 193 | uint16_t mchid = get_dev_id(dev); |
| 194 | uint8_t mch_revision = get_dev_revision(dev); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 195 | const char *mch_type = "Unknown"; |
| 196 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 197 | for (i = 0; i < ARRAY_SIZE(mch_table); i++) { |
| 198 | if (mch_table[i].mchid == mchid) { |
| 199 | mch_type = mch_table[i].name; |
| 200 | break; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 201 | } |
| 202 | } |
| 203 | |
| 204 | printk(BIOS_DEBUG, "MCH: device id %04x (rev %02x) is %s\n", |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 205 | mchid, mch_revision, mch_type); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | static void report_pch_info(void) |
| 209 | { |
| 210 | int i; |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 211 | pci_devfn_t dev = PCH_DEV_LPC; |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 212 | uint16_t lpcid = get_dev_id(dev); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 213 | const char *pch_type = "Unknown"; |
| 214 | |
| 215 | for (i = 0; i < ARRAY_SIZE(pch_table); i++) { |
| 216 | if (pch_table[i].lpcid == lpcid) { |
| 217 | pch_type = pch_table[i].name; |
| 218 | break; |
| 219 | } |
| 220 | } |
| 221 | printk(BIOS_DEBUG, "PCH: device id %04x (rev %02x) is %s\n", |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 222 | lpcid, get_dev_revision(dev), pch_type); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | static void report_igd_info(void) |
| 226 | { |
| 227 | int i; |
Elyes HAOUAS | 68c851b | 2018-06-12 22:06:09 +0200 | [diff] [blame] | 228 | pci_devfn_t dev = SA_DEV_IGD; |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 229 | uint16_t igdid = get_dev_id(dev); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 230 | const char *igd_type = "Unknown"; |
| 231 | |
| 232 | for (i = 0; i < ARRAY_SIZE(igd_table); i++) { |
| 233 | if (igd_table[i].igdid == igdid) { |
| 234 | igd_type = igd_table[i].name; |
| 235 | break; |
| 236 | } |
| 237 | } |
| 238 | printk(BIOS_DEBUG, "IGD: device id %04x (rev %02x) is %s\n", |
Subrata Banik | df5ae9c | 2017-12-06 19:10:15 +0530 | [diff] [blame] | 239 | igdid, get_dev_revision(dev), igd_type); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | void report_platform_info(void) |
| 243 | { |
| 244 | report_cpu_info(); |
| 245 | report_mch_info(); |
| 246 | report_pch_info(); |
| 247 | report_igd_info(); |
| 248 | } |
| 249 | |
| 250 | /* |
| 251 | * Dump in the log memory controller configuration as read from the memory |
| 252 | * controller registers. |
| 253 | */ |
| 254 | void report_memory_config(void) |
| 255 | { |
| 256 | u32 addr_decoder_common, addr_decode_ch[2]; |
| 257 | int i; |
| 258 | |
| 259 | addr_decoder_common = MCHBAR32(0x5000); |
| 260 | addr_decode_ch[0] = MCHBAR32(0x5004); |
| 261 | addr_decode_ch[1] = MCHBAR32(0x5008); |
| 262 | |
| 263 | printk(BIOS_DEBUG, "memcfg DDR3 clock %d MHz\n", |
| 264 | (MCHBAR32(0x5e04) * 13333 * 2 + 50)/100); |
| 265 | printk(BIOS_DEBUG, "memcfg channel assignment: A: %d, B % d, C % d\n", |
| 266 | addr_decoder_common & 3, |
| 267 | (addr_decoder_common >> 2) & 3, |
| 268 | (addr_decoder_common >> 4) & 3); |
| 269 | |
| 270 | for (i = 0; i < ARRAY_SIZE(addr_decode_ch); i++) { |
| 271 | u32 ch_conf = addr_decode_ch[i]; |
| 272 | printk(BIOS_DEBUG, "memcfg channel[%d] config (%8.8x):\n", |
| 273 | i, ch_conf); |
| 274 | printk(BIOS_DEBUG, " enhanced interleave mode %s\n", |
| 275 | ((ch_conf >> 22) & 1) ? "on" : "off"); |
| 276 | printk(BIOS_DEBUG, " rank interleave %s\n", |
| 277 | ((ch_conf >> 21) & 1) ? "on" : "off"); |
| 278 | printk(BIOS_DEBUG, " DIMMA %d MB width %s %s rank%s\n", |
| 279 | ((ch_conf >> 0) & 0xff) * 256, |
| 280 | ((ch_conf >> 19) & 1) ? "x16" : "x8 or x32", |
| 281 | ((ch_conf >> 17) & 1) ? "dual" : "single", |
| 282 | ((ch_conf >> 16) & 1) ? "" : ", selected"); |
| 283 | printk(BIOS_DEBUG, " DIMMB %d MB width %s %s rank%s\n", |
| 284 | ((ch_conf >> 8) & 0xff) * 256, |
| 285 | ((ch_conf >> 19) & 1) ? "x16" : "x8 or x32", |
| 286 | ((ch_conf >> 18) & 1) ? "dual" : "single", |
| 287 | ((ch_conf >> 16) & 1) ? ", selected" : ""); |
| 288 | } |
| 289 | } |