Aaron Durbin (adurbin@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3162
-gerrit
commit 9ab4574110cbf18329e5706586a56c74f0938b40 Author: Aaron Durbin adurbin@chromium.org Date: Tue Apr 30 15:41:13 2013 -0500
device tree: optionally 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 DEV_INIT_TIMES Kconfig 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 --- src/Kconfig | 6 ++++++ src/device/device.c | 12 ++++++++++++ 2 files changed, 18 insertions(+)
diff --git a/src/Kconfig b/src/Kconfig index ab2a927..11355c2 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -324,6 +324,12 @@ config TIMER_QUEUE help Provide a timer queue for performing time-based callbacks.
+config DEV_INIT_TIMES + def_bool n + depends on HAVE_MONOTONIC_TIMER + help + Track the times each device takes to initialize in the device tree. + config HIGH_SCRATCH_MEMORY_SIZE hex default 0x0 diff --git a/src/device/device.c b/src/device/device.c index e0c8bf0..ac786ff 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -43,6 +43,7 @@ #if CONFIG_ARCH_X86 #include <arch/ebda.h> #endif +#include <timer.h>
/** Linked list of ALL devices */ struct device *all_devices = &dev_root; @@ -1103,6 +1104,12 @@ static void init_dev(struct device *dev) return;
if (!dev->initialized && dev->ops && dev->ops->init) { +#if CONFIG_DEV_INIT_TIMES + struct mono_time start_time; + struct rela_time dev_init_time; + + timer_monotonic_get(&start_time); +#endif if (dev->path.type == DEVICE_PATH_I2C) { printk(BIOS_DEBUG, "smbus: %s[%d]->", 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)); dev->initialized = 1; dev->ops->init(dev); +#if CONFIG_DEV_INIT_TIMES + 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 } }