From 97b337b252fe67f8ffb7a98f70f08835513920ba Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Mon, 22 Jan 2018 01:26:53 +0100 Subject: device/dram/ddr2.c: Add methods to compute to identify dram DDR2 DIMMs are uniquely defined by SPD byte 64 till 72 and 93 till 98. Compute a crc16 over that data to provide a solid way to check DIMM identify. Reuse the crc16 function from ddr3.c to do this. Change-Id: I3c0c42786197f9b4eb3e42261c10ff5e4266120f Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/23345 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/device/dram/ddr3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/device/dram/ddr3.c') diff --git a/src/device/dram/ddr3.c b/src/device/dram/ddr3.c index 87aa3c5362..67f30092ea 100644 --- a/src/device/dram/ddr3.c +++ b/src/device/dram/ddr3.c @@ -46,7 +46,7 @@ int spd_dimm_is_registered_ddr3(enum spd_dimm_type type) return 0; } -static u16 crc16(const u8 *ptr, int n_crc) +u16 ddr3_crc16(const u8 *ptr, int n_crc) { int i; u16 crc = 0; @@ -87,7 +87,7 @@ u16 spd_ddr3_calc_crc(u8 *spd, int len) /* Not enough bytes available to get the CRC */ return 0; - return crc16(spd, n_crc); + return ddr3_crc16(spd, n_crc); } /** @@ -104,7 +104,7 @@ u16 spd_ddr3_calc_unique_crc(u8 *spd, int len) /* Not enough bytes available to get the CRC */ return 0; - return crc16(&spd[117], 11); + return ddr3_crc16(&spd[117], 11); } /** -- cgit v1.2.3