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

Commit 37d15909 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Jesse Barnes
Browse files

arm/PCI: convert to pci_scan_root_bus() for correct root bus resources



Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus
resource fixups.  This fixes the problem of "early" and "header" quirks
seeing incorrect root bus resources.

CC: Russell King <linux@arm.linux.org.uk>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent a2f33da1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -299,8 +299,8 @@ int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
		goto err1;
	}

	sys->resource[0] = &it8152_io;
	sys->resource[1] = &it8152_mem;
	pci_add_resource(&sys->resources, &it8152_io);
	pci_add_resource(&sys->resources, &it8152_mem);

	if (platform_notify || platform_notify_remove) {
		printk(KERN_ERR "PCI: Can't use platform_notify\n");
@@ -355,7 +355,7 @@ void pcibios_set_master(struct pci_dev *dev)

struct pci_bus * __init it8152_pci_scan_bus(int nr, struct pci_sys_data *sys)
{
	return pci_scan_bus(nr, &it8152_ops, sys);
	return pci_scan_root_bus(NULL, nr, &it8152_ops, sys, &sys->resources);
}

EXPORT_SYMBOL(dma_set_coherent_mask);
+2 −1
Original line number Diff line number Diff line
@@ -86,7 +86,8 @@ int __init via82c505_setup(int nr, struct pci_sys_data *sys)
struct pci_bus * __init via82c505_scan_bus(int nr, struct pci_sys_data *sysdata)
{
	if (nr == 0)
		return pci_scan_bus(0, &via82c505_ops, sysdata);
		return pci_scan_root_bus(NULL, 0, &via82c505_ops, sysdata,
					 &sysdata->resources);

	return NULL;
}
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ struct pci_sys_data {
	u64		mem_offset;	/* bus->cpu memory mapping offset	*/
	unsigned long	io_offset;	/* bus->cpu IO mapping offset		*/
	struct pci_bus	*bus;		/* PCI bus				*/
	struct resource *resource[3];	/* Primary PCI bus resources		*/
	struct list_head resources;	/* root bus resources (apertures)       */
					/* Bridge swizzling			*/
	u8		(*swizzle)(struct pci_dev *, u8 *);
					/* IRQ mapping				*/
+8 −19
Original line number Diff line number Diff line
@@ -316,21 +316,6 @@ pdev_fixup_device_resources(struct pci_sys_data *root, struct pci_dev *dev)
	}
}

static void __devinit
pbus_assign_bus_resources(struct pci_bus *bus, struct pci_sys_data *root)
{
	struct pci_dev *dev = bus->self;
	int i;

	if (!dev) {
		/*
		 * Assign root bus resources.
		 */
		for (i = 0; i < 3; i++)
			bus->resource[i] = root->resource[i];
	}
}

/*
 * pcibios_fixup_bus - Called after each bus is probed,
 * but before its children are examined.
@@ -341,8 +326,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
	struct pci_dev *dev;
	u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK;

	pbus_assign_bus_resources(bus, root);

	/*
	 * Walk the devices on this bus, working out what we can
	 * and can't support.
@@ -508,12 +491,18 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
		sys->busnr   = busnr;
		sys->swizzle = hw->swizzle;
		sys->map_irq = hw->map_irq;
		sys->resource[0] = &ioport_resource;
		sys->resource[1] = &iomem_resource;
		INIT_LIST_HEAD(&sys->resources);

		ret = hw->setup(nr, sys);

		if (ret > 0) {
			if (list_empty(&sys->resources)) {
				pci_add_resource(&sys->resources,
						 &ioport_resource);
				pci_add_resource(&sys->resources,
						 &iomem_resource);
			}

			sys->bus = hw->scan(nr, sys);

			if (!sys->bus)
+4 −4
Original line number Diff line number Diff line
@@ -151,13 +151,12 @@ static int cns3xxx_pci_setup(int nr, struct pci_sys_data *sys)
	struct cns3xxx_pcie *cnspci = sysdata_to_cnspci(sys);
	struct resource *res_io = &cnspci->res_io;
	struct resource *res_mem = &cnspci->res_mem;
	struct resource **sysres = sys->resource;

	BUG_ON(request_resource(&iomem_resource, res_io) ||
	       request_resource(&iomem_resource, res_mem));

	sysres[0] = res_io;
	sysres[1] = res_mem;
	pci_add_resource(&sys->resources, res_io);
	pci_add_resource(&sys->resources, res_mem);

	return 1;
}
@@ -169,7 +168,8 @@ static struct pci_ops cns3xxx_pcie_ops = {

static struct pci_bus *cns3xxx_pci_scan_bus(int nr, struct pci_sys_data *sys)
{
	return pci_scan_bus(sys->busnr, &cns3xxx_pcie_ops, sys);
	return pci_scan_root_bus(NULL, sys->busnr, &cns3xxx_pcie_ops, sys,
				 &sys->resources);
}

static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
Loading