quoted
@@ -500,22 +473,19 @@ static void netc_timer_handle_etts_event(struct
netc_timer *priv, int index,
quoted
bool update_event)
{
struct ptp_clock_event event;
- u32 etts_l = 0, etts_h = 0;
+ u64 etts = 0;
- while (netc_timer_rd(priv, NETC_TMR_STAT) & TMR_STAT_ETS_VLD(index))
{quoted
- etts_l = netc_timer_rd(priv, NETC_TMR_ETTS_L(index));
- etts_h = netc_timer_rd(priv, NETC_TMR_ETTS_H(index));
- }
+ while (netc_timer_rd(priv, NETC_TMR_STAT) & TMR_STAT_ETS_VLD(index))
+ etts = netc_timer_rd64(priv, NETC_TMR_ETTS_L(index));
/* Invalid time stamp */
- if (!etts_l && !etts_h)
+ if (!etts)
return;
if (update_event) {
event.type = PTP_CLOCK_EXTTS;
event.index = index;
- event.timestamp = (u64)etts_h << 32;
- event.timestamp |= etts_l;
+ event.timestamp = etts;
ptp_clock_event(priv->clock, &event);
}
}
[Severity: High]
This is a pre-existing issue, but does this loop discard all but the last
timestamp from the hardware FIFO?
The while loop successfully drains multiple timestamps from the TMR_ETTS
FIFO
if they accumulate before the interrupt is handled. However, because etts is
overwritten on each iteration and ptp_clock_event() is only called once
after the loop completes, it appears any prior external events in the batch
are silently lost.
This is a false positive, the intention is to get the last timestamp.