From abc504f427b9e2e7b0426b9eb44bcd7fa2726efb Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Mon, 15 May 2017 09:36:44 +0200 Subject: nb/intel/sandybridge: Use macros to determine min and max of timA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This improves readability. Change-Id: Ib4387a4f4092053dab273191a73edb0ef31a79f6 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/19691 Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paul Menzel Reviewed-by: Patrick Rudolph --- src/northbridge/intel/sandybridge/raminit_common.c | 36 ++++++++-------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'src/northbridge/intel/sandybridge') diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c index e9d38c95b3..be0589dd8b 100644 --- a/src/northbridge/intel/sandybridge/raminit_common.c +++ b/src/northbridge/intel/sandybridge/raminit_common.c @@ -1020,30 +1020,18 @@ void program_timings(ramctr_timing * ctrl, int channel) 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 < -- cgit v1.2.3