Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44d745fb authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

Merge branch 'pci/irq-fixups' into next

* pci/irq-fixups:
  arm64: PCI: Drop DT IRQ allocation from pcibios_alloc_irq()
  PCI: xilinx-nwl: Move to struct pci_host_bridge IRQ mapping functions
  PCI: rockchip: Move to struct pci_host_bridge IRQ mapping functions
  PCI: xgene: Move to struct pci_host_bridge IRQ mapping functions
  PCI: altera: Drop pci_fixup_irqs()
  PCI: versatile: Drop pci_fixup_irqs()
  PCI: generic: Drop pci_fixup_irqs()
  PCI: faraday: Drop pci_fixup_irqs()
  PCI: designware: Drop pci_fixup_irqs()
  PCI: iproc: Drop pci_fixup_irqs()
  PCI: rcar: Drop pci_fixup_irqs()
  PCI: xilinx: Drop pci_fixup_irqs()
  PCI: tegra: Drop pci_fixup_irqs()
  ARM/PCI: Remove pci_fixup_irqs() call for bios32 host controllers
  PCI: Add a call to pci_assign_irq() in pci_device_probe()
  OF/PCI: Update of_irq_parse_and_map_pci() comment
  PCI: Add pci_assign_irq() function and have pci_fixup_irqs() use it
  PCI: Add IRQ mapping function pointers to pci_host_bridge struct
  PCI: Build setup-irq.o on all arches
  PCI: Remove pci_scan_root_bus_msi()
  PCI: xilinx-nwl: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: rockchip: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: generic: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: xgene: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: xilinx: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: altera: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: versatile: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: iproc: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: rcar: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: aardvark: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: designware: Convert PCI scan API to pci_scan_root_bus_bridge()
  ARM/PCI: Convert PCI scan API to pci_scan_root_bus_bridge()
  PCI: Make pci_register_host_bridge() PCI core internal
  PCI: Add pci_scan_root_bus_bridge() interface
  PCI: tegra: Fix host bridge memory leakage
  PCI: faraday: Fix host bridge memory leakage
  PCI: Add devm_pci_alloc_host_bridge() interface
  PCI: Add pci_free_host_bridge() interface
  PCI: Initialize bridge release function at bridge allocation
  PCI: faraday: Convert IRQ masking to raw PCI config accessors
  PCI: iproc: Convert link check to raw PCI config accessors
  PCI: xilinx-nwl: Remove nwl_pcie_enable_msi() unused bus parameter
parents bb02ce95 769b461f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ PER-CPU MEM
  devm_free_percpu()

PCI
  devm_pci_alloc_host_bridge()  : managed PCI host bridge allocation
  devm_pci_remap_cfgspace()	: ioremap PCI configuration space
  devm_pci_remap_cfg_resource()	: ioremap PCI configuration space resource
  pcim_enable_device()		: after success, all PCI ops become managed
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
struct pci_sys_data;
struct pci_ops;
struct pci_bus;
struct pci_host_bridge;
struct device;

struct hw_pci {
@@ -25,7 +26,7 @@ struct hw_pci {
	unsigned int	io_optional:1;
	void		**private_data;
	int		(*setup)(int nr, struct pci_sys_data *);
	struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
	int		(*scan)(int nr, struct pci_host_bridge *);
	void		(*preinit)(void);
	void		(*postinit)(void);
	u8		(*swizzle)(struct pci_dev *dev, u8 *pin);
+28 −16
Original line number Diff line number Diff line
@@ -458,10 +458,14 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
	int nr, busnr;

	for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
		sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
		if (WARN(!sys, "PCI: unable to allocate sys data!"))
		struct pci_host_bridge *bridge;

		bridge = pci_alloc_host_bridge(sizeof(struct pci_sys_data));
		if (WARN(!bridge, "PCI: unable to allocate bridge!"))
			break;

		sys = pci_host_bridge_priv(bridge);

		sys->busnr   = busnr;
		sys->swizzle = hw->swizzle;
		sys->map_irq = hw->map_irq;
@@ -473,7 +477,6 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
		ret = hw->setup(nr, sys);

		if (ret > 0) {
			struct pci_host_bridge *host_bridge;

			ret = pcibios_init_resource(nr, sys, hw->io_optional);
			if (ret)  {
@@ -481,26 +484,37 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
				break;
			}

			if (hw->scan)
				sys->bus = hw->scan(nr, sys);
			else
				sys->bus = pci_scan_root_bus_msi(parent,
					sys->busnr, hw->ops, sys,
					&sys->resources, hw->msi_ctrl);
			bridge->map_irq = pcibios_map_irq;
			bridge->swizzle_irq = pcibios_swizzle;

			if (WARN(!sys->bus, "PCI: unable to scan bus!")) {
				kfree(sys);
			if (hw->scan)
				ret = hw->scan(nr, bridge);
			else {
				list_splice_init(&sys->resources,
						 &bridge->windows);
				bridge->dev.parent = parent;
				bridge->sysdata = sys;
				bridge->busnr = sys->busnr;
				bridge->ops = hw->ops;
				bridge->msi = hw->msi_ctrl;
				bridge->align_resource =
						hw->align_resource;

				ret = pci_scan_root_bus_bridge(bridge);
			}

			if (WARN(ret < 0, "PCI: unable to scan bus!")) {
				pci_free_host_bridge(bridge);
				break;
			}

			sys->bus = bridge->bus;

			busnr = sys->bus->busn_res.end + 1;

			list_add(&sys->node, head);

			host_bridge = pci_find_host_bridge(sys->bus);
			host_bridge->align_resource = hw->align_resource;
		} else {
			kfree(sys);
			pci_free_host_bridge(bridge);
			if (ret < 0)
				break;
		}
@@ -519,8 +533,6 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
	if (hw->postinit)
		hw->postinit();

	pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq);

	list_for_each_entry(sys, &head, node) {
		struct pci_bus *bus = sys->bus;

+12 −5
Original line number Diff line number Diff line
@@ -152,16 +152,23 @@ static void rc_pci_fixup(struct pci_dev *dev)
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);

static struct pci_bus __init *
dove_pcie_scan_bus(int nr, struct pci_sys_data *sys)
static int __init
dove_pcie_scan_bus(int nr, struct pci_host_bridge *bridge)
{
	struct pci_sys_data *sys = pci_host_bridge_priv(bridge);

	if (nr >= num_pcie_ports) {
		BUG();
		return NULL;
		return -EINVAL;
	}

	return pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys,
				 &sys->resources);
	list_splice_init(&sys->resources, &bridge->windows);
	bridge->dev.parent = NULL;
	bridge->sysdata = sys;
	bridge->busnr = sys->busnr;
	bridge->ops = &pcie_ops;

	return pci_scan_root_bus_bridge(bridge);
}

static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+20 −11
Original line number Diff line number Diff line
@@ -504,10 +504,10 @@ iop13xx_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)

/* Scan an IOP13XX PCI bus.  nr selects which ATU we use.
 */
struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *sys)
int iop13xx_scan_bus(int nr, struct pci_host_bridge *bridge)
{
	int which_atu;
	struct pci_bus *bus = NULL;
	int which_atu, ret;
	struct pci_sys_data *sys = pci_host_bridge_priv(bridge);

	switch (init_atu) {
	case IOP13XX_INIT_ATU_ATUX:
@@ -525,9 +525,14 @@ struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *sys)

	if (!which_atu) {
		BUG();
		return NULL;
		return -ENODEV;
	}

	list_splice_init(&sys->resources, &bridge->windows);
	bridge->dev.parent = NULL;
	bridge->sysdata = sys;
	bridge->busnr = sys->busnr;

	switch (which_atu) {
	case IOP13XX_INIT_ATU_ATUX:
		if (time_after_eq(jiffies + msecs_to_jiffies(1000),
@@ -535,18 +540,22 @@ struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *sys)
			while(time_before(jiffies, atux_trhfa_timeout))
				udelay(100);

		bus = pci_bus_atux = pci_scan_root_bus(NULL, sys->busnr,
						       &iop13xx_atux_ops,
						       sys, &sys->resources);
		bridge->ops = &iop13xx_atux_ops;
		ret = pci_scan_root_bus_bridge(bridge);
		if (!ret)
			pci_bus_atux = bridge->bus;
		break;
	case IOP13XX_INIT_ATU_ATUE:
		bus = pci_bus_atue = pci_scan_root_bus(NULL, sys->busnr,
						       &iop13xx_atue_ops,
						       sys, &sys->resources);
		bridge->ops = &iop13xx_atue_ops;
		ret = pci_scan_root_bus_bridge(bridge);
		if (!ret)
			pci_bus_atue = bridge->bus;
		break;
	default:
		ret = -EINVAL;
	}

	return bus;
	return ret;
}

/* This function is called from iop13xx_pci_init() after assigning valid
Loading