diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2011-10-28 18:27:38 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-01-06 15:11:08 -0500 |
commit | 49a6cba4eb165dba65221eea4d555ec8a7c85800 (patch) | |
tree | c7dc82688aa131ff9dd0d52118a813cb36e55252 /arch/powerpc/kernel | |
parent | a46770f5b97ec8d04292db797fbcad795b98cf03 (diff) |
powerpc/PCI: split PHB part out of pcibios_map_io_space()
No functional change. This is so we can use pcibios_phb_map_io_space()
before we have a struct pci_bus.
v2: fix map io phb typo
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index bcf4bf9e72d9..3318d39b7d4c 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -131,30 +131,13 @@ EXPORT_SYMBOL_GPL(pcibios_unmap_io_space); | |||
131 | 131 | ||
132 | #endif /* CONFIG_HOTPLUG */ | 132 | #endif /* CONFIG_HOTPLUG */ |
133 | 133 | ||
134 | int __devinit pcibios_map_io_space(struct pci_bus *bus) | 134 | static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose) |
135 | { | 135 | { |
136 | struct vm_struct *area; | 136 | struct vm_struct *area; |
137 | unsigned long phys_page; | 137 | unsigned long phys_page; |
138 | unsigned long size_page; | 138 | unsigned long size_page; |
139 | unsigned long io_virt_offset; | 139 | unsigned long io_virt_offset; |
140 | struct pci_controller *hose; | ||
141 | |||
142 | WARN_ON(bus == NULL); | ||
143 | |||
144 | /* If this not a PHB, nothing to do, page tables still exist and | ||
145 | * thus HPTEs will be faulted in when needed | ||
146 | */ | ||
147 | if (bus->self) { | ||
148 | pr_debug("IO mapping for PCI-PCI bridge %s\n", | ||
149 | pci_name(bus->self)); | ||
150 | pr_debug(" virt=0x%016llx...0x%016llx\n", | ||
151 | bus->resource[0]->start + _IO_BASE, | ||
152 | bus->resource[0]->end + _IO_BASE); | ||
153 | return 0; | ||
154 | } | ||
155 | 140 | ||
156 | /* Get the host bridge */ | ||
157 | hose = pci_bus_to_host(bus); | ||
158 | phys_page = _ALIGN_DOWN(hose->io_base_phys, PAGE_SIZE); | 141 | phys_page = _ALIGN_DOWN(hose->io_base_phys, PAGE_SIZE); |
159 | size_page = _ALIGN_UP(hose->pci_io_size, PAGE_SIZE); | 142 | size_page = _ALIGN_UP(hose->pci_io_size, PAGE_SIZE); |
160 | 143 | ||
@@ -198,11 +181,30 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus) | |||
198 | 181 | ||
199 | return 0; | 182 | return 0; |
200 | } | 183 | } |
184 | |||
185 | int __devinit pcibios_map_io_space(struct pci_bus *bus) | ||
186 | { | ||
187 | WARN_ON(bus == NULL); | ||
188 | |||
189 | /* If this not a PHB, nothing to do, page tables still exist and | ||
190 | * thus HPTEs will be faulted in when needed | ||
191 | */ | ||
192 | if (bus->self) { | ||
193 | pr_debug("IO mapping for PCI-PCI bridge %s\n", | ||
194 | pci_name(bus->self)); | ||
195 | pr_debug(" virt=0x%016llx...0x%016llx\n", | ||
196 | bus->resource[0]->start + _IO_BASE, | ||
197 | bus->resource[0]->end + _IO_BASE); | ||
198 | return 0; | ||
199 | } | ||
200 | |||
201 | return pcibios_map_phb_io_space(pci_bus_to_host(bus)); | ||
202 | } | ||
201 | EXPORT_SYMBOL_GPL(pcibios_map_io_space); | 203 | EXPORT_SYMBOL_GPL(pcibios_map_io_space); |
202 | 204 | ||
203 | void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose) | 205 | void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose) |
204 | { | 206 | { |
205 | pcibios_map_io_space(hose->bus); | 207 | pcibios_map_phb_io_space(hose); |
206 | } | 208 | } |
207 | 209 | ||
208 | #define IOBASE_BRIDGE_NUMBER 0 | 210 | #define IOBASE_BRIDGE_NUMBER 0 |