diff options
author | Timothy Pearson <tpearson@raptorengineeringinc.com> | 2016-03-24 19:31:02 -0500 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineeringinc.com> | 2016-03-28 18:20:59 +0200 |
commit | e2e0057ee786d0b4d5ce7b71a6dc9210fc52ae0f (patch) | |
tree | 28517ff19b5654a945bfb40d251d2075b816e6fb /src/northbridge | |
parent | ec38c3d956ed2c34f6ae7783d45cfbf4cab3c2df (diff) | |
download | coreboot-e2e0057ee786d0b4d5ce7b71a6dc9210fc52ae0f.tar.xz |
nb/amd/mct_ddr3: Use standard C function calls in mct_ResetDataStruct_D()
Replace open coded memset() functions with calls to the library function.
The new code also explicitly backs up and restores the data structures
that are preserved across calls to mct_ResetDataStruct_D(), and no longer
relies on structure member order to function correctly.
Change-Id: I6dd6377deda0087cd1b65f7555588978657d6516
Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Reviewed-on: https://review.coreboot.org/14165
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/northbridge')
-rw-r--r-- | src/northbridge/amd/amdmct/mct_ddr3/mct_d.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c index e6628d52f1..4d9bc58c68 100644 --- a/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c +++ b/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c @@ -1,7 +1,7 @@ /* * This file is part of the coreboot project. * - * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering + * Copyright (C) 2015-2016 Raptor Engineering, LLC * Copyright (C) 2010 Advanced Micro Devices, Inc. * * This program is free software; you can redistribute it and/or modify @@ -7407,38 +7407,25 @@ static u8 CheckNBCOFEarlyArbEn(struct MCTStatStruc *pMCTstat, static void mct_ResetDataStruct_D(struct MCTStatStruc *pMCTstat, struct DCTStatStruc *pDCTstatA) { - u8 Node; - u32 i; + uint8_t Node; struct DCTStatStruc *pDCTstat; - u32 start, stop; - u8 *p; - u16 host_serv1, host_serv2; + uint16_t host_serv1, host_serv2; + uint8_t CH_D_B_TxDqs_bkp[2][4][9]; /* Initialize Data structures by clearing all entries to 0 */ - p = (u8 *) pMCTstat; - for (i = 0; i < sizeof(struct MCTStatStruc); i++) { - p[i] = 0; - } + memset(pMCTstat, 0, sizeof(struct MCTStatStruc)); for (Node = 0; Node < 8; Node++) { pDCTstat = pDCTstatA + Node; host_serv1 = pDCTstat->HostBiosSrvc1; host_serv2 = pDCTstat->HostBiosSrvc2; + memcpy(CH_D_B_TxDqs_bkp, pDCTstat->CH_D_B_TxDqs, sizeof(CH_D_B_TxDqs_bkp)); - p = (u8 *) pDCTstat; - start = 0; - stop = ((u32) &((struct DCTStatStruc *)0)->CH_D_DIR_B_DQS); - for (i = start; i < stop ; i++) { - p[i] = 0; - } + memset(pDCTstat, 0, sizeof(struct DCTStatStruc)); - start = ((u32) &((struct DCTStatStruc *)0)->CH_D_BC_RCVRDLY[2][4]); - stop = sizeof(struct DCTStatStruc); - for (i = start; i < stop; i++) { - p[i] = 0; - } pDCTstat->HostBiosSrvc1 = host_serv1; pDCTstat->HostBiosSrvc2 = host_serv2; + memcpy(pDCTstat->CH_D_B_TxDqs, CH_D_B_TxDqs_bkp, sizeof(pDCTstat->CH_D_B_TxDqs)); } } |