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

Commit 2613ba48 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Bjorn Helgaas
Browse files

PCI: mvebu: Call request_resource() on the apertures



It is typical for host drivers to request a resource for the aperture; once
this is done the PCI core will properly populate resources for all BARs in
the system.

With this patch cat /proc/iomem will now show:

  e0000000-efffffff : PCI MEM 0000
    e0000000-e00fffff : PCI Bus 0000:01
      e0000000-e001ffff : 0000:01:00.0

Tested on Kirkwood.

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarJason Cooper <jason@lakedaemon.net>
parent a723e752
Loading
Loading
Loading
Loading
+23 −1
Original line number Original line Diff line number Diff line
@@ -101,7 +101,9 @@ struct mvebu_pcie {
	struct mvebu_pcie_port *ports;
	struct mvebu_pcie_port *ports;
	struct msi_chip *msi;
	struct msi_chip *msi;
	struct resource io;
	struct resource io;
	char io_name[30];
	struct resource realio;
	struct resource realio;
	char mem_name[30];
	struct resource mem;
	struct resource mem;
	struct resource busn;
	struct resource busn;
	int nports;
	int nports;
@@ -672,10 +674,30 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
{
{
	struct mvebu_pcie *pcie = sys_to_pcie(sys);
	struct mvebu_pcie *pcie = sys_to_pcie(sys);
	int i;
	int i;
	int domain = 0;


	if (resource_size(&pcie->realio) != 0)
#ifdef CONFIG_PCI_DOMAINS
	domain = sys->domain;
#endif

	snprintf(pcie->mem_name, sizeof(pcie->mem_name), "PCI MEM %04x",
		 domain);
	pcie->mem.name = pcie->mem_name;

	snprintf(pcie->io_name, sizeof(pcie->io_name), "PCI I/O %04x", domain);
	pcie->realio.name = pcie->io_name;

	if (request_resource(&iomem_resource, &pcie->mem))
		return 0;

	if (resource_size(&pcie->realio) != 0) {
		if (request_resource(&ioport_resource, &pcie->realio)) {
			release_resource(&pcie->mem);
			return 0;
		}
		pci_add_resource_offset(&sys->resources, &pcie->realio,
		pci_add_resource_offset(&sys->resources, &pcie->realio,
					sys->io_offset);
					sys->io_offset);
	}
	pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset);
	pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset);
	pci_add_resource(&sys->resources, &pcie->busn);
	pci_add_resource(&sys->resources, &pcie->busn);