Skip to content

Commit

Permalink
SBE FIFO: Change set #4
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ilya Smirnov authored and marthabroyles committed Jun 29, 2017
1 parent 00f6d89 commit 7adb49a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 69 deletions.
6 changes: 0 additions & 6 deletions src/occ_405/firdata/native.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand All @@ -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 )
{
Expand Down
26 changes: 26 additions & 0 deletions src/occ_405/firdata/scom_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
13 changes: 10 additions & 3 deletions src/occ_405/firdata/scom_util.h
Original file line number Diff line number Diff line change
@@ -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. */
/* */
/* */
Expand Down Expand Up @@ -81,11 +81,18 @@ 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.
* @param o_val 32-bit returned value.
* @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 );

86 changes: 26 additions & 60 deletions src/occ_405/scom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 7adb49a

Please sign in to comment.