diff options
author | Elyes HAOUAS <ehaouas@noos.fr> | 2018-11-27 11:25:19 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-01-03 21:55:59 +0000 |
commit | 0afc41e865fb4a3147c45e14483b4676f9019808 (patch) | |
tree | 7af5ed96ff18aa2fcc598a5b6e9c746463c580d3 /src | |
parent | 66b462dd4fac6967354109398f025c46303488e2 (diff) |
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>
Reviewed-on: https://review.coreboot.org/c/29860
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/northbridge/amd/pi/00630F01/dimmSpd.c | 9 | ||||
-rw-r--r-- | src/northbridge/amd/pi/00730F01/dimmSpd.c | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/northbridge/amd/pi/00630F01/dimmSpd.c b/src/northbridge/amd/pi/00630F01/dimmSpd.c index 28e3fe4bde..7e0200bef5 100644 --- a/src/northbridge/amd/pi/00630F01/dimmSpd.c +++ b/src/northbridge/amd/pi/00630F01/dimmSpd.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#include <commonlib/helpers.h> #include <device/pci_def.h> #include <device/device.h> @@ -23,8 +24,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 +33,11 @@ AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PAR 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 bbcbfe9ab7..c325418c24 100644 --- a/src/northbridge/amd/pi/00730F01/dimmSpd.c +++ b/src/northbridge/amd/pi/00730F01/dimmSpd.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#include <commonlib/helpers.h> #include <device/pci_def.h> #include <device/device.h> @@ -23,8 +24,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 +33,11 @@ AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINTN unused2, AGESA_READ_SPD_PAR 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 |