MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / pci / setup-bus.c
blob855ce05a12d5601d2922bb645bd23900f2b538cd
1 /*
2 * drivers/pci/setup-bus.c
4 * Extruded from code written by
5 * Dave Rusling (david.rusling@reo.mts.dec.com)
6 * David Mosberger (davidm@cs.arizona.edu)
7 * David Miller (davem@redhat.com)
9 * Support routines for initializing a PCI subsystem.
13 * Nov 2000, Ivan Kokshaysky <ink@jurassic.park.msu.ru>
14 * PCI-PCI bridges cleanup, sorted resource allocation.
15 * Feb 2002, Ivan Kokshaysky <ink@jurassic.park.msu.ru>
16 * Converted to allocation in 3 passes, which gives
17 * tighter packing. Prefetchable range support.
20 #include <linux/init.h>
21 #include <linux/kernel.h>
22 #include <linux/module.h>
23 #include <linux/pci.h>
24 #include <linux/errno.h>
25 #include <linux/ioport.h>
26 #include <linux/cache.h>
27 #include <linux/slab.h>
28 #include <linux/config.h>
30 #define DEBUG_CONFIG 1
31 #if DEBUG_CONFIG
32 # define DBGC(args) printk args
33 #else
34 # define DBGC(args)
35 #endif
37 #define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
40 * FIXME: IO should be max 256 bytes. However, since we may
41 * have a P2P bridge below a cardbus bridge, we need 4K.
43 #define CARDBUS_IO_SIZE (4096)
44 #ifdef CONFIG_ARCH_MOXACPU // add by Victor Yu. 01-05-2006
45 #define CARDBUS_MEM_SIZE (4*1024*1024)
46 #else
47 #define CARDBUS_MEM_SIZE (32*1024*1024)
48 #endif
50 static void __devinit
51 pbus_assign_resources_sorted(struct pci_bus *bus)
53 struct pci_dev *dev;
54 struct resource *res;
55 struct resource_list head, *list, *tmp;
56 int idx;
58 bus->bridge_ctl &= ~PCI_BRIDGE_CTL_VGA;
60 head.next = NULL;
61 list_for_each_entry(dev, &bus->devices, bus_list) {
62 u16 class = dev->class >> 8;
64 if (class == PCI_CLASS_DISPLAY_VGA
65 || class == PCI_CLASS_NOT_DEFINED_VGA)
66 bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
68 pdev_sort_resources(dev, &head);
71 for (list = head.next; list;) {
72 res = list->res;
73 idx = res - &list->dev->resource[0];
74 pci_assign_resource(list->dev, idx);
75 tmp = list;
76 list = list->next;
77 kfree(tmp);
81 static void __devinit
82 pci_setup_cardbus(struct pci_bus *bus)
84 struct pci_dev *bridge = bus->self;
85 struct pci_bus_region region;
87 printk("PCI: Bus %d, cardbus bridge: %s\n",
88 bus->number, pci_name(bridge));
90 #if 0 // This is a bug. It will not match PCMCIA device driver. Victor Yu. 01-11-2006
91 pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
92 if (bus->resource[0]->flags & IORESOURCE_IO) {
93 #else
94 pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
95 if (bus->resource[2]->flags & IORESOURCE_IO) {
96 #endif
98 * The IO resource is allocated a range twice as large as it
99 * would normally need. This allows us to set both IO regs.
101 printk(" IO window: %08lx-%08lx\n",
102 region.start, region.end);
103 #ifdef CONFIG_ARCH_MOXACPU // add by Victor Yu. 01-10-2006
104 pci_write_config_dword(bridge, PCI_CB_IO_BASE_0,
105 PHY_ADDRESS(region.start));
106 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0,
107 PHY_ADDRESS(region.end));
108 #else
109 pci_write_config_dword(bridge, PCI_CB_IO_BASE_0,
110 region.start);
111 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0,
112 region.end);
113 #endif
116 #if 0 // This is a bug. It will not match PCMCIA device driver. Victor Yu. 01-11-2006
117 pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
118 if (bus->resource[1]->flags & IORESOURCE_IO) {
119 #else
120 pcibios_resource_to_bus(bridge, &region, bus->resource[3]);
121 if (bus->resource[3]->flags & IORESOURCE_IO) {
122 #endif
123 printk(" IO window: %08lx-%08lx\n",
124 region.start, region.end);
125 #ifdef CONFIG_ARCH_MOXACPU // add by Victor Yu. 01-10-2006
126 pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
127 PHY_ADDRESS(region.start));
128 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1,
129 PHY_ADDRESS(region.end));
130 #else
131 pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
132 region.start);
133 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1,
134 region.end);
135 #endif
138 #if 0 // This is a bug. It will not match PCMCIA device driver. Victor Yu. 01-11-2006
139 pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
140 if (bus->resource[2]->flags & IORESOURCE_MEM) {
141 #else
142 pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
143 if (bus->resource[0]->flags & IORESOURCE_MEM) {
144 #endif
145 printk(" PREFETCH window: %08lx-%08lx\n",
146 region.start, region.end);
147 #ifdef CONFIG_ARCH_MOXACPU // add by Victor Yu. 01-10-2006
148 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
149 MEM_PHY_ADDRESS(region.start));
150 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0,
151 MEM_PHY_ADDRESS(region.end));
152 #else
153 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
154 region.start);
155 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0,
156 region.end);
157 #endif
160 #if 0 // This is a bug. It will not match PCMCIA device driver. Victor Yu. 01-11-2006
161 pcibios_resource_to_bus(bridge, &region, bus->resource[3]);
162 if (bus->resource[3]->flags & IORESOURCE_MEM) {
163 #else
164 pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
165 if (bus->resource[1]->flags & IORESOURCE_MEM) {
166 #endif
167 printk(" MEM window: %08lx-%08lx\n",
168 region.start, region.end);
169 #ifdef CONFIG_ARCH_MOXACPU // add by Victor Yu. 01-10-2006
170 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
171 MEM_PHY_ADDRESS(region.start));
172 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1,
173 MEM_PHY_ADDRESS(region.end));
174 #else
175 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
176 region.start);
177 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1,
178 region.end);
179 #endif
183 /* Initialize bridges with base/limit values we have collected.
184 PCI-to-PCI Bridge Architecture Specification rev. 1.1 (1998)
185 requires that if there is no I/O ports or memory behind the
186 bridge, corresponding range must be turned off by writing base
187 value greater than limit to the bridge's base/limit registers.
189 Note: care must be taken when updating I/O base/limit registers
190 of bridges which support 32-bit I/O. This update requires two
191 config space writes, so it's quite possible that an I/O window of
192 the bridge will have some undesirable address (e.g. 0) after the
193 first write. Ditto 64-bit prefetchable MMIO. */
194 static void __devinit
195 pci_setup_bridge(struct pci_bus *bus)
197 struct pci_dev *bridge = bus->self;
198 struct pci_bus_region region;
199 u32 l, io_upper16;
201 DBGC((KERN_INFO "PCI: Bus %d, bridge: %s\n",
202 bus->number, pci_name(bridge)));
204 /* Set up the top and bottom of the PCI I/O segment for this bus. */
205 pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
206 if (bus->resource[0]->flags & IORESOURCE_IO) {
207 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
208 l &= 0xffff0000;
209 l |= (PHY_ADDRESS(region.start) >> 8) & 0x00f0;
210 l |= PHY_ADDRESS(region.end) & 0xf000;
211 /* Set up upper 16 bits of I/O base/limit. */
212 io_upper16 = (PHY_ADDRESS(region.end) & 0xffff0000) | (PHY_ADDRESS(region.start) >> 16);
213 DBGC((KERN_INFO " IO window: %04lx-%04lx\n",
214 PHY_ADDRESS(region.start), PHY_ADDRESS(region.end)));
216 else {
217 /* Clear upper 16 bits of I/O base/limit. */
218 io_upper16 = 0;
219 l = 0x00f0;
220 //#endif
221 DBGC((KERN_INFO " IO window: disabled.\n"));
223 /* Temporarily disable the I/O range before updating PCI_IO_BASE. */
224 pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff);
225 /* Update lower 16 bits of I/O base/limit. */
226 pci_write_config_dword(bridge, PCI_IO_BASE, l);
227 /* Update upper 16 bits of I/O base/limit. */
228 pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, io_upper16);
230 /* Set up the top and bottom of the PCI Memory segment
231 for this bus. */
232 pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
233 if (bus->resource[1]->flags & IORESOURCE_MEM) {
234 l = (MEM_PHY_ADDRESS(region.start) >> 16) & 0xfff0;
235 l |= MEM_PHY_ADDRESS(region.end) & 0xfff00000;
236 DBGC((KERN_INFO " MEM window: %08lx-%08lx\n",
237 MEM_PHY_ADDRESS(region.start), MEM_PHY_ADDRESS(region.end)));
239 else {
240 l = 0x0000fff0;
241 DBGC((KERN_INFO " MEM window: disabled.\n"));
244 pci_write_config_dword(bridge, PCI_MEMORY_BASE, l);
246 /* Clear out the upper 32 bits of PREF limit.
247 If PCI_PREF_BASE_UPPER32 was non-zero, this temporarily
248 disables PREF range, which is ok. */
249 pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, 0);
251 /* Set up PREF base/limit. */
252 pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
253 if (bus->resource[2]->flags & IORESOURCE_PREFETCH) {
254 l = (region.start >> 16) & 0xfff0;
255 l |= region.end & 0xfff00000;
256 DBGC((KERN_INFO " PREFETCH window: %08lx-%08lx\n",
257 region.start, region.end));
259 else {
260 l = 0x0000fff0;
261 DBGC((KERN_INFO " PREFETCH window: disabled.\n"));
263 pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
265 /* Clear out the upper 32 bits of PREF base. */
266 pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, 0);
268 pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl);
271 /* Check whether the bridge supports optional I/O and
272 prefetchable memory ranges. If not, the respective
273 base/limit registers must be read-only and read as 0. */
274 static void __devinit
275 pci_bridge_check_ranges(struct pci_bus *bus)
277 u16 io;
278 u32 pmem;
279 struct pci_dev *bridge = bus->self;
280 struct resource *b_res;
282 b_res = &bridge->resource[PCI_BRIDGE_RESOURCES];
283 b_res[1].flags |= IORESOURCE_MEM;
285 pci_read_config_word(bridge, PCI_IO_BASE, &io);
286 if (!io) {
287 pci_write_config_word(bridge, PCI_IO_BASE, 0xf0f0);
288 pci_read_config_word(bridge, PCI_IO_BASE, &io);
289 pci_write_config_word(bridge, PCI_IO_BASE, 0x0);
291 if (io)
292 b_res[0].flags |= IORESOURCE_IO;
293 /* DECchip 21050 pass 2 errata: the bridge may miss an address
294 disconnect boundary by one PCI data phase.
295 Workaround: do not use prefetching on this device. */
296 if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001)
297 return;
298 pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
299 if (!pmem) {
300 pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE,
301 0xfff0fff0);
302 pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem);
303 pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0);
305 if (pmem)
306 b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
309 /* Helper function for sizing routines: find first available
310 bus resource of a given type. Note: we intentionally skip
311 the bus resources which have already been assigned (that is,
312 have non-NULL parent resource). */
313 static struct resource * __devinit
314 find_free_bus_resource(struct pci_bus *bus, unsigned long type)
316 int i;
317 struct resource *r;
318 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
319 IORESOURCE_PREFETCH;
321 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
322 r = bus->resource[i];
323 if (r && (r->flags & type_mask) == type && !r->parent)
324 return r;
326 return NULL;
329 /* Sizing the IO windows of the PCI-PCI bridge is trivial,
330 since these windows have 4K granularity and the IO ranges
331 of non-bridge PCI devices are limited to 256 bytes.
332 We must be careful with the ISA aliasing though. */
333 static void __devinit
334 pbus_size_io(struct pci_bus *bus)
336 struct pci_dev *dev;
337 struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO);
338 unsigned long size = 0, size1 = 0;
340 if (!b_res)
341 return;
343 list_for_each_entry(dev, &bus->devices, bus_list) {
344 int i;
346 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
347 struct resource *r = &dev->resource[i];
348 unsigned long r_size;
350 if (r->parent || !(r->flags & IORESOURCE_IO))
351 continue;
352 r_size = r->end - r->start + 1;
354 if (r_size < 0x400)
355 /* Might be re-aligned for ISA */
356 size += r_size;
357 else
358 size1 += r_size;
361 /* To be fixed in 2.5: we should have sort of HAVE_ISA
362 flag in the struct pci_bus. */
363 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
364 size = (size & 0xff) + ((size & ~0xffUL) << 2);
365 #endif
366 size = ROUND_UP(size + size1, 4096);
367 if (!size) {
368 b_res->flags = 0;
369 return;
371 /* Alignment of the IO window is always 4K */
372 b_res->start = 4096;
373 b_res->end = b_res->start + size - 1;
376 /* Calculate the size of the bus and minimal alignment which
377 guarantees that all child resources fit in this size. */
378 static int __devinit
379 pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
381 struct pci_dev *dev;
382 unsigned long min_align, align, size;
383 unsigned long aligns[12]; /* Alignments from 1Mb to 2Gb */
384 int order, max_order;
385 struct resource *b_res = find_free_bus_resource(bus, type);
387 if (!b_res)
388 return 0;
390 memset(aligns, 0, sizeof(aligns));
391 max_order = 0;
392 size = 0;
394 list_for_each_entry(dev, &bus->devices, bus_list) {
395 int i;
397 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
398 struct resource *r = &dev->resource[i];
399 unsigned long r_size;
401 if (r->parent || (r->flags & mask) != type)
402 continue;
403 r_size = r->end - r->start + 1;
404 /* For bridges size != alignment */
405 align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start;
406 order = __ffs(align) - 20;
407 if (order > 11) {
408 printk(KERN_WARNING "PCI: region %s/%d "
409 "too large: %lx-%lx\n",
410 pci_name(dev), i, r->start, r->end);
411 r->flags = 0;
412 continue;
414 size += r_size;
415 if (order < 0)
416 order = 0;
417 /* Exclude ranges with size > align from
418 calculation of the alignment. */
419 if (r_size == align)
420 aligns[order] += align;
421 if (order > max_order)
422 max_order = order;
426 align = 0;
427 min_align = 0;
428 for (order = 0; order <= max_order; order++) {
429 unsigned long align1 = 1UL << (order + 20);
431 if (!align)
432 min_align = align1;
433 else if (ROUND_UP(align + min_align, min_align) < align1)
434 min_align = align1 >> 1;
435 align += aligns[order];
437 size = ROUND_UP(size, min_align);
438 if (!size) {
439 b_res->flags = 0;
440 return 1;
442 b_res->start = min_align;
443 b_res->end = size + min_align - 1;
444 return 1;
447 static void __devinit
448 pci_bus_size_cardbus(struct pci_bus *bus)
450 struct pci_dev *bridge = bus->self;
451 struct resource *b_res = &bridge->resource[PCI_BRIDGE_RESOURCES];
452 u16 ctrl;
455 * Reserve some resources for CardBus. We reserve
456 * a fixed amount of bus space for CardBus bridges.
458 #if 0 // This is a bug. It will not match PCMCIA device driver. Victor Yu. 01-11-2006
459 b_res[0].start = CARDBUS_IO_SIZE;
460 b_res[0].end = b_res[0].start + CARDBUS_IO_SIZE - 1;
461 b_res[0].flags |= IORESOURCE_IO;
463 b_res[1].start = CARDBUS_IO_SIZE;
464 b_res[1].end = b_res[1].start + CARDBUS_IO_SIZE - 1;
465 b_res[1].flags |= IORESOURCE_IO;
466 #else
467 b_res[2].start = CARDBUS_IO_SIZE;
468 b_res[2].end = b_res[2].start + CARDBUS_IO_SIZE - 1;
469 b_res[2].flags |= IORESOURCE_IO;
471 b_res[3].start = CARDBUS_IO_SIZE;
472 b_res[3].end = b_res[3].start + CARDBUS_IO_SIZE - 1;
473 b_res[3].flags |= IORESOURCE_IO;
474 #endif
477 * Check whether prefetchable memory is supported
478 * by this bridge.
480 pci_read_config_word(bridge, PCI_CB_BRIDGE_CONTROL, &ctrl);
481 if (!(ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0)) {
482 ctrl |= PCI_CB_BRIDGE_CTL_PREFETCH_MEM0;
483 pci_write_config_word(bridge, PCI_CB_BRIDGE_CONTROL, ctrl);
484 pci_read_config_word(bridge, PCI_CB_BRIDGE_CONTROL, &ctrl);
488 * If we have prefetchable memory support, allocate
489 * two regions. Otherwise, allocate one region of
490 * twice the size.
492 if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
493 #if 0 // This is a bug. It will not match PCMCIA device driver. Victor Yu. 01-11-2006
494 b_res[2].start = CARDBUS_MEM_SIZE;
495 b_res[2].end = b_res[2].start + CARDBUS_MEM_SIZE - 1;
496 b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
498 b_res[3].start = CARDBUS_MEM_SIZE;
499 b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE - 1;
500 b_res[3].flags |= IORESOURCE_MEM;
501 #else
502 b_res[0].start = CARDBUS_MEM_SIZE;
503 b_res[0].end = b_res[0].start + CARDBUS_MEM_SIZE - 1;
504 b_res[0].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
506 b_res[1].start = CARDBUS_MEM_SIZE;
507 b_res[1].end = b_res[1].start + CARDBUS_MEM_SIZE - 1;
508 b_res[1].flags |= IORESOURCE_MEM;
509 #endif
510 } else {
511 #if 0 // This is a bug. It will not match PCMCIA device driver. Victor Yu. 01-11-2006
512 b_res[3].start = CARDBUS_MEM_SIZE * 2;
513 b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE * 2 - 1;
514 b_res[3].flags |= IORESOURCE_MEM;
515 #else
516 b_res[1].start = CARDBUS_MEM_SIZE * 2;
517 b_res[1].end = b_res[1].start + CARDBUS_MEM_SIZE * 2 - 1;
518 b_res[1].flags |= IORESOURCE_MEM;
519 #endif
523 void __devinit
524 pci_bus_size_bridges(struct pci_bus *bus)
526 struct pci_dev *dev;
527 unsigned long mask, prefmask;
529 list_for_each_entry(dev, &bus->devices, bus_list) {
530 struct pci_bus *b = dev->subordinate;
531 if (!b)
532 continue;
534 switch (dev->class >> 8) {
535 case PCI_CLASS_BRIDGE_CARDBUS:
536 pci_bus_size_cardbus(b);
537 break;
539 case PCI_CLASS_BRIDGE_PCI:
540 default:
541 pci_bus_size_bridges(b);
542 break;
546 /* The root bus? */
547 if (!bus->self)
548 return;
550 switch (bus->self->class >> 8) {
551 case PCI_CLASS_BRIDGE_CARDBUS:
552 /* don't size cardbuses yet. */
553 break;
555 case PCI_CLASS_BRIDGE_PCI:
556 pci_bridge_check_ranges(bus);
557 default:
558 pbus_size_io(bus);
559 /* If the bridge supports prefetchable range, size it
560 separately. If it doesn't, or its prefetchable window
561 has already been allocated by arch code, try
562 non-prefetchable range for both types of PCI memory
563 resources. */
564 mask = IORESOURCE_MEM;
565 prefmask = IORESOURCE_MEM | IORESOURCE_PREFETCH;
566 if (pbus_size_mem(bus, prefmask, prefmask))
567 mask = prefmask; /* Success, size non-prefetch only. */
568 pbus_size_mem(bus, mask, IORESOURCE_MEM);
569 break;
572 EXPORT_SYMBOL(pci_bus_size_bridges);
574 void __devinit
575 pci_bus_assign_resources(struct pci_bus *bus)
577 struct pci_bus *b;
578 struct pci_dev *dev;
580 pbus_assign_resources_sorted(bus);
582 if (bus->bridge_ctl & PCI_BRIDGE_CTL_VGA) {
583 /* Propagate presence of the VGA to upstream bridges */
584 for (b = bus; b->parent; b = b->parent) {
585 b->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
588 list_for_each_entry(dev, &bus->devices, bus_list) {
589 b = dev->subordinate;
590 if (!b)
591 continue;
593 pci_bus_assign_resources(b);
595 switch (dev->class >> 8) {
596 case PCI_CLASS_BRIDGE_PCI:
597 pci_setup_bridge(b);
598 break;
600 case PCI_CLASS_BRIDGE_CARDBUS:
601 pci_setup_cardbus(b);
602 break;
604 default:
605 printk(KERN_INFO "PCI: not setting up bridge %s "
606 "for bus %d\n", pci_name(dev), b->number);
607 break;
611 EXPORT_SYMBOL(pci_bus_assign_resources);
613 void __init
614 pci_assign_unassigned_resources(void)
616 struct list_head *ln;
618 /* Depth first, calculate sizes and alignments of all
619 subordinate buses. */
620 list_for_each(ln, &pci_root_buses) {
621 pci_bus_size_bridges(pci_bus_b(ln));
623 /* Depth last, allocate resources and update the hardware. */
624 list_for_each(ln, &pci_root_buses) {
625 pci_bus_assign_resources(pci_bus_b(ln));
626 pci_enable_bridges(pci_bus_b(ln));