Intel GM45, 945, SNB: Move multiply_to_tsc()
to tsc.h
multiply_to_tsc was being copied everywhere, which is bad practice. Put it in the tsc.h include file where it belongs. Delete the copies of it. Per secunet, no copyright notice is needed. This might be a good time to get a copyright notice into tsc.h anyway. Change-Id: Ied0013ad4b1a9e5e2b330614bb867fd806f9a407 Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: http://review.coreboot.org/3242 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber <nico.huber@secunet.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
@ -27,6 +27,19 @@ static inline tsc_t rdtsc(void)
|
||||
}
|
||||
|
||||
#if !defined(__ROMCC__)
|
||||
/* Simple 32- to 64-bit multiplication. Uses 16-bit words to avoid overflow.
|
||||
* This code is used to prevent use of libgcc's umoddi3.
|
||||
*/
|
||||
static inline void multiply_to_tsc(tsc_t *const tsc, const u32 a, const u32 b)
|
||||
{
|
||||
tsc->lo = (a & 0xffff) * (b & 0xffff);
|
||||
tsc->hi = ((tsc->lo >> 16)
|
||||
+ ((a & 0xffff) * (b >> 16))
|
||||
+ ((b & 0xffff) * (a >> 16)));
|
||||
tsc->lo = ((tsc->hi & 0xffff) << 16) | (tsc->lo & 0xffff);
|
||||
tsc->hi = ((a >> 16) * (b >> 16)) + (tsc->hi >> 16);
|
||||
}
|
||||
|
||||
/* Too many registers for ROMCC */
|
||||
static inline unsigned long long rdtscll(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user