Skip to content

Commit 6a1e19c

Browse files
Tomasz Bursztykanashif
authored andcommitted
drivers/pcie: Add virtual channel details output to shell module
Helps to see how many VCs are supported and the related ressources. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 5e4e6bc commit 6a1e19c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

drivers/pcie/host/shell.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include <zephyr/drivers/pcie/cap.h>
1616

17+
#include "vc.h"
18+
1719
struct pcie_cap_id_to_str {
1820
uint32_t id;
1921
char *str;
@@ -200,6 +202,42 @@ static void show_capabilities(const struct shell *sh, pcie_bdf_t bdf)
200202
}
201203
}
202204

205+
static void show_vc(const struct shell *sh, pcie_bdf_t bdf)
206+
{
207+
uint32_t base;
208+
struct pcie_vc_regs regs;
209+
struct pcie_vc_resource_regs res_regs[PCIE_VC_MAX_COUNT];
210+
int idx;
211+
212+
base = pcie_vc_cap_lookup(bdf, &regs);
213+
if (base == 0) {
214+
return;
215+
}
216+
217+
shell_fprintf(sh, SHELL_NORMAL,
218+
" VC exposed : VC/LPVC count: %u/%u, "
219+
"PAT entry size 0x%x, VCA cap 0x%x, "
220+
"VCA table Offset 0x%x\n",
221+
regs.cap_reg_1.vc_count + 1,
222+
regs.cap_reg_1.lpvc_count,
223+
regs.cap_reg_1.pat_entry_size,
224+
regs.cap_reg_2.vca_cap,
225+
regs.cap_reg_2.vca_table_offset);
226+
227+
pcie_vc_load_resources_regs(bdf, base, res_regs,
228+
regs.cap_reg_1.vc_count + 1);
229+
230+
for (idx = 0; idx < regs.cap_reg_1.vc_count + 1; idx++) {
231+
shell_fprintf(sh, SHELL_NORMAL,
232+
" VC %d - PA Cap 0x%x, RST %u,"
233+
"Max TS %u PAT offset 0x%x\n",
234+
idx, res_regs[idx].cap_reg.pa_cap,
235+
res_regs[idx].cap_reg.rst,
236+
res_regs[idx].cap_reg.max_time_slots,
237+
res_regs[idx].cap_reg.pa_table_offset);
238+
}
239+
}
240+
203241
static void pcie_dump(const struct shell *sh, pcie_bdf_t bdf)
204242
{
205243
for (int i = 0; i < 16; i++) {
@@ -289,6 +327,7 @@ static void show(const struct shell *sh, pcie_bdf_t bdf, bool details, bool dump
289327

290328
if (details) {
291329
show_capabilities(sh, bdf);
330+
show_vc(sh, bdf);
292331
}
293332

294333
if (dump) {

0 commit comments

Comments
 (0)