summaryrefslogtreecommitdiffstats
path: root/resources/libreboot/patch/coreboot/369b561315ca68d0cdedc38208105a513c7139b5/grub/kcma-d8/0018-nb-amdmct-mct_ddr3-Enable-mainboard-voltage-set.patch
blob: 7b2fdc238cdf720754b193663bafbcc0efb1bb8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From 7c59896199f78e3b7ededce1a9c2eb9a9bfa795d Mon Sep 17 00:00:00 2001
From: Timothy Pearson <tpearson@raptorengineeringinc.com>
Date: Tue, 24 Nov 2015 14:11:53 -0600
Subject: [PATCH 18/45] nb/amdmct/mct_ddr3: Enable mainboard voltage set

The existing code used an incorrect macro name to check for mainboard
DRAM voltage set support, and as a result no voltages were actually
set.  Furthermore, the existing code did not contain a centralized
voltage assumption for boards that did not have a DIMM voltage set
implementation.

Use the correct macro name to test for boards with voltage set
implementation, and provide a basic fallback to 1.5V operation
for boards without a voltage set implementation.

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
---
 src/northbridge/amd/amdmct/mct_ddr3/mct_d.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c
index 9724008..e1c0d4f 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c
@@ -254,6 +254,10 @@ static uint8_t dct_ddr_voltage_index(struct DCTStatStruc *pDCTstat, uint8_t dct)
 	uint8_t dimm;
 	uint8_t ddr_voltage_index = 0;
 
+	/* If no DIMMs are present on this DCT, report 1.5V operation and skip checking the hardware */
+	if (pDCTstat->DIMMValidDCT[dct] == 0)
+		return 0x1;
+
 	/* Find current DDR supply voltage for this DCT */
 	for (dimm = 0; dimm < MAX_DIMMS_SUPPORTED; dimm++) {
 		if (pDCTstat->DIMMValidDCT[dct] & (1 << dimm))
@@ -2409,6 +2413,7 @@ static void mctAutoInitMCT_D(struct MCTStatStruc *pMCTstat,
 	 */
 	u8 Node, NodesWmem;
 	u32 node_sys_base;
+	uint8_t dimm;
 	uint8_t nvram;
 	uint8_t enable_cc6;
 	uint8_t allow_config_restore;
@@ -2498,10 +2503,25 @@ restartinit:
 		nvram = 0;
 		set_option("allow_spd_nvram_cache_restore", &nvram);
 
-#if IS_ENABLED(DIMM_VOLTAGE_SET_SUPPORT)
+#if IS_ENABLED(CONFIG_DIMM_VOLTAGE_SET_SUPPORT)
 		printk(BIOS_DEBUG, "%s: DIMMSetVoltage\n", __func__);
 		DIMMSetVoltages(pMCTstat, pDCTstatA);	/* Set the DIMM voltages (mainboard specific) */
 #endif
+		if (!IS_ENABLED(CONFIG_DIMM_VOLTAGE_SET_SUPPORT)) {
+			/* Assume 1.5V operation */
+			for (Node = 0; Node < MAX_NODES_SUPPORTED; Node++) {
+				struct DCTStatStruc *pDCTstat;
+				pDCTstat = pDCTstatA + Node;
+
+				if (!pDCTstat->NodePresent)
+					continue;
+
+				for (dimm = 0; dimm < MAX_DIMMS_SUPPORTED; dimm++) {
+					if (pDCTstat->DIMMValid & (1 << dimm))
+						pDCTstat->DimmConfiguredVoltage[dimm] = 0x1;
+				}
+			}
+		}
 
 		/* If DIMM configuration has not changed since last boot restore training values */
 		allow_config_restore = 1;
-- 
2.1.4