summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2
diff options
context:
space:
mode:
authorGlenn Miles <milesg@ibm.com>2019-02-22 15:57:25 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2019-03-11 17:11:13 -0500
commit8147343269628e7bdab1ab25487e0ada3ace95e6 (patch)
treead7fb4cbddc55dafe6b7ce9fb402bf7eafd9f960 /src/usr/fapi2
parentff62338a569993f34032f02c04cf484a058aa9bd (diff)
downloadtalos-hostboot-8147343269628e7bdab1ab25487e0ada3ace95e6.tar.gz
talos-hostboot-8147343269628e7bdab1ab25487e0ada3ace95e6.zip
Use thread_local for globals that require it
Change-Id: I84294a60c53da2501b7bb1b53fe84d9f9709f8b1 RTC:147599 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72379 Tested-by: Jenkins Server <pfd-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> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
-rw-r--r--src/usr/fapi2/plat_hw_access.C15
-rw-r--r--src/usr/fapi2/plat_utils.C41
2 files changed, 23 insertions, 33 deletions
diff --git a/src/usr/fapi2/plat_hw_access.C b/src/usr/fapi2/plat_hw_access.C
index 9339e4ed9..dad30b177 100644
--- a/src/usr/fapi2/plat_hw_access.C
+++ b/src/usr/fapi2/plat_hw_access.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2018 */
+/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -58,11 +58,20 @@ const uint32_t CFAM_ENGINE_OFFSET = 0xFE00;
// Function prototypes
uint64_t platGetDDScanMode(const uint32_t i_ringMode);
-//TODO RTC:147599 Make this thread_local
+// Operational mode for scom operations (ignore errors, wakeup core, etc.)
+#ifndef PLAT_NO_THREAD_LOCAL_STORAGE
+thread_local OpModes opMode = NORMAL;
+#else
OpModes opMode = NORMAL;
+#endif
-//TODO RTC:147599 Make pib_err_mask thread local
+// Bitmap of PIB errors to ignore during a PIB oeration
+#ifndef PLAT_NO_THREAD_LOCAL_STORAGE
+thread_local uint8_t pib_err_mask = 0x00;
+#else
uint8_t pib_err_mask = 0x00;
+#endif
+
//------------------------------------------------------------------------------
// HW Communication Functions to be implemented at the platform layer.
diff --git a/src/usr/fapi2/plat_utils.C b/src/usr/fapi2/plat_utils.C
index ee1fde715..01eacb645 100644
--- a/src/usr/fapi2/plat_utils.C
+++ b/src/usr/fapi2/plat_utils.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2018 */
+/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -70,11 +70,12 @@ TRAC_INIT(&g_fapiMfgTd, FAPI_MFG_TRACE_NAME, 4*KILOBYTE);
namespace fapi2
{
-//@fixme-RTC:147599
// Define global current_err
-//thread_local ReturnCode current_err;
+#ifndef PLAT_NO_THREAD_LOCAL_STORAGE
+thread_local ReturnCode current_err;
+#else
ReturnCode current_err;
-
+#endif
///
/// @brief Retrieve the ring data from the centaur hw image
@@ -1516,35 +1517,15 @@ fapi2::ReturnCode platSpecialWakeup(const Target<TARGET_TYPE_ALL>& i_target,
return fapi_rc;
}
-//@fixme-RTC:147599-Remove when thread-local storage works right
-///
-/// @brief Mutex to prevent multiple threads from running HWPs at the same time
///
-mutex_t g_fapi2Mux = MUTEX_INITIALIZER;
-
-//@fixme-RTC:147599-Remove when thread-local storage works right
+/// @brief Resets all HWP thread_local variables
///
-/// @brief Lock or unlock the HWP futex
-/// @param[i] i_lock true:lock the mutex, false:unlock
-///
-void hwpLock( bool i_lock )
+void hwpResetGlobals(void)
{
- if( i_lock )
- {
- mutex_lock(&g_fapi2Mux);
- // Clear out all of our global (fake TLS) vars before we start
- fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
- fapi2::opMode = fapi2::NORMAL;
- fapi2::setPIBErrorMask(0);
- }
- else
- {
- fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
- fapi2::opMode = fapi2::NORMAL;
- fapi2::setPIBErrorMask(0);
- // Clear out all of our global (fake TLS) vars after we finish
- mutex_unlock(&g_fapi2Mux);
- }
+ // Reset all HWP thread_local vars
+ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
+ fapi2::opMode = fapi2::NORMAL;
+ fapi2::setPIBErrorMask(0);
}
OpenPOWER on IntegriCloud