@@ -49,7 +49,8 @@
#define TIM_LF_RING_REL (0x400)
#define TIM_MAX_INTERVAL_TICKS ((1ULL << 32) - 1)
-#define TIM_MAX_BUCKET_SIZE ((1ULL << 20) - 1)
-#define TIM_MIN_BUCKET_SIZE 3
+#define TIM_MAX_BUCKET_SIZE ((1ULL << 20) - 2)
+#define TIM_MIN_BUCKET_SIZE 1
+#define TIM_BUCKET_WRAP_SIZE 3
#endif /* __TIM_HW_H__ */
@@ -154,6 +154,8 @@ struct mbox_msghdr {
M(TIM_DISABLE_RING, 0x804, tim_disable_ring, tim_ring_req, msg_rsp) \
M(TIM_GET_MIN_INTVL, 0x805, tim_get_min_intvl, tim_intvl_req, \
tim_intvl_rsp) \
+ M(TIM_CAPTURE_COUNTERS, 0x806, tim_capture_counters, msg_req, \
+ tim_capture_rsp) \
/* CPT mbox IDs (range 0xA00 - 0xBFF) */ \
M(CPT_LF_ALLOC, 0xA00, cpt_lf_alloc, cpt_lf_alloc_req_msg, msg_rsp) \
M(CPT_LF_FREE, 0xA01, cpt_lf_free, msg_req, msg_rsp) \
@@ -2541,6 +2543,10 @@ enum tim_clk_srcs {
TIM_CLK_SRCS_GPIO = 1,
TIM_CLK_SRCS_GTI = 2,
TIM_CLK_SRCS_PTP = 3,
+ TIM_CLK_SRCS_SYNCE = 4,
+ TIM_CLK_SRCS_BTS = 5,
+ TIM_CLK_SRCS_EXT_MIO = 6,
+ TIM_CLK_SRCS_EXT_GTI = 7,
TIM_CLK_SRSC_INVALID,
};
@@ -2652,6 +2658,11 @@ struct tim_intvl_rsp {
uint64_t __io intvl_ns;
};
+struct tim_capture_rsp {
+ struct mbox_msghdr hdr;
+ uint64_t __io counters[TIM_CLK_SRSC_INVALID];
+};
+
struct sdp_node_info {
/* Node to which this PF belons to */
uint8_t __io node_id;
@@ -891,7 +891,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp, ui
goto sso_msix_fail;
}
- nb_tim_lfs = nb_tim_lfs ? PLT_MIN(nb_tim_lfs, free_tim_lfs) : free_tim_lfs;
+ nb_tim_lfs = PLT_MIN(nb_tim_lfs, free_tim_lfs);
}
/* 2 error interrupt per TIM LF */
@@ -91,6 +91,31 @@ tim_err_desc(int rc)
}
}
+int
+roc_tim_capture_counters(struct roc_tim *roc_tim, uint64_t *counters, uint8_t nb_cntrs)
+{
+ struct sso *sso = roc_sso_to_sso_priv(roc_tim->roc_sso);
+ struct dev *dev = &sso->dev;
+ struct mbox *mbox = mbox_get(dev->mbox);
+ struct tim_capture_rsp *rsp;
+ int rc, i;
+
+ mbox_alloc_msg_tim_capture_counters(mbox);
+ rc = mbox_process_msg(dev->mbox, (void **)&rsp);
+ if (rc) {
+ tim_err_desc(rc);
+ rc = -EIO;
+ goto fail;
+ }
+
+ for (i = 0; i < nb_cntrs; i++)
+ counters[i] = rsp->counters[i];
+
+fail:
+ mbox_put(mbox);
+ return rc;
+}
+
int
roc_tim_lf_enable(struct roc_tim *roc_tim, uint8_t ring_id, uint64_t *start_tsc,
uint32_t *cur_bkt)
@@ -138,7 +163,7 @@ roc_tim_lf_disable(struct roc_tim *roc_tim, uint8_t ring_id)
goto fail;
req->ring = ring_id;
- rc = mbox_process(dev->mbox);
+ rc = mbox_process(mbox);
if (rc) {
tim_err_desc(rc);
rc = -EIO;
@@ -14,6 +14,8 @@ enum roc_tim_clk_src {
ROC_TIM_CLK_SRC_PTP,
ROC_TIM_CLK_SRC_SYNCE,
ROC_TIM_CLK_SRC_BTS,
+ ROC_TIM_CLK_SRC_EXT_MIO,
+ ROC_TIM_CLK_SRC_EXT_GTI,
ROC_TIM_CLK_SRC_INVALID,
};
@@ -48,5 +50,6 @@ int __roc_api roc_tim_lf_alloc(struct roc_tim *roc_tim, uint8_t ring_id,
int __roc_api roc_tim_lf_free(struct roc_tim *roc_tim, uint8_t ring_id);
uintptr_t __roc_api roc_tim_lf_base_get(struct roc_tim *roc_tim,
uint8_t ring_id);
+int roc_tim_capture_counters(struct roc_tim *roc_tim, uint64_t *counters, uint8_t nb_cntrs);
#endif