[coreboot-gerrit] Change in coreboot[master]: soc/amd/stoneyridge: Ignore SPD address for mainboard_read_spd

Martin Roth (Code Review) gerrit at coreboot.org
Thu Jan 4 07:51:22 CET 2018


Martin Roth has uploaded this change for review. ( https://review.coreboot.org/23085


Change subject: soc/amd/stoneyridge: Ignore SPD address for mainboard_read_spd
......................................................................

soc/amd/stoneyridge: Ignore SPD address for mainboard_read_spd

Currrently the mainboard_read_spd() functions don't actually use the
spd address.  The spd_addr_lookup table had been removed from grunt's
devicetree.cb file, causing the spd address checks to fail.

This patch puts those checks into the if clause where they would
actually be used, and just passes a 0 to the mainboard_read_spd
function.

BUG=b:71535311
TEST=Build

Change-Id: I43eef260adde4ce6aa4e32e8e0c52e6fd0cd7912
Signed-off-by: Martin Roth <martinroth at google.com>
---
M src/soc/amd/stoneyridge/BiosCallOuts.c
1 file changed, 23 insertions(+), 22 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/85/23085/1

diff --git a/src/soc/amd/stoneyridge/BiosCallOuts.c b/src/soc/amd/stoneyridge/BiosCallOuts.c
index f6ac187..dd9f832 100644
--- a/src/soc/amd/stoneyridge/BiosCallOuts.c
+++ b/src/soc/amd/stoneyridge/BiosCallOuts.c
@@ -95,7 +95,7 @@
 
 AGESA_STATUS agesa_ReadSpd(UINT32 Func, UINTN Data, VOID *ConfigPtr)
 {
-	uint8_t spd_address;
+	uint8_t spd_address = 0;
 	int err;
 	DEVTREE_CONST struct device *dev;
 	DEVTREE_CONST struct soc_amd_stoneyridge_config *conf;
@@ -104,33 +104,34 @@
 	if (!ENV_ROMSTAGE)
 		return AGESA_UNSUPPORTED;
 
-	dev = dev_find_slot(0, DCT_DEVFN);
-	if (dev == NULL)
-		return AGESA_ERROR;
-
-	conf = dev->chip_info;
-	if (conf == NULL)
-		return AGESA_ERROR;
-
-	if (info->SocketId >= ARRAY_SIZE(conf->spd_addr_lookup))
-		return AGESA_ERROR;
-	if (info->MemChannelId >= ARRAY_SIZE(conf->spd_addr_lookup[0]))
-		return AGESA_ERROR;
-	if (info->DimmId >= ARRAY_SIZE(conf->spd_addr_lookup[0][0]))
-		return AGESA_ERROR;
-
-	spd_address = conf->spd_addr_lookup
-		[info->SocketId][info->MemChannelId][info->DimmId];
-	if (spd_address == 0)
-		return AGESA_ERROR;
-
 	err = mainboard_read_spd(spd_address, (void *)info->Buffer,
 				CONFIG_DIMM_SPD_SIZE);
 
 	/* Read the SPD if the mainboard didn't fill the buffer */
-	if (err || (*info->Buffer == 0))
+	if (err || (*info->Buffer == 0)) {
+		dev = dev_find_slot(0, DCT_DEVFN);
+		if (dev == NULL)
+			return AGESA_ERROR;
+
+		conf = dev->chip_info;
+		if (conf == NULL)
+			return AGESA_ERROR;
+
+		if (info->SocketId >= ARRAY_SIZE(conf->spd_addr_lookup))
+			return AGESA_ERROR;
+		if (info->MemChannelId >= ARRAY_SIZE(conf->spd_addr_lookup[0]))
+			return AGESA_ERROR;
+		if (info->DimmId >= ARRAY_SIZE(conf->spd_addr_lookup[0][0]))
+			return AGESA_ERROR;
+
+		spd_address = conf->spd_addr_lookup
+			[info->SocketId][info->MemChannelId][info->DimmId];
+		if (spd_address == 0)
+			return AGESA_ERROR;
+
 		err = sb_read_spd(spd_address, (void *)info->Buffer,
 				CONFIG_DIMM_SPD_SIZE);
+	}
 
 	if (err)
 		return AGESA_ERROR;

-- 
To view, visit https://review.coreboot.org/23085
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: I43eef260adde4ce6aa4e32e8e0c52e6fd0cd7912
Gerrit-Change-Number: 23085
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180104/7793394d/attachment-0001.html>


More information about the coreboot-gerrit mailing list