hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/alpha/kernel/sys_nautilus.c
....@@ -32,7 +32,7 @@
3232 #include <linux/pci.h>
3333 #include <linux/init.h>
3434 #include <linux/reboot.h>
35
-#include <linux/bootmem.h>
35
+#include <linux/memblock.h>
3636 #include <linux/bitops.h>
3737
3838 #include <asm/ptrace.h>
....@@ -40,7 +40,6 @@
4040 #include <asm/irq.h>
4141 #include <asm/mmu_context.h>
4242 #include <asm/io.h>
43
-#include <asm/pgtable.h>
4443 #include <asm/core_irongate.h>
4544 #include <asm/hwrpb.h>
4645 #include <asm/tlbflush.h>
....@@ -187,10 +186,6 @@
187186
188187 extern void pcibios_claim_one_bus(struct pci_bus *);
189188
190
-static struct resource irongate_io = {
191
- .name = "Irongate PCI IO",
192
- .flags = IORESOURCE_IO,
193
-};
194189 static struct resource irongate_mem = {
195190 .name = "Irongate PCI MEM",
196191 .flags = IORESOURCE_MEM,
....@@ -208,17 +203,19 @@
208203 struct pci_controller *hose = hose_head;
209204 struct pci_host_bridge *bridge;
210205 struct pci_bus *bus;
211
- struct pci_dev *irongate;
212206 unsigned long bus_align, bus_size, pci_mem;
213207 unsigned long memtop = max_low_pfn << PAGE_SHIFT;
214
- int ret;
215208
216209 bridge = pci_alloc_host_bridge(0);
217210 if (!bridge)
218211 return;
219212
213
+ /* Use default IO. */
220214 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
+
222219 pci_add_resource(&bridge->windows, &busn_resource);
223220 bridge->dev.parent = NULL;
224221 bridge->sysdata = hose;
....@@ -226,59 +223,49 @@
226223 bridge->ops = alpha_mv.pci_ops;
227224 bridge->swizzle_irq = alpha_mv.pci_swizzle;
228225 bridge->map_irq = alpha_mv.pci_map_irq;
226
+ bridge->size_windows = 1;
229227
230228 /* Scan our single hose. */
231
- ret = pci_scan_root_bus_bridge(bridge);
232
- if (ret) {
229
+ if (pci_scan_root_bus_bridge(bridge)) {
233230 pci_free_host_bridge(bridge);
234231 return;
235232 }
236
-
237233 bus = hose->bus = bridge->bus;
238234 pcibios_claim_one_bus(bus);
239235
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
-
245236 pci_bus_size_bridges(bus);
246237
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;
255243 if (bus_align < 0x1000000UL)
256244 bus_align = 0x1000000UL;
257245
258246 pci_mem = (0x100000000UL - bus_size) & -bus_align;
247
+ irongate_mem.start = pci_mem;
248
+ irongate_mem.end = 0xffffffffUL;
259249
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)
263253 printk(KERN_ERR "Failed to request MEM on hose 0\n");
254
+
255
+ printk(KERN_INFO "Irongate pci_mem %pR\n", &irongate_mem);
264256
265257 if (pci_mem < memtop)
266258 memtop = pci_mem;
267259 if (memtop > alpha_mv.min_mem_address) {
268260 free_reserved_area(__va(alpha_mv.min_mem_address),
269261 __va(memtop), -1, NULL);
270
- printk("nautilus_init_pci: %ldk freed\n",
262
+ printk(KERN_INFO "nautilus_init_pci: %ldk freed\n",
271263 (memtop - alpha_mv.min_mem_address) >> 10);
272264 }
273
-
274265 if ((IRONGATE0->dev_vendor >> 16) > 0x7006) /* Albacore? */
275266 IRONGATE0->pci_mem = pci_mem;
276267
277268 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;
282269 pci_bus_add_devices(bus);
283270 }
284271