summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Lugo-Reyes <aalugore@us.ibm.com>2018-03-05 11:16:58 -0600
committerAndres A. Lugo-Reyes <aalugore@us.ibm.com>2018-03-06 14:20:43 -0500
commit1c7b23cc6b8f1d31a8851d8adc6dfe1c94502136 (patch)
tree75870a7be6223221afabdbc56c9ce770c863aaaa
parent2fe8f2c01e62eb73dd441dd5e0d386f40150787d (diff)
downloadtalos-occ-1c7b23cc6b8f1d31a8851d8adc6dfe1c94502136.tar.gz
talos-occ-1c7b23cc6b8f1d31a8851d8adc6dfe1c94502136.zip
WOF: Force ceff_ratio to 0% if voltage component is 0
Change-Id: I9d4d66b9dc1625c3fa12e96712f39062a1e26a17 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/55039 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com> Reviewed-by: William A. Bryan <wilbryan@us.ibm.com> Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com>
-rw-r--r--src/occ_405/wof/wof.c114
1 files changed, 61 insertions, 53 deletions
diff --git a/src/occ_405/wof/wof.c b/src/occ_405/wof/wof.c
index 76e3377..d5bd592 100644
--- a/src/occ_405/wof/wof.c
+++ b/src/occ_405/wof/wof.c
@@ -1045,7 +1045,7 @@ uint32_t calculate_effective_capacitance( uint32_t i_iAC,
uint32_t i_frequency )
{
// Prevent divide by zero
- if( i_frequency == 0 )
+ if( (i_frequency == 0) || (i_voltage == 0) )
{
// Return 0 causing caller to disable wof.
return 0;
@@ -1115,63 +1115,71 @@ void calculate_ceff_ratio_vdn( void )
*/
void calculate_ceff_ratio_vdd( void )
{
- // Read iac_tdp_vdd from OCCPstateParmBlock struct
- g_wof->iac_tdp_vdd =
- multiply_ratio( G_oppb.lac_tdp_vdd_turbo_10ma,
- g_wof->v_ratio );
-
-
- // Get Vturbo and convert to 100uV (mV -> 100uV) = mV*10
- // Multiply by Vratio
- g_wof->c_ratio_vdd_volt = G_oppb.operating_points[TURBO].vdd_mv * 10;
-
- // Get Fturbo and multiply by Fratio
- g_wof->c_ratio_vdd_freq =
- G_oppb.operating_points[TURBO].frequency_mhz * g_wof->f_ratio;
- /* TODO Uncomment once we use f_ratio from PGPE
- g_wof->c_ratio_vdd_freq =
- multiply_ratio( G_oppb.operating_points[TURBO].frequency_mhz,
- g_wof->f_ratio );
- */
-
- // Calculate ceff_tdp_vdd
- // iac_tdp_vdd / ((Vturbo*Vratio)^1.3 * (Fturbo*Fratio))
- g_wof->ceff_tdp_vdd =
- calculate_effective_capacitance( g_wof->iac_tdp_vdd,
- g_wof->c_ratio_vdd_volt,
- g_wof->c_ratio_vdd_freq );
- // Calculate ceff_vdd
- // iac_vdd / (Vclip^1.3 * Fclip)
- // NOTE: WOF Phase 1 to use VOLTVDDSENSE. Phase 2 will use v_clip
- g_wof->ceff_vdd =
- calculate_effective_capacitance( g_wof->iac_vdd,
- //(g_wof->v_clip*10),// mV->100uV
- g_wof->voltvddsense_sensor,
- g_wof->f_clip_freq );
-
- // Prevent divide by zero
- if( g_wof->ceff_tdp_vdd == 0 )
+ // If we get v_ratio of 0 from pgpe, force ceff_ratio_vdd to 0;
+ if( g_wof->v_ratio == 0 )
{
- // Print debug info to help isolate offending variable
- INTR_TRAC_ERR("WOF Disabled! Ceff VDD divide by 0");
- INTR_TRAC_ERR("iac_tdp_vdd = %d", G_oppb.lac_tdp_vdd_turbo_10ma );
- INTR_TRAC_ERR("v_ratio = %d", g_wof->v_ratio );
- INTR_TRAC_ERR("f_ratio = %d", g_wof->f_ratio );
- INTR_TRAC_ERR("vdd_mv = %d", G_oppb.operating_points[TURBO].vdd_mv);
- INTR_TRAC_ERR("freq_mhz = %d", G_oppb.operating_points[TURBO].frequency_mhz);
- INTR_TRAC_ERR("v_clip_mv = %d", g_wof->v_clip);
- INTR_TRAC_ERR("f_clip_PS = 0x%x", g_wof->f_clip_ps);
-
- // Return 0
g_wof->ceff_ratio_vdd = 0;
- set_clear_wof_disabled(SET, WOF_RC_DIVIDE_BY_ZERO);
}
else
{
- // Save ceff_ratio_vdd. Multiply by 10000 to convert to correct granularity.
- // Prevent Over current by clipping to max of 100%
- g_wof->ceff_ratio_vdd =
- prevent_over_current((g_wof->ceff_vdd*10000) / g_wof->ceff_tdp_vdd);
+ // Read iac_tdp_vdd from OCCPstateParmBlock struct
+ g_wof->iac_tdp_vdd =
+ multiply_ratio( G_oppb.lac_tdp_vdd_turbo_10ma,
+ g_wof->v_ratio );
+
+
+ // Get Vturbo and convert to 100uV (mV -> 100uV) = mV*10
+ // Multiply by Vratio
+ g_wof->c_ratio_vdd_volt = G_oppb.operating_points[TURBO].vdd_mv * 10;
+
+ // Get Fturbo and multiply by Fratio
+ g_wof->c_ratio_vdd_freq =
+ G_oppb.operating_points[TURBO].frequency_mhz * g_wof->f_ratio;
+ /* TODO Uncomment once we use f_ratio from PGPE
+ g_wof->c_ratio_vdd_freq =
+ multiply_ratio( G_oppb.operating_points[TURBO].frequency_mhz,
+ g_wof->f_ratio );
+ */
+
+ // Calculate ceff_tdp_vdd
+ // iac_tdp_vdd / ((Vturbo*Vratio)^1.3 * (Fturbo*Fratio))
+ g_wof->ceff_tdp_vdd =
+ calculate_effective_capacitance( g_wof->iac_tdp_vdd,
+ g_wof->c_ratio_vdd_volt,
+ g_wof->c_ratio_vdd_freq );
+ // Calculate ceff_vdd
+ // iac_vdd / (Vclip^1.3 * Fclip)
+ // NOTE: WOF Phase 1 to use VOLTVDDSENSE. Phase 2 will use v_clip
+ g_wof->ceff_vdd =
+ calculate_effective_capacitance( g_wof->iac_vdd,
+ //(g_wof->v_clip*10),// mV->100uV
+ g_wof->voltvddsense_sensor,
+ g_wof->f_clip_freq );
+
+ // Prevent divide by zero
+ if( g_wof->ceff_tdp_vdd == 0 )
+ {
+ // Print debug info to help isolate offending variable
+ INTR_TRAC_ERR("WOF Disabled! Ceff VDD divide by 0");
+ INTR_TRAC_ERR("iac_tdp_vdd = %d", G_oppb.lac_tdp_vdd_turbo_10ma );
+ INTR_TRAC_ERR("v_ratio = %d", g_wof->v_ratio );
+ INTR_TRAC_ERR("f_ratio = %d", g_wof->f_ratio );
+ INTR_TRAC_ERR("vdd_mv = %d", G_oppb.operating_points[TURBO].vdd_mv);
+ INTR_TRAC_ERR("freq_mhz = %d", G_oppb.operating_points[TURBO].frequency_mhz);
+ INTR_TRAC_ERR("v_clip_mv = %d", g_wof->v_clip);
+ INTR_TRAC_ERR("f_clip_PS = 0x%x", g_wof->f_clip_ps);
+
+ // Return 0
+ g_wof->ceff_ratio_vdd = 0;
+ set_clear_wof_disabled(SET, WOF_RC_DIVIDE_BY_ZERO);
+ }
+ else
+ {
+ // Save ceff_ratio_vdd. Multiply by 10000 to convert to correct granularity.
+ // Prevent Over current by clipping to max of 100%
+ g_wof->ceff_ratio_vdd =
+ prevent_over_current((g_wof->ceff_vdd*10000) / g_wof->ceff_tdp_vdd);
+ }
}
}
OpenPOWER on IntegriCloud