drivers/pcie: add support to read wired IRQ configuration
Firmware is supposed to set a register in PCI configuration space which indicates the hardware IRQ that the endpoint is attached to. A function is implemented which reads this register, and the PCIe shell is updated to use it instead of doing it "manually". Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
parent
ef1788da70
commit
f16f7fc491
3 changed files with 19 additions and 4 deletions
|
@ -79,6 +79,13 @@ u32_t pcie_get_mbar(pcie_bdf_t bdf, unsigned int index)
|
|||
return pcie_get_bar(bdf, index, false);
|
||||
}
|
||||
|
||||
unsigned int pcie_wired_irq(pcie_bdf_t bdf)
|
||||
{
|
||||
u32_t data = pcie_conf_read(bdf, PCIE_CONF_INTR);
|
||||
|
||||
return PCIE_CONF_INTR_IRQ(data);
|
||||
}
|
||||
|
||||
u32_t pcie_get_iobar(pcie_bdf_t bdf, unsigned int index)
|
||||
{
|
||||
return pcie_get_bar(bdf, index, true);
|
||||
|
|
|
@ -58,6 +58,7 @@ static void show_bars(const struct shell *shell, pcie_bdf_t bdf)
|
|||
static void show(const struct shell *shell, pcie_bdf_t bdf)
|
||||
{
|
||||
u32_t data;
|
||||
unsigned int irq;
|
||||
|
||||
data = pcie_conf_read(bdf, PCIE_CONF_ID);
|
||||
|
||||
|
@ -88,11 +89,10 @@ static void show(const struct shell *shell, pcie_bdf_t bdf)
|
|||
shell_fprintf(shell, SHELL_NORMAL, "\n");
|
||||
show_bars(shell, bdf);
|
||||
show_msi(shell, bdf);
|
||||
data = pcie_conf_read(bdf, PCIE_CONF_INTR);
|
||||
if (PCIE_CONF_INTR_IRQ(data) != PCIE_CONF_INTR_IRQ_NONE) {
|
||||
irq = pcie_wired_irq(bdf);
|
||||
if (irq != PCIE_CONF_INTR_IRQ_NONE) {
|
||||
shell_fprintf(shell, SHELL_NORMAL,
|
||||
" wired interrupt on IRQ %d\n",
|
||||
PCIE_CONF_INTR_IRQ(data));
|
||||
" wired interrupt on IRQ %d\n", irq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,14 @@ extern u32_t pcie_get_iobar(pcie_bdf_t bdf, unsigned int index);
|
|||
*/
|
||||
extern void pcie_set_cmd(pcie_bdf_t bdf, u32_t bits, bool on);
|
||||
|
||||
/**
|
||||
* @brief Return the IRQ assigned by the firmware/board to an endpoint.
|
||||
*
|
||||
* @param bdf the PCI(e) endpoint
|
||||
* @return the IRQ number, or PCIE_CONF_INTR_IRQ_NONE if unknown.
|
||||
*/
|
||||
extern unsigned int pcie_wired_irq(pcie_bdf_t bdf);
|
||||
|
||||
/**
|
||||
* @brief Enable the PCI(e) endpoint to generate the specified IRQ.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue