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

Commit 9f786d03 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

arm/PCI: get rid of device resource fixups



Tell the PCI core about host bridge address translation so it can take
care of bus-to-resource conversion for us.

CC: Russell King <linux@arm.linux.org.uk>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent c04d9e35
Loading
Loading
Loading
Loading
+2 −2
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;
	}

	pci_add_resource(&sys->resources, &it8152_io);
	pci_add_resource(&sys->resources, &it8152_mem);
	pci_add_resource_offset(&sys->resources, &it8152_io, sys->io_offset);
	pci_add_resource_offset(&sys->resources, &it8152_mem, sys->mem_offset);

	if (platform_notify || platform_notify_remove) {
		printk(KERN_ERR "PCI: Can't use platform_notify\n");
+1 −7
Original line number Diff line number Diff line
@@ -57,13 +57,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                               enum pci_mmap_state mmap_state, int write_combine);

extern void
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
			 struct resource *res);

extern void
pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
			struct pci_bus_region *region);
#define ARCH_HAS_GENERIC_PCI_OFFSETS

/*
 * Dummy implementation; always return 0.
+4 −65
Original line number Diff line number Diff line
@@ -293,28 +293,6 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev)

}

/*
 * Adjust the device resources from bus-centric to Linux-centric.
 */
static void __devinit
pdev_fixup_device_resources(struct pci_sys_data *root, struct pci_dev *dev)
{
	resource_size_t offset;
	int i;

	for (i = 0; i < PCI_NUM_RESOURCES; i++) {
		if (dev->resource[i].start == 0)
			continue;
		if (dev->resource[i].flags & IORESOURCE_MEM)
			offset = root->mem_offset;
		else
			offset = root->io_offset;

		dev->resource[i].start += offset;
		dev->resource[i].end   += offset;
	}
}

/*
 * pcibios_fixup_bus - Called after each bus is probed,
 * but before its children are examined.
@@ -332,8 +310,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
	list_for_each_entry(dev, &bus->devices, bus_list) {
		u16 status;

		pdev_fixup_device_resources(root, dev);

		pci_read_config_word(dev, PCI_STATUS, &status);

		/*
@@ -398,43 +374,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
EXPORT_SYMBOL(pcibios_fixup_bus);
#endif

/*
 * Convert from Linux-centric to bus-centric addresses for bridge devices.
 */
void
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
			 struct resource *res)
{
	struct pci_sys_data *root = dev->sysdata;
	unsigned long offset = 0;

	if (res->flags & IORESOURCE_IO)
		offset = root->io_offset;
	if (res->flags & IORESOURCE_MEM)
		offset = root->mem_offset;

	region->start = res->start - offset;
	region->end   = res->end - offset;
}
EXPORT_SYMBOL(pcibios_resource_to_bus);

void __devinit
pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
			struct pci_bus_region *region)
{
	struct pci_sys_data *root = dev->sysdata;
	unsigned long offset = 0;

	if (res->flags & IORESOURCE_IO)
		offset = root->io_offset;
	if (res->flags & IORESOURCE_MEM)
		offset = root->mem_offset;

	res->start = region->start + offset;
	res->end   = region->end + offset;
}
EXPORT_SYMBOL(pcibios_bus_to_resource);

/*
 * Swizzle the device pin each time we cross a bridge.
 * This might update pin and returns the slot number.
@@ -496,10 +435,10 @@ static void __init pcibios_init_hw(struct hw_pci *hw)

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

			sys->bus = hw->scan(nr, sys);
+2 −2
Original line number Diff line number Diff line
@@ -155,8 +155,8 @@ static int cns3xxx_pci_setup(int nr, struct pci_sys_data *sys)
	BUG_ON(request_resource(&iomem_resource, res_io) ||
	       request_resource(&iomem_resource, res_mem));

	pci_add_resource(&sys->resources, res_io);
	pci_add_resource(&sys->resources, res_mem);
	pci_add_resource_offset(&sys->resources, res_io, sys->io_offset);
	pci_add_resource_offset(&sys->resources, res_mem, sys->mem_offset);

	return 1;
}
+2 −2
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
	pp->res[0].flags = IORESOURCE_IO;
	if (request_resource(&ioport_resource, &pp->res[0]))
		panic("Request PCIe IO resource failed\n");
	pci_add_resource(&sys->resources, &pp->res[0]);
	pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset);

	/*
	 * IORESOURCE_MEM
@@ -88,7 +88,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
	pp->res[1].flags = IORESOURCE_MEM;
	if (request_resource(&iomem_resource, &pp->res[1]))
		panic("Request PCIe Memory resource failed\n");
	pci_add_resource(&sys->resources, &pp->res[1]);
	pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset);

	return 1;
}
Loading