summaryrefslogtreecommitdiffstats
path: root/src/occ_405/wof
diff options
context:
space:
mode:
authorAndres Lugo-Reyes <aalugore@us.ibm.com>2017-09-26 13:10:19 -0500
committerWilliam A. Bryan <wilbryan@us.ibm.com>2017-10-19 12:29:06 -0400
commit1522d76c9df97e9bb9e994afff455e013b6f56fa (patch)
tree95bb544a09acf8c0060ad16378821cc77d4ad215 /src/occ_405/wof
parent50cfdf257476da2f34b49eb991eaed257829da23 (diff)
downloadtalos-occ-1522d76c9df97e9bb9e994afff455e013b6f56fa.tar.gz
talos-occ-1522d76c9df97e9bb9e994afff455e013b6f56fa.zip
Prevent Over-Current scenario caused by vdd ratio calculations
Change-Id: I3faf6590d9ad430cf2926caeb669082fda77dce2 RTC:180234 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46758 Reviewed-by: Martha Broyles <mbroyles@us.ibm.com> Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Diffstat (limited to 'src/occ_405/wof')
-rw-r--r--src/occ_405/wof/wof.c69
-rw-r--r--src/occ_405/wof/wof.h10
2 files changed, 62 insertions, 17 deletions
diff --git a/src/occ_405/wof/wof.c b/src/occ_405/wof/wof.c
index f2b5c3e..09ad7b0 100644
--- a/src/occ_405/wof/wof.c
+++ b/src/occ_405/wof/wof.c
@@ -325,15 +325,15 @@ void call_wof_main( void )
}
/**
- * wof_main
+ * wof_main
*
- * Description: Main Wof algorithm
+ * Description: Main Wof algorithm
*
- * Param: None
+ * Param: None
*
- * Return: None
+ * Return: None
*/
-void wof_main(void)
+void wof_main( void )
{
// Read out the sensor data needed for calculations
@@ -390,17 +390,17 @@ void wof_main(void)
}
/**
- * calculate_step_from_start
+ * calculate_step_from_start
*
- * Description: Calculates the step number for the current VDN/VDD
+ * Description: Calculates the step number for the current VDN/VDD
*
- * Param[in]: i_ceff_vdx_ratio - The current Ceff_vdd or Ceff_vdn_ratio
- * to calculate the step for.
- * Param[in]: i_step_size - The size of each step.
- * Param[in]: i_min_ceff - The minimum step number for this VDN/VDD
- * Param[in]: i_max_step - The maximum step number for this VDN/VDD
+ * Param[in]: i_ceff_vdx_ratio - The current Ceff_vdd or Ceff_vdn_ratio
+ * to calculate the step for.
+ * Param[in]: i_step_size - The size of each step.
+ * Param[in]: i_min_ceff - The minimum step number for this VDN/VDD
+ * Param[in]: i_max_step - The maximum step number for this VDN/VDD
*
- * Return: The calculated step for current Ceff_vdd/Ceff_vdn
+ * Return: The calculated step for current Ceff_vdd/Ceff_vdn
*/
uint16_t calculate_step_from_start(uint16_t i_ceff_vdx_ratio,
uint16_t i_step_size,
@@ -1119,7 +1119,9 @@ void calculate_ceff_ratio_vdd( void )
else
{
// Save ceff_ratio_vdd. Multiply by 10000 to convert to correct granularity.
- g_wof->ceff_ratio_vdd = (g_wof->ceff_vdd*10000) / g_wof->ceff_tdp_vdd;
+ // 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);
}
}
@@ -2062,3 +2064,42 @@ void print_oppb( void )
CMDH_TRAC_INFO("vdn_sysparm.distloss = %d", G_oppb.vdn_sysparm.distloss_uohm);
CMDH_TRAC_INFO("End OCCPstateParmBlock");
}
+
+/**
+ * prevent_over_current
+ *
+ * Description: Determines whether ceff_ratio_vdd will cause an over-current
+ * and clips it to a ratio of 1.0 if necessary.
+ *
+ * Param: Calculated ceff_ratio before clipping at 1.0
+ *
+ * Return: Clipped ceff_ratio
+ */
+uint32_t prevent_over_current( uint32_t i_ceff_ratio )
+{
+ static uint8_t L_oc_prevention_timer = 0;
+ uint32_t l_clipped_ratio = i_ceff_ratio;
+
+ if( i_ceff_ratio > MAX_CEFF_RATIO ) // 10000 = 1.0 ratio
+ {
+ INCREMENT_ERR_HISTORY( ERRH_CEFF_RATIO_VDD_EXCURSION );
+ l_clipped_ratio = MAX_CEFF_RATIO;
+
+ // If over current timer not started, start it.
+ if( L_oc_prevention_timer == 0 )
+ {
+ L_oc_prevention_timer = 10; // 10 WOF iterations
+ }
+ else
+ {
+ L_oc_prevention_timer--;
+ }
+ }
+ else if( L_oc_prevention_timer != 0 ) // Timer is running
+ {
+ l_clipped_ratio = MAX_CEFF_RATIO;
+ L_oc_prevention_timer--;
+ }
+
+ return l_clipped_ratio;
+}
diff --git a/src/occ_405/wof/wof.h b/src/occ_405/wof/wof.h
index c0bcd77..162c9d7 100644
--- a/src/occ_405/wof/wof.h
+++ b/src/occ_405/wof/wof.h
@@ -37,7 +37,9 @@
#define PGPE_WOF_OFF 0
#define PGPE_WOF_ON 1
#define NUM_CORES_PER_QUAD 4
-#define WOF_TABLES_OFFSET 0xC0000// Relative to PPMR_ADDRESS_HOMER
+#define WOF_TABLES_OFFSET 0xC0000 // Relative to PPMR_ADDRESS_HOMER
+#define MAX_CEFF_RATIO 10000 // 1.0 ratio = 10000
+ // (scaled to avoid floating point)
//******************************************************************************
// Bit Vector Masks
//******************************************************************************
@@ -437,7 +439,9 @@ uint32_t scale_and_interpolate( uint16_t * i_leak_arr,
uint16_t i_base_temp,
uint16_t i_voltage );
-void print_data(void);
+void print_data( void );
-void print_oppb(void);
+void print_oppb( void );
+
+uint32_t prevent_over_current( uint32_t i_ceff_ratio );
#endif
OpenPOWER on IntegriCloud