Skip to content
Permalink
Browse files

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>
  • Loading branch information...
Charles E. Youse authored and nashif committed May 1, 2019
1 parent ef1788d commit f16f7fc491c933a17bcc06b86fc5f2b0a6fa59d5
Showing with 19 additions and 4 deletions.
  1. +7 −0 drivers/pcie/pcie.c
  2. +4 −4 drivers/pcie/shell.c
  3. +8 −0 include/drivers/pcie/pcie.h
@@ -79,6 +79,13 @@ u32_t pcie_get_mbar(pcie_bdf_t bdf, unsigned int index)
return pcie_get_bar(bdf, index, false); 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) u32_t pcie_get_iobar(pcie_bdf_t bdf, unsigned int index)
{ {
return pcie_get_bar(bdf, index, true); 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) static void show(const struct shell *shell, pcie_bdf_t bdf)
{ {
u32_t data; u32_t data;
unsigned int irq;


data = pcie_conf_read(bdf, PCIE_CONF_ID); 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"); shell_fprintf(shell, SHELL_NORMAL, "\n");
show_bars(shell, bdf); show_bars(shell, bdf);
show_msi(shell, bdf); show_msi(shell, bdf);
data = pcie_conf_read(bdf, PCIE_CONF_INTR); irq = pcie_wired_irq(bdf);
if (PCIE_CONF_INTR_IRQ(data) != PCIE_CONF_INTR_IRQ_NONE) { if (irq != PCIE_CONF_INTR_IRQ_NONE) {
shell_fprintf(shell, SHELL_NORMAL, shell_fprintf(shell, SHELL_NORMAL,
" wired interrupt on IRQ %d\n", " wired interrupt on IRQ %d\n", irq);
PCIE_CONF_INTR_IRQ(data));
} }
} }
} }
@@ -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); 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. * @brief Enable the PCI(e) endpoint to generate the specified IRQ.
* *

0 comments on commit f16f7fc

Please sign in to comment.
You can’t perform that action at this time.