|
14 | 14 |
|
15 | 15 | #include <zephyr/drivers/pcie/cap.h>
|
16 | 16 |
|
| 17 | +#include "vc.h" |
| 18 | + |
17 | 19 | struct pcie_cap_id_to_str {
|
18 | 20 | uint32_t id;
|
19 | 21 | char *str;
|
@@ -200,6 +202,42 @@ static void show_capabilities(const struct shell *sh, pcie_bdf_t bdf)
|
200 | 202 | }
|
201 | 203 | }
|
202 | 204 |
|
| 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, ®s); |
| 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 | + |
203 | 241 | static void pcie_dump(const struct shell *sh, pcie_bdf_t bdf)
|
204 | 242 | {
|
205 | 243 | 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
|
289 | 327 |
|
290 | 328 | if (details) {
|
291 | 329 | show_capabilities(sh, bdf);
|
| 330 | + show_vc(sh, bdf); |
292 | 331 | }
|
293 | 332 |
|
294 | 333 | if (dump) {
|
|
0 commit comments