Vladimir Serbinenko (phcoder@gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13527
-gerrit
commit fa04728439cb7205c4c5808c901417655ef2b3fd Author: Vladimir Serbinenko phcoder@gmail.com Date: Sat Jan 30 17:50:41 2016 +0100
Experiment with circular
Change-Id: I67c428524f71db88757ead7fc7b1634c0b40728e --- src/northbridge/intel/sandybridge/raminit.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/northbridge/intel/sandybridge/raminit.c b/src/northbridge/intel/sandybridge/raminit.c index 8a287c1..7e2b15c 100644 --- a/src/northbridge/intel/sandybridge/raminit.c +++ b/src/northbridge/intel/sandybridge/raminit.c @@ -1670,14 +1670,14 @@ struct run { int length; };
-static struct run get_longest_zero_run(int *seq, int sz) +static struct run get_longest_zero_run(int *seq, int sz, int circular) { int i, ls; int bl = 0, bs = 0; struct run ret;
ls = 0; - for (i = 0; i < 2 * sz; i++) + for (i = 0; i < (1 + circular) * sz; i++) if (seq[i % sz]) { if (i - ls > bl) { bl = i - ls; @@ -1726,7 +1726,7 @@ static void discover_timA_coarse(ramctr_timing * ctrl, int channel, } } FOR_ALL_LANES { - struct run rn = get_longest_zero_run(statistics[lane], 128); + struct run rn = get_longest_zero_run(statistics[lane], 128, 1); ctrl->timings[channel][slotrank].lanes[lane].timA = rn.middle; upperA[lane] = rn.end; if (upperA[lane] < rn.middle) @@ -2106,7 +2106,7 @@ static void discover_timC(ramctr_timing * ctrl, int channel, int slotrank) } FOR_ALL_LANES { struct run rn = - get_longest_zero_run(statistics[lane], MAX_TIMC + 1); + get_longest_zero_run(statistics[lane], MAX_TIMC + 1, 1); ctrl->timings[channel][slotrank].lanes[lane].timC = rn.middle; if (rn.all) printk(BIOS_CRIT, "timC discovery failed"); @@ -2333,7 +2333,7 @@ static void discover_timB(ramctr_timing * ctrl, int channel, int slotrank) } } FOR_ALL_LANES { - struct run rn = get_longest_zero_run(statistics[lane], 128); + struct run rn = get_longest_zero_run(statistics[lane], 128, 0); ctrl->timings[channel][slotrank].lanes[lane].timB = rn.start; if (rn.all) die("timB discovery failed"); @@ -2821,7 +2821,7 @@ static int try_cmd_stretch(ramctr_timing * ctrl, int cmd_stretch) } FOR_ALL_POPULATED_RANKS { struct run rn = - get_longest_zero_run(stat[slotrank], 255); + get_longest_zero_run(stat[slotrank], 255, 1); ctrl->timings[channel][slotrank].val_320c = rn.middle - 127; printram("3val: %d, %d: %d\n", channel, @@ -2933,7 +2933,7 @@ static void discover_edges_real(ramctr_timing * ctrl, int channel, int slotrank, } FOR_ALL_LANES { struct run rn = - get_longest_zero_run(statistics[lane], MAX_EDGE_TIMING + 1); + get_longest_zero_run(statistics[lane], MAX_EDGE_TIMING + 1, 1); edges[lane] = rn.middle; if (rn.all) die("edge discovery failed"); @@ -3233,7 +3233,7 @@ static void discover_edges_write_real(ramctr_timing * ctrl, int channel, statistics[edge] = ! !(raw_statistics[edge] & (1 << lane)); rn = get_longest_zero_run(statistics, - MAX_EDGE_TIMING + 1); + MAX_EDGE_TIMING + 1, 1); printram("edges: %d, %d, %d: 0x%x-0x%x-0x%x, 0x%x-0x%x\n", channel, slotrank, i, rn.start, rn.middle, rn.end, rn.start + ctrl->edge_offset[i], @@ -3391,7 +3391,7 @@ static void discover_timC_write(ramctr_timing * ctrl) !!(raw_statistics[timC] & (1 << lane)); rn = get_longest_zero_run(statistics, - MAX_TIMC + 1); + MAX_TIMC + 1, 1); if (rn.all) die("timC write discovery failed"); printram("timC: %d, %d, %d: 0x%x-0x%x-0x%x, 0x%x-0x%x\n",