diff options
Diffstat (limited to 'src/northbridge/amd')
-rw-r--r-- | src/northbridge/amd/amdk8/raminit.c | 12 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/raminit_f.c | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/northbridge/amd/amdk8/raminit.c b/src/northbridge/amd/amdk8/raminit.c index 7e42e94a3c..f3194503a9 100644 --- a/src/northbridge/amd/amdk8/raminit.c +++ b/src/northbridge/amd/amdk8/raminit.c @@ -1712,7 +1712,7 @@ static int update_dimm_Trc(const struct mem_controller *ctrl, const struct mem_p if ((value == 0) || (value == 0xff)) { value = param->tRC; } - clocks = ((value << 1) + param->divisor - 1)/param->divisor; + clocks = CEIL_DIV((value << 1), param->divisor); if (clocks < DTL_TRC_MIN) { clocks = DTL_TRC_MIN; } @@ -1741,7 +1741,7 @@ static int update_dimm_Trfc(const struct mem_controller *ctrl, const struct mem_ if ((value == 0) || (value == 0xff)) { value = param->tRFC; } - clocks = ((value << 1) + param->divisor - 1)/param->divisor; + clocks = CEIL_DIV((value << 1), param->divisor); if (clocks < DTL_TRFC_MIN) { clocks = DTL_TRFC_MIN; } @@ -1767,7 +1767,7 @@ static int update_dimm_Trcd(const struct mem_controller *ctrl, const struct mem_ int value; value = spd_read_byte(ctrl->channel0[i], 29); if (value < 0) return -1; - clocks = (value + (param->divisor << 1) -1)/(param->divisor << 1); + clocks = CEIL_DIV(value, (param->divisor << 1)); if (clocks < DTL_TRCD_MIN) { clocks = DTL_TRCD_MIN; } @@ -1792,7 +1792,7 @@ static int update_dimm_Trrd(const struct mem_controller *ctrl, const struct mem_ int value; value = spd_read_byte(ctrl->channel0[i], 28); if (value < 0) return -1; - clocks = (value + (param->divisor << 1) -1)/(param->divisor << 1); + clocks = CEIL_DIV(value, (param->divisor << 1)); if (clocks < DTL_TRRD_MIN) { clocks = DTL_TRRD_MIN; } @@ -1817,7 +1817,7 @@ static int update_dimm_Tras(const struct mem_controller *ctrl, const struct mem_ int value; value = spd_read_byte(ctrl->channel0[i], 30); if (value < 0) return -1; - clocks = ((value << 1) + param->divisor - 1)/param->divisor; + clocks = CEIL_DIV((value << 1), param->divisor); if (clocks < DTL_TRAS_MIN) { clocks = DTL_TRAS_MIN; } @@ -1842,7 +1842,7 @@ static int update_dimm_Trp(const struct mem_controller *ctrl, const struct mem_p int value; value = spd_read_byte(ctrl->channel0[i], 27); if (value < 0) return -1; - clocks = (value + (param->divisor << 1) - 1)/(param->divisor << 1); + clocks = CEIL_DIV(value, (param->divisor << 1)); if (clocks < DTL_TRP_MIN) { clocks = DTL_TRP_MIN; } diff --git a/src/northbridge/amd/amdk8/raminit_f.c b/src/northbridge/amd/amdk8/raminit_f.c index 36e0527dd8..b8417a6203 100644 --- a/src/northbridge/amd/amdk8/raminit_f.c +++ b/src/northbridge/amd/amdk8/raminit_f.c @@ -1973,7 +1973,7 @@ static int get_dimm_Trc_clocks(u32 spd_device, const struct mem_param *param) value *= 10; printk_raminit("update_dimm_Trc: tRC final value = %i\n", value); - clocks = (value + param->divisor - 1)/param->divisor; + clocks = CEIL_DIV(value, param->divisor); printk_raminit("update_dimm_Trc: clocks = %i\n", clocks); if (clocks < DTL_TRC_MIN) { @@ -2069,7 +2069,7 @@ static int update_dimm_TT_1_4(const struct mem_controller *ctrl, const struct me value = spd_read_byte(spd_device, SPD_TT); //already in 1/4 ns if (value < 0) return -1; value *=10; - clocks = (value + param->divisor -1)/param->divisor; + clocks = CEIL_DIV(value, param->divisor); if (clocks < TT_MIN) { clocks = TT_MIN; } @@ -2123,7 +2123,7 @@ static int update_dimm_Tras(const struct mem_controller *ctrl, const struct mem_ value *= 10; printk_raminit("update_dimm_Tras: 1 value= %08x\n", value); - clocks = (value + param->divisor - 1)/param->divisor; + clocks = CEIL_DIV(value, param->divisor); printk_raminit("update_dimm_Tras: divisor= %08x\n", param->divisor); printk_raminit("update_dimm_Tras: clocks= %08x\n", clocks); if (clocks < DTL_TRAS_MIN) { |