x86: timer: Set up the timer in timer_early_get_count()

This function can be called before the timer is set up. Make sure that the
init function is called so that it works correctly.

This is needed so that bootstage can work correctly in TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2019-10-20 21:31:54 -06:00 committed by Bin Meng
parent c52b5e8e2c
commit 096c71e34b

View File

@ -461,6 +461,8 @@ unsigned long notrace timer_early_get_rate(void)
u64 notrace timer_early_get_count(void)
{
tsc_timer_ensure_setup(true);
return rdtsc() - gd->arch.tsc_base;
}