Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48398 )
Change subject: [WIP] plot 2D write margins ......................................................................
[WIP] plot 2D write margins
Looks like they don't work as intended
Change-Id: Id76e7f292fdb3813a8dd973273b17279b74ac5c1 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/northbridge/intel/sandybridge/raminit_common.c 1 file changed, 48 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/98/48398/1
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c index 3efabdb..667ec14 100644 --- a/src/northbridge/intel/sandybridge/raminit_common.c +++ b/src/northbridge/intel/sandybridge/raminit_common.c @@ -2723,6 +2723,9 @@ int aggressive_write_training(ramctr_timing *ctrl) { const u8 wr_vref_offsets[3] = { 0, 0x0f, 0x2f }; + + const bool sweep_vref = 0 && CONFIG(RAMINIT_PLOT_READ_MARGINS); + int i, pat;
int lower[NUM_CHANNELS][NUM_SLOTRANKS][NUM_LANES]; @@ -2749,12 +2752,20 @@
printram("discover tx_dq write:\n");
- for (i = 0; i < ARRAY_SIZE(wr_vref_offsets); i++) { - FOR_ALL_POPULATED_CHANNELS { - set_write_vref(channel, wr_vref_offsets[i]); + const int max_vref_idx = sweep_vref ? 63 : ARRAY_SIZE(wr_vref_offsets);
- for (pat = 0; pat < NUM_PATTERNS; pat++) { - FOR_ALL_POPULATED_RANKS { + FOR_ALL_POPULATED_CHANNELS { + FOR_ALL_POPULATED_RANKS { + printram("channel %d, rank %d\n", channel, slotrank); + + for (i = 0; i < max_vref_idx; i++) { + const int vref = i >= 32 ? i : 31 - i; + set_write_vref(channel, sweep_vref ? vref : wr_vref_offsets[i]); + + if (sweep_vref) + printram("% 5d:\t", 31 - i); + + for (pat = 0; pat < NUM_PATTERNS; pat++) { int tx_dq; u32 raw_stats[MAX_TX_DQ + 1]; int stats[MAX_TX_DQ + 1]; @@ -2771,10 +2782,24 @@ } program_timings(ctrl, channel);
+ MCHBAR32(IOSAV_BYTE_SERROR_C_ch(channel)); + test_aggressive_write(ctrl, channel, slotrank);
raw_stats[tx_dq] = MCHBAR32( IOSAV_BYTE_SERROR_C_ch(channel)); + + if (!sweep_vref) + continue; + + printram("%02x ", raw_stats[tx_dq] & 0xff); + +#if 0 + if (i == 31 && tx_dq == (MAX_TX_DQ + 1) / 2) + printram("%c", raw_stats[tx_dq] & 0xff ? 'X' : '+'); + else + printram("%c", raw_stats[tx_dq] & 0xff ? '#' : '.'); +#endif } FOR_ALL_LANES { struct run rn; @@ -2792,12 +2817,6 @@
return MAKE_ERR; } - printram("tx_dq: %d, %d, %d: " - "0x%02x-0x%02x-0x%02x, " - "0x%02x-0x%02x\n", channel, slotrank, - i, rn.start, rn.middle, rn.end, - rn.start + ctrl->tx_dq_offset[i], - rn.end - ctrl->tx_dq_offset[i]);
lower[channel][slotrank][lane] = MAX(rn.start + ctrl->tx_dq_offset[i], @@ -2807,9 +2826,27 @@ MIN(rn.end - ctrl->tx_dq_offset[i], upper[channel][slotrank][lane]);
+ if (sweep_vref) + continue; + + printram("tx_dq: %d, %d, %d: " + "0x%02x-0x%02x-0x%02x, " + "0x%02x-0x%02x\n", channel, slotrank, + i, rn.start, rn.middle, rn.end, + rn.start + ctrl->tx_dq_offset[i], + rn.end - ctrl->tx_dq_offset[i]); } + + if (sweep_vref) + printram(" "); } + + if (sweep_vref) + printram("\n"); } + + if (sweep_vref) + printram("\n"); } }