diff options
author | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> | 2014-02-12 17:57:08 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-02-18 15:35:20 -0500 |
commit | 2613ba480fb7b40c67eea36d03c9946977828623 (patch) | |
tree | 11fde1037ae883acd15637fb17f3f352726f42b5 /drivers/pci | |
parent | a723e7523c140423ddb450d2ba5c3ba44b003c69 (diff) |
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: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/host/pci-mvebu.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 05e352889868..d3d1cfd51e09 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -101,7 +101,9 @@ struct mvebu_pcie { | |||
101 | struct mvebu_pcie_port *ports; | 101 | struct mvebu_pcie_port *ports; |
102 | struct msi_chip *msi; | 102 | struct msi_chip *msi; |
103 | struct resource io; | 103 | struct resource io; |
104 | char io_name[30]; | ||
104 | struct resource realio; | 105 | struct resource realio; |
106 | char mem_name[30]; | ||
105 | struct resource mem; | 107 | struct resource mem; |
106 | struct resource busn; | 108 | struct resource busn; |
107 | int nports; | 109 | int nports; |
@@ -672,10 +674,30 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys) | |||
672 | { | 674 | { |
673 | struct mvebu_pcie *pcie = sys_to_pcie(sys); | 675 | struct mvebu_pcie *pcie = sys_to_pcie(sys); |
674 | int i; | 676 | int i; |
677 | int domain = 0; | ||
675 | 678 | ||
676 | if (resource_size(&pcie->realio) != 0) | 679 | #ifdef CONFIG_PCI_DOMAINS |
680 | domain = sys->domain; | ||
681 | #endif | ||
682 | |||
683 | snprintf(pcie->mem_name, sizeof(pcie->mem_name), "PCI MEM %04x", | ||
684 | domain); | ||
685 | pcie->mem.name = pcie->mem_name; | ||
686 | |||
687 | snprintf(pcie->io_name, sizeof(pcie->io_name), "PCI I/O %04x", domain); | ||
688 | pcie->realio.name = pcie->io_name; | ||
689 | |||
690 | if (request_resource(&iomem_resource, &pcie->mem)) | ||
691 | return 0; | ||
692 | |||
693 | if (resource_size(&pcie->realio) != 0) { | ||
694 | if (request_resource(&ioport_resource, &pcie->realio)) { | ||
695 | release_resource(&pcie->mem); | ||
696 | return 0; | ||
697 | } | ||
677 | pci_add_resource_offset(&sys->resources, &pcie->realio, | 698 | pci_add_resource_offset(&sys->resources, &pcie->realio, |
678 | sys->io_offset); | 699 | sys->io_offset); |
700 | } | ||
679 | pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset); | 701 | pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset); |
680 | pci_add_resource(&sys->resources, &pcie->busn); | 702 | pci_add_resource(&sys->resources, &pcie->busn); |
681 | 703 | ||