diff options
author | spashabk-in <shakeebbk@in.ibm.com> | 2018-05-18 04:14:04 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2018-06-19 21:00:29 -0400 |
commit | 9f90433232b883ebd760265736e64bfb840b7554 (patch) | |
tree | 862943c8a98402793abcd27c7aabf8cf4f0980c2 /src/sbefw | |
parent | 5d80e1109dd59bbf00f5fd58dc5e7a960cac6346 (diff) | |
download | talos-sbe-9f90433232b883ebd760265736e64bfb840b7554.tar.gz talos-sbe-9f90433232b883ebd760265736e64bfb840b7554.zip |
Support periodic timer
This timer will be sued to toggle EI bus after every 24 hours.
Change-Id: Id21af317914ddfb02d42a166bc7c0b6ce62bffdd
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60777
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
(cherry picked from commit 4fe7e7c6520087ec1416e332be2b0b8ca85574d4)
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48096
Diffstat (limited to 'src/sbefw')
-rw-r--r-- | src/sbefw/core/sbe_sp_intf.H | 1 | ||||
-rw-r--r-- | src/sbefw/core/sbecmdprocessor.C | 44 | ||||
-rw-r--r-- | src/sbefw/core/sbeglobals.H | 10 | ||||
-rw-r--r-- | src/sbefw/core/sbemain.C | 9 |
4 files changed, 59 insertions, 5 deletions
diff --git a/src/sbefw/core/sbe_sp_intf.H b/src/sbefw/core/sbe_sp_intf.H index e35ac4be..b283777b 100644 --- a/src/sbefw/core/sbe_sp_intf.H +++ b/src/sbefw/core/sbe_sp_intf.H @@ -225,6 +225,7 @@ enum sbeSecondaryResponse SBE_SEC_S0_START_MPIPL_FAILED = 0x24, SBE_SEC_S0_STOP_CLOCK_FAILED = 0x25, SBE_SEC_S0_CONTINUE_MPIPL_FAILED = 0x26, + SBE_SEC_PERIODIC_IO_TOGGLE_FAILED = 0x27, }; /** diff --git a/src/sbefw/core/sbecmdprocessor.C b/src/sbefw/core/sbecmdprocessor.C index 32645255..e200babf 100644 --- a/src/sbefw/core/sbecmdprocessor.C +++ b/src/sbefw/core/sbecmdprocessor.C @@ -48,11 +48,18 @@ #include "sbeglobals.H" #include "core/chipop_handler.H" #include "core/ipl.H" +#include "sbeFFDC.H" #ifdef _S0_ #include "sbes0handler.H" #endif +#if PERIODIC_IO_TOGGLE_SUPPORTED +#include "p9_sbe_io_eol_toggle.H" +#endif + +const uint32_t PERIODIC_TIMER_INTERVAL_MS = 24*60*60*1000; // 24 hours + using namespace fapi2; // Forward declaration for performAttrSetup @@ -418,18 +425,45 @@ void sbeSyncCommandProcessor_routine(void *i_pArg) #endif } while(true); // Thread always exists SBE_EXIT(SBE_FUNC); + #undef SBE_FUNC } ////////////////////////////////////////////////////// ////////////////////////////////////////////////////// void sbeAsyncCommandProcessor_routine(void *arg) { - SBE_INFO("sbeAsyncCommandProcessor Thread started"); - + #define SBE_FUNC "sbeAsyncCommandProcessor" + SBE_INFO(SBE_FUNC " Thread started"); + #if PERIODIC_IO_TOGGLE_SUPPORTED do { - // @TODO RTC via : 130392 - // Add infrastructure for host interface + // Since currently there is only one async job + // - IO EOL toggle, this task runs every + // PERIODIC_TIMER_INTERVAL_MS and performs the + // operation. Modify this implementation by introducing job + // queue, if there are more asynchronous jobs. + int l_rcPk = pk_semaphore_pend ( + &SBE_GLOBAL->sbeSemAsyncProcess, + PK_MILLISECONDS(PERIODIC_TIMER_INTERVAL_MS)); + // PK API failure + if ((-l_rcPk) != PK_SEMAPHORE_PEND_TIMED_OUT) + { + SBE_ERROR(SBE_FUNC" pk_semaphore_pend failed, " + "l_rcPk=-%04x", -l_rcPk ); + // Ignore the failure + } - } while(0); + ReturnCode rc = FAPI2_RC_SUCCESS; + Target<TARGET_TYPE_PROC_CHIP > proc = plat_getChipTarget(); + SBE_EXEC_HWP(rc, p9_sbe_io_eol_toggle, proc) + if (rc != FAPI2_RC_SUCCESS) + { + SBE_ERROR(SBE_FUNC " p9_sbe_io_eol_toggle failed"); + // SBE async ffdc + captureAsyncFFDC(SBE_PRI_GENERIC_EXECUTION_FAILURE, + SBE_SEC_PERIODIC_IO_TOGGLE_FAILED); + } + } while(1); + #endif // PERIODIC_IO_TOGGLE_SUPPORTED + #undef SBE_FUNC } diff --git a/src/sbefw/core/sbeglobals.H b/src/sbefw/core/sbeglobals.H index 8ddb06be..e7bd76b6 100644 --- a/src/sbefw/core/sbeglobals.H +++ b/src/sbefw/core/sbeglobals.H @@ -76,6 +76,15 @@ class SBEGlobalsSingleton * */ PkSemaphore sbeSemCmdProcess; + + /** + * @brief Global semaphore for async task + * + * This is used to send invoke commands on Async process + * + */ + PkSemaphore sbeSemAsyncProcess; + sbeRole SBERole; // SBE Frequency. Initially nest frequency is 133 MHZ uint32_t sbefreq; @@ -138,6 +147,7 @@ class SBEGlobalsSingleton sbeIntrSource(), sbeSemCmdRecv(), sbeSemCmdProcess(), + sbeSemAsyncProcess(), SBERole(SBE_ROLE_MASTER), sbefreq(( 133 * 1000 * 1000)/SBE::SBE_TO_NEST_FREQ_FACTOR), sbeFWSecurityEnabled(1) diff --git a/src/sbefw/core/sbemain.C b/src/sbefw/core/sbemain.C index bc84739b..327c3339 100644 --- a/src/sbefw/core/sbemain.C +++ b/src/sbefw/core/sbemain.C @@ -49,6 +49,9 @@ // Max defines for Semaphores static uint32_t MAX_SEMAPHORE_COUNT = 3; +// As periodic timer expire in 24 hours count should never +// be more than 1. +static uint32_t MAX_PERIODIC_TIMER_SEMAPHORE_COUNT = 1; extern "C" { // These variables are declared in linker script to keep track of @@ -119,6 +122,12 @@ uint32_t sbeInitSems(void) { break; } + l_rc = pk_semaphore_create(&SBE_GLOBAL->sbeSemAsyncProcess, 0, + MAX_PERIODIC_TIMER_SEMAPHORE_COUNT); + if (l_rc) + { + break; + } } while (false); if (l_rc) |