From 95315239d8e73b3f08c98e9cc7e978a4ef0a31a5 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Tue, 31 Aug 2021 10:03:53 +0200 Subject: [PATCH] pcie: use newly introduced IDs define for MSI/MSI-X Remove the locally MSI/MSI-X capabilities ID define and use the newly introduced one from the PCI Code and ID Assignment Specification Revision 1.11 document header. Signed-off-by: Neil Armstrong --- drivers/pcie/host/msi.c | 13 +++++++------ drivers/pcie/host/shell.c | 5 +++-- include/drivers/pcie/msi.h | 7 ------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/pcie/host/msi.c b/drivers/pcie/host/msi.c index 187c9ceff4a..2ec073e3402 100644 --- a/drivers/pcie/host/msi.c +++ b/drivers/pcie/host/msi.c @@ -6,6 +6,7 @@ #include #include +#include /* functions documented in include/drivers/pcie/msi.h */ @@ -118,12 +119,12 @@ uint8_t pcie_msi_vectors_allocate(pcie_bdf_t bdf, uint32_t base; uint32_t req_vectors; - base = pcie_get_cap(bdf, PCIE_MSI_CAP_ID); + base = pcie_get_cap(bdf, PCI_CAP_ID_MSI); if (IS_ENABLED(CONFIG_PCIE_MSI_X)) { uint32_t base_msix; - base_msix = pcie_get_cap(bdf, PCIE_MSIX_CAP_ID); + base_msix = pcie_get_cap(bdf, PCI_CAP_ID_MSIX); if (base_msix != 0U) { msi = false; base = base_msix; @@ -161,12 +162,12 @@ bool pcie_msi_vector_connect(pcie_bdf_t bdf, { uint32_t base; - base = pcie_get_cap(bdf, PCIE_MSI_CAP_ID); + base = pcie_get_cap(bdf, PCI_CAP_ID_MSI); if (IS_ENABLED(CONFIG_PCIE_MSI_X)) { uint32_t base_msix; - base_msix = pcie_get_cap(bdf, PCIE_MSIX_CAP_ID); + base_msix = pcie_get_cap(bdf, PCI_CAP_ID_MSIX); if (base_msix != 0U) { base = base_msix; } @@ -265,12 +266,12 @@ bool pcie_msi_enable(pcie_bdf_t bdf, bool msi = true; uint32_t base; - base = pcie_get_cap(bdf, PCIE_MSI_CAP_ID); + base = pcie_get_cap(bdf, PCI_CAP_ID_MSI); if (IS_ENABLED(CONFIG_PCIE_MSI_X)) { uint32_t base_msix; - base_msix = pcie_get_cap(bdf, PCIE_MSIX_CAP_ID); + base_msix = pcie_get_cap(bdf, PCI_CAP_ID_MSIX); if ((base_msix != 0U) && (base != 0U)) { disable_msi(bdf, base); } diff --git a/drivers/pcie/host/shell.c b/drivers/pcie/host/shell.c index ef826c93cbd..b3229cb80d8 100644 --- a/drivers/pcie/host/shell.c +++ b/drivers/pcie/host/shell.c @@ -9,6 +9,7 @@ #ifdef CONFIG_PCIE_MSI #include +#include #endif static void show_msi(const struct shell *shell, pcie_bdf_t bdf) @@ -17,7 +18,7 @@ static void show_msi(const struct shell *shell, pcie_bdf_t bdf) uint32_t msi; uint32_t data; - msi = pcie_get_cap(bdf, PCIE_MSI_CAP_ID); + msi = pcie_get_cap(bdf, PCI_CAP_ID_MSI); if (msi) { data = pcie_conf_read(bdf, msi + PCIE_MSI_MCR); @@ -26,7 +27,7 @@ static void show_msi(const struct shell *shell, pcie_bdf_t bdf) (data & PCIE_MSI_MCR_EN) ? ", enabled" : ""); } - msi = pcie_get_cap(bdf, PCIE_MSIX_CAP_ID); + msi = pcie_get_cap(bdf, PCI_CAP_ID_MSIX); if (msi) { shell_fprintf(shell, SHELL_NORMAL, " MSI-X support\n"); diff --git a/include/drivers/pcie/msi.h b/include/drivers/pcie/msi.h index d13cca81891..bddeebdfad2 100644 --- a/include/drivers/pcie/msi.h +++ b/include/drivers/pcie/msi.h @@ -109,13 +109,6 @@ extern bool pcie_msi_enable(pcie_bdf_t bdf, uint8_t n_vector, unsigned int irq); -/* - * MSI capability IDs in the PCI configuration capability list. - */ - -#define PCIE_MSI_CAP_ID 0x05U -#define PCIE_MSIX_CAP_ID 0x11U - /* * The first word of the MSI capability is shared with the * capability ID and list link. The high 16 bits are the MCR.