|
@@ -4099,12 +4099,37 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
|
|
|
struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
|
|
|
cc);
|
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
|
- cycle_t systim;
|
|
|
+ cycle_t systim, systim_next;
|
|
|
|
|
|
/* latch SYSTIMH on read of SYSTIML */
|
|
|
systim = (cycle_t)er32(SYSTIML);
|
|
|
systim |= (cycle_t)er32(SYSTIMH) << 32;
|
|
|
|
|
|
+ if ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) {
|
|
|
+ u64 incvalue, time_delta, rem, temp;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ /* errata for 82574/82583 possible bad bits read from SYSTIMH/L
|
|
|
+ * check to see that the time is incrementing at a reasonable
|
|
|
+ * rate and is a multiple of incvalue
|
|
|
+ */
|
|
|
+ incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;
|
|
|
+ for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {
|
|
|
+ /* latch SYSTIMH on read of SYSTIML */
|
|
|
+ systim_next = (cycle_t)er32(SYSTIML);
|
|
|
+ systim_next |= (cycle_t)er32(SYSTIMH) << 32;
|
|
|
+
|
|
|
+ time_delta = systim_next - systim;
|
|
|
+ temp = time_delta;
|
|
|
+ rem = do_div(temp, incvalue);
|
|
|
+
|
|
|
+ systim = systim_next;
|
|
|
+
|
|
|
+ if ((time_delta < E1000_82574_SYSTIM_EPSILON) &&
|
|
|
+ (rem == 0))
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
return systim;
|
|
|
}
|
|
|
|