diff options
author | John Watts <contact@jookia.org> | 2023-02-01 16:33:34 +1100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-02-02 08:22:51 +0100 |
commit | 1c9f1e90888d4d4eb79b0a7e90f19644ef84e5ae (patch) | |
tree | 86906b691077dc21d4f93978dbbb8d51a3f4dbde /common/ddr4_dimm_params.c | |
parent | 09bea7ff6ad8ebc777bb4a6ab138095137042b9c (diff) | |
download | barebox-1c9f1e90888d4d4eb79b0a7e90f19644ef84e5ae.tar.gz |
ddr_dimms: Check spd->mem_type before computing parameters
Checking the mem_type here as well as the CRC means developers can
just read the SPD and pass it directly to parameter computation.
This makes it so developers can rely fully on parameters for checking
if RAM is compatible with their board and not need to worry about reading
SPD data themselves.
Signed-off-by: John Watts <contact@jookia.org>
Link: https://lore.barebox.org/20230201053334.971854-1-contact@jookia.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/ddr4_dimm_params.c')
-rw-r--r-- | common/ddr4_dimm_params.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/ddr4_dimm_params.c b/common/ddr4_dimm_params.c index 9fa3225d90..045cbd457c 100644 --- a/common/ddr4_dimm_params.c +++ b/common/ddr4_dimm_params.c @@ -136,6 +136,11 @@ unsigned int ddr4_compute_dimm_parameters(const struct ddr4_spd_eeprom *spd, u8 *ptr; u8 val; + if (spd->mem_type != SPD_MEMTYPE_DDR4) { + printf("DIMM: SPD data is not DDR4\n"); + return 3; + } + ret = ddr4_spd_check(spd); if (ret) { printf("DIMM: failed checksum\n"); |