Fix so pci device memory allocation does not use memory base address at 0xfec00000...
[coreboot.git] / src / devices / device.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * It was originally based on the Linux kernel (arch/i386/kernel/pci-pc.c).
5  *
6  * Modifications are:
7  * Copyright (C) 2003 Eric Biederman <ebiederm@xmission.com>
8  * Copyright (C) 2003-2004 Linux Networx
9  * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
10  * Copyright (C) 2003 Ronald G. Minnich <rminnich@gmail.com>
11  * Copyright (C) 2004-2005 Li-Ta Lo <ollie@lanl.gov>
12  * Copyright (C) 2005-2006 Tyan
13  * (Written by Yinghai Lu <yhlu@tyan.com> for Tyan)
14  * Copyright (C) 2005-2006 Stefan Reinauer <stepan@openbios.org>
15  */
16
17 /*
18  *      (c) 1999--2000 Martin Mares <mj@suse.cz>
19  */
20 /* lots of mods by ron minnich (rminnich@lanl.gov), with 
21  * the final architecture guidance from Tom Merritt (tjm@codegen.com)
22  * In particular, we changed from the one-pass original version to 
23  * Tom's recommended multiple-pass version. I wasn't sure about doing 
24  * it with multiple passes, until I actually started doing it and saw
25  * the wisdom of Tom's recommendations ...
26  *
27  * Lots of cleanups by Eric Biederman to handle bridges, and to
28  * handle resource allocation for non-pci devices.
29  */
30
31 #include <console/console.h>
32 #include <bitops.h>
33 #include <arch/io.h>
34 #include <device/device.h>
35 #include <device/pci.h>
36 #include <device/pci_ids.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include <smp/spinlock.h>
40
41 /** Linked list of ALL devices */
42 struct device *all_devices = &dev_root;
43 /** Pointer to the last device */
44 extern struct device **last_dev_p;
45
46 /** The upper limit of MEM resource of the devices.
47  * Reserve 20M for the system */
48 #define DEVICE_MEM_HIGH 0xFEBFFFFFUL
49 /** The lower limit of IO resource of the devices.
50  * Reserve 4k for ISA/Legacy devices */
51 #define DEVICE_IO_START 0x1000
52
53 /**
54  * @brief Allocate a new device structure.
55  * 
56  * Allocte a new device structure and attached it to the device tree as a
57  * child of the parent bus.
58  *
59  * @param parent parent bus the newly created device attached to.
60  * @param path path to the device to be created.
61  *
62  * @return pointer to the newly created device structure.
63  *
64  * @see device_path
65  */
66 static spinlock_t dev_lock = SPIN_LOCK_UNLOCKED;
67 device_t alloc_dev(struct bus *parent, struct device_path *path)
68 {
69         device_t dev, child;
70         int link;
71
72         spin_lock(&dev_lock);   
73
74         /* Find the last child of our parent */
75         for(child = parent->children; child && child->sibling; ) {
76                 child = child->sibling;
77         }
78
79         dev = malloc(sizeof(*dev));
80         if (dev == 0) {
81                 die("DEV: out of memory.\n");
82         }
83         memset(dev, 0, sizeof(*dev));
84         memcpy(&dev->path, path, sizeof(*path));
85
86         /* Initialize the back pointers in the link fields */
87         for(link = 0; link < MAX_LINKS; link++) {
88                 dev->link[link].dev  = dev;
89                 dev->link[link].link = link;
90         }
91
92         /* By default devices are enabled */
93         dev->enabled = 1;
94
95         /* Add the new device to the list of children of the bus. */
96         dev->bus = parent;
97         if (child) {
98                 child->sibling = dev;
99         } else {
100                 parent->children = dev;
101         }
102
103         /* Append a new device to the global device list.
104          * The list is used to find devices once everything is set up.
105          */
106         *last_dev_p = dev;
107         last_dev_p = &dev->next;
108
109         spin_unlock(&dev_lock);
110         return dev;
111 }
112
113 /**
114  * @brief round a number up to an alignment. 
115  * @param val the starting value
116  * @param roundup Alignment as a power of two
117  * @returns rounded up number
118  */
119 static resource_t round(resource_t val, unsigned long pow)
120 {
121         resource_t mask;
122         mask = (1ULL << pow) - 1ULL;
123         val += mask;
124         val &= ~mask;
125         return val;
126 }
127
128 /** Read the resources on all devices of a given bus.
129  * @param bus bus to read the resources on.
130  */
131 static void read_resources(struct bus *bus)
132 {
133         struct device *curdev;
134
135         printk_spew("%s read_resources bus %d link: %d\n",
136                 dev_path(bus->dev), bus->secondary, bus->link);
137
138         /* Walk through all of the devices and find which resources they need. */
139         for(curdev = bus->children; curdev; curdev = curdev->sibling) {
140                 unsigned links;
141                 int i;
142                 if (curdev->have_resources) {
143                         continue;
144                 }
145                 if (!curdev->enabled) {
146                         continue;
147                 }
148                 if (!curdev->ops || !curdev->ops->read_resources) {
149                         printk_err("%s missing read_resources\n",
150                                 dev_path(curdev));
151                         continue;
152                 }
153                 curdev->ops->read_resources(curdev);
154                 curdev->have_resources = 1;
155                 /* Read in subtractive resources behind the current device */
156                 links = 0;
157                 for(i = 0; i < curdev->resources; i++) {
158                         struct resource *resource;
159                         unsigned link;
160                         resource = &curdev->resource[i];
161                         if (!(resource->flags & IORESOURCE_SUBTRACTIVE)) 
162                                 continue;
163                         link = IOINDEX_SUBTRACTIVE_LINK(resource->index);
164                         if (link > MAX_LINKS) {
165                                 printk_err("%s subtractive index on link: %d\n",
166                                         dev_path(curdev), link);
167                                 continue;
168                         }
169                         if (!(links & (1 << link))) {
170                                 links |= (1 << link);
171                                 read_resources(&curdev->link[link]);
172                         }
173                 }
174         }
175         printk_spew("%s read_resources bus %d link: %d done\n",
176                 dev_path(bus->dev), bus->secondary, bus->link);
177 }
178
179 struct pick_largest_state {
180         struct resource *last;
181         struct device   *result_dev;
182         struct resource *result;
183         int seen_last;
184 };
185
186 static void pick_largest_resource(void *gp,
187         struct device *dev, struct resource *resource)
188 {
189         struct pick_largest_state *state = gp;
190         struct resource *last;
191         last = state->last;
192         /* Be certain to pick the successor to last */
193         if (resource == last) {
194                 state->seen_last = 1;
195                 return;
196         }
197         if (resource->flags & IORESOURCE_FIXED ) return; //skip it 
198         if (last && (
199                     (last->align < resource->align) ||
200                     ((last->align == resource->align) &&
201                             (last->size < resource->size)) ||
202                     ((last->align == resource->align) &&
203                             (last->size == resource->size) &&
204                             (!state->seen_last)))) {
205                 return;
206         }
207         if (!state->result || 
208                 (state->result->align < resource->align) ||
209                 ((state->result->align == resource->align) &&
210                         (state->result->size < resource->size)))
211         {
212                 state->result_dev = dev;
213                 state->result = resource;
214         }    
215 }
216
217 static struct device *largest_resource(struct bus *bus, struct resource **result_res,
218         unsigned long type_mask, unsigned long type)
219 {
220         struct pick_largest_state state;
221
222         state.last = *result_res;
223         state.result_dev = 0;
224         state.result = 0;
225         state.seen_last = 0;
226
227         search_bus_resources(bus, type_mask, type, pick_largest_resource, &state);
228
229         *result_res = state.result;
230         return state.result_dev;
231 }
232
233 /* Compute allocate resources is the guts of the resource allocator.
234  * 
235  * The problem.
236  *  - Allocate resources locations for every device.
237  *  - Don't overlap, and follow the rules of bridges.
238  *  - Don't overlap with resources in fixed locations.
239  *  - Be efficient so we don't have ugly strategies.
240  *
241  * The strategy.
242  * - Devices that have fixed addresses are the minority so don't
243  *   worry about them too much.  Instead only use part of the address
244  *   space for devices with programmable addresses.  This easily handles
245  *   everything except bridges.
246  *
247  * - PCI devices are required to have thier sizes and their alignments
248  *   equal.  In this case an optimal solution to the packing problem
249  *   exists.  Allocate all devices from highest alignment to least
250  *   alignment or vice versa.  Use this.
251  *
252  * - So we can handle more than PCI run two allocation passes on
253  *   bridges.  The first to see how large the resources are behind
254  *   the bridge, and what their alignment requirements are.  The
255  *   second to assign a safe address to the devices behind the
256  *   bridge.  This allows me to treat a bridge as just a device with 
257  *   a couple of resources, and not need to special case it in the
258  *   allocator.  Also this allows handling of other types of bridges.
259  *
260  */
261
262 void compute_allocate_resource(
263         struct bus *bus,
264         struct resource *bridge,
265         unsigned long type_mask,
266         unsigned long type)
267 {
268         struct device *dev;
269         struct resource *resource;
270         resource_t base;
271         unsigned long align, min_align;
272         min_align = 0;
273         base = bridge->base;
274
275         printk_spew("%s compute_allocate_%s: base: %08Lx size: %08Lx align: %d gran: %d\n", 
276                 dev_path(bus->dev),
277                 (bridge->flags & IORESOURCE_IO)? "io":
278                 (bridge->flags & IORESOURCE_PREFETCH)? "prefmem" : "mem",
279                 base, bridge->size, bridge->align, bridge->gran);
280
281         /* We want different minimum alignments for different kinds of
282          * resources.  These minimums are not device type specific
283          * but resource type specific.
284          */
285         if (bridge->flags & IORESOURCE_IO) {
286                 min_align = log2(DEVICE_IO_ALIGN);
287         }
288         if (bridge->flags & IORESOURCE_MEM) {
289                 min_align = log2(DEVICE_MEM_ALIGN);
290         }
291
292         /* Make certain I have read in all of the resources */
293         read_resources(bus);
294
295         /* Remember I haven't found anything yet. */
296         resource = 0;
297
298         /* Walk through all the devices on the current bus and 
299          * compute the addresses.
300          */
301         while((dev = largest_resource(bus, &resource, type_mask, type))) {
302                 resource_t size;
303                 /* Do NOT I repeat do not ignore resources which have zero size.
304                  * If they need to be ignored dev->read_resources should not even
305                  * return them.   Some resources must be set even when they have
306                  * no size.  PCI bridge resources are a good example of this.
307                  */
308                 /* Make certain we are dealing with a good minimum size */
309                 size = resource->size;
310                 align = resource->align;
311                 if (align < min_align) {
312                         align = min_align;
313                 }
314
315                 /* Propogate the resource alignment to the bridge register  */
316                 if (align > bridge->align) {
317                         bridge->align = align;
318                 }
319
320                 if (resource->flags & IORESOURCE_FIXED) {
321                         continue;
322                 }
323
324                 /* Propogate the resource limit to the bridge register */
325                 if (bridge->limit > resource->limit) {
326                         bridge->limit = resource->limit;
327                 }
328                 /* Artificially deny limits between DEVICE_MEM_HIGH and 0xffffffff */
329                 if ((bridge->limit > DEVICE_MEM_HIGH) && (bridge->limit <= 0xffffffff)) {
330                         bridge->limit = DEVICE_MEM_HIGH;
331                 }
332                 if (resource->flags & IORESOURCE_IO) {
333                         /* Don't allow potential aliases over the
334                          * legacy pci expansion card addresses.
335                          * The legacy pci decodes only 10 bits,
336                          * uses 100h - 3ffh. Therefor, only 0 - ff
337                          * can be used out of each 400h block of io
338                          * space.
339                          */
340                         if ((base & 0x300) != 0) {
341                                 base = (base & ~0x3ff) + 0x400;
342                         }
343                         /* Don't allow allocations in the VGA IO range.
344                          * PCI has special cases for that.
345                          */
346                         else if ((base >= 0x3b0) && (base <= 0x3df)) {
347                                 base = 0x3e0;
348                         }
349                 }
350                 if (((round(base, align) + size) -1) <= resource->limit) {
351                         /* base must be aligned to size */
352                         base = round(base, align);
353                         resource->base = base;
354                         resource->flags |= IORESOURCE_ASSIGNED;
355                         resource->flags &= ~IORESOURCE_STORED;
356                         base += size;
357                         
358                         printk_spew(
359                                 "%s %02x *  [0x%08Lx - 0x%08Lx] %s\n",
360                                 dev_path(dev),
361                                 resource->index, 
362                                 resource->base, 
363                                 resource->base + resource->size - 1,
364                                 (resource->flags & IORESOURCE_IO)? "io":
365                                 (resource->flags & IORESOURCE_PREFETCH)? "prefmem": "mem");
366                 }
367         }
368         /* A pci bridge resource does not need to be a power
369          * of two size, but it does have a minimum granularity.
370          * Round the size up to that minimum granularity so we
371          * know not to place something else at an address postitively
372          * decoded by the bridge.
373          */
374         bridge->size = round(base, bridge->gran) - bridge->base;
375
376         printk_spew("%s compute_allocate_%s: base: %08Lx size: %08Lx align: %d gran: %d done\n", 
377                 dev_path(bus->dev),
378                 (bridge->flags & IORESOURCE_IO)? "io":
379                 (bridge->flags & IORESOURCE_PREFETCH)? "prefmem" : "mem",
380                 base, bridge->size, bridge->align, bridge->gran);
381
382
383 }
384
385 #if CONFIG_CONSOLE_VGA == 1
386 device_t vga_pri = 0;
387 static void allocate_vga_resource(void)
388 {
389 #warning "FIXME modify allocate_vga_resource so it is less pci centric!"
390 #warning "This function knows to much about PCI stuff, it should be just a ietrator/visitor."
391
392         /* FIXME handle the VGA pallette snooping */
393         struct device *dev, *vga, *vga_onboard, *vga_first, *vga_last;
394         struct bus *bus;
395         bus = 0;
396         vga = 0;
397         vga_onboard = 0;
398         vga_first = 0;
399         vga_last = 0;
400         for(dev = all_devices; dev; dev = dev->next) {
401                 if (!dev->enabled) continue;
402                 if (((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
403                         ((dev->class >> 8) != PCI_CLASS_DISPLAY_OTHER)) 
404                 {
405                         if (!vga_first) {
406                                 if (dev->on_mainboard) {
407                                         vga_onboard = dev;
408                                 } else {
409                                         vga_first = dev;
410                                 }
411                         } else {
412                                 if (dev->on_mainboard) {
413                                         vga_onboard = dev;
414                                 } else {
415                                         vga_last = dev;
416                                 }
417                         }
418
419                         /* It isn't safe to enable other VGA cards */
420                         dev->command &= ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
421                 }
422         }
423         
424         vga = vga_last;
425
426         if(!vga) {
427                 vga = vga_first;
428         }
429
430 #if CONFIG_CONSOLE_VGA_ONBOARD_AT_FIRST == 1
431         if (vga_onboard) // will use on board vga as pri
432 #else
433         if (!vga) // will use last add on adapter as pri
434 #endif
435         {
436                 vga = vga_onboard;
437         }
438
439         
440         if (vga) {
441                 /* vga is first add on card or the only onboard vga */
442                 printk_debug("Allocating VGA resource %s\n", dev_path(vga));
443                 /* All legacy VGA cards have MEM & I/O space registers */
444                 vga->command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
445                 vga_pri = vga;
446                 bus = vga->bus;
447         }
448         /* Now walk up the bridges setting the VGA enable */
449         while(bus) {
450                 printk_debug("Setting PCI_BRIDGE_CTL_VGA for bridge %s\n",
451                              dev_path(bus->dev));
452                 bus->bridge_ctrl |= PCI_BRIDGE_CTL_VGA;
453                 bus = (bus == bus->dev->bus)? 0 : bus->dev->bus;
454         } 
455 }
456
457 #endif
458
459
460 /**
461  * @brief  Assign the computed resources to the devices on the bus.
462  *
463  * @param bus Pointer to the structure for this bus
464  *
465  * Use the device specific set_resources method to store the computed
466  * resources to hardware. For bridge devices, the set_resources() method
467  * has to recurse into every down stream buses.
468  *
469  * Mutual recursion:
470  *      assign_resources() -> device_operation::set_resources()
471  *      device_operation::set_resources() -> assign_resources()
472  */
473 void assign_resources(struct bus *bus)
474 {
475         struct device *curdev;
476
477         printk_spew("%s assign_resources, bus %d link: %d\n", 
478                 dev_path(bus->dev), bus->secondary, bus->link);
479
480         for(curdev = bus->children; curdev; curdev = curdev->sibling) {
481                 if (!curdev->enabled || !curdev->resources) {
482                         continue;
483                 }
484                 if (!curdev->ops || !curdev->ops->set_resources) {
485                         printk_err("%s missing set_resources\n",
486                                 dev_path(curdev));
487                         continue;
488                 }
489                 curdev->ops->set_resources(curdev);
490         }
491         printk_spew("%s assign_resources, bus %d link: %d\n", 
492                 dev_path(bus->dev), bus->secondary, bus->link);
493 }
494
495 /**
496  * @brief Enable the resources for a specific device
497  *
498  * @param dev the device whose resources are to be enabled
499  *
500  * Enable resources of the device by calling the device specific
501  * enable_resources() method.
502  *
503  * The parent's resources should be enabled first to avoid having enabling
504  * order problem. This is done by calling the parent's enable_resources()
505  * method and let that method to call it's children's enable_resoruces()
506  * method via the (global) enable_childrens_resources().
507  *
508  * Indirect mutual recursion:
509  *      enable_resources() -> device_operations::enable_resource()
510  *      device_operations::enable_resource() -> enable_children_resources()
511  *      enable_children_resources() -> enable_resources()
512  */
513 void enable_resources(struct device *dev)
514 {
515         if (!dev->enabled) {
516                 return;
517         }
518         if (!dev->ops || !dev->ops->enable_resources) {
519                 printk_err("%s missing enable_resources\n", dev_path(dev));
520                 return;
521         }
522         dev->ops->enable_resources(dev);
523 }
524
525 /** 
526  * @brief Reset all of the devices a bus
527  *
528  * Reset all of the devices on a bus and clear the bus's reset_needed flag.
529  *
530  * @param bus pointer to the bus structure
531  *
532  * @return 1 if the bus was successfully reset, 0 otherwise.
533  *
534  */
535 int reset_bus(struct bus *bus)
536 {
537         if (bus && bus->dev && bus->dev->ops && bus->dev->ops->reset_bus)
538         {
539                 bus->dev->ops->reset_bus(bus);
540                 bus->reset_needed = 0;
541                 return 1;
542         }
543         return 0;
544 }
545
546 /** 
547  * @brief Scan for devices on a bus.
548  *
549  * If there are bridges on the bus, recursively scan the buses behind the bridges.
550  * If the setting up and tuning of the bus causes a reset to be required, 
551  * reset the bus and scan it again.
552  *
553  * @param bus pointer to the bus device
554  * @param max current bus number
555  *
556  * @return The maximum bus number found, after scanning all subordinate busses
557  */
558 unsigned int scan_bus(device_t bus, unsigned int max)
559 {
560         unsigned int new_max;
561         int do_scan_bus;
562         if (    !bus ||
563                 !bus->enabled ||
564                 !bus->ops ||
565                 !bus->ops->scan_bus)
566         {
567                 return max;
568         }
569         do_scan_bus = 1;
570         while(do_scan_bus) {
571                 int link;
572                 new_max = bus->ops->scan_bus(bus, max);
573                 do_scan_bus = 0;
574                 for(link = 0; link < bus->links; link++) {
575                         if (bus->link[link].reset_needed) {
576                                 if (reset_bus(&bus->link[link])) {
577                                         do_scan_bus = 1;
578                                 } else {
579                                         bus->bus->reset_needed = 1;
580                                 }
581                         }
582                 }
583         }
584         return new_max;
585 }
586
587
588 /**
589  * @brief Determine the existence of devices and extend the device tree.
590  *
591  * Most of the devices in the system are listed in the mainboard Config.lb
592  * file. The device structures for these devices are generated at compile
593  * time by the config tool and are organized into the device tree. This
594  * function determines if the devices created at compile time actually exist
595  * in the physical system.
596  *
597  * For devices in the physical system but not listed in the Config.lb file,
598  * the device structures have to be created at run time and attached to the
599  * device tree.
600  *
601  * This function starts from the root device 'dev_root', scan the buses in
602  * the system recursively, modify the device tree according to the result of
603  * the probe.
604  *
605  * This function has no idea how to scan and probe buses and devices at all.
606  * It depends on the bus/device specific scan_bus() method to do it. The
607  * scan_bus() method also has to create the device structure and attach
608  * it to the device tree. 
609  */
610 void dev_enumerate(void)
611 {
612         struct device *root;
613         unsigned subordinate;
614         printk_info("Enumerating buses...\n");
615         root = &dev_root;
616         if (root->chip_ops && root->chip_ops->enable_dev) {
617                 root->chip_ops->enable_dev(root);
618         }
619         if (!root->ops || !root->ops->scan_bus) {
620                 printk_err("dev_root missing scan_bus operation");
621                 return;
622         }
623         subordinate = scan_bus(root, 0);
624         printk_info("done\n");
625 }
626
627 /**
628  * @brief Configure devices on the devices tree.
629  * 
630  * Starting at the root of the device tree, travel it recursively in two
631  * passes. In the first pass, we compute and allocate resources (ranges)
632  * requried by each device. In the second pass, the resources ranges are
633  * relocated to their final position and stored to the hardware.
634  *
635  * I/O resources start at DEVICE_IO_START and grow upward. MEM resources start
636  * at DEVICE_MEM_START and grow downward.
637  *
638  * Since the assignment is hierarchical we set the values into the dev_root
639  * struct. 
640  */
641 void dev_configure(void)
642 {
643         struct resource *io, *mem;
644         struct device *root;
645
646         printk_info("Allocating resources...\n");
647
648         root = &dev_root;
649         if (!root->ops || !root->ops->read_resources) {
650                 printk_err("dev_root missing read_resources\n");
651                 return;
652         }
653         if (!root->ops || !root->ops->set_resources) {
654                 printk_err("dev_root missing set_resources\n");
655                 return;
656         }
657
658         printk_info("Reading resources...\n");
659         root->ops->read_resources(root);
660         printk_info("Done reading resources.\n");
661
662         /* Get the resources */
663         io  = &root->resource[0];
664         mem = &root->resource[1];
665         /* Make certain the io devices are allocated somewhere safe. */
666         io->base = DEVICE_IO_START;
667         io->flags |= IORESOURCE_ASSIGNED;
668         io->flags &= ~IORESOURCE_STORED;
669         /* Now reallocate the pci resources memory with the
670          * highest addresses I can manage.
671          */
672         mem->base = resource_max(&root->resource[1]);
673         mem->flags |= IORESOURCE_ASSIGNED;
674         mem->flags &= ~IORESOURCE_STORED;
675
676 #if CONFIG_CONSOLE_VGA == 1
677         /* Allocate the VGA I/O resource.. */
678         allocate_vga_resource(); 
679 #endif
680
681         /* Store the computed resource allocations into device registers ... */
682         printk_info("Setting resources...\n");
683         root->ops->set_resources(root);
684         printk_info("Done setting resources.\n");
685 #if 0
686         mem->flags |= IORESOURCE_STORED;
687         report_resource_stored(root, mem, "");
688 #endif
689
690         printk_info("Done allocating resources.\n");
691 }
692
693 /**
694  * @brief Enable devices on the device tree.
695  *
696  * Starting at the root, walk the tree and enable all devices/bridges by
697  * calling the device's enable_resources() method.
698  */
699 void dev_enable(void)
700 {
701         printk_info("Enabling resources...\n");
702
703         /* now enable everything. */
704         enable_resources(&dev_root);
705
706         printk_info("done.\n");
707 }
708
709 /**
710  * @brief Initialize all devices in the global device list.
711  *
712  * Starting at the first device on the global device link list,
713  * walk the list and call the device's init() method to do deivce
714  * specific setup.
715  */
716 void dev_initialize(void)
717 {
718         struct device *dev;
719
720         printk_info("Initializing devices...\n");
721         for(dev = all_devices; dev; dev = dev->next) {
722                 if (dev->enabled && !dev->initialized && 
723                         dev->ops && dev->ops->init) 
724                 {
725                         if (dev->path.type == DEVICE_PATH_I2C) {
726                                 printk_debug("smbus: %s[%d]->",
727                                         dev_path(dev->bus->dev), dev->bus->link);
728                         }
729                         printk_debug("%s init\n", dev_path(dev));
730                         dev->initialized = 1;
731                         dev->ops->init(dev);
732                 }
733         }
734         printk_info("Devices initialized\n");
735 }
736