summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C
diff options
context:
space:
mode:
authorRahul Batra <rbatra@us.ibm.com>2017-05-23 21:24:55 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2017-06-01 06:45:26 -0400
commit1551812fabb4988129f15356aca8af7786240097 (patch)
treedc990cc9b3ac76074e835274cad185dc31449149 /src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C
parent2309514197db436f8bb6bd0615834c3611c9f89b (diff)
downloadtalos-hostboot-1551812fabb4988129f15356aca8af7786240097.tar.gz
talos-hostboot-1551812fabb4988129f15356aca8af7786240097.zip
PSTATE: System Calc Parameters Fix
- Adds PStateVSlopes and VPStateSlopes to Global Parm Struct - Calculates slopes for RAW/SYSP/BIASED/SYSP_BIASED Operating Pts - Leaves the old slopes and calculation in p9_pstate_parameter_block.C using slope shift of 13. To be removed later - Adds a new slopes format of 4.12[4 bits integer + 12 bit fractional - Recovers the lost system parameter equation fix Change-Id: Ic79ed4d0311c46612d68d6dffdabc459ec88d8e1 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40891 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Juan R. Medina <jrmedina@us.ibm.com> Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA <prasadbgr@in.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40996 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C')
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C124
1 files changed, 107 insertions, 17 deletions
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C b/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C
index f808296be..3fa029419 100644
--- a/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C
@@ -350,7 +350,12 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_
memcpy(l_globalppb.operating_points_set, l_operating_points, sizeof(l_operating_points));
// Calculate pre-calculated slopes
- p9_pstate_compute_PsV_slopes(l_operating_points, &l_globalppb);
+ p9_pstate_compute_PsV_slopes(l_operating_points, &l_globalppb); //Remote this RTC: 174743
+
+ p9_pstate_compute_PStateV_slope(VPD_PT_SET_RAW, l_operating_points, &l_globalppb);
+ p9_pstate_compute_PStateV_slope(VPD_PT_SET_SYSP, l_operating_points, &l_globalppb);
+ p9_pstate_compute_PStateV_slope(VPD_PT_SET_BIASED, l_operating_points, &l_globalppb);
+ p9_pstate_compute_PStateV_slope(VPD_PT_SET_BIASED_SYSP, l_operating_points, &l_globalppb);
l_globalppb.dpll_pstate0_value = revle32((revle32(l_globalppb.reference_frequency_khz) + revle32(
l_globalppb.frequency_step_khz) - 1) / revle32(
@@ -1688,15 +1693,15 @@ void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[NUM_OP_PO
for (p = 0; p < NUM_OP_POINTS; p++)
{
o_operating_points[VPD_PT_SET_SYSP][p].vdd_mv =
- revle32((revle32(i_gppb->operating_points[p].vdd_mv) * 1000 +
- (revle32(i_gppb->operating_points[p].idd_100ma) * 100 * revle32(i_gppb->vdd_sysparm.loadline_uohm +
- i_gppb->vdd_sysparm.distloss_uohm)) / 1000 +
- revle32(i_gppb->vdd_sysparm.distoffset_uv)) / 1000) ;
+ revle32(revle32(i_gppb->operating_points[p].vdd_mv) +
+ (((revle32(i_gppb->operating_points[p].idd_100ma) * 100) *
+ (revle32(i_gppb->vdd_sysparm.loadline_uohm) + revle32(i_gppb->vdd_sysparm.distloss_uohm))) / 1000 +
+ (revle32(i_gppb->vdd_sysparm.distoffset_uv))) / 1000) ;
o_operating_points[VPD_PT_SET_SYSP][p].vcs_mv =
- revle32( (revle32(i_gppb->operating_points[p].vcs_mv) * 1000 +
- (revle32(i_gppb->operating_points[p].ics_100ma) * 100 * (i_gppb->vcs_sysparm.loadline_uohm +
- i_gppb->vcs_sysparm.distloss_uohm) / 1000) +
- (i_gppb->vcs_sysparm.distoffset_uv)) / 1000) ;
+ revle32(revle32(i_gppb->operating_points[p].vcs_mv) +
+ (((revle32(i_gppb->operating_points[p].ics_100ma) * 100) *
+ (revle32(i_gppb->vcs_sysparm.loadline_uohm) + revle32(i_gppb->vcs_sysparm.distloss_uohm))) / 1000 +
+ (revle32(i_gppb->vcs_sysparm.distoffset_uv))) / 1000) ;
o_operating_points[VPD_PT_SET_SYSP][p].idd_100ma = (i_gppb->operating_points[p].idd_100ma);
o_operating_points[VPD_PT_SET_SYSP][p].ics_100ma = (i_gppb->operating_points[p].ics_100ma);
o_operating_points[VPD_PT_SET_SYSP][p].frequency_mhz = (i_gppb->operating_points[p].frequency_mhz);
@@ -1745,14 +1750,14 @@ void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[NUM_OP_PO
for (p = 0; p < NUM_OP_POINTS; p++)
{
o_operating_points[VPD_PT_SET_BIASED_SYSP][p].vdd_mv =
- revle32(((revle32(o_operating_points[VPD_PT_SET_BIASED][p].vdd_mv) * 1000) +
- ((revle32(o_operating_points[VPD_PT_SET_BIASED][p].idd_100ma) * 100) *
- (revle32(i_gppb->vdd_sysparm.loadline_uohm + i_gppb->vdd_sysparm.distloss_uohm))) / 1000 +
- (revle32(i_gppb->vdd_sysparm.distoffset_uv))) / 1000 );
+ revle32(revle32(o_operating_points[VPD_PT_SET_BIASED][p].vdd_mv) +
+ (((revle32(o_operating_points[VPD_PT_SET_BIASED][p].idd_100ma) * 100) *
+ (revle32(i_gppb->vdd_sysparm.loadline_uohm) + revle32(i_gppb->vdd_sysparm.distloss_uohm))) / 1000 +
+ (revle32(i_gppb->vdd_sysparm.distoffset_uv))) / 1000);
o_operating_points[VPD_PT_SET_BIASED_SYSP][p].vcs_mv =
- revle32(((revle32(o_operating_points[VPD_PT_SET_BIASED][p].vcs_mv) * 1000) +
- ((revle32(o_operating_points[VPD_PT_SET_BIASED][p].ics_100ma) * 100) *
- (revle32(i_gppb->vcs_sysparm.loadline_uohm + i_gppb->vcs_sysparm.distloss_uohm))) / 1000 +
+ revle32(revle32(o_operating_points[VPD_PT_SET_BIASED][p].vcs_mv) +
+ (((revle32(o_operating_points[VPD_PT_SET_BIASED][p].ics_100ma) * 100) *
+ (revle32(i_gppb->vcs_sysparm.loadline_uohm) + revle32(i_gppb->vcs_sysparm.distloss_uohm))) / 1000 +
(revle32(i_gppb->vcs_sysparm.distoffset_uv))) / 1000 );
o_operating_points[VPD_PT_SET_BIASED_SYSP][p].idd_100ma =
(o_operating_points[VPD_PT_SET_BIASED][p].idd_100ma);
@@ -1788,6 +1793,7 @@ void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[NUM_OP_PO
//Inflection Point 1 is NOMINAL
//Inflection Point 0 is POWERSAVE
//
+//\todo: Remove this. RTC: 174743
void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4],
GlobalPstateParmBlock* o_gppb)
{
@@ -1967,6 +1973,90 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4],
while(0);
}
+//This fills up the PStateVSlopes and VPStatesSlopes in GlobalParmBlock
+//Going forward this method should be retained in favor of the p9_pstate_compute_PsVSlopes
+void p9_pstate_compute_PStateV_slope(uint32_t pt_set, VpdOperatingPoint i_operating_points[][4],
+ GlobalPstateParmBlock* o_gppb)
+{
+
+ uint32_t tmp;
+ uint32_t eVidFP[NUM_OP_POINTS];
+ char const* vpdSetStr[NUM_VPD_PTS_SET] = VPD_PT_SET_ORDER_STR;
+
+ //convert to a fixed-point number
+ eVidFP[POWERSAVE] = revle32(revle32(i_operating_points[pt_set][POWERSAVE].vdd_mv) << VID_SLOPE_FP_SHIFT_12);
+ eVidFP[NOMINAL] = revle32(revle32(i_operating_points[pt_set][NOMINAL].vdd_mv) << VID_SLOPE_FP_SHIFT_12);
+ eVidFP[TURBO] = revle32(revle32(i_operating_points[pt_set][TURBO].vdd_mv) << VID_SLOPE_FP_SHIFT_12);
+ eVidFP[ULTRA] = revle32(revle32(i_operating_points[pt_set][ULTRA].vdd_mv) << VID_SLOPE_FP_SHIFT_12);
+
+ FAPI_INF("eVidFP[POWERSAVE] %x %04x", revle32(eVidFP[POWERSAVE]),
+ revle32(i_operating_points[pt_set][POWERSAVE].vdd_mv));
+ FAPI_INF("eVidFP[NOMINAL] %x %04x", revle32(eVidFP[NOMINAL]), revle32(i_operating_points[pt_set][NOMINAL].vdd_mv));
+ FAPI_INF("eVidFP[TURBO] %x %04x", revle32(eVidFP[TURBO]), revle32(i_operating_points[pt_set][TURBO].vdd_mv));
+ FAPI_INF("eVidFP[ULTRA] %x %04x", revle32(eVidFP[ULTRA]), revle32(i_operating_points[pt_set][ULTRA].vdd_mv));
+
+ // ULTRA TURBO pstate check is not required..because it's pstate will be
+ // 0
+ if (!(i_operating_points[pt_set][POWERSAVE].pstate) ||
+ !(i_operating_points[pt_set][NOMINAL].pstate) ||
+ !(i_operating_points[pt_set][TURBO].pstate))
+ {
+ FAPI_ERR("PSTATE value shouldn't be zero for %s", vpdSetStr[pt_set]);
+ return;
+ }
+
+ //Calculate slopes
+ tmp = revle32((revle32(eVidFP[NOMINAL]) - revle32(eVidFP[POWERSAVE])) /
+ ((uint32_t)(-i_operating_points[pt_set][NOMINAL].pstate +
+ i_operating_points[pt_set][POWERSAVE].pstate)));
+ o_gppb->PStateVSlopes[pt_set][REGION_POWERSAVE_NOMINAL] = revle16( revle32(tmp));
+ FAPI_INF("PStateVSlopes[%s][REGION_POWERSAVE_NOMINAL] %X tmp %X ", vpdSetStr[pt_set],
+ revle16(o_gppb->PStateVSlopes[pt_set][REGION_POWERSAVE_NOMINAL]), revle32(tmp));
+
+
+ tmp = revle32((revle32(eVidFP[TURBO]) - revle32(eVidFP[NOMINAL])) /
+ ((uint32_t)(-i_operating_points[pt_set][TURBO].pstate +
+ i_operating_points[pt_set][NOMINAL].pstate)));
+ o_gppb->PStateVSlopes[pt_set][REGION_NOMINAL_TURBO] = revle16( revle32(tmp));
+ FAPI_INF("PStateVSlopes[%s][REGION_NOMINAL_TURBO] %X tmp %X ", vpdSetStr[pt_set],
+ revle16(o_gppb->PStateVSlopes[pt_set][REGION_NOMINAL_TURBO]), revle32(tmp));
+
+
+ tmp = revle32((revle32(eVidFP[ULTRA]) - revle32(eVidFP[TURBO])) /
+ ((uint32_t)(-i_operating_points[pt_set][ULTRA].pstate +
+ i_operating_points[pt_set][TURBO].pstate)));
+ o_gppb->PStateVSlopes[pt_set][REGION_TURBO_ULTRA] = revle16( revle32(tmp));
+ FAPI_INF("PStateVSlopes[%s][REGION_TURBO_ULTRA] %X tmp %X ", vpdSetStr[pt_set],
+ revle16(o_gppb->PStateVSlopes[pt_set][REGION_TURBO_ULTRA]), revle32(tmp));
+
+ //Calculate inverted slopes
+ tmp = revle32((uint32_t)((-i_operating_points[pt_set][NOMINAL].pstate +
+ i_operating_points[pt_set][POWERSAVE].pstate) << VID_SLOPE_FP_SHIFT_12)
+ / (uint32_t) (revle32(i_operating_points[pt_set][NOMINAL].vdd_mv) -
+ revle32(i_operating_points[pt_set][POWERSAVE].vdd_mv)));
+ o_gppb->VPStateSlopes[pt_set][REGION_POWERSAVE_NOMINAL] = revle16( revle32(tmp));
+ FAPI_INF("VPStateSlopes[%s][REGION_POWERSAVE_NOMINAL] %X tmp %X", vpdSetStr[pt_set],
+ (revle16(o_gppb->VPStateSlopes[pt_set][REGION_POWERSAVE_NOMINAL])), revle32(tmp));
+
+
+ tmp = revle32((uint32_t)((-i_operating_points[pt_set][TURBO].pstate +
+ i_operating_points[pt_set][NOMINAL].pstate) << VID_SLOPE_FP_SHIFT_12)
+ / (uint32_t) (revle32(i_operating_points[pt_set][TURBO].vdd_mv) -
+ revle32(i_operating_points[pt_set][NOMINAL].vdd_mv)));
+ o_gppb->VPStateSlopes[pt_set][REGION_NOMINAL_TURBO] = revle16( revle32(tmp));
+ FAPI_INF("VPStateSlopes[%s][REGION_NOMINAL_TURBO] %X tmp %X", vpdSetStr[pt_set],
+ (revle16(o_gppb->VPStateSlopes[pt_set][REGION_NOMINAL_TURBO])), revle32(tmp));
+
+
+ tmp = revle32((uint32_t)((-i_operating_points[pt_set][ULTRA].pstate +
+ i_operating_points[pt_set][TURBO].pstate) << VID_SLOPE_FP_SHIFT_12)
+ / (uint32_t) (revle32(i_operating_points[pt_set][ULTRA].vdd_mv) -
+ revle32(i_operating_points[pt_set][TURBO].vdd_mv)));
+ o_gppb->VPStateSlopes[pt_set][REGION_TURBO_ULTRA] = revle16( revle32(tmp));
+ FAPI_INF("VPStateSlopes[%s][REGION_TURBO_ULTRA] %X tmp %X", vpdSetStr[pt_set],
+ (revle16(o_gppb->VPStateSlopes[pt_set][REGION_TURBO_ULTRA])), revle32(tmp));
+}
+
/// Print a GlobalPstateParameterBlock structure on a given stream
///
/// \param gppb The Global Pstate Parameter Block print
@@ -2789,7 +2879,7 @@ void p9_pstate_compute_PsVIDCompSlopes_slopes(PoundW_data i_data,
//convert to fixed-point number
for (uint8_t p = 0; p < NUM_OP_POINTS; ++p)
{
- cVidFP[p] = revle32((io_lppb->vid_point_set[p]) << VID_SLOPE_FP_SHIFT);
+ cVidFP[p] = revle32((io_lppb->vid_point_set[p]) << VID_SLOPE_FP_SHIFT_12);
}
OpenPOWER on IntegriCloud