]> Git Repo - J-u-boot.git/blobdiff - drivers/timer/tsc_timer.c
x86: Avoid timer-clock overflow
[J-u-boot.git] / drivers / timer / tsc_timer.c
index 80c084f380d9ea01680e91c75ca4ae9bbc18c76e..2f2c2f27b7ff07af38c12d4780e9b486906baa09 100644 (file)
@@ -403,6 +403,10 @@ static void tsc_timer_ensure_setup(bool early)
        if (!gd->arch.clock_rate) {
                unsigned long fast_calibrate;
 
+               /* deal with this being called before x86_cpu_init_f() */
+               if (!gd->arch.x86_vendor)
+                       x86_get_identity_for_timer();
+
                /**
                 * There is no obvious way to obtain this information from EFI
                 * boot services. This value was measured on a Framework Laptop
@@ -438,6 +442,7 @@ static void tsc_timer_ensure_setup(bool early)
                        return;
 
 done:
+               fast_calibrate = min(fast_calibrate, 4000UL);
                if (!gd->arch.clock_rate)
                        gd->arch.clock_rate = fast_calibrate * 1000000;
        }
This page took 0.026081 seconds and 4 git commands to generate.