aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Proshkin <n.proshkin@yadro.com>2023-12-27 14:45:03 +0500
committerMartin Mares <mj@ucw.cz>2024-02-17 23:44:53 +0100
commit4eba399e79c179d70ce16044722fb7ecaa20e4cb (patch)
tree5b6fa7b0e54b5b86a7bda6f02dd8c31d0e9ac665
parent394b24da3faeb7d09ad7ef71ca2f05641887ab2d (diff)
downloadpciutils-4eba399e79c179d70ce16044722fb7ecaa20e4cb.tar.gz
pcilmr: Add handling of situations when device reports its MaxOffset values equal to 0
According to spec, for the MaxTimingOffset and MaxVoltageOffset parameters 'A 0 value may be reported if the vendor chooses not to report the offset'. Use max possible Offset value in such situations and report to the user. Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com> Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
-rw-r--r--lmr/lmr.h3
-rw-r--r--lmr/margin.c9
-rw-r--r--lmr/margin_log.c7
-rw-r--r--lmr/margin_results.c13
4 files changed, 30 insertions, 2 deletions
diff --git a/lmr/lmr.h b/lmr/lmr.h
index c9dcd69..7375c33 100644
--- a/lmr/lmr.h
+++ b/lmr/lmr.h
@@ -107,6 +107,9 @@ struct margin_results {
double tim_coef;
double volt_coef;
+ bool tim_off_reported;
+ bool volt_off_reported;
+
u8 lanes_n;
struct margin_res_lane *lanes;
};
diff --git a/lmr/margin.c b/lmr/margin.c
index cc142fa..0b14747 100644
--- a/lmr/margin.c
+++ b/lmr/margin.c
@@ -328,8 +328,13 @@ margin_test_receiver(struct margin_dev *dev, u8 recvn, struct margin_args *args,
margin_apply_hw_quirks(&recv);
margin_log_hw_quirks(&recv);
- results->tim_coef = (double)params.timing_offset / (double)params.timing_steps;
- results->volt_coef = (double)params.volt_offset / (double)params.volt_steps * 10.0;
+ results->tim_off_reported = params.timing_offset != 0;
+ results->volt_off_reported = params.volt_offset != 0;
+ double tim_offset = results->tim_off_reported ? (double)params.timing_offset : 50.0;
+ double volt_offset = results->volt_off_reported ? (double)params.volt_offset : 50.0;
+
+ results->tim_coef = tim_offset / (double)params.timing_steps;
+ results->volt_coef = volt_offset / (double)params.volt_steps * 10.0;
results->lane_reversal = recv.lane_reversal;
results->link_speed = dev->link_speed;
diff --git a/lmr/margin_log.c b/lmr/margin_log.c
index a93e07b..b3c4bd5 100644
--- a/lmr/margin_log.c
+++ b/lmr/margin_log.c
@@ -86,6 +86,13 @@ margin_log_receiver(struct margin_recv *recv)
margin_log("\nWarning: device uses Lane Reversal.\n");
margin_log("However, utility uses logical lane numbers in arguments and for logging.\n");
}
+
+ if (recv->params->timing_offset == 0)
+ margin_log("\nWarning: Vendor chose not to report the Max Timing Offset.\n"
+ "Utility will use its max possible value - 50 (50%% UI).\n");
+ if (recv->params->volt_support && recv->params->volt_offset == 0)
+ margin_log("\nWarning: Vendor chose not to report the Max Voltage Offset.\n"
+ "Utility will use its max possible value - 50 (500 mV).\n");
}
void
diff --git a/lmr/margin_results.c b/lmr/margin_results.c
index aca3ab7..6d6ed29 100644
--- a/lmr/margin_results.c
+++ b/lmr/margin_results.c
@@ -105,6 +105,19 @@ margin_results_print_brief(struct margin_results *results, u8 recvs_n)
if (res->lane_reversal)
printf("Rx(%X) - Lane Reversal\n", 10 + res->recvn - 1);
+ if (!res->tim_off_reported)
+ printf("Rx(%X) - Attention: Vendor chose not to report the Max Timing Offset.\n"
+ "Utility used its max possible value (50%% UI) for calculations of %% UI and ps.\n"
+ "Keep in mind that for timing results of this receiver only steps values are "
+ "reliable.\n\n",
+ 10 + res->recvn - 1);
+ if (params.volt_support && !res->volt_off_reported)
+ printf("Rx(%X) - Attention: Vendor chose not to report the Max Voltage Offset.\n"
+ "Utility used its max possible value (500 mV) for calculations of mV.\n"
+ "Keep in mind that for voltage results of this receiver only steps values are "
+ "reliable.\n\n",
+ 10 + res->recvn - 1);
+
if (check_recv_weird(res, MARGIN_TIM_MIN, MARGIN_VOLT_MIN))
lane_rating = WEIRD;
else