intel raminit: rewrite timB high adjust calculation
Found while doing code review. Simplify the code by using a loop for positive and negative phase adjustments. Change-Id: I0980443d0d2815bccef969709fddecc07d61a788 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: http://review.coreboot.org/10890 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Nicolas Reinecke <nr@das-labor.org>
This commit is contained in:
committed by
Patrick Georgi
parent
0620b1e8a3
commit
e324cc91e0
@ -2288,18 +2288,17 @@ static int get_timB_high_adjust(u64 val)
|
|||||||
if (val == 0xffffffffffffffffLL)
|
if (val == 0xffffffffffffffffLL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (val >= 0xfffffffffffff000LL)
|
if (val >= 0xf000000000000000LL) {
|
||||||
return 3;
|
/* needs negative adjustment */
|
||||||
if (val >= 0xfffffffffff00000LL)
|
for (i = 0; i < 8; i++)
|
||||||
return -1;
|
if (val << (8 * (7 - i) + 4))
|
||||||
if (val >= 0xfffffff000000000LL)
|
return -i;
|
||||||
return -2;
|
} else {
|
||||||
if (val >= 0xfff0000000000000LL)
|
/* needs positive adjustment */
|
||||||
return -3;
|
for (i = 0; i < 8; i++)
|
||||||
|
if (val >> (8 * (7 - i) + 4))
|
||||||
for (i = 0; i < 8; i++)
|
return i;
|
||||||
if (val >> (8 * (7 - i) + 4))
|
}
|
||||||
return i;
|
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user