HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/29860
Change subject: nb/amd/pi/00{630F01,730F01}: Use ARRAY_SIZE ......................................................................
nb/amd/pi/00{630F01,730F01}: Use ARRAY_SIZE
Use already defined ARRAY_SIZE macro.
Change-Id: Ie22e3557e958b562816921a985411dd55c712142 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/northbridge/amd/pi/00630F01/dimmSpd.c M src/northbridge/amd/pi/00730F01/dimmSpd.c 2 files changed, 6 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/29860/1
diff --git a/src/northbridge/amd/pi/00630F01/dimmSpd.c b/src/northbridge/amd/pi/00630F01/dimmSpd.c index 28e3fe4..dcf3192 100644 --- a/src/northbridge/amd/pi/00630F01/dimmSpd.c +++ b/src/northbridge/amd/pi/00630F01/dimmSpd.c @@ -23,8 +23,6 @@
#include <northbridge/amd/pi/dimmSpd.h>
-#define DIMENSION(array)(sizeof(array)/ sizeof(array [0])) - AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info) { int spdAddress; @@ -34,11 +32,11 @@ if ((dev == 0) || (config == 0)) return AGESA_ERROR;
- if (info->SocketId >= DIMENSION(config->spdAddrLookup )) + if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup)) return AGESA_ERROR; - if (info->MemChannelId >= DIMENSION(config->spdAddrLookup[0] )) + if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0])) return AGESA_ERROR; - if (info->DimmId >= DIMENSION(config->spdAddrLookup[0][0])) + if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0])) return AGESA_ERROR;
spdAddress = config->spdAddrLookup diff --git a/src/northbridge/amd/pi/00730F01/dimmSpd.c b/src/northbridge/amd/pi/00730F01/dimmSpd.c index bbcbfe9..b7ffdb0 100644 --- a/src/northbridge/amd/pi/00730F01/dimmSpd.c +++ b/src/northbridge/amd/pi/00730F01/dimmSpd.c @@ -23,8 +23,6 @@
#include <northbridge/amd/pi/dimmSpd.h>
-#define DIMENSION(array)(sizeof(array)/ sizeof(array [0])) - AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PARAMS *info) { int spdAddress; @@ -34,11 +32,11 @@ if ((dev == 0) || (config == 0)) return AGESA_ERROR;
- if (info->SocketId >= DIMENSION(config->spdAddrLookup )) + if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup)) return AGESA_ERROR; - if (info->MemChannelId >= DIMENSION(config->spdAddrLookup[0] )) + if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0])) return AGESA_ERROR; - if (info->DimmId >= DIMENSION(config->spdAddrLookup[0][0])) + if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0])) return AGESA_ERROR;
spdAddress = config->spdAddrLookup