summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcommon/Makefile2
-rw-r--r--common/boottime.c56
-rw-r--r--include/boottime.h44
-rw-r--r--include/configs/u8500.h5
4 files changed, 93 insertions, 14 deletions
diff --git a/common/Makefile b/common/Makefile
index c82f08122..3824d3e56 100755
--- a/common/Makefile
+++ b/common/Makefile
@@ -166,7 +166,7 @@ COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o
COBJS-$(CONFIG_UPDATE_TFTP) += update.o
COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
-COBJS-$(CONFIG_BOOTTIME) += boottime.o
+COBJS-y += boottime.o
COBJS := $(sort $(COBJS-y))
SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/common/boottime.c b/common/boottime.c
index 8381ad249..87be46762 100644
--- a/common/boottime.c
+++ b/common/boottime.c
@@ -23,6 +23,8 @@
#include <asm/byteorder.h>
#include <asm/setup.h>
+#ifdef CONFIG_BOOTTIME
+
static struct tag_boottime boottime = {
.idle = 0,
.total = 0,
@@ -67,12 +69,6 @@ unsigned long boottime_idle_get(void)
return boottime.idle;
}
-void boottime_remove_last(void)
-{
- if (boottime.num > 0)
- boottime.num--;
-}
-
static int do_boottime(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
unsigned int i;
@@ -91,6 +87,18 @@ static int do_boottime(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 0;
}
+static int do_boottime_tag (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+
+ if (argc < 2) {
+ cmd_usage(cmdtp);
+ return 1;
+ }
+ boottime_tag(argv[1]);
+
+ return 0;
+}
+
U_BOOT_CMD(
boottime, 1, 1, do_boottime,
"print boottime info",
@@ -98,5 +106,41 @@ U_BOOT_CMD(
" - print boottime tags\n"
);
+U_BOOT_CMD(
+ boottime_tag, 2, 1, do_boottime_tag,
+ "boottime tag 'name'",
+ ""
+ " - Add a boottime tag at the current time\n"
+);
+
+#else
+/*
+ * Dummy functions when boottime is not enabled.
+ */
+static int do_boottime_tag (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ return 0;
+}
+
+void boottime_tag(char *name)
+{
+
+}
+
+void boottime_idle_add(unsigned long time)
+{
+
+}
+
+U_BOOT_CMD(
+ boottime_tag, 2, 1, do_boottime_tag,
+ "boottime tag 'name'",
+ ""
+ " - NOT ENABLED: Add CONFIG_BOOTIME to your boards configuration"
+ " file to enable boottime.\n"
+);
+
+#endif
+
diff --git a/include/boottime.h b/include/boottime.h
index 95f039170..b48696bde 100644
--- a/include/boottime.h
+++ b/include/boottime.h
@@ -28,17 +28,47 @@ struct boottime_entry {
u8 name[BOOTTIME_MAX_NAME_LEN];
};
-#ifdef CONFIG_BOOTTIME
+/**
+ * boottime_tag()
+ * Add a sample point with a name now. Shall be called before function "name"
+ * is executed.
+ * @name: Sample point name.
+ */
void boottime_tag(char *name);
-void boottime_remove_last(void);
+
+/**
+ * boottime_get_entry()
+ *
+ * Loads a boottime measure point information.
+ * @i: boottime measurement point entry.
+ *
+ * Returns a boottime entry. NULL, if not existing.
+ */
struct boottime_entry *boottime_get_entry(unsigned int i);
+
+/**
+ * boottime_idle_get()
+ *
+ * Returns the amount of time in us that has been spent idling.
+ */
unsigned long boottime_idle_get(void);
+
+/**
+ * boottime_idle_done()
+ *
+ * Returns the total time since start in us.
+ */
unsigned long boottime_idle_done(void);
+
+/**
+ * boottime_idle_add()
+ *
+ * This function shall be added to all delay() functions.
+ * The delay time input to delay() shall be provided to this
+ * function as well. It is used to calculate average load
+ * during boot.
+ * @time: time in us.
+ */
void boottime_idle_add(unsigned long time);
-#else
-#define boottime_tag(x)
-#define boottime_remove_last()
-#define boottime_idle_add(x)
-#endif
#endif
diff --git a/include/configs/u8500.h b/include/configs/u8500.h
index 24b7b47fa..35d7833b1 100644
--- a/include/configs/u8500.h
+++ b/include/configs/u8500.h
@@ -41,6 +41,8 @@
#define CONFIG_SYS_TIMERBASE 0xA03C6000 /* MTU0 timer */
#endif
+#define CONFIG_BOOTTIME
+
#define BOARD_LATE_INIT 1
/*-----------------------------------------------------------------------
@@ -144,8 +146,11 @@
"console=${console}\0" \
"emmcboot=echo Booting from eMMC ...; " \
"run commonargs emmcargs addcons memargs;" \
+ "boottime_tag write_partition;" \
"write_partition_block;" \
+ "boottime_tag load_kernel;" \
"mmc read 0 ${loadaddr} 0xA0000 0x4000;" \
+ "boottime_tag boot_kernel;" \
"bootm ${loadaddr}\0" \
"cmdfile=mmc init 1;mmc_read_cmd_file;run bootcmd\0" \
"flash=mmc init 1;fatload mmc 1 ${loadaddr} flash.scr;" \