nb/amd_fam10/mct_ddr3: Use common function to compute crc16 checksum
Change-Id: I730a8a150134cc1ef8fb3872728bb0586ac7b210 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/19732 Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
committed by
Martin Roth
parent
4769cc3c0c
commit
0722613563
@@ -42,6 +42,7 @@
|
|||||||
#include <cpu/x86/msr.h>
|
#include <cpu/x86/msr.h>
|
||||||
#include <arch/acpi.h>
|
#include <arch/acpi.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <device/dram/ddr3.h>
|
||||||
#include "s3utils.h"
|
#include "s3utils.h"
|
||||||
|
|
||||||
static u8 ReconfigureDIMMspare_D(struct MCTStatStruc *pMCTstat,
|
static u8 ReconfigureDIMMspare_D(struct MCTStatStruc *pMCTstat,
|
||||||
@@ -8214,30 +8215,12 @@ static void AfterDramInit_D(struct DCTStatStruc *pDCTstat, u8 dct) {
|
|||||||
*/
|
*/
|
||||||
uint8_t crcCheck(struct DCTStatStruc *pDCTstat, uint8_t dimm)
|
uint8_t crcCheck(struct DCTStatStruc *pDCTstat, uint8_t dimm)
|
||||||
{
|
{
|
||||||
u8 byte_use;
|
u16 crc_calc = spd_ddr3_calc_crc(pDCTstat->spd_data.spd_bytes[dimm],
|
||||||
u8 Index;
|
sizeof(pDCTstat->spd_data.spd_bytes[dimm]));
|
||||||
u16 CRC;
|
u16 checksum_spd = pDCTstat->spd_data.spd_bytes[dimm][SPD_byte_127] << 8
|
||||||
u8 byte, i;
|
| pDCTstat->spd_data.spd_bytes[dimm][SPD_byte_126];
|
||||||
|
|
||||||
byte_use = pDCTstat->spd_data.spd_bytes[dimm][SPD_ByteUse];
|
return crc_calc == checksum_spd;
|
||||||
if (byte_use & 0x80)
|
|
||||||
byte_use = 117;
|
|
||||||
else
|
|
||||||
byte_use = 126;
|
|
||||||
|
|
||||||
CRC = 0;
|
|
||||||
for (Index = 0; Index < byte_use; Index ++) {
|
|
||||||
byte = pDCTstat->spd_data.spd_bytes[dimm][Index];
|
|
||||||
CRC ^= byte << 8;
|
|
||||||
for (i = 0; i < 8; i++) {
|
|
||||||
if (CRC & 0x8000) {
|
|
||||||
CRC <<= 1;
|
|
||||||
CRC ^= 0x1021;
|
|
||||||
} else
|
|
||||||
CRC <<= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return CRC == (pDCTstat->spd_data.spd_bytes[dimm][SPD_byte_127] << 8 | pDCTstat->spd_data.spd_bytes[dimm][SPD_byte_126]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t abs(int32_t val)
|
int32_t abs(int32_t val)
|
||||||
|
Reference in New Issue
Block a user