From 2a1c5318956aa7b3ecb94557abe5728abd7c6402 Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 20 Nov 2009 15:23:58 +0100 Subject: Corrected timer errors and changed MTU0 timer from 0 to 3 due to 0 is used by the linux kernel and we still want to be able to use that timer for boottime measurement. IE leave the 3rd timer run until we're executing init. Added atags for u-boot timing measurements as communication with the kernel. --- lib_arm/bootm.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'lib_arm') diff --git a/lib_arm/bootm.c b/lib_arm/bootm.c index 128b7e313..ebaf2b3f2 100644 --- a/lib_arm/bootm.c +++ b/lib_arm/bootm.c @@ -26,6 +26,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -56,6 +57,13 @@ static void setup_videolfb_tag (gd_t *gd); static struct tag *params; #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ +#ifdef CONFIG_BOOTTIME +ulong boottime_ticks_uboot_init = 0; +ulong boottime_ticks_load_kernel = 0; +ulong boottime_ticks_uboot_done = 0; +static void setup_boottime_tags(void); +#endif + int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { bd_t *bd = gd->bd; @@ -83,14 +91,20 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) debug ("## Transferring control to Linux (at address %08lx) ...\n", (ulong) theKernel); + boottime_tag_uboot_done() + #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ defined (CONFIG_CMDLINE_TAG) || \ defined (CONFIG_INITRD_TAG) || \ defined (CONFIG_SERIAL_TAG) || \ defined (CONFIG_REVISION_TAG) || \ defined (CONFIG_LCD) || \ - defined (CONFIG_VFD) + defined (CONFIG_VFD) || \ + defined (CONFIG_BOOTTIME) setup_start_tag (bd); +#ifdef CONFIG_BOOTTIME + setup_boottime_tags(); +#endif #ifdef CONFIG_SERIAL_TAG setup_serial_tag (¶ms); #endif @@ -113,6 +127,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) setup_end_tag (bd); #endif + /* we assume that the kernel is in place */ printf ("\nStarting kernel ...\n\n"); @@ -153,6 +168,33 @@ static void setup_start_tag (bd_t *bd) params = tag_next (params); } +#ifdef CONFIG_BOOTTIME +static void setup_boottime_tags(void) +{ + if(!boottime_ticks_uboot_init) + printf("Warning: uboot init time not tracked\n"); + if(!boottime_ticks_load_kernel) + printf("Warning: load kernel time not tracked\n"); + if(!boottime_ticks_uboot_done) + printf("Warning: uboot done time not tracked\n"); + + params->hdr.tag = ATAG_BOOTTIME_UBOOT_INIT; + params->hdr.size = tag_size (tag_boottime); + params->u.boottime.tick = boottime_ticks_uboot_init; + params = tag_next (params); + + params->hdr.tag = ATAG_BOOTTIME_LOAD_KERNEL; + params->hdr.size = tag_size (tag_boottime); + params->u.boottime.tick = boottime_ticks_load_kernel; + params = tag_next (params); + + params->hdr.tag = ATAG_BOOTTIME_UBOOT_DONE; + params->hdr.size = tag_size (tag_boottime); + params->u.boottime.tick = boottime_ticks_uboot_done; + params = tag_next (params); + +} +#endif #ifdef CONFIG_SETUP_MEMORY_TAGS static void setup_memory_tags (bd_t *bd) -- cgit v1.2.3