console: support timestamp for printf
with this patch, we can see the detail boot time of boot flow. The U-Boot log is like this: [ 0.259266] U-Boot 2017.09-01739-g856f373-dirty (Jul 10 2018 - 20:26:05 +0800) [ 0.260596] Model: Rockchip RK3399 Evaluation Board [ 0.261332] DRAM: 3.8 GiB Relocation Offset is: f5bfd000 Using default environment [ 0.354038] dwmmc@fe320000: 1, sdhci@fe330000: 0 [ 0.521125] Card did not respond to voltage select! [ 0.521188] mmc_init: -95, time 9 [ 0.671451] switch to partitions #0, OK [ 0.671500] mmc0(part 0) is current device ...... Change-Id: I3ce2a4466f9ecd9eeb6b334ba4ba48391aa47c30 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
b520084e79
commit
243527b501
|
|
@ -111,6 +111,10 @@ config BOOTSTAGE_STASH_SIZE
|
|||
This should be large enough to hold the bootstage stash. A value of
|
||||
4096 (4KiB) is normally plenty.
|
||||
|
||||
config BOOTSTAGE_PRINTF_TIMESTAMP
|
||||
bool "Support printf timestamp"
|
||||
help
|
||||
Enabling this will support printf timestamp.
|
||||
endmenu
|
||||
|
||||
menu "Boot media"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include <exports.h>
|
||||
#include <environment.h>
|
||||
#include <watchdog.h>
|
||||
#include <vsprintf.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
|
@ -516,11 +517,51 @@ void putc(const char c)
|
|||
}
|
||||
}
|
||||
|
||||
#if (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_BOOTSTAGE_PRINTF_TIMESTAMP))
|
||||
static void vspfunc(char *buf, size_t size, char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vsnprintf(buf, size, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void puts(const char *s)
|
||||
{
|
||||
unsigned long ts_sec, ts_msec, ticks;
|
||||
char pr_timestamp[32], *p;
|
||||
|
||||
while (*s) {
|
||||
if (*s == '\n') {
|
||||
gd->new_line = 1;
|
||||
putc(*s++);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gd->new_line) {
|
||||
gd->new_line = 0;
|
||||
ticks = (get_ticks() / 24ULL);
|
||||
ts_sec = ticks / 1000000;
|
||||
ts_msec = ticks % 1000000;
|
||||
vspfunc(pr_timestamp, sizeof(pr_timestamp),
|
||||
"[%5lu.%06lu] ", ts_sec, ts_msec);
|
||||
p = pr_timestamp;
|
||||
while (*p)
|
||||
putc(*p++);
|
||||
}
|
||||
|
||||
putc(*s++);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void puts(const char *s)
|
||||
{
|
||||
while (*s)
|
||||
putc(*s++);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_CONSOLE_RECORD
|
||||
int console_record_init(void)
|
||||
|
|
|
|||
|
|
@ -122,6 +122,11 @@ typedef struct global_data {
|
|||
struct bootstage_data *new_bootstage; /* Relocated bootstage info */
|
||||
#endif
|
||||
phys_addr_t pm_ctx_phys;
|
||||
|
||||
#ifdef CONFIG_BOOTSTAGE_PRINTF_TIMESTAMP
|
||||
int new_line;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LOG
|
||||
int log_drop_count; /* Number of dropped log messages */
|
||||
int default_log_level; /* For devices with no filters */
|
||||
|
|
|
|||
Loading…
Reference in New Issue