device tree: track init times

With the introduction of a monotonic timer it is possible to
track the individual times of each device's init() call. Add this
ability behind a HAVE_MONOTONIC_TIMER option.

Example log messages:
Root Device init 5 usecs
CPU_CLUSTER: 0 init 66004 usecs
PCI: 00:00.0 init 1020 usecs
PCI: 00:02.0 init 456941 usecs
PCI: 00:13.0 init 3 usecs
PCI: 00:14.0 init 3 usecs
PCI: 00:15.0 init 92 usecs
PCI: 00:15.1 init 37 usecs
PCI: 00:15.2 init 36 usecs
PCI: 00:15.3 init 35 usecs
PCI: 00:15.4 init 35 usecs
PCI: 00:15.5 init 36 usecs
PCI: 00:15.6 init 35 usecs
PCI: 00:16.0 init 3666 usecs
PCI: 00:17.0 init 63 usecs
PCI: 00:1b.0 init 3 usecs
PCI: 00:1c.0 init 89 usecs
PCI: 00:1c.1 init 15 usecs
PCI: 00:1c.2 init 15 usecs
PCI: 00:1c.3 init 15 usecs
PCI: 00:1c.4 init 15 usecs
PCI: 00:1c.5 init 16 usecs
PCI: 00:1d.0 init 4 usecs
PCI: 00:1f.0 init 495 usecs
PCI: 00:1f.2 init 29 usecs
PCI: 00:1f.3 init 4 usecs
PCI: 00:1f.6 init 4 usecs

Change-Id: Ibe499848432c7ab20166ab10d6dfb07db03eab01
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/3162
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Aaron Durbin 2013-04-30 15:41:13 -05:00 committed by Ronald G. Minnich
parent c0466d46b7
commit 052942923b
1 changed files with 12 additions and 0 deletions
src/device

View File

@ -43,6 +43,7 @@
#if CONFIG_ARCH_X86 #if CONFIG_ARCH_X86
#include <arch/ebda.h> #include <arch/ebda.h>
#endif #endif
#include <timer.h>
/** Linked list of ALL devices */ /** Linked list of ALL devices */
struct device *all_devices = &dev_root; struct device *all_devices = &dev_root;
@ -1103,6 +1104,12 @@ static void init_dev(struct device *dev)
return; return;
if (!dev->initialized && dev->ops && dev->ops->init) { if (!dev->initialized && dev->ops && dev->ops->init) {
#if CONFIG_HAVE_MONOTONIC_TIMER
struct mono_time start_time;
struct rela_time dev_init_time;
timer_monotonic_get(&start_time);
#endif
if (dev->path.type == DEVICE_PATH_I2C) { if (dev->path.type == DEVICE_PATH_I2C) {
printk(BIOS_DEBUG, "smbus: %s[%d]->", printk(BIOS_DEBUG, "smbus: %s[%d]->",
dev_path(dev->bus->dev), dev->bus->link_num); dev_path(dev->bus->dev), dev->bus->link_num);
@ -1111,6 +1118,11 @@ static void init_dev(struct device *dev)
printk(BIOS_DEBUG, "%s init\n", dev_path(dev)); printk(BIOS_DEBUG, "%s init\n", dev_path(dev));
dev->initialized = 1; dev->initialized = 1;
dev->ops->init(dev); dev->ops->init(dev);
#if CONFIG_HAVE_MONOTONIC_TIMER
dev_init_time = current_time_from(&start_time);
printk(BIOS_DEBUG, "%s init %ld usecs\n", dev_path(dev),
rela_time_in_microseconds(&dev_init_time));
#endif
} }
} }