Skip to content

Commit

Permalink
Cleanup to Runtime SCOM RCs
Browse files Browse the repository at this point in the history
Standardized a few more constants and cleaned up some comments
and FFDC to be more obvious

Change-Id: Ifd387123573d75002e2194037636a44702b705d2
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66616
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Richard Ward <rward15@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@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: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
dcrowell77 authored and wghoffa committed Oct 9, 2018
1 parent d6741cb commit 52f52bb
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 80 deletions.
36 changes: 20 additions & 16 deletions src/include/runtime/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,28 @@ enum MemoryError_t
};


/** Common return codes to translate into pib error codes. */
// RC for a piberr is equal to 0x1000 plus the pib error value,
// made into a negative
enum HbrtRcPiberr_t
{
HBRT_RC_PIBERR_MASK = (0x00000000u - 0x00001007u), // 0xFFFF_EFF9
/** Common return codes for scom_read, scom_write. */

HBRT_RC_PIBERR_001_BUSY = (0x00000000u - 0x00001001u), // 0xFFFF_EFFF
HBRT_RC_PIBERR_010_OFFLINE = (0x00000000u - 0x00001002u), // 0xFFFF_EFFE
HBRT_RC_PIBERR_011_PGOOD = (0x00000000u - 0x00001003u), // 0xFFFF_EFFD
HBRT_RC_PIBERR_100_INVALIDADDR = (0x00000000u - 0x00001004u), // 0xFFFF_EFFC
HBRT_RC_PIBERR_101_CLOCKERR = (0x00000000u - 0x00001005u), // 0xFFFF_EFFB
HBRT_RC_PIBERR_110_PARITYERR = (0x00000000u - 0x00001006u), // 0xFFFF_EFFA
HBRT_RC_PIBERR_111_TIMEOUT = (0x00000000u - 0x00001007u), // 0xFFFF_EFF9
/* RC for a piberr is equal to 0x1000 plus the pib error value,
made into a negative */
#define HBRT_RC_PIBERR_MASK ((int)(0x0u - 0x1007u)) /* 0xFFFF_EFF9 */

HBRT_RC_SOMEOTHERERROR = (0x00000000u - 0x00001008u) // 0xFFFF_EFF8
};
#define HBRT_RC_PIBERR_001_BUSY ((int)(0x0u - 0x1001u)) /* 0xFFFF_EFFF */
#define HBRT_RC_PIBERR_010_OFFLINE ((int)(0x0u - 0x1002u)) /* 0xFFFF_EFFE */
#define HBRT_RC_PIBERR_011_PGOOD ((int)(0x0u - 0x1003u)) /* 0xFFFF_EFFD */
#define HBRT_RC_PIBERR_100_INVALIDADDR ((int)(0x0u - 0x1004u)) /* 0xFFFF_EFFC */
#define HBRT_RC_PIBERR_101_CLOCKERR ((int)(0x0u - 0x1005u)) /* 0xFFFF_EFFB */
#define HBRT_RC_PIBERR_110_PARITYERR ((int)(0x0u - 0x1006u)) /* 0xFFFF_EFFA */
#define HBRT_RC_PIBERR_111_TIMEOUT ((int)(0x0u - 0x1007u)) /* 0xFFFF_EFF9 */

/* Memory channel failure caused an error out to buffer chip. */
#define HBRT_RC_CHANNEL_FAILURE ((int)(0x0u - 0x1008u)) /* 0xFFFF_EFF8 */

/* Any host-specific RCs will be this value or bigger */
#define HBRT_RC_NEXT_OPEN_RC ((int)(0x0u - 0x1009u)) /* 0xFFFF_EFF7 */

/** End return codes for scom_read, scom_write. */


/**
* I2C Master Description: chip, engine and port packed into
Expand Down Expand Up @@ -156,7 +160,7 @@ enum HbrtRcPiberr_t
#define HBRT_RSVD_MEM__DATA "ibm,hbrt-data"
#define HBRT_RSVD_MEM__ARCH_REG "ibm,arch-reg-data"

// Aligned reserved memory size for Opal
/* Aligned reserved memory size for Opal */
#define HBRT_RSVD_MEM_OPAL_ALIGN 64*KILOBYTE

/**
Expand Down
126 changes: 63 additions & 63 deletions src/usr/scom/runtime/rt_scom.C
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace SCOM
struct RcPibErrMap
{
PIB::PibError iv_Piberr;
HbrtRcPiberr_t iv_Common;
int iv_Common;
int iv_Opal; // note : opal values taken from opal-api.h
};

Expand Down Expand Up @@ -94,7 +94,7 @@ const RcPibErrMap pibErrTbl[] =
* @return PibError, PIB::PIB_NO_ERROR if not translatable
*
*/
PIB::PibError HbrtRcToPibErr( HbrtRcPiberr_t i_rc )
PIB::PibError HbrtScomRcToPibErr( int i_rc )
{
int l_entryCnt = sizeof(pibErrTbl) / sizeof(RcPibErrMap);
PIB::PibError l_rv = PIB::PIB_NO_ERROR;
Expand Down Expand Up @@ -163,7 +163,7 @@ errlHndl_t sendScomToHyp(DeviceFW::OperationType i_opType,
void * io_buffer)
{
errlHndl_t l_err = nullptr;
int rc = 0;
int l_hostRC = 0;

do
{
Expand All @@ -183,108 +183,108 @@ errlHndl_t sendScomToHyp(DeviceFW::OperationType i_opType,

if(i_opType == DeviceFW::READ)
{
rc =
l_hostRC =
g_hostInterfaces->scom_read(proc_id,
i_scomAddr,
io_buffer
);
}
else if (i_opType == DeviceFW::WRITE)
{
rc =
l_hostRC =
g_hostInterfaces->scom_write(proc_id,
i_scomAddr,
io_buffer
);
}

if(rc)
if(l_hostRC)
{
TRACFCOMP(g_trac_scom,ERR_MRK
"Hypervisor scom read/write failed. "
"rc 0x%X target 0x%llX proc_id 0x%llX addr 0x%llX r/w %d",
rc, get_huid(i_target), proc_id, i_scomAddr, i_opType);
l_hostRC, get_huid(i_target), proc_id, i_scomAddr, i_opType);

// Use an unused bit in the 64-bit scom range to indicate
// read/write. Cannot use bit0 since that is part of an
// indirect address. Cannot use bit63 because that is a
// valid part of the address.
uint64_t l_userdata2 = i_scomAddr;
if(i_opType == DeviceFW::WRITE)
{
l_userdata2 |= 0x4000000000000000;
}

// convert rc to error log
/*@
* @errortype
* @moduleid SCOM_RT_SEND_SCOM_TO_HYP
* @reasoncode SCOM_RUNTIME_HYP_ERR
* @userdata1[0:31] Hypervisor return code
* @userdata1[32:63] SCOM Op Type
* @userdata2 SCOM address
* @devdesc SCOM access error
* @userdata1[0:31] Hypervisor return code
* @userdata2[32:63] Chipid sent to Hyp
* @userdata2[0:63] SCOM address
* @userdata2[1] SCOM Op Type: 0=read, 1=write
* @devdesc Error from Hypervisor attempting SCOM
*/
l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
SCOM_RT_SEND_SCOM_TO_HYP,
SCOM_RUNTIME_HYP_ERR,
TWO_UINT32_TO_UINT64(
rc,
l_hostRC,
i_opType),
i_scomAddr);

constexpr int MembufFatalError = -0x1008;
l_userdata2);

if (rc == MembufFatalError)
if (l_hostRC == HBRT_RC_CHANNEL_FAILURE)
{
// Channel is dead so switch to using the FSP for
// access
FSISCOM::switchToFspScomAccess(i_target);
}

// attempt to translate rc into a pib error assuming
// the rc is in common format
HbrtRcPiberr_t l_commonRc = static_cast<HbrtRcPiberr_t>(rc);
PIB::PibError l_piberr = HbrtRcToPibErr( l_commonRc );

if // input was translated to a PIB error code
( l_piberr != PIB::PIB_NO_ERROR )
{
// (translation was successful)
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: PIBERR 0x%X",l_piberr);
}

else if // input was common format, but not a PIB error
( l_commonRc == HBRT_RC_SOMEOTHERERROR )
{
// (already translated to PIB::PIB_NO_ERROR,
// no more translation needed)
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: PIB_NO_ERROR");
// Callout the failing buffer chip
l_err->addHwCallout(i_target,
HWAS::SRCI_PRIORITY_HIGH,
HWAS::NO_DECONFIG,
HWAS::GARD_NULL);
}

else if // legacy opal
( TARGETING::is_sapphire_load() )
else
{
// attempt to translate rc into a pib error assuming
// the rc is in old opal format
// this preserves legacy behavior to avoid co-req/pre-req
l_piberr = OpalRcToPibErr( rc );
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: OPAL 0x%X",l_piberr);
}
// the rc is in common format
int l_commonRc = l_hostRC;
PIB::PibError l_piberr = HbrtScomRcToPibErr( l_commonRc );

else if // legacy phyp
( TARGETING::is_phyp_load() )
{
// default to OFFLINE for now to trigger
// the multicast workaround in scom.C
l_piberr = PIB::PIB_CHIPLET_OFFLINE;
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: PIB_CHIPLET_OFFLINE");
}
if // input was translated to a PIB error code
( l_piberr != PIB::PIB_NO_ERROR )
{
// (translation was successful)
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: PIBERR 0x%X",l_piberr);
}

else
{
// our testcases respond back with the
// pib error directly
if( rc > 0 )
else if // legacy opal
( TARGETING::is_sapphire_load() )
{
l_piberr = static_cast<PIB::PibError>(rc);
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: RC 0x%X",l_piberr);
// attempt to translate rc into a pib error assuming
// the rc is in old opal format
// this preserves legacy behavior to avoid co-req/pre-req
l_piberr = OpalRcToPibErr( l_hostRC );
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: OPAL 0x%X",l_piberr);
}
}

PIB::addFruCallouts(i_target,
l_piberr,
i_scomAddr,
l_err);
else if // legacy phyp
( TARGETING::is_phyp_load() )
{
// default to OFFLINE for now to trigger
// the multicast workaround in scom.C
l_piberr = PIB::PIB_CHIPLET_OFFLINE;
TRACFCOMP(g_trac_scom,ERR_MRK"RC to PIB Err: PIB_CHIPLET_OFFLINE");
}

PIB::addFruCallouts(i_target,
l_piberr,
i_scomAddr,
l_err);
}

// Note: no trace buffer available at runtime
}
Expand Down
2 changes: 1 addition & 1 deletion src/usr/testcore/rtloader/loader.H
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
if( addr == 0x11223344 ||
addr == 0x22334455 )
{
rc = 4; //invalid address pib code
rc = HBRT_RC_PIBERR_100_INVALIDADDR;
}

return rc;
Expand Down

0 comments on commit 52f52bb

Please sign in to comment.