HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46264 )
Change subject: nb/amd/pi/*/dimmSpd.c: Reduce difference ......................................................................
nb/amd/pi/*/dimmSpd.c: Reduce difference
Also add missing <commonlib/helpers.h> to pi/00660F01/dimmSpd.c.
Change-Id: Ie072b23e8bac3901c120bc238c415160e992d40c Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/northbridge/amd/pi/00630F01/dimmSpd.c M src/northbridge/amd/pi/00660F01/dimmSpd.c M src/northbridge/amd/pi/00730F01/dimmSpd.c 3 files changed, 10 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/46264/1
diff --git a/src/northbridge/amd/pi/00630F01/dimmSpd.c b/src/northbridge/amd/pi/00630F01/dimmSpd.c index be3613d..063e4d0 100644 --- a/src/northbridge/amd/pi/00630F01/dimmSpd.c +++ b/src/northbridge/amd/pi/00630F01/dimmSpd.c @@ -8,7 +8,6 @@ #include <Porting.h> #include <AGESA.h> #include "chip.h" - #include <northbridge/amd/pi/dimmSpd.h>
AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info) @@ -26,8 +25,10 @@
if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup)) return AGESA_ERROR; + if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0])) return AGESA_ERROR; + if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0])) return AGESA_ERROR;
diff --git a/src/northbridge/amd/pi/00660F01/dimmSpd.c b/src/northbridge/amd/pi/00660F01/dimmSpd.c index 0a1281f..591cf34 100644 --- a/src/northbridge/amd/pi/00660F01/dimmSpd.c +++ b/src/northbridge/amd/pi/00660F01/dimmSpd.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <commonlib/helpers.h> #include <device/pci_def.h> #include <device/device.h>
@@ -24,14 +25,19 @@
if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup)) return AGESA_ERROR; + if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0])) return AGESA_ERROR; + if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0])) return AGESA_ERROR; + spdAddress = config->spdAddrLookup [info->SocketId] [info->MemChannelId] [info->DimmId]; + if (spdAddress == 0) return AGESA_ERROR; + int err = hudson_readSpd(spdAddress, (void *) info->Buffer, 128); if (err) return AGESA_ERROR; diff --git a/src/northbridge/amd/pi/00730F01/dimmSpd.c b/src/northbridge/amd/pi/00730F01/dimmSpd.c index 42dd5a2..05e4f9b 100644 --- a/src/northbridge/amd/pi/00730F01/dimmSpd.c +++ b/src/northbridge/amd/pi/00730F01/dimmSpd.c @@ -8,7 +8,6 @@ #include <Porting.h> #include <AGESA.h> #include "chip.h" - #include <northbridge/amd/pi/dimmSpd.h>
AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info) @@ -26,8 +25,10 @@
if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup)) return AGESA_ERROR; + if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0])) return AGESA_ERROR; + if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0])) return AGESA_ERROR;