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 <narmstrong@baylibre.com>
This commit is contained in:
parent
bcbae563ea
commit
95315239d8
3 changed files with 10 additions and 15 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <drivers/pcie/msi.h>
|
#include <drivers/pcie/msi.h>
|
||||||
|
#include <drivers/pcie/cap.h>
|
||||||
|
|
||||||
/* functions documented in include/drivers/pcie/msi.h */
|
/* 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 base;
|
||||||
uint32_t req_vectors;
|
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)) {
|
if (IS_ENABLED(CONFIG_PCIE_MSI_X)) {
|
||||||
uint32_t base_msix;
|
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) {
|
if (base_msix != 0U) {
|
||||||
msi = false;
|
msi = false;
|
||||||
base = base_msix;
|
base = base_msix;
|
||||||
|
@ -161,12 +162,12 @@ bool pcie_msi_vector_connect(pcie_bdf_t bdf,
|
||||||
{
|
{
|
||||||
uint32_t base;
|
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)) {
|
if (IS_ENABLED(CONFIG_PCIE_MSI_X)) {
|
||||||
uint32_t base_msix;
|
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) {
|
if (base_msix != 0U) {
|
||||||
base = base_msix;
|
base = base_msix;
|
||||||
}
|
}
|
||||||
|
@ -265,12 +266,12 @@ bool pcie_msi_enable(pcie_bdf_t bdf,
|
||||||
bool msi = true;
|
bool msi = true;
|
||||||
uint32_t base;
|
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)) {
|
if (IS_ENABLED(CONFIG_PCIE_MSI_X)) {
|
||||||
uint32_t base_msix;
|
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)) {
|
if ((base_msix != 0U) && (base != 0U)) {
|
||||||
disable_msi(bdf, base);
|
disable_msi(bdf, base);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#ifdef CONFIG_PCIE_MSI
|
#ifdef CONFIG_PCIE_MSI
|
||||||
#include <drivers/pcie/msi.h>
|
#include <drivers/pcie/msi.h>
|
||||||
|
#include <drivers/pcie/cap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void show_msi(const struct shell *shell, pcie_bdf_t bdf)
|
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 msi;
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
|
|
||||||
msi = pcie_get_cap(bdf, PCIE_MSI_CAP_ID);
|
msi = pcie_get_cap(bdf, PCI_CAP_ID_MSI);
|
||||||
|
|
||||||
if (msi) {
|
if (msi) {
|
||||||
data = pcie_conf_read(bdf, msi + PCIE_MSI_MCR);
|
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" : "");
|
(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) {
|
if (msi) {
|
||||||
shell_fprintf(shell, SHELL_NORMAL, " MSI-X support\n");
|
shell_fprintf(shell, SHELL_NORMAL, " MSI-X support\n");
|
||||||
|
|
|
@ -109,13 +109,6 @@ extern bool pcie_msi_enable(pcie_bdf_t bdf,
|
||||||
uint8_t n_vector,
|
uint8_t n_vector,
|
||||||
unsigned int irq);
|
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
|
* The first word of the MSI capability is shared with the
|
||||||
* capability ID and list link. The high 16 bits are the MCR.
|
* capability ID and list link. The high 16 bits are the MCR.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue