[coreboot-gerrit] Patch set updated for coreboot: b43e84b libpayload: improve us timer accuracy
Marc Jones (marc.jones@se-eng.com)
gerrit at coreboot.org
Fri Jan 9 07:31:32 CET 2015
Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8128
-gerrit
commit b43e84b84dbe57fd2d608e174e9e2a06cf81eb29
Author: Vadim Bendebury <vbendeb at chromium.org>
Date: Thu Jul 10 12:49:46 2014 -0700
libpayload: improve us timer accuracy
In cases where timer clock frequency is not an integer number of
megahertz, the calculations in timer_us() lack accuracy.
This patch modifies calculations to reduce the error. The maximum
interval this calculation would support decreases, but it still is in
excess of 1844674 seconds for a timer clocked by 10 MHz, which is more
than enough.
BUG=none
TEST=manual
. verified timer accuracy using a depthcharge CLI command
Original-Change-Id: Iffb323db10e74b0ce3b4d59a56983bfee12e6805
Original-Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/207358
Original-Reviewed-by: David Hendricks <dhendrix at chromium.org>
(cherry picked from commit e1abf87d438de1a04714482d5b610671e8cc0663)
Signed-off-by: Marc Jones <marc.jones at se-eng.com>
Change-Id: Ia892726187ab040dd235f493c92856c15951cc06
---
payloads/libpayload/libc/time.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c
index 0d81634..8d07c4f 100644
--- a/payloads/libpayload/libc/time.c
+++ b/payloads/libpayload/libc/time.c
@@ -204,5 +204,5 @@ u64 timer_us(u64 base)
}
}
- return timer_raw_value() / (hz / 1000000) - base;
+ return (1000000 * timer_raw_value()) / hz - base;
}
More information about the coreboot-gerrit
mailing list