Commit ea643e1a authored by Lucas Stach's avatar Lucas Stach Committed by Bjorn Helgaas

PCI: designware: Factor out MSI msg setup

Factor out the PCI MSI message setup from the single MSI setup function.
This will be reused by the multivector MSI setup.

No functional change yet.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarPratyush Anand <pratyush.anand@gmail.com>
parent 339e5b44
...@@ -293,19 +293,9 @@ static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) ...@@ -293,19 +293,9 @@ static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos)
return -ENOSPC; return -ENOSPC;
} }
static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev, static void dw_msi_setup_msg(struct pcie_port *pp, unsigned int irq, u32 pos)
struct msi_desc *desc)
{ {
int irq, pos;
struct msi_msg msg; struct msi_msg msg;
struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata);
if (desc->msi_attrib.is_msix)
return -EINVAL;
irq = assign_irq(1, desc, &pos);
if (irq < 0)
return irq;
if (pp->ops->get_msi_addr) if (pp->ops->get_msi_addr)
msg.address_lo = pp->ops->get_msi_addr(pp); msg.address_lo = pp->ops->get_msi_addr(pp);
...@@ -319,6 +309,22 @@ static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev, ...@@ -319,6 +309,22 @@ static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev,
msg.data = pos; msg.data = pos;
pci_write_msi_msg(irq, &msg); pci_write_msi_msg(irq, &msg);
}
static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev,
struct msi_desc *desc)
{
int irq, pos;
struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata);
if (desc->msi_attrib.is_msix)
return -EINVAL;
irq = assign_irq(1, desc, &pos);
if (irq < 0)
return irq;
dw_msi_setup_msg(pp, irq, pos);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment