From 525318b3a87d45d1158b720264cbce84095809d4 Mon Sep 17 00:00:00 2001 From: mbroyles Date: Mon, 27 Feb 2017 11:53:37 -0600 Subject: Mode support with WOF Change-Id: I5f58a2b8444f151d4c7b0367137dd8c700442538 RTC: 168025 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37109 Tested-by: FSP CI Jenkins Reviewed-by: William A. Bryan Reviewed-by: Andres A. Lugo-Reyes Reviewed-by: Martha Broyles --- src/occ_405/mode.c | 223 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 154 insertions(+), 69 deletions(-) (limited to 'src/occ_405/mode.c') diff --git a/src/occ_405/mode.c b/src/occ_405/mode.c index d83485e..ee7a13b 100755 --- a/src/occ_405/mode.c +++ b/src/occ_405/mode.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -33,6 +33,7 @@ #include "amec_freq.h" #include "amec_part.h" #include "amec_data.h" +#include "amec_sys.h" errlHndl_t SMGR_mode_transition_to_nominal(); errlHndl_t SMGR_mode_transition_to_powersave(); @@ -40,6 +41,10 @@ errlHndl_t SMGR_mode_transition_to_dynpowersave(); errlHndl_t SMGR_mode_transition_to_dynpowersave_fp(); errlHndl_t SMGR_mode_transition_to_turbo(); errlHndl_t SMGR_mode_transition_to_ffo(); +errlHndl_t SMGR_mode_transition_to_fmf(); +errlHndl_t SMGR_mode_transition_to_nom_perf(); +errlHndl_t SMGR_mode_transition_to_max_perf(); + // Mode that OCC is currently in OCC_MODE G_occ_internal_mode = OCC_MODE_NOCHANGE; @@ -74,6 +79,9 @@ const smgr_state_trans_t G_smgr_mode_trans[] = {OCC_MODE_ALL, OCC_MODE_DYN_POWER_SAVE_FP, &SMGR_mode_transition_to_dynpowersave_fp}, {OCC_MODE_ALL, OCC_MODE_TURBO, &SMGR_mode_transition_to_turbo}, {OCC_MODE_ALL, OCC_MODE_FFO, &SMGR_mode_transition_to_ffo}, + {OCC_MODE_ALL, OCC_MODE_FMF, &SMGR_mode_transition_to_fmf}, + {OCC_MODE_ALL, OCC_MODE_NOM_PERFORMANCE, &SMGR_mode_transition_to_nom_perf}, + {OCC_MODE_ALL, OCC_MODE_MAX_PERFORMANCE, &SMGR_mode_transition_to_max_perf}, }; const uint8_t G_smgr_mode_trans_count = sizeof(G_smgr_mode_trans)/sizeof(smgr_state_trans_t); @@ -166,83 +174,68 @@ errlHndl_t SMGR_set_mode( const OCC_MODE i_mode ) } } - switch (l_mode) + // Change Mode via Transition Function + do { - case OCC_MODE_NOMINAL: // FALL THROUGH - case OCC_MODE_PWRSAVE: // FALL THROUGH - case OCC_MODE_DYN_POWER_SAVE: // FALL THROUGH - case OCC_MODE_DYN_POWER_SAVE_FP: // FALL THROUGH - case OCC_MODE_TURBO: // FALL THROUGH - case OCC_MODE_FFO: // FALL THROUGH - // Notify AMEC of mode change - - // Change Mode via Transition Function - do + // Loop through mode transition table, and find the state + // transition function that matches the transition we need to do. + for(jj=0; jjwof.wof_disabled |= WOF_RC_MODE_NO_SUPPORT_MASK; + CURRENT_MODE() = OCC_MODE_NOMINAL; TRAC_IMP("SMGR: Mode to Nominal Transition Completed"); @@ -301,6 +297,9 @@ errlHndl_t SMGR_mode_transition_to_powersave() // Set Freq Mode for AMEC to use l_errlHndl = amec_set_freq_range(OCC_MODE_PWRSAVE); + // WOF is disabled in SPS mode + g_amec->wof.wof_disabled |= WOF_RC_MODE_NO_SUPPORT_MASK; + CURRENT_MODE() = OCC_MODE_PWRSAVE; TRAC_IMP("SMGR: Mode to PowerSave Transition Completed"); @@ -324,6 +323,9 @@ errlHndl_t SMGR_mode_transition_to_dynpowersave() // Set Freq Mode for AMEC to use l_errlHndl = amec_set_freq_range(OCC_MODE_DYN_POWER_SAVE); + // WOF is enabled in DPS, clear the mode bit + g_amec->wof.wof_disabled &= ~WOF_RC_MODE_NO_SUPPORT_MASK; + CURRENT_MODE() = OCC_MODE_DYN_POWER_SAVE; TRAC_IMP("SMGR: Mode to Dynamic PowerSave-Favor Energy Transition Completed"); @@ -346,6 +348,9 @@ errlHndl_t SMGR_mode_transition_to_dynpowersave_fp() // Set Freq Mode for AMEC to use l_errlHndl = amec_set_freq_range(OCC_MODE_DYN_POWER_SAVE_FP); + // WOF is enabled in DPS-FP, clear the mode bit + g_amec->wof.wof_disabled &= ~WOF_RC_MODE_NO_SUPPORT_MASK; + CURRENT_MODE() = OCC_MODE_DYN_POWER_SAVE_FP; TRAC_IMP("SMGR: Mode to Dynamic PowerSave-Favor Performance Transition Completed"); @@ -369,6 +374,9 @@ errlHndl_t SMGR_mode_transition_to_turbo() // Set Freq Mode for AMEC to use l_errlHndl = amec_set_freq_range(OCC_MODE_TURBO); + // WOF is disabled in turbo mode + g_amec->wof.wof_disabled |= WOF_RC_MODE_NO_SUPPORT_MASK; + CURRENT_MODE() = OCC_MODE_TURBO; TRAC_IMP("SMGR: Mode to Turbo Transition Completed"); @@ -392,9 +400,86 @@ errlHndl_t SMGR_mode_transition_to_ffo() // Set Freq Mode for AMEC to use l_errlHndl = amec_set_freq_range(OCC_MODE_FFO); + // WOF is disabled in FFO + g_amec->wof.wof_disabled |= WOF_RC_MODE_NO_SUPPORT_MASK; + CURRENT_MODE() = OCC_MODE_FFO; TRAC_IMP("SMGR: Mode to FFO Transition Completed"); return l_errlHndl; } +// Function Specification +// +// Name: SMGR_mode_transition_to_fmf +// +// Description: Transition to Fixed Maximum Frequency mode +// +// End Function Specification +errlHndl_t SMGR_mode_transition_to_fmf() +{ + errlHndl_t l_errlHndl = NULL; + + TRAC_IMP("SMGR: Mode to FMF Transition Started"); + + // Set Freq Mode for AMEC to use + l_errlHndl = amec_set_freq_range(OCC_MODE_FMF); + + // WOF is enabled in FMF, clear the mode bit + g_amec->wof.wof_disabled &= ~WOF_RC_MODE_NO_SUPPORT_MASK; + + CURRENT_MODE() = OCC_MODE_FMF; + TRAC_IMP("SMGR: Mode to FMF Transition Completed"); + + return l_errlHndl; +} + +// Function Specification +// +// Name: SMGR_mode_transition_to_nom_perf +// +// Description: Transition to nominal performance mode +// +// End Function Specification +errlHndl_t SMGR_mode_transition_to_nom_perf() +{ + errlHndl_t l_errlHndl = NULL; + + TRAC_IMP("SMGR: Mode to Nominal Performance Transition Started"); + + // Set Freq Mode for AMEC to use + l_errlHndl = amec_set_freq_range(OCC_MODE_NOM_PERFORMANCE); + + // WOF is enabled in nominal performance mode, clear the mode bit + g_amec->wof.wof_disabled &= ~WOF_RC_MODE_NO_SUPPORT_MASK; + + CURRENT_MODE() = OCC_MODE_NOM_PERFORMANCE; + TRAC_IMP("SMGR: Mode to Nominal Performance Transition Completed"); + + return l_errlHndl; +} + +// Function Specification +// +// Name: SMGR_mode_transition_to_max_perf +// +// Description: Transition to Maximum Performance mode +// +// End Function Specification +errlHndl_t SMGR_mode_transition_to_max_perf() +{ + errlHndl_t l_errlHndl = NULL; + + TRAC_IMP("SMGR: Mode to Maximum Performance Transition Started"); + + // Set Freq Mode for AMEC to use + l_errlHndl = amec_set_freq_range(OCC_MODE_MAX_PERFORMANCE); + + // WOF is enabled in max performance mode, clear the mode bit + g_amec->wof.wof_disabled &= ~WOF_RC_MODE_NO_SUPPORT_MASK; + + CURRENT_MODE() = OCC_MODE_MAX_PERFORMANCE; + TRAC_IMP("SMGR: Mode to Maximum Performance Transition Completed"); + + return l_errlHndl; +} -- cgit v1.2.1