diff options
author | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-04-06 11:11:20 +0200 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-04-06 11:11:20 +0200 |
commit | 36cee0c070a631eb744aff33916dba0d8c92d3d6 (patch) | |
tree | 707bca58e7bf89a8f1883a8726f0c8c08ec9da11 /arch/arm/common/boottime.c | |
parent | 609cbf05e36abcc92b1e60749b8dd0dc420144fa (diff) | |
parent | e2673ac489a6fd2f8c4016b1a617f708efb21cc2 (diff) |
Merge topic branch 'trace-debug' into integration-linux-ux500-3.3
Diffstat (limited to 'arch/arm/common/boottime.c')
-rw-r--r-- | arch/arm/common/boottime.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/common/boottime.c b/arch/arm/common/boottime.c new file mode 100644 index 00000000000..73e9e04ed37 --- /dev/null +++ b/arch/arm/common/boottime.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) ST-Ericsson SA 2009-2010 + * + * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson + * + * License terms: GNU General Public License (GPL) version 2 + * + * Store boot times measured during for example u-boot startup. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/boottime.h> +#include <linux/string.h> +#include <asm/setup.h> + +static u32 bootloader_idle; +static u32 bootloader_total; + +static int __init boottime_parse_tag(const struct tag *tag) +{ + int i; + char buff[BOOTTIME_MAX_NAME_LEN]; + + bootloader_idle = tag->u.boottime.idle; + bootloader_total = tag->u.boottime.total; + + for (i = 0; i < tag->u.boottime.num; i++) { + snprintf(buff, BOOTTIME_MAX_NAME_LEN, "%s+0x0/0x0", + tag->u.boottime.entry[i].name); + buff[BOOTTIME_MAX_NAME_LEN - 1] = '\0'; + boottime_mark_wtime(buff, tag->u.boottime.entry[i].time); + } + + return 0; +} + +__tagtable(ATAG_BOOTTIME, boottime_parse_tag); + +int boottime_bootloader_idle(void) +{ + if (bootloader_total == 0) + return 0; + + return (int) ((bootloader_idle) / (bootloader_total / 100)); +} |