Richard Spiegel has posted comments on this change. ( https://review.coreboot.org/23785 )
Change subject: soc/amd/stoneyridge/romstage.c: Fix AGESA warning
......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/23785/1/src/soc/amd/stoneyridge/romstage.c
File src/soc/amd/stoneyridge/romstage.c:
https://review.coreboot.org/#/c/23785/1/src/soc/amd/stoneyridge/romstage.c@…
PS1, Line 179: printk(BIOS_SPEW, "Ranks %d\n", ranks);
This should have been removed.
--
To view, visit https://review.coreboot.org/23785
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I002328d1029c968c371ff751986537135231f306
Gerrit-Change-Number: 23785
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
Gerrit-Reviewer: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
Gerrit-Comment-Date: Thu, 15 Feb 2018 20:42:57 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/23786
Change subject: soc/amd/stoneyridge/romstage.c: Fix AGESA warning
......................................................................
soc/amd/stoneyridge/romstage.c: Fix AGESA warning
AmdInitPost returns AGESA_WARNING. This is because AGESA by default
enables bank interleaving, while the HW does not meet the requirements
for it. After some investigation, it was found that AGESA was really
checking rank.
Using the new rank function, disable bank interleave if the number of
ranks is odd.
BUG=b:73118857
TEST= Build and run kahlee. Search for "agesawrapper_amdinitpost()
returned AGESA_SUCCESS".
Change-Id: Id8a2a3bc927f87e91d30971b512fac12230aaad7
Signed-off-by: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
---
M src/soc/amd/stoneyridge/romstage.c
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/23786/1
diff --git a/src/soc/amd/stoneyridge/romstage.c b/src/soc/amd/stoneyridge/romstage.c
index 351a266..2488ef9 100644
--- a/src/soc/amd/stoneyridge/romstage.c
+++ b/src/soc/amd/stoneyridge/romstage.c
@@ -176,7 +176,9 @@
cfg = dev->chip_info;
uint8_t ranks = get_total_ranks(cfg);
- printk(BIOS_SPEW, "Ranks %d\n", ranks);
+ /* If the number of ranks is odd, disable interleaving */
+ if (ranks & 1)
+ PostParams->MemConfig.EnableBankIntlv = FALSE;
PostParams->MemConfig.EnableMemClr = cfg->dram_clear_on_reset;
--
To view, visit https://review.coreboot.org/23786
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8a2a3bc927f87e91d30971b512fac12230aaad7
Gerrit-Change-Number: 23786
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/23785
Change subject: soc/amd/stoneyridge/romstage.c: Fix AGESA warning
......................................................................
soc/amd/stoneyridge/romstage.c: Fix AGESA warning
AmdInitPost returns AGESA_WARNING. This is because AGESA by default
enables bank interleaving, while the HW does not meet the requirements
for it. After some investigation, it was found that AGESA was really
checking rank.
In preparation to control interleaving, create a function that returns
the number of ranks for DDR3 and DDR4.
BUG=b:73118857
TEST= Build and run kahlee. Use a print over serial to display DDR3/DDR4
and the number of ranks. Remove the print before committing.
Change-Id: I002328d1029c968c371ff751986537135231f306
Signed-off-by: Richard Spiegel <richard.spiegel(a)silverbackltd.com>
---
M src/soc/amd/stoneyridge/romstage.c
1 file changed, 33 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/85/23785/1
diff --git a/src/soc/amd/stoneyridge/romstage.c b/src/soc/amd/stoneyridge/romstage.c
index 490fd9e..351a266 100644
--- a/src/soc/amd/stoneyridge/romstage.c
+++ b/src/soc/amd/stoneyridge/romstage.c
@@ -31,6 +31,7 @@
#include <soc/northbridge.h>
#include <soc/southbridge.h>
#include <amdblocks/psp.h>
+#include <amdblocks/dimm_spd.h>
asmlinkage void car_stage_entry(void)
{
@@ -130,6 +131,36 @@
post_code(0x50); /* Should never see this post code. */
}
+static uint8_t get_total_ranks(const struct soc_amd_stoneyridge_config *cfg)
+{
+ uint8_t err, spd_address, ranks, spd_rank, type, spd[16];
+
+ spd_address = cfg->spd_addr_lookup[0][0][0];
+ err = mainboard_read_spd(spd_address, (void *)spd, 16);
+
+ /* Read the SPD if the mainboard didn't fill the buffer */
+ if (err || (*spd == 0))
+ err = sb_read_spd(spd_address, (void *)spd, 16);
+ if (err)
+ return 1; /* for safety, just 1 rank */
+
+ type = spd[2];
+ switch (type) {
+ case 0x0b:
+ spd_rank = spd[7]; /* DDR3 */
+ break;
+ case 0x0c:
+ spd_rank = spd[12]; /* DDR4 */
+ break;
+ default:
+ spd_rank = 0; /* will force 1 rank */
+ }
+ spd_rank &= 0x38; /* rank mask for DDR3 and DDR4 */
+ ranks = spd_rank >> 3;
+ ranks++;
+ return ranks;
+}
+
void SetMemParams(AMD_POST_PARAMS *PostParams)
{
const struct soc_amd_stoneyridge_config *cfg;
@@ -144,6 +175,8 @@
}
cfg = dev->chip_info;
+ uint8_t ranks = get_total_ranks(cfg);
+ printk(BIOS_SPEW, "Ranks %d\n", ranks);
PostParams->MemConfig.EnableMemClr = cfg->dram_clear_on_reset;
--
To view, visit https://review.coreboot.org/23785
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I002328d1029c968c371ff751986537135231f306
Gerrit-Change-Number: 23785
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Spiegel <richard.spiegel(a)silverbackltd.com>