<p>Marc Jones has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22485">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/amd/stoneyridge: Add mainboard call for SPD values<br><br>Add a mainboad function call to write the AGESA SPD buffer.<br><br>BUG=b:67845441<br><br>Change-Id: Id42622008b49b4559e648a7fa1bfd9f26e1f56a4<br>Signed-off-by: Marc Jones <marcj303@gmail.com><br>---<br>M src/soc/amd/common/block/include/amdblocks/dimm_spd.h<br>M src/soc/amd/stoneyridge/BiosCallOuts.c<br>M src/soc/amd/stoneyridge/dimm_spd.c<br>3 files changed, 21 insertions(+), 14 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/85/22485/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/soc/amd/common/block/include/amdblocks/dimm_spd.h b/src/soc/amd/common/block/include/amdblocks/dimm_spd.h<br>index 8683caa..00b4a06 100644<br>--- a/src/soc/amd/common/block/include/amdblocks/dimm_spd.h<br>+++ b/src/soc/amd/common/block/include/amdblocks/dimm_spd.h<br>@@ -20,6 +20,7 @@<br> AmdMemoryReadSPD(IN UINT32 Func, IN UINTN Data,<br>                             IN OUT AGESA_READ_SPD_PARAMS *SpdData);<br> <br>+int mainboard_read_spd(uint8_t spdAddress, char *buf, size_t len);<br> int sb_read_spd(uint8_t spdAddress, char *buf, size_t len);<br> <br> #endif<br>diff --git a/src/soc/amd/stoneyridge/BiosCallOuts.c b/src/soc/amd/stoneyridge/BiosCallOuts.c<br>index 2c68f38..63ae4cf 100644<br>--- a/src/soc/amd/stoneyridge/BiosCallOuts.c<br>+++ b/src/soc/amd/stoneyridge/BiosCallOuts.c<br>@@ -96,19 +96,7 @@<br>        if (!ENV_ROMSTAGE)<br>            return Status;<br> <br>-    if (IS_ENABLED(CONFIG_GENERIC_SPD_BIN)) {<br>-            AGESA_READ_SPD_PARAMS *info = ConfigPtr;<br>-             if (info->MemChannelId > 0)<br>-                    return AGESA_UNSUPPORTED;<br>-            if (info->SocketId != 0)<br>-                  return AGESA_UNSUPPORTED;<br>-            if (info->DimmId > 1)<br>-                  return AGESA_UNSUPPORTED;<br>-<br>-         die("SPD in cbfs not yet supported.\n");<br>-   } else {<br>-             Status = AmdMemoryReadSPD(Func, Data, ConfigPtr);<br>-    }<br>+    Status = AmdMemoryReadSPD(Func, Data, ConfigPtr);<br> <br>  return Status;<br> }<br>diff --git a/src/soc/amd/stoneyridge/dimm_spd.c b/src/soc/amd/stoneyridge/dimm_spd.c<br>index ee58e9b..263c28a 100644<br>--- a/src/soc/amd/stoneyridge/dimm_spd.c<br>+++ b/src/soc/amd/stoneyridge/dimm_spd.c<br>@@ -25,23 +25,41 @@<br>                                              AGESA_READ_SPD_PARAMS *info)<br> {<br>      uint8_t spd_address;<br>+ int err;<br>      DEVTREE_CONST struct device *dev = dev_find_slot(0, DCT_DEVFN);<br>       DEVTREE_CONST struct soc_amd_stoneyridge_config *conf = dev->chip_info;<br> <br>         if ((dev == 0) || (conf == 0))<br>                return AGESA_ERROR;<br>+<br>        if (info->SocketId >= ARRAY_SIZE(conf->spd_addr_lookup))<br>             return AGESA_ERROR;<br>   if (info->MemChannelId >= ARRAY_SIZE(conf->spd_addr_lookup[0]))<br>              return AGESA_ERROR;<br>   if (info->DimmId >= ARRAY_SIZE(conf->spd_addr_lookup[0][0]))<br>                 return AGESA_ERROR;<br>+<br>        spd_address = conf->spd_addr_lookup<br>                [info->SocketId][info->MemChannelId][info->DimmId];<br>  if (spd_address == 0)<br>                 return AGESA_ERROR;<br>-  int err = sb_read_spd(spd_address, (void *)info->Buffer, CONFIG_DIMM_SPD_SIZE);<br>+<br>+        err = mainboard_read_spd(spd_address, (void *)info->Buffer, CONFIG_DIMM_SPD_SIZE);<br>+<br>+     /* Read the SPD if the mainboard didn't fill the buffer */<br>+       if (err || (*info->Buffer == 0))<br>+          err = sb_read_spd(spd_address, (void *)info->Buffer, CONFIG_DIMM_SPD_SIZE);<br>+<br>     if (err)<br>              return AGESA_ERROR;<br>+<br>        return AGESA_SUCCESS;<br> }<br>+<br>+/* Allow mainboards to fill the SPD buffer */<br>+__attribute__((weak)) int mainboard_read_spd(uint8_t spdAddress, char *buf,<br>+                                           size_t len)<br>+{<br>+      printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);<br>+    return -1; /* SPD not read */<br>+}<br></pre><p>To view, visit <a href="https://review.coreboot.org/22485">change 22485</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22485"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id42622008b49b4559e648a7fa1bfd9f26e1f56a4 </div>
<div style="display:none"> Gerrit-Change-Number: 22485 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marc Jones <marc@marcjonesconsulting.com> </div>