summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspashabk-in <shakeebbk@in.ibm.com>2018-05-18 04:14:04 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2018-06-19 21:00:29 -0400
commit9f90433232b883ebd760265736e64bfb840b7554 (patch)
tree862943c8a98402793abcd27c7aabf8cf4f0980c2
parent5d80e1109dd59bbf00f5fd58dc5e7a960cac6346 (diff)
downloadtalos-sbe-9f90433232b883ebd760265736e64bfb840b7554.zip
talos-sbe-9f90433232b883ebd760265736e64bfb840b7554.tar.gz
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
-rw-r--r--src/build/img_defs.mk7
-rw-r--r--src/build/import_hwp_mk/power/istepmpipl/Makefile2
-rw-r--r--src/build/import_hwp_mk/power/istepmpipl/istepmpiplfiles.mk2
-rw-r--r--src/build/power_defs.mk1
-rw-r--r--src/sbefw/core/sbe_sp_intf.H1
-rw-r--r--src/sbefw/core/sbecmdprocessor.C44
-rw-r--r--src/sbefw/core/sbeglobals.H10
-rw-r--r--src/sbefw/core/sbemain.C9
8 files changed, 69 insertions, 7 deletions
diff --git a/src/build/img_defs.mk b/src/build/img_defs.mk
index c6cd7d8..24b82b9 100644
--- a/src/build/img_defs.mk
+++ b/src/build/img_defs.mk
@@ -135,6 +135,10 @@ ifndef NEST_SRCDIR
export NEST_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/nest
endif
+ifndef IO_SRCDIR
+export IO_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/io
+endif
+
ifndef PM_SRCDIR
export PM_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/pm
endif
@@ -184,7 +188,7 @@ export P9_XIP_BINDIR = $(BASE_OBJDIR)/xip
endif
ifndef IMG_INCLUDES
-export IMG_INCLUDES = -I$(IMAGEPROCS_COMMON_SRCDIR) -I$(IMAGEPROCS_P9_SRCDIR) -I$(IMAGEPROCS_CEN_SRCDIR) -I$(P9_XIP_SRCDIR) -I$(BUILD_DIR) -I$(CACHE_SRCDIR) -I$(UTILS_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR) -I$(PM_SRCDIR) -I$(INITFILES_SRCDIR) -I$(HWPLIB_SRCDIR) -I$(HWPFFDC_SRCDIR)
+export IMG_INCLUDES = -I$(IMAGEPROCS_COMMON_SRCDIR) -I$(IMAGEPROCS_P9_SRCDIR) -I$(IMAGEPROCS_CEN_SRCDIR) -I$(P9_XIP_SRCDIR) -I$(BUILD_DIR) -I$(CACHE_SRCDIR) -I$(UTILS_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR) -I$(IO_SRCDIR) -I$(PM_SRCDIR) -I$(INITFILES_SRCDIR) -I$(HWPLIB_SRCDIR) -I$(HWPFFDC_SRCDIR)
endif
ifndef BOOT_OBJDIR
@@ -378,6 +382,7 @@ GCC-DEFS += -DPLAT_NO_THREAD_LOCAL_STORAGE=1
# disable assert
GCC-DEFS += -DNDEBUG
GCC-DEFS += -DHOST_INTERFACE_AVAILABLE=$(HOST_INTERFACE_AVAILABLE)
+GCC-DEFS += -DPERIODIC_IO_TOGGLE_SUPPORTED=$(PERIODIC_IO_TOGGLE_SUPPORTED)
# use the default settings in the code unless a size is defined
ifdef PK_TRACE_SZ
diff --git a/src/build/import_hwp_mk/power/istepmpipl/Makefile b/src/build/import_hwp_mk/power/istepmpipl/Makefile
index f9cba2d..4cc55c0 100644
--- a/src/build/import_hwp_mk/power/istepmpipl/Makefile
+++ b/src/build/import_hwp_mk/power/istepmpipl/Makefile
@@ -31,7 +31,7 @@ export SUB_OBJDIR = /$(IMPORT_OBJDIR)/istepmpipl
include img_defs.mk
include istepmpiplfiles.mk
-export VPATH = $(PERV_SRCDIR):$(NEST_SRCDIR):$(CACHE_SRCDIR):$(CORE_SRCDIR):$(PM_SRCDIR):$(INITFILES_SRCDIR):$(HWPLIB_SRCDIR)
+export VPATH = $(PERV_SRCDIR):$(NEST_SRCDIR):$(IO_SRCDIR):$(CACHE_SRCDIR):$(CORE_SRCDIR):$(PM_SRCDIR):$(INITFILES_SRCDIR):$(HWPLIB_SRCDIR)
OBJSISTEPMPIPL := $(addprefix $(OBJDIR-ISTEPMPIPL)/, $(ISTEPMPIPL_OBJECTS))
diff --git a/src/build/import_hwp_mk/power/istepmpipl/istepmpiplfiles.mk b/src/build/import_hwp_mk/power/istepmpipl/istepmpiplfiles.mk
index e353031..e84c70c 100644
--- a/src/build/import_hwp_mk/power/istepmpipl/istepmpiplfiles.mk
+++ b/src/build/import_hwp_mk/power/istepmpipl/istepmpiplfiles.mk
@@ -58,6 +58,8 @@ ISTEPMPIPL-CPP-SOURCES +=p9_query_cache_access_state.C
ISTEPMPIPL-CPP-SOURCES += p9_sbe_fastarray_abist_catchup.C
ISTEPMPIPL-CPP-SOURCES += p9_sbe_fastarray_cleanup.C
ISTEPMPIPL-CPP-SOURCES += p9_sbe_fastarray_setup.C
+# io eol toggle procedure moved here to locate it on seeprom
+ISTEPMPIPL-CPP-SOURCES += p9_sbe_io_eol_toggle.C
ISTEPMPIPL-C-SOURCES =
ISTEPMPIPL-S-SOURCES =
diff --git a/src/build/power_defs.mk b/src/build/power_defs.mk
index d9db8b0..d930418 100644
--- a/src/build/power_defs.mk
+++ b/src/build/power_defs.mk
@@ -33,6 +33,7 @@ SBE_TRACE_LEVEL_DEF = 2
FAPI_TRACE_LEVEL_DEF = 2
HOST_INTERFACE_AVAILABLE = 1
+PERIODIC_IO_TOGGLE_SUPPORTED = 1
export SBE_S0_SUPPORT = 1
diff --git a/src/sbefw/core/sbe_sp_intf.H b/src/sbefw/core/sbe_sp_intf.H
index e35ac4b..b283777 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 3264525..e200bab 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 8ddb06b..e7bd76b 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 bc84739..327c333 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)
OpenPOWER on IntegriCloud