.. | .. |
---|
32 | 32 | #include <linux/pci.h> |
---|
33 | 33 | #include <linux/init.h> |
---|
34 | 34 | #include <linux/reboot.h> |
---|
35 | | -#include <linux/bootmem.h> |
---|
| 35 | +#include <linux/memblock.h> |
---|
36 | 36 | #include <linux/bitops.h> |
---|
37 | 37 | |
---|
38 | 38 | #include <asm/ptrace.h> |
---|
.. | .. |
---|
40 | 40 | #include <asm/irq.h> |
---|
41 | 41 | #include <asm/mmu_context.h> |
---|
42 | 42 | #include <asm/io.h> |
---|
43 | | -#include <asm/pgtable.h> |
---|
44 | 43 | #include <asm/core_irongate.h> |
---|
45 | 44 | #include <asm/hwrpb.h> |
---|
46 | 45 | #include <asm/tlbflush.h> |
---|
.. | .. |
---|
187 | 186 | |
---|
188 | 187 | extern void pcibios_claim_one_bus(struct pci_bus *); |
---|
189 | 188 | |
---|
190 | | -static struct resource irongate_io = { |
---|
191 | | - .name = "Irongate PCI IO", |
---|
192 | | - .flags = IORESOURCE_IO, |
---|
193 | | -}; |
---|
194 | 189 | static struct resource irongate_mem = { |
---|
195 | 190 | .name = "Irongate PCI MEM", |
---|
196 | 191 | .flags = IORESOURCE_MEM, |
---|
.. | .. |
---|
208 | 203 | struct pci_controller *hose = hose_head; |
---|
209 | 204 | struct pci_host_bridge *bridge; |
---|
210 | 205 | struct pci_bus *bus; |
---|
211 | | - struct pci_dev *irongate; |
---|
212 | 206 | unsigned long bus_align, bus_size, pci_mem; |
---|
213 | 207 | unsigned long memtop = max_low_pfn << PAGE_SHIFT; |
---|
214 | | - int ret; |
---|
215 | 208 | |
---|
216 | 209 | bridge = pci_alloc_host_bridge(0); |
---|
217 | 210 | if (!bridge) |
---|
218 | 211 | return; |
---|
219 | 212 | |
---|
| 213 | + /* Use default IO. */ |
---|
220 | 214 | pci_add_resource(&bridge->windows, &ioport_resource); |
---|
221 | | - pci_add_resource(&bridge->windows, &iomem_resource); |
---|
| 215 | + /* Irongate PCI memory aperture, calculate requred size before |
---|
| 216 | + setting it up. */ |
---|
| 217 | + pci_add_resource(&bridge->windows, &irongate_mem); |
---|
| 218 | + |
---|
222 | 219 | pci_add_resource(&bridge->windows, &busn_resource); |
---|
223 | 220 | bridge->dev.parent = NULL; |
---|
224 | 221 | bridge->sysdata = hose; |
---|
.. | .. |
---|
226 | 223 | bridge->ops = alpha_mv.pci_ops; |
---|
227 | 224 | bridge->swizzle_irq = alpha_mv.pci_swizzle; |
---|
228 | 225 | bridge->map_irq = alpha_mv.pci_map_irq; |
---|
| 226 | + bridge->size_windows = 1; |
---|
229 | 227 | |
---|
230 | 228 | /* Scan our single hose. */ |
---|
231 | | - ret = pci_scan_root_bus_bridge(bridge); |
---|
232 | | - if (ret) { |
---|
| 229 | + if (pci_scan_root_bus_bridge(bridge)) { |
---|
233 | 230 | pci_free_host_bridge(bridge); |
---|
234 | 231 | return; |
---|
235 | 232 | } |
---|
236 | | - |
---|
237 | 233 | bus = hose->bus = bridge->bus; |
---|
238 | 234 | pcibios_claim_one_bus(bus); |
---|
239 | 235 | |
---|
240 | | - irongate = pci_get_domain_bus_and_slot(pci_domain_nr(bus), 0, 0); |
---|
241 | | - bus->self = irongate; |
---|
242 | | - bus->resource[0] = &irongate_io; |
---|
243 | | - bus->resource[1] = &irongate_mem; |
---|
244 | | - |
---|
245 | 236 | pci_bus_size_bridges(bus); |
---|
246 | 237 | |
---|
247 | | - /* IO port range. */ |
---|
248 | | - bus->resource[0]->start = 0; |
---|
249 | | - bus->resource[0]->end = 0xffff; |
---|
250 | | - |
---|
251 | | - /* Set up PCI memory range - limit is hardwired to 0xffffffff, |
---|
252 | | - base must be at aligned to 16Mb. */ |
---|
253 | | - bus_align = bus->resource[1]->start; |
---|
254 | | - bus_size = bus->resource[1]->end + 1 - bus_align; |
---|
| 238 | + /* Now we've got the size and alignment of PCI memory resources |
---|
| 239 | + stored in irongate_mem. Set up the PCI memory range: limit is |
---|
| 240 | + hardwired to 0xffffffff, base must be aligned to 16Mb. */ |
---|
| 241 | + bus_align = irongate_mem.start; |
---|
| 242 | + bus_size = irongate_mem.end + 1 - bus_align; |
---|
255 | 243 | if (bus_align < 0x1000000UL) |
---|
256 | 244 | bus_align = 0x1000000UL; |
---|
257 | 245 | |
---|
258 | 246 | pci_mem = (0x100000000UL - bus_size) & -bus_align; |
---|
| 247 | + irongate_mem.start = pci_mem; |
---|
| 248 | + irongate_mem.end = 0xffffffffUL; |
---|
259 | 249 | |
---|
260 | | - bus->resource[1]->start = pci_mem; |
---|
261 | | - bus->resource[1]->end = 0xffffffffUL; |
---|
262 | | - if (request_resource(&iomem_resource, bus->resource[1]) < 0) |
---|
| 250 | + /* Register our newly calculated PCI memory window in the resource |
---|
| 251 | + tree. */ |
---|
| 252 | + if (request_resource(&iomem_resource, &irongate_mem) < 0) |
---|
263 | 253 | printk(KERN_ERR "Failed to request MEM on hose 0\n"); |
---|
| 254 | + |
---|
| 255 | + printk(KERN_INFO "Irongate pci_mem %pR\n", &irongate_mem); |
---|
264 | 256 | |
---|
265 | 257 | if (pci_mem < memtop) |
---|
266 | 258 | memtop = pci_mem; |
---|
267 | 259 | if (memtop > alpha_mv.min_mem_address) { |
---|
268 | 260 | free_reserved_area(__va(alpha_mv.min_mem_address), |
---|
269 | 261 | __va(memtop), -1, NULL); |
---|
270 | | - printk("nautilus_init_pci: %ldk freed\n", |
---|
| 262 | + printk(KERN_INFO "nautilus_init_pci: %ldk freed\n", |
---|
271 | 263 | (memtop - alpha_mv.min_mem_address) >> 10); |
---|
272 | 264 | } |
---|
273 | | - |
---|
274 | 265 | if ((IRONGATE0->dev_vendor >> 16) > 0x7006) /* Albacore? */ |
---|
275 | 266 | IRONGATE0->pci_mem = pci_mem; |
---|
276 | 267 | |
---|
277 | 268 | pci_bus_assign_resources(bus); |
---|
278 | | - |
---|
279 | | - /* pci_common_swizzle() relies on bus->self being NULL |
---|
280 | | - for the root bus, so just clear it. */ |
---|
281 | | - bus->self = NULL; |
---|
282 | 269 | pci_bus_add_devices(bus); |
---|
283 | 270 | } |
---|
284 | 271 | |
---|