summaryrefslogtreecommitdiffstats
path: root/src/include/usr/fapi2
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2017-01-06 13:55:20 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-01-23 23:29:43 -0500
commitc50f586098a5208764c5cbee9b88f23a51d16f07 (patch)
treedf2d2cc4e36295344b2c1ab6cfe4d0e19b09a56d /src/include/usr/fapi2
parent44eaa7b67e29cbca5b79e60c491ebdfcb624d787 (diff)
downloadblackbird-hostboot-c50f586098a5208764c5cbee9b88f23a51d16f07.tar.gz
blackbird-hostboot-c50f586098a5208764c5cbee9b88f23a51d16f07.zip
Enforce single-threaded rule for Hardware Procedures
Because we aren't using read thread-local storage for the FAPI variables (opmode, piberrmask, current_err) we need to ensure that we never have multiple HWPs running at the same time. The external interface that we use in all cases is FAPI_INVOKE_HWP so that is where a mutex is placed. This change also uncovered a couple bugs in how we were executing some non-fapi HWPs in the SBE update code so I fixed those as well. Change-Id: Ie8817da62dd4e6bc9ed3ac2debf126f6d05c2b23 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34518 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/usr/fapi2')
-rw-r--r--src/include/usr/fapi2/hwp_executor.H5
-rw-r--r--src/include/usr/fapi2/plat_hwp_invoker.H13
2 files changed, 13 insertions, 5 deletions
diff --git a/src/include/usr/fapi2/hwp_executor.H b/src/include/usr/fapi2/hwp_executor.H
index 6c2049595..6eea155c5 100644
--- a/src/include/usr/fapi2/hwp_executor.H
+++ b/src/include/usr/fapi2/hwp_executor.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -45,9 +45,6 @@
* Call the HWP directly.
*/
#define FAPI_PLAT_EXEC_HWP(RC, FUNC, _args_...) \
- fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;\
- fapi2::opMode = fapi2::NORMAL;\
- fapi2::setPIBErrorMask(0);\
RC = FUNC(_args_)
#endif // HWPEXECUTOR_H_
diff --git a/src/include/usr/fapi2/plat_hwp_invoker.H b/src/include/usr/fapi2/plat_hwp_invoker.H
index 211b3f0c6..c7ababf18 100644
--- a/src/include/usr/fapi2/plat_hwp_invoker.H
+++ b/src/include/usr/fapi2/plat_hwp_invoker.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -44,6 +44,15 @@
#include <plat_utils.H>
#include <xscom/piberror.H>
+namespace fapi2 {
+//@fixme-RTC:147599-Remove when thread-local storage works right
+///
+/// @brief Lock or unlock the HWP futex
+/// @param[i] i_lock true:lock the mutex, false:unlock
+///
+void hwpLock( bool i_lock );
+}
+
/**
* @brief HWP Invoker macro
*
@@ -59,6 +68,7 @@
#define FAPI_INVOKE_HWP(ERRHNDL, FUNC, _args_...) \
{\
+ fapi2::hwpLock(true); \
fapi2::ReturnCode l_rc; \
FAPI_EXEC_HWP(l_rc, FUNC, ##_args_); \
ERRHNDL = fapi2::rcToErrl(l_rc);\
@@ -66,6 +76,7 @@
ERRHNDL->collectTrace(FAPI_IMP_TRACE_NAME,256);\
ERRHNDL->collectTrace(FAPI_TRACE_NAME,384);\
}\
+ fapi2::hwpLock(false); \
}
#endif // PLATHWPINVOKER_H_
OpenPOWER on IntegriCloud