summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIlya Smirnov <ismirno@us.ibm.com>2017-06-15 16:36:10 -0500
committerMartha Broyles <mbroyles@us.ibm.com>2017-06-29 13:14:16 -0400
commit7adb49aeec6971ff0f3656a73829a793907f5567 (patch)
tree53f0d179233372cfa58d9a5735fd03c6cdc88dfb /src
parent00f6d894363b79e4e38f3f44fa6f78afb43e4f1d (diff)
downloadtalos-occ-7adb49aeec6971ff0f3656a73829a793907f5567.tar.gz
talos-occ-7adb49aeec6971ff0f3656a73829a793907f5567.zip
SBE FIFO: Change set #4
Enabled SCOM code paths that were disabled in p9. Added SCOM_putScom for putscom operations. Change-Id: I96b467df39e91531a607e56e70afafd7889d1d6e RTC:175100 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41935 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/occ_405/firdata/native.c6
-rw-r--r--src/occ_405/firdata/scom_util.c26
-rw-r--r--src/occ_405/firdata/scom_util.h13
-rw-r--r--src/occ_405/scom.c86
4 files changed, 62 insertions, 69 deletions
diff --git a/src/occ_405/firdata/native.c b/src/occ_405/firdata/native.c
index 3d57801..d214468 100644
--- a/src/occ_405/firdata/native.c
+++ b/src/occ_405/firdata/native.c
@@ -40,14 +40,11 @@ int32_t xscom_read( uint32_t i_address, uint64_t * o_data )
*o_data = 0;
-// TODO: RTC 173636 Needs SCOM support.
-#if 0
rc = getscom_ffdc( i_address, o_data, NULL );
if ( SUCCESS != rc )
{
TRAC_ERR( "SCOM error in xscom_read wrapper, rc=%d", rc );
}
-#endif
if ( TRACE_XSCOM )
{
@@ -62,14 +59,11 @@ int32_t xscom_write( uint32_t i_address, uint64_t i_data )
{
int32_t rc = SUCCESS;
-// TODO: RTC 173636 Needs SCOM support.
-#if 0
rc = putscom_ffdc( i_address, i_data, NULL );
if ( SUCCESS != rc )
{
TRAC_ERR( "SCOM error in xscom_write wrapper, rc=%d", rc );
}
-#endif
if ( TRACE_XSCOM )
{
diff --git a/src/occ_405/firdata/scom_util.c b/src/occ_405/firdata/scom_util.c
index 432d795..61a7a8e 100644
--- a/src/occ_405/firdata/scom_util.c
+++ b/src/occ_405/firdata/scom_util.c
@@ -574,3 +574,29 @@ int32_t SCOM_getIdScom( SCOM_Trgt_t i_trgt, uint64_t i_addr, uint32_t * o_val )
#undef FUNC
}
+
+/**
+ * @brief Executes standard putscom.
+ * @param i_trgt Chip to SCOM.
+ * @param i_addr Address to SCOM.
+ * @param i_val Value to put.
+ * @return Non-SUCCESS if an internal function fails. SUCCESS otherwise.
+*/
+int32_t SCOM_putScom( SCOM_Trgt_t i_trgt, uint32_t i_addr, uint64_t i_val )
+{
+ int32_t l_rc = SUCCESS;
+
+ /* Get the parent chip. */
+ SCOM_Trgt_t l_chip_targ = SCOM_Trgt_getParentChip(i_trgt);
+
+ /* Get the address relative to the parent chip. */
+ uint64_t l_trans_addr;
+ l_rc = translate_addr( i_trgt, i_addr, &l_trans_addr );
+ if ( SUCCESS == l_rc )
+ {
+ /* Do the SCOM. */
+ l_rc = putscomraw( l_chip_targ, l_trans_addr, i_val );
+ }
+
+ return l_rc;
+}
diff --git a/src/occ_405/firdata/scom_util.h b/src/occ_405/firdata/scom_util.h
index ea0ae49..1ec7fd2 100644
--- a/src/occ_405/firdata/scom_util.h
+++ b/src/occ_405/firdata/scom_util.h
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/occ/firdata/scom_util.H $ */
+/* $Source: src/occ_405/firdata/scom_util.h $ */
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -81,6 +81,14 @@ typedef enum
*/
int32_t SCOM_getScom( SCOM_Trgt_t i_trgt, uint32_t i_addr, uint64_t * o_val );
+/** @brief Performs a hardware put scom on a regular register.
+ * @param i_trgt The SCOM target.
+ * @param i_addr 32-bit SCOM address.
+ * @param i_val 64-bit value to write to the address.
+ * @return Non-SUCCESS if the SCOM fails. SUCCESS otherwise.
+*/
+int32_t SCOM_putScom( SCOM_Trgt_t i_trgt, uint32_t i_addr, uint64_t i_val );
+
/** @brief Performs a hardware scom on an indirect-SCOM register.
* @param i_trgt The SCOM target.
* @param i_addr 64-bit SCOM address.
@@ -88,4 +96,3 @@ int32_t SCOM_getScom( SCOM_Trgt_t i_trgt, uint32_t i_addr, uint64_t * o_val );
* @return Non-SUCCESS if the SCOM fails. SUCCESS otherwise.
*/
int32_t SCOM_getIdScom( SCOM_Trgt_t i_trgt, uint64_t i_addr, uint32_t * o_val );
-
diff --git a/src/occ_405/scom.c b/src/occ_405/scom.c
index 7aed750..bda8ac0 100644
--- a/src/occ_405/scom.c
+++ b/src/occ_405/scom.c
@@ -30,8 +30,7 @@
#include "occ_service_codes.h"
#include "occ_sys_config.h"
#include "polling.h"
-
-#define MAX_SCOM_FFDC_RETRIES 1
+#include <scom_util.h>
// Function Specification
//
@@ -44,45 +43,28 @@
// uncomitted error log.
//
// End Function Specification
-
-// In P9 we cannot do a scom from the 405. They must be done from a GPE.
-#if 0
int getscom_ffdc(uint32_t i_addr, uint64_t* o_data, errlHndl_t* o_errp)
{
- pmc_o2p_addr_reg_t l_addr;
- pmc_o2p_ctrl_status_reg_t l_status;
int l_rc;
- int l_retries = 0;
errlHndl_t l_err = NULL;
- while(l_retries <= MAX_SCOM_FFDC_RETRIES)
- {
- l_rc = _getscom(i_addr, o_data, SCOM_TIMEOUT);
- if(!l_rc)
- {
- break;
- }
-
- //_getscom returns immediately if the o2p interface was busy
- //wait to see if busy condition clears up
- if(l_rc == -SCOM_PROTOCOL_ERROR_GETSCOM_BUSY)
- {
- busy_wait(SCOM_TIMEOUT);
- }
-
- l_retries++;
- }
+ //P9 SCOM logic requires a target. However, if we're here, then it doesn't
+ //matter which target we pass in, so long as isMaster is true. This will
+ //allow to take the branch of code that schedules GPE scom job. See
+ //src/occ_405/firdata/scom_util.c for more info.
+ SCOM_Trgt_t l_tempTarget;
+ l_tempTarget.type = TRGT_PROC;
+ l_tempTarget.isMaster = TRUE;
+ l_tempTarget.procUnitPos = 0;
+
+ l_rc = SCOM_getScom(l_tempTarget, i_addr, o_data);
if(l_rc)
{
//grab additional ffdc
- l_status.value = in32(PMC_O2P_CTRL_STATUS_REG);
- l_addr.value = in32(PMC_O2P_ADDR_REG);
- TRAC_ERR("getscom_ffdc: scom failed. addr[%08x] rc[%08x] o2p_stat[%08x] o2p_addr[%08x]",
+ TRAC_ERR("getscom_ffdc: scom failed. addr[%08x] rc[%08x]",
i_addr,
- -l_rc,
- l_status.value,
- l_addr.value);
+ -l_rc);
/* @
* @errortype
@@ -140,40 +122,25 @@ int getscom_ffdc(uint32_t i_addr, uint64_t* o_data, errlHndl_t* o_errp)
// End Function Specification
int putscom_ffdc(uint32_t i_addr, uint64_t i_data, errlHndl_t* o_errp)
{
- pmc_o2p_addr_reg_t l_addr;
- pmc_o2p_ctrl_status_reg_t l_status;
int l_rc;
- int l_retries = 0;
errlHndl_t l_err = NULL;
- while(l_retries <= MAX_SCOM_FFDC_RETRIES)
- {
- l_rc = _putscom(i_addr, i_data, SCOM_TIMEOUT);
- if(!l_rc)
- {
- break;
- }
-
- //_putscom returns immediately if the o2p interface was busy. Instead, see if
- //it cleared after SCOM_TIMEOUT period.
- if(l_rc == -SCOM_PROTOCOL_ERROR_PUTSCOM_BUSY)
- {
- busy_wait(SCOM_TIMEOUT);
- }
-
- l_retries++;
- }
+ //P9 SCOM logic requires a target. However, if we're here, then it doesn't
+ //matter which target we pass in, so long as isMaster is true. This will
+ //allow to take the branch of code that schedules GPE scom job. See
+ //src/occ_405/firdata/scom_util.c for more info.
+ SCOM_Trgt_t l_tempTarget;
+ l_tempTarget.type = TRGT_PROC;
+ l_tempTarget.isMaster = TRUE;
+ l_tempTarget.procUnitPos = 0;
+
+ l_rc = SCOM_putScom(l_tempTarget, i_addr, i_data);
if(l_rc)
{
- //grab addtional ffdc
- l_status.value = in32(PMC_O2P_CTRL_STATUS_REG);
- l_addr.value = in32(PMC_O2P_ADDR_REG);
- TRAC_ERR("putscom_ffdc: scom failed. addr[%08x] rc[%08x] o2p_stat[%08x] o2p_addr[%08x]",
+ TRAC_ERR("putscom_ffdc: scom failed. addr[%08x] rc[%08x]",
i_addr,
- -l_rc,
- l_status.value,
- l_addr.value);
+ -l_rc);
/* @
* @errortype
@@ -213,7 +180,6 @@ int putscom_ffdc(uint32_t i_addr, uint64_t i_data, errlHndl_t* o_errp)
commitErrl(&l_err);
}
}
-
return l_rc;
}
-#endif
+
OpenPOWER on IntegriCloud