Arthur Heymans has submitted this change and it was merged. ( https://review.coreboot.org/19691 )
Change subject: nb/intel/sandybridge: Use macros to determine min and max of timA ......................................................................
nb/intel/sandybridge: Use macros to determine min and max of timA
This improves readability.
Change-Id: Ib4387a4f4092053dab273191a73edb0ef31a79f6 Signed-off-by: Arthur Heymans arthur@aheymans.xyz Reviewed-on: https://review.coreboot.org/19691 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Philippe Mathieu-Daudé philippe.mathieu.daude@gmail.com Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Reviewed-by: Patrick Rudolph siro@das-labor.org --- M src/northbridge/intel/sandybridge/raminit_common.c 1 file changed, 12 insertions(+), 24 deletions(-)
Approvals: Patrick Rudolph: Looks good to me, approved Philippe Mathieu-Daudé: Looks good to me, but someone else must approve Paul Menzel: Looks good to me, but someone else must approve build bot (Jenkins): Verified
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c index e9d38c9..be0589d 100644 --- a/src/northbridge/intel/sandybridge/raminit_common.c +++ b/src/northbridge/intel/sandybridge/raminit_common.c @@ -1020,30 +1020,18 @@ shift = 0;
FOR_ALL_LANES { - if (post_timA_min_high > - ((ctrl->timings[channel][slotrank].lanes[lane]. - timA + shift) >> 6)) - post_timA_min_high = - ((ctrl->timings[channel][slotrank]. - lanes[lane].timA + shift) >> 6); - if (pre_timA_min_high > - (ctrl->timings[channel][slotrank].lanes[lane]. - timA >> 6)) - pre_timA_min_high = - (ctrl->timings[channel][slotrank]. - lanes[lane].timA >> 6); - if (post_timA_max_high < - ((ctrl->timings[channel][slotrank].lanes[lane]. - timA + shift) >> 6)) - post_timA_max_high = - ((ctrl->timings[channel][slotrank]. - lanes[lane].timA + shift) >> 6); - if (pre_timA_max_high < - (ctrl->timings[channel][slotrank].lanes[lane]. - timA >> 6)) - pre_timA_max_high = - (ctrl->timings[channel][slotrank]. - lanes[lane].timA >> 6); + post_timA_min_high = MIN(post_timA_min_high, + (ctrl->timings[channel][slotrank].lanes[lane]. + timA + shift) >> 6); + pre_timA_min_high = MIN(pre_timA_min_high, + ctrl->timings[channel][slotrank].lanes[lane]. + timA >> 6); + post_timA_max_high = MAX(post_timA_max_high, + (ctrl->timings[channel][slotrank].lanes[lane]. + timA + shift) >> 6); + pre_timA_max_high = MAX(pre_timA_max_high, + ctrl->timings[channel][slotrank].lanes[lane]. + timA >> 6); }
if (pre_timA_max_high - pre_timA_min_high <