1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
9 cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val)
11 struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt);
12 struct cpt_rd_wr_reg_msg *msg;
13 struct dev *dev = &cpt->dev;
16 msg = mbox_alloc_msg_cpt_rd_wr_register(dev->mbox);
20 msg->hdr.pcifunc = dev->pf_func;
23 msg->reg_offset = reg;
26 ret = mbox_process_msg(dev->mbox, (void *)&msg);
36 cpt_sts_print(struct roc_cpt *roc_cpt)
38 struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt);
39 struct dev *dev = &cpt->dev;
40 struct cpt_sts_req *req;
41 struct cpt_sts_rsp *rsp;
44 req = mbox_alloc_msg_cpt_sts_get(dev->mbox);
49 ret = mbox_process_msg(dev->mbox, (void *)&rsp);
53 plt_print(" %s:\t0x%016" PRIx64, "inst_req_pc", rsp->inst_req_pc);
54 plt_print(" %s:\t0x%016" PRIx64, "inst_lat_pc", rsp->inst_lat_pc);
55 plt_print(" %s:\t\t0x%016" PRIx64, "rd_req_pc", rsp->rd_req_pc);
56 plt_print(" %s:\t\t0x%016" PRIx64, "rd_lat_pc", rsp->rd_lat_pc);
57 plt_print(" %s:\t\t0x%016" PRIx64, "rd_uc_pc", rsp->rd_uc_pc);
58 plt_print(" %s:\t0x%016" PRIx64, "active_cycles_pc",
59 rsp->active_cycles_pc);
60 plt_print(" %s:\t\t0x%016" PRIx64, "ctx_mis_pc", rsp->ctx_mis_pc);
61 plt_print(" %s:\t\t0x%016" PRIx64, "ctx_hit_pc", rsp->ctx_hit_pc);
62 plt_print(" %s:\t\t0x%016" PRIx64, "ctx_aop_pc", rsp->ctx_aop_pc);
63 plt_print(" %s:\t0x%016" PRIx64, "ctx_aop_lat_pc",
65 plt_print(" %s:\t0x%016" PRIx64, "ctx_ifetch_pc",
67 plt_print(" %s:\t0x%016" PRIx64, "ctx_ifetch_lat_pc",
68 rsp->ctx_ifetch_lat_pc);
69 plt_print(" %s:\t0x%016" PRIx64, "ctx_ffetch_pc",
71 plt_print(" %s:\t0x%016" PRIx64, "ctx_ffetch_lat_pc",
72 rsp->ctx_ffetch_lat_pc);
73 plt_print(" %s:\t0x%016" PRIx64, "ctx_wback_pc", rsp->ctx_wback_pc);
74 plt_print(" %s:\t0x%016" PRIx64, "ctx_wback_lat_pc",
75 rsp->ctx_wback_lat_pc);
76 plt_print(" %s:\t\t0x%016" PRIx64, "ctx_psh_pc", rsp->ctx_psh_pc);
77 plt_print(" %s:\t0x%016" PRIx64, "ctx_psh_lat_pc",
79 plt_print(" %s:\t\t0x%016" PRIx64, "ctx_err", rsp->ctx_err);
80 plt_print(" %s:\t\t0x%016" PRIx64, "ctx_enc_id", rsp->ctx_enc_id);
81 plt_print(" %s:\t0x%016" PRIx64, "ctx_flush_timer",
82 rsp->ctx_flush_timer);
83 plt_print(" %s:\t\t0x%016" PRIx64, "rxc_time", rsp->rxc_time);
84 plt_print(" %s:\t0x%016" PRIx64, "rxc_time_cfg", rsp->rxc_time_cfg);
85 plt_print(" %s:\t0x%016" PRIx64, "rxc_active_sts",
87 plt_print(" %s:\t0x%016" PRIx64, "rxc_zombie_sts",
89 plt_print(" %s:\t0x%016" PRIx64, "rxc_dfrg", rsp->rxc_dfrg);
90 plt_print(" %s:\t0x%016" PRIx64, "x2p_link_cfg0",
92 plt_print(" %s:\t0x%016" PRIx64, "x2p_link_cfg1",
94 plt_print(" %s:\t0x%016" PRIx64, "busy_sts_ae", rsp->busy_sts_ae);
95 plt_print(" %s:\t0x%016" PRIx64, "free_sts_ae", rsp->free_sts_ae);
96 plt_print(" %s:\t0x%016" PRIx64, "busy_sts_se", rsp->busy_sts_se);
97 plt_print(" %s:\t0x%016" PRIx64, "free_sts_se", rsp->free_sts_se);
98 plt_print(" %s:\t0x%016" PRIx64, "busy_sts_ie", rsp->busy_sts_ie);
99 plt_print(" %s:\t0x%016" PRIx64, "free_sts_ie", rsp->free_sts_ie);
100 plt_print(" %s:\t0x%016" PRIx64, "exe_err_info", rsp->exe_err_info);
101 plt_print(" %s:\t\t0x%016" PRIx64, "cptclk_cnt", rsp->cptclk_cnt);
102 plt_print(" %s:\t\t0x%016" PRIx64, "diag", rsp->diag);
108 roc_cpt_afs_print(struct roc_cpt *roc_cpt)
112 plt_print("CPT AF registers:");
114 if (cpt_af_reg_read(roc_cpt, CPT_AF_LFX_CTL(0), ®_val))
117 plt_print(" CPT_AF_LF0_CTL:\t0x%016" PRIx64, reg_val);
119 if (cpt_af_reg_read(roc_cpt, CPT_AF_LFX_CTL2(0), ®_val))
122 plt_print(" CPT_AF_LF0_CTL2:\t0x%016" PRIx64, reg_val);
124 cpt_sts_print(roc_cpt);
130 cpt_lf_print(struct roc_cpt_lf *lf)
134 reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_BYTE_CNT);
135 plt_print(" Encrypted byte count:\t%" PRIu64, reg_val);
137 reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_PKT_CNT);
138 plt_print(" Encrypted packet count:\t%" PRIu64, reg_val);
140 reg_val = plt_read64(lf->rbase + CPT_LF_CTX_DEC_BYTE_CNT);
141 plt_print(" Decrypted byte count:\t%" PRIu64, reg_val);
143 reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_PKT_CNT);
144 plt_print(" Decrypted packet count:\t%" PRIu64, reg_val);
148 roc_cpt_lfs_print(struct roc_cpt *roc_cpt)
150 struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt);
151 struct roc_cpt_lf *lf;
157 for (lf_id = 0; lf_id < roc_cpt->nb_lf; lf_id++) {
158 lf = roc_cpt->lf[lf_id];
162 plt_print("Count registers for CPT LF%d:", lf_id);