Skip to content

Commit 51ade5b

Browse files
authored
Merge pull request #1760 from tlaurion/mrothfuss-d16_ram_init_fixes_coreboot411
coreboot-4.11: add fixes to KGPE-D16 raminit
2 parents 1c21f9c + ef6cbe5 commit 51ade5b

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From f6c818898b3f978bd22ed2829a881322e0eadaf9 Mon Sep 17 00:00:00 2001
2+
From: Mike Rothfuss <6182328+mrothfuss@users.noreply.github.com>
3+
Date: Fri, 23 Aug 2024 19:54:54 -0600
4+
Subject: [PATCH 1/2] northbridge/amd: Fixed errors in fam15h DQS timing
5+
6+
Fixed two errors in determining whether valid values were
7+
found for read DQS delays in raminit.
8+
---
9+
src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c | 17 ++++++-----------
10+
1 file changed, 6 insertions(+), 11 deletions(-)
11+
12+
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c
13+
index d34b2dc2ba..6cf67afa4f 100644
14+
--- a/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c
15+
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c
16+
@@ -21,6 +21,7 @@
17+
#include <arch/cpu.h>
18+
#include <cpu/amd/msr.h>
19+
#include <cpu/amd/mtrr.h>
20+
+#include <southbridge/amd/common/reset.h>
21+
#include "mct_d.h"
22+
#include "mct_d_gcc.h"
23+
24+
@@ -1287,6 +1288,7 @@ static uint8_t TrainDQSRdWrPos_D_Fam15(struct MCTStatStruc *pMCTstat,
25+
uint8_t cur_count = 0;
26+
uint8_t best_pos = 0;
27+
uint8_t best_count = 0;
28+
+ uint16_t region_center;
29+
30+
uint32_t index_reg = 0x98;
31+
uint32_t dev = pDCTstat->dev_dct;
32+
@@ -1455,23 +1457,16 @@ static uint8_t TrainDQSRdWrPos_D_Fam15(struct MCTStatStruc *pMCTstat,
33+
last_pos = 0;
34+
}
35+
36+
- if (best_count > 2) {
37+
- uint16_t region_center = (best_pos + (best_count / 2));
38+
-
39+
- if (region_center < 16) {
40+
- printk(BIOS_WARNING, "TrainDQSRdWrPos: negative DQS recovery delay detected!"
41+
- " Attempting to continue but your system may be unstable...\n");
42+
- region_center = 0;
43+
- } else {
44+
- region_center -= 16;
45+
- }
46+
+ region_center = (best_pos + (best_count / 2));
47+
+ if ((best_count > 2) && (region_center >= 16)) {
48+
+ region_center -= 16;
49+
50+
/* Restore current settings of other (previously trained) lanes to the active array */
51+
memcpy(current_read_dqs_delay, initial_read_dqs_delay, sizeof(current_read_dqs_delay));
52+
53+
/* Program the Read DQS Timing Control register with the center of the passing window */
54+
current_read_dqs_delay[lane] = region_center;
55+
- passing_dqs_delay_found[lane] = 1;
56+
+ passing_read_dqs_delay_found = 1;
57+
58+
/* Commit the current Read DQS Timing Control settings to the hardware registers */
59+
write_dqs_read_data_timing_registers(current_read_dqs_delay, dev, dct, dimm, index_reg);
60+
--
61+
2.39.2
62+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
From ce1c7a35fa11b46d0478e97c4a4001179ab9d1bf Mon Sep 17 00:00:00 2001
2+
From: Mike Rothfuss <6182328+mrothfuss@users.noreply.github.com>
3+
Date: Fri, 23 Aug 2024 19:59:09 -0600
4+
Subject: [PATCH 2/2] northbridge/amd: Added resets for ram training failures
5+
6+
Instead of booting into an unstable state (and crashing), the board
7+
resets to re-attempt raminit.
8+
---
9+
src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c | 7 +++++--
10+
src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c | 7 +++++--
11+
2 files changed, 10 insertions(+), 4 deletions(-)
12+
13+
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c b/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c
14+
index 1ee10608b9..9a53bd352d 100644
15+
--- a/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c
16+
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c
17+
@@ -18,6 +18,7 @@
18+
#include <stdint.h>
19+
#include <console/console.h>
20+
#include <string.h>
21+
+#include <southbridge/amd/common/reset.h>
22+
#include "mct_d.h"
23+
#include "mct_d_gcc.h"
24+
25+
@@ -265,11 +266,13 @@ static void WriteLevelization_HW(struct MCTStatStruc *pMCTstat,
26+
27+
pDCTstat->TargetFreq = final_target_freq;
28+
29+
- if (global_phy_training_status)
30+
+ if (global_phy_training_status) {
31+
printk(BIOS_WARNING,
32+
"%s: Uncorrectable invalid value(s) detected in second phase of write levelling; "
33+
- "continuing but system may be unstable!\n",
34+
+ "Restarting system\n",
35+
__func__);
36+
+ soft_reset();
37+
+ }
38+
39+
uint8_t dct;
40+
for (dct = 0; dct < 2; dct++) {
41+
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c b/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c
42+
index dbb989fe3d..c4cb53442d 100644
43+
--- a/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c
44+
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c
45+
@@ -26,6 +26,7 @@
46+
#include <string.h>
47+
#include <cpu/x86/msr.h>
48+
#include <cpu/amd/msr.h>
49+
+#include <southbridge/amd/common/reset.h>
50+
#include "mct_d.h"
51+
#include "mct_d_gcc.h"
52+
53+
@@ -1698,8 +1699,10 @@ void dqsTrainMaxRdLatency_SW_Fam15(struct MCTStatStruc *pMCTstat,
54+
Set_NB32_index_wait_DCT(dev, Channel, index_reg, 0x00000050, 0x13131313);
55+
}
56+
dword = Get_NB32_DCT(dev, Channel, 0x268) & 0x3ffff;
57+
- if (dword)
58+
- printk(BIOS_ERR, "WARNING: MaxRdLatency training FAILED! Attempting to continue but your system may be unstable...\n");
59+
+ if (dword) {
60+
+ printk(BIOS_ERR, "WARNING: MaxRdLatency training FAILED! Restarting system\n");
61+
+ soft_reset();
62+
+ }
63+
64+
/* 2.10.5.8.5.1.5 */
65+
nb_pstate = 0;
66+
--
67+
2.39.2
68+

0 commit comments

Comments
 (0)