drivers/pcie: Add a function to know MSI/MSI-x support of an endpoint

And since it does yet another round of pcie_get_cap() on PCIE_MSI_CAP_ID
and PCIE_MSIX_CAP_ID, let's factorize that into a utility function and
change the relevant places to use that function instead.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2021-03-15 15:00:52 +01:00 committed by Anas Nashif
commit fbb2f1511c
2 changed files with 46 additions and 40 deletions

View file

@ -109,6 +109,14 @@ extern bool pcie_msi_enable(pcie_bdf_t bdf,
uint8_t n_vector,
unsigned int irq);
/**
* @brief Check if the given PCI endpoint supports MSI/MSI-X
*
* @param bdf the target PCI endpoint
* @return true if the endpoint support MSI/MSI-X
*/
extern bool pcie_is_msi(pcie_bdf_t bdf);
/*
* The first word of the MSI capability is shared with the
* capability ID and list link. The high 16 bits are the MCR.