
From: Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com
Modify routine timer_get_boot_us(), as the base_time will be stored in bss if initialized to zero(observed for arm compilers, arm and arm64) and for most of the boards bss was not initialized to zero before relocation and hence causing a junk timestamp value in boot record if there is an entry record before relocation(example would be board_init_f entry). Also, as it is in bss which will be intialized to zero after relocation, it causes the first entry after relocation to be missed while printing bootstage report as the timer_get_boot_us() returns zero if bss_time is zero. This patch fixes the same by initialzing bss_time to 1 and also returning current timestamp if bss_time is 1. Intializing it to 1 causes it to be placed in data section and hence no issues.
Before this patch: ZynqMP> bootstage report Timer summary in microseconds: Mark Elapsed Stage 0 0 reset 491,000 491,000 id=64 516,000 25,000 id=65 522,000 6,000 main_loop 112,092,989,575,347,436,48112,092,989,575,342,216,48 board_init_f
After this patch: ZynqMP> bootstage report Timer summary in microseconds: Mark Elapsed Stage 0 0 reset 9,969 9,969 board_init_f 1,227,000 1,217,031 board_init_r 1,713,000 486,000 id=64 1,733,000 20,000 id=65 1,735,000 2,000 main_loop
Signed-off-by: Siva Durga Prasad Paladugu sivadur@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com ---
common/bootstage.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/common/bootstage.c b/common/bootstage.c index bca74cd207fc..b65345c28105 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -294,16 +294,18 @@ void bootstage_report(void)
ulong __timer_get_boot_us(void) { - static ulong base_time; + static ulong base_time = 1;
/* * We can't implement this properly. Return 0 on the first call and * larger values after that. */ - if (base_time) + if (base_time != 1) return get_timer(base_time) * 1000; - base_time = get_timer(0); - return 0; + else + base_time = get_timer(0); + + return base_time; }
ulong timer_get_boot_us(void)