Lines Matching full:msi

22 #include <linux/msi.h>
57 struct rcar_msi msi; member
298 bridge->msi = &host->msi.chip; in rcar_pcie_enable()
394 /* Enable MSI */ in rcar_pcie_hw_init()
480 int msi; in rcar_msi_alloc() local
484 msi = find_first_zero_bit(chip->used, INT_PCI_MSI_NR); in rcar_msi_alloc()
485 if (msi < INT_PCI_MSI_NR) in rcar_msi_alloc()
486 set_bit(msi, chip->used); in rcar_msi_alloc()
488 msi = -ENOSPC; in rcar_msi_alloc()
492 return msi; in rcar_msi_alloc()
497 int msi; in rcar_msi_alloc_region() local
500 msi = bitmap_find_free_region(chip->used, INT_PCI_MSI_NR, in rcar_msi_alloc_region()
504 return msi; in rcar_msi_alloc_region()
518 struct rcar_msi *msi = &host->msi; in rcar_pcie_msi_irq() local
524 /* MSI & INTx share an interrupt - we only handle MSI here */ in rcar_pcie_msi_irq()
535 msi_irq = irq_find_mapping(msi->domain, index); in rcar_pcie_msi_irq()
537 if (test_bit(index, msi->used)) in rcar_pcie_msi_irq()
540 dev_info(dev, "unhandled MSI\n"); in rcar_pcie_msi_irq()
542 /* Unknown MSI, just clear it */ in rcar_pcie_msi_irq()
543 dev_dbg(dev, "unexpected MSI\n"); in rcar_pcie_msi_irq()
556 struct rcar_msi *msi = to_rcar_msi(chip); in rcar_msi_setup_irq() local
558 msi.chip); in rcar_msi_setup_irq()
564 hwirq = rcar_msi_alloc(msi); in rcar_msi_setup_irq()
568 irq = irq_find_mapping(msi->domain, hwirq); in rcar_msi_setup_irq()
570 rcar_msi_free(msi, hwirq); in rcar_msi_setup_irq()
588 struct rcar_msi *msi = to_rcar_msi(chip); in rcar_msi_setup_irqs() local
590 msi.chip); in rcar_msi_setup_irqs()
598 /* MSI-X interrupts are not supported */ in rcar_msi_setup_irqs()
605 hwirq = rcar_msi_alloc_region(msi, nvec); in rcar_msi_setup_irqs()
609 irq = irq_find_mapping(msi->domain, hwirq); in rcar_msi_setup_irqs()
641 struct rcar_msi *msi = to_rcar_msi(chip); in rcar_msi_teardown_irq() local
644 rcar_msi_free(msi, d->hwirq); in rcar_msi_teardown_irq()
648 .name = "R-Car PCIe MSI",
670 struct rcar_msi *msi = &host->msi; in rcar_pcie_unmap_msi() local
674 irq = irq_find_mapping(msi->domain, i); in rcar_pcie_unmap_msi()
679 irq_domain_remove(msi->domain); in rcar_pcie_unmap_msi()
685 struct rcar_msi *msi = &host->msi; in rcar_pcie_hw_enable_msi() local
688 /* setup MSI data target */ in rcar_pcie_hw_enable_msi()
689 base = virt_to_phys((void *)msi->pages); in rcar_pcie_hw_enable_msi()
694 /* enable all MSI interrupts */ in rcar_pcie_hw_enable_msi()
702 struct rcar_msi *msi = &host->msi; in rcar_pcie_enable_msi() local
705 mutex_init(&msi->lock); in rcar_pcie_enable_msi()
707 msi->chip.dev = dev; in rcar_pcie_enable_msi()
708 msi->chip.setup_irq = rcar_msi_setup_irq; in rcar_pcie_enable_msi()
709 msi->chip.setup_irqs = rcar_msi_setup_irqs; in rcar_pcie_enable_msi()
710 msi->chip.teardown_irq = rcar_msi_teardown_irq; in rcar_pcie_enable_msi()
712 msi->domain = irq_domain_add_linear(dev->of_node, INT_PCI_MSI_NR, in rcar_pcie_enable_msi()
713 &msi_domain_ops, &msi->chip); in rcar_pcie_enable_msi()
714 if (!msi->domain) { in rcar_pcie_enable_msi()
720 irq_create_mapping(msi->domain, i); in rcar_pcie_enable_msi()
722 /* Two irqs are for MSI, but they are also used for non-MSI irqs */ in rcar_pcie_enable_msi()
723 err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq, in rcar_pcie_enable_msi()
731 err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq, in rcar_pcie_enable_msi()
739 /* setup MSI data target */ in rcar_pcie_enable_msi()
740 msi->pages = __get_free_pages(GFP_KERNEL, 0); in rcar_pcie_enable_msi()
753 struct rcar_msi *msi = &host->msi; in rcar_pcie_teardown_msi() local
755 /* Disable all MSI interrupts */ in rcar_pcie_teardown_msi()
758 /* Disable address decoding of the MSI interrupt, MSIFE */ in rcar_pcie_teardown_msi()
761 free_pages(msi->pages, 0); in rcar_pcie_teardown_msi()
793 dev_err(dev, "cannot get platform resources for msi interrupt\n"); in rcar_pcie_get_resources()
797 host->msi.irq1 = i; in rcar_pcie_get_resources()
801 dev_err(dev, "cannot get platform resources for msi interrupt\n"); in rcar_pcie_get_resources()
805 host->msi.irq2 = i; in rcar_pcie_get_resources()
810 irq_dispose_mapping(host->msi.irq1); in rcar_pcie_get_resources()
958 "failed to enable MSI support: %d\n", in rcar_pcie_probe()
984 irq_dispose_mapping(host->msi.irq2); in rcar_pcie_probe()
985 irq_dispose_mapping(host->msi.irq1); in rcar_pcie_probe()
1015 /* Enable MSI */ in rcar_pcie_resume()