summaryrefslogtreecommitdiffstats
path: root/src/hwpf/src/plat/plat_hw_access.C
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2016-08-17 03:36:49 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-09-09 08:50:10 -0400
commitcc5d7d24b85f7e60ebd05a815dffcc857aa5988a (patch)
tree35f602ee6a9ffbb15c3afdeb9045d1d0e3924370 /src/hwpf/src/plat/plat_hw_access.C
parenta97202a9a4d328b8af4dd734d67df24cb6462333 (diff)
downloadtalos-sbe-cc5d7d24b85f7e60ebd05a815dffcc857aa5988a.tar.gz
talos-sbe-cc5d7d24b85f7e60ebd05a815dffcc857aa5988a.zip
Handle parity/timeout errors
Change-Id: Ic9035ef7b2487dae93f6b53ad19e11772c2c4d12 RTC: 158199 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28370 Reviewed-by: AMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/hwpf/src/plat/plat_hw_access.C')
-rw-r--r--src/hwpf/src/plat/plat_hw_access.C61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/hwpf/src/plat/plat_hw_access.C b/src/hwpf/src/plat/plat_hw_access.C
index 5c2af1a8..01fedc96 100644
--- a/src/hwpf/src/plat/plat_hw_access.C
+++ b/src/hwpf/src/plat/plat_hw_access.C
@@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -24,6 +25,7 @@
#include <fapi2.H>
#include "plat_hw_access.H"
+#include "p9_perv_scom_addresses.H"
namespace fapi2
{
@@ -53,6 +55,10 @@ namespace fapi2
uint32_t l_rc = 0;
FAPI_INF("getScom: address: 0x%08X", i_addr);
l_rc = getscom_abs(i_addr, o_data);
+ if( PIB_NO_ERROR != l_rc )
+ {
+ l_rc = p9_pibErrRetry( i_addr, o_data, l_rc, true);
+ }
FAPI_INF("getScom: returned rc: 0x%08X, data HI: 0x%08X, "
"data LO: 0x%08X", l_rc, (*o_data >> 32),
static_cast<uint32_t>(*o_data & 0xFFFFFFFF));
@@ -66,7 +72,62 @@ namespace fapi2
i_addr, (i_data >> 32),
static_cast<uint32_t>(i_data & 0xFFFFFFFF));
l_rc = putscom_abs(i_addr, i_data);
+ if( PIB_NO_ERROR != l_rc )
+ {
+ l_rc = p9_pibErrRetry( i_addr, &i_data, l_rc, false);
+ }
FAPI_INF("putScom: returned rc: 0x%08X", l_rc);
return l_rc;
}
+
+uint32_t p9_pibErrRetry( const uint32_t i_addr, uint64_t *io_data,
+ const uint8_t i_pibErr, const bool i_isRead)
+{
+ FAPI_INF("Entering p9_pibErrRetry");
+ static const uint8_t MAX_RETRIES = 2;
+ static const uint64_t REG_BIT0 = (uint64_t)(0x1)<<63;
+ uint8_t l_retryCount = 0;
+ uint32_t pibErr = i_pibErr;
+
+ do
+ {
+ // Only retry for parity and timeout errors
+ if (( i_pibErr != PIB_PARITY_ERROR )
+ && ( i_pibErr != PIB_TIMEOUT_ERROR ))
+ {
+ break;
+ }
+ for(l_retryCount = 0; l_retryCount < MAX_RETRIES; l_retryCount++)
+ {
+ // RESET_PCB: Reset all PCB elements outside of the standby domain
+ pibErr = putscom_abs( PERV_PIB_RESET_REG, REG_BIT0 );
+ if( pibErr ) break;
+ // RESET_PCB: clear it again
+ pibErr = putscom_abs( PERV_PIB_RESET_REG, 0);
+ if( pibErr ) break;
+
+ FAPI_DBG( "*** Retry %i ***", l_retryCount );
+
+ if ( i_isRead )
+ {
+ pibErr = getscom_abs(i_addr, io_data);
+ }
+ else
+ {
+ pibErr = putscom_abs(i_addr, *io_data);
+ }
+
+ if( PIB_NO_ERROR == pibErr )
+ {
+ FAPI_INF("Read/Write Retry Successful");
+ break;
+ }
+ if ( pibErr != i_pibErr ) break;
+ }
+ }while(0);
+ FAPI_INF("Exiting p9_pibErrRetry");
+ return pibErr;
+}
+
+
};
OpenPOWER on IntegriCloud