Skip to content

Commit 12f67c1

Browse files
finikorgcfriedt
authored andcommitted
pcie: shell: Print more MSI-X information
For pcie ls command print more detailed MSI / MSI-X information. Signed-off-by: Andrei Emeltchenko <[email protected]>
1 parent bf4d79a commit 12f67c1

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

drivers/pcie/host/shell.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,42 @@ static void show_msi(const struct shell *shell, pcie_bdf_t bdf)
2424
data = pcie_conf_read(bdf, msi + PCIE_MSI_MCR);
2525
shell_fprintf(shell, SHELL_NORMAL, " MSI support%s%s\n",
2626
(data & PCIE_MSI_MCR_64) ? ", 64-bit" : "",
27-
(data & PCIE_MSI_MCR_EN) ? ", enabled" : "");
27+
(data & PCIE_MSI_MCR_EN) ?
28+
", enabled" : ", disabled");
2829
}
2930

3031
msi = pcie_get_cap(bdf, PCI_CAP_ID_MSIX);
3132

3233
if (msi) {
33-
shell_fprintf(shell, SHELL_NORMAL, " MSI-X support\n");
34+
uint32_t offset, table_size;
35+
uint8_t bir;
36+
37+
data = pcie_conf_read(bdf, msi + PCIE_MSIX_MCR);
38+
39+
table_size = ((data & PCIE_MSIX_MCR_TSIZE) >>
40+
PCIE_MSIX_MCR_TSIZE_SHIFT) + 1;
41+
42+
shell_fprintf(shell, SHELL_NORMAL,
43+
" MSI-X support%s table size %d\n",
44+
(data & PCIE_MSIX_MCR_EN) ?
45+
", enabled" : ", disabled",
46+
table_size);
47+
48+
offset = pcie_conf_read(bdf, msi + PCIE_MSIX_TR);
49+
bir = offset & PCIE_MSIX_TR_BIR;
50+
offset &= PCIE_MSIX_TR_OFFSET;
51+
52+
shell_fprintf(shell, SHELL_NORMAL,
53+
"\tTable offset 0x%x BAR %d\n",
54+
offset, bir);
55+
56+
offset = pcie_conf_read(bdf, msi + PCIE_MSIX_PBA);
57+
bir = offset & PCIE_MSIX_PBA_BIR;
58+
offset &= PCIE_MSIX_PBA_OFFSET;
59+
60+
shell_fprintf(shell, SHELL_NORMAL,
61+
"\tPBA offset 0x%x BAR %d\n",
62+
offset, bir);
3463
}
3564
#endif
3665
}

include/drivers/pcie/msi.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,13 @@ extern bool pcie_msi_enable(pcie_bdf_t bdf,
147147
#define PCIE_MSIR_TABLE_ENTRY_SIZE 16
148148

149149
#define PCIE_MSIX_TR 1U
150-
#define PCIE_MSIX_TR_BIR 0x00000007U /* BIR mask */
150+
#define PCIE_MSIX_TR_BIR 0x00000007U /* Table BIR mask */
151151
#define PCIE_MSIX_TR_OFFSET 0xFFFFFFF8U /* Offset mask */
152152

153+
#define PCIE_MSIX_PBA 2U
154+
#define PCIE_MSIX_PBA_BIR 0x00000007U /* PBA BIR mask */
155+
#define PCIE_MSIX_PBA_OFFSET 0xFFFFFFF8U /* Offset mask */
156+
153157
#define PCIE_VTBL_MA 0U /* Msg Address offset */
154158
#define PCIE_VTBL_MUA 4U /* Msg Upper Address offset */
155159
#define PCIE_VTBL_MD 8U /* Msg Data offset */

0 commit comments

Comments
 (0)