summaryrefslogtreecommitdiffstats
path: root/src/usr/xscom
diff options
context:
space:
mode:
authorCorey Swenson <cswenson@us.ibm.com>2018-03-19 16:46:58 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-03-27 09:50:58 -0400
commit8a783ea89563b0e452caab5c5900add8cc99e358 (patch)
tree029f82798d081b6af6b3557e76f461440cedb375 /src/usr/xscom
parent3d9454e644784df51aaa61ca6ab6c4f69a40b528 (diff)
downloadtalos-hostboot-8a783ea89563b0e452caab5c5900add8cc99e358.tar.gz
talos-hostboot-8a783ea89563b0e452caab5c5900add8cc99e358.zip
Move runtime scoms to common function
- Calls hypervisor scom interfaces - Move from xscom/runtime to scom/runtime RTC:190143 Change-Id: I41e0788f03fa27ae87c31a48dd041dbd66ca09c2 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/56042 CI-Ready: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/xscom')
-rw-r--r--src/usr/xscom/runtime/rt_xscom.C289
1 files changed, 18 insertions, 271 deletions
diff --git a/src/usr/xscom/runtime/rt_xscom.C b/src/usr/xscom/runtime/rt_xscom.C
index 99ef427fc..93e011864 100644
--- a/src/usr/xscom/runtime/rt_xscom.C
+++ b/src/usr/xscom/runtime/rt_xscom.C
@@ -26,16 +26,9 @@
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <targeting/common/targetservice.H>
-#include <targeting/common/utilFilter.H>
#include <xscom/xscomreasoncodes.H>
#include "../xscom.H"
-#include <assert.h>
-#include <errl/errludlogregister.H>
-#include <runtime/interface.h>
-#include <errl/errludtarget.H>
-#include <runtime/rt_targeting.H>
-#include <xscom/piberror.H>
+#include <scom/runtime/rt_scomif.H>
// Trace definition
trace_desc_t* g_trac_xscom = NULL;
@@ -65,114 +58,6 @@ DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD,
TARGETING::TYPE_MEMBUF,
xscomPerformOp);
-struct RcPibErrMap
-{
- PIB::PibError iv_Piberr;
- HbrtRcPiberr_t iv_Common;
- int iv_Opal; // note : opal values taken from opal-api.h
-};
-
-
-const RcPibErrMap pibErrTbl[] =
-{
- // 001
- PIB::PIB_RESOURCE_OCCUPIED,
- HBRT_RC_PIBERR_001_BUSY,
- -12, // OPAL_XSCOM_BUSY
-
- // 002
- PIB::PIB_CHIPLET_OFFLINE,
- HBRT_RC_PIBERR_010_OFFLINE,
- -14, // OPAL_XSCOM_CHIPLET_OFF
-
- // 003
- PIB::PIB_PARTIAL_GOOD,
- HBRT_RC_PIBERR_011_PGOOD,
- -25, // OPAL_XSCOM_PARTIAL_GOOD
-
- // 004
- PIB::PIB_INVALID_ADDRESS,
- HBRT_RC_PIBERR_100_INVALIDADDR,
- -26, // OPAL_XSCOM_ADDR_ERROR
-
- // 005
- PIB::PIB_CLOCK_ERROR,
- HBRT_RC_PIBERR_101_CLOCKERR,
- -27, // OPAL_XSCOM_CLOCK_ERROR
-
- // 006
- PIB::PIB_PARITY_ERROR,
- HBRT_RC_PIBERR_110_PARITYERR,
- -28, // OPAL_XSCOM_PARITY_ERROR
-
- // 007
- PIB::PIB_TIMEOUT,
- HBRT_RC_PIBERR_111_TIMEOUT,
- -29 // OPAL_XSCOM_TIMEOUT
-};
-
-
-/**
- * @brief Internal routine that translates a HBRT return code to a
- * PIB error code
- *
- * @param[in] i_rc HBRT return code,
- * @return PibError, PIB::PIB_NO_ERROR if not translatable
- *
- */
-PIB::PibError HbrtRcToPibErr( HbrtRcPiberr_t i_rc )
-{
- int l_entryCnt = sizeof(pibErrTbl) / sizeof(RcPibErrMap);
- PIB::PibError l_rv = PIB::PIB_NO_ERROR;
-
- for // loop thru the xlate table
- ( int i = 0;
- i < l_entryCnt;
- i++ )
- {
- if // matching entry found
- ( pibErrTbl[i].iv_Common == i_rc )
- {
- // extract translation value
- l_rv = pibErrTbl[i].iv_Piberr;
- break;
- }
- }
-
- return( l_rv );
-}
-
-
-/**
- * @brief Internal routine that translates an OPAL return code to a
- * PIB error code
- *
- * @param[in] i_rc OPAL return code
- * @return PibError, PIB::PIB_NO_ERROR if not translatable
- */
-PIB::PibError OpalRcToPibErr( int i_rc )
-{
- int l_entryCnt = sizeof(pibErrTbl) / sizeof(RcPibErrMap);
- PIB::PibError l_rv = PIB::PIB_NO_ERROR;
-
- for // loop thru the xlate table
- ( int i = 0;
- i < l_entryCnt;
- i++ )
- {
- if // matching entry found
- ( pibErrTbl[i].iv_Opal == i_rc )
- {
- // extract translation value
- l_rv = pibErrTbl[i].iv_Piberr;
- break;
- }
- }
-
- return( l_rv );
-}
-
-
/**
* @brief Internal routine that verifies the validity of input parameters
* for an XSCOM access.
@@ -183,7 +68,7 @@ PIB::PibError OpalRcToPibErr( int i_rc )
* @param[in/out] i_buffer Read: Pointer to output data storage
* Write: Pointer to input data storage
* @param[in/out] i_buflen Input: size of io_buffer (in bytes)
- * Output:
+ * Output:
* Read: Size of output data
* Write: Size of data written
* @param[in] i_args This is an argument list for DD framework.
@@ -195,14 +80,6 @@ errlHndl_t xscomOpSanityCheck(const DeviceFW::OperationType i_opType,
const TARGETING::Target* i_target,
const void* i_buffer,
const size_t& i_buflen,
- const va_list i_args);
-
-
-
-errlHndl_t xscomOpSanityCheck(const DeviceFW::OperationType i_opType,
- const TARGETING::Target* i_target,
- const void* i_buffer,
- const size_t& i_buflen,
const va_list i_args){
errlHndl_t l_err = NULL;
@@ -256,149 +133,23 @@ errlHndl_t xscomOpSanityCheck(const DeviceFW::OperationType i_opType,
return l_err;
}
+
/**
- * @brief Do the scom operation
+ * @brief Complete the xscom op
+ *
+ * @param[in] i_opType Operation type, see driverif.H
+ * @param[in] i_target XSCom target
+ * @param[in/out] io_buffer Read: Pointer to output data storage
+ * Write: Pointer to input data storage
+ * @param[in/out] io_buflen Input: size of io_buffer (in bytes)
+ * Output: Read: Size of output data
+ * Write: Size of data written
+ * @param[in] i_accessType Access type
+ * @param[in] i_args This is an argument list for DD framework.
+ * In this function, there's only one argument,
+ * which is the MMIO XSCom address
+ * @return errlHndl_t
*/
-errlHndl_t xScomDoOp(DeviceFW::OperationType i_ioType,
- TARGETING::Target * i_target,
- uint64_t i_scomAddr,
- void * io_buffer)
-{
- errlHndl_t l_err = NULL;
- int rc = 0;
- RT_TARG::rtChipId_t proc_id = 0;
-
- // Convert target to something Sapphire understands
- l_err = RT_TARG::getRtTarget(i_target,
- proc_id);
-
- if(l_err)
- {
- return l_err;
- }
-
- if(g_hostInterfaces != NULL &&
- g_hostInterfaces->scom_read != NULL &&
- g_hostInterfaces->scom_write != NULL)
- {
-
- if(i_ioType == DeviceFW::READ)
- {
- rc =
- g_hostInterfaces->scom_read(proc_id,
- i_scomAddr,
- io_buffer
- );
- }
- else if (i_ioType == DeviceFW::WRITE)
- {
- rc =
- g_hostInterfaces->scom_write(proc_id,
- i_scomAddr,
- io_buffer
- );
- }
-
- if(rc)
- {
- TRACFCOMP(g_trac_xscom,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_ioType);
-
- // convert rc to error log
- /*@
- * @errortype
- * @moduleid XSCOM_RT_DO_OP
- * @reasoncode XSCOM_RUNTIME_ERR
- * @userdata1 Hypervisor return code
- * @userdata2 SCOM address
- * @devdesc XSCOM access error
- */
- l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
- XSCOM_RT_DO_OP,
- XSCOM_RUNTIME_ERR,
- rc,
- i_scomAddr);
-
- // 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)
- }
-
- 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)
- }
-
- else if // legacy opal
- ( TARGETING::is_sapphire_load() )
- {
- // 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 );
- }
-
- 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;
- }
-
- else
- {
- // our testcases respond back with the
- // pib error directly
- if( rc > 0 )
- {
- l_piberr = static_cast<PIB::PibError>(rc);
- }
- }
-
- PIB::addFruCallouts(i_target,
- l_piberr,
- i_scomAddr,
- l_err);
-
- // Note: no trace buffer available at runtime
- }
- }
- else // Hypervisor interface not initialized
- {
- TRACFCOMP(g_trac_xscom,ERR_MRK"Hypervisor scom interface not linked");
- /*@
- * @errortype
- * @moduleid XSCOM_RT_DO_OP
- * @reasoncode XSCOM_RUNTIME_INTERFACE_ERR
- * @userdata1 0
- * @userdata2 SCOM address
- * @devdesc XSCOM runtime interface not linked.
- */
- l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
- XSCOM_RT_DO_OP,
- XSCOM_RUNTIME_INTERFACE_ERR,
- 0,
- i_scomAddr);
-
- l_err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
- HWAS::SRCI_PRIORITY_HIGH);
- }
-
- return l_err;
-}
-
-
errlHndl_t xscomPerformOp(DeviceFW::OperationType i_opType,
TARGETING::Target* i_target,
void* io_buffer,
@@ -418,11 +169,7 @@ errlHndl_t xscomPerformOp(DeviceFW::OperationType i_opType,
if (!l_err)
{
-
- l_err = xScomDoOp(i_opType,
- i_target,
- l_addr,
- io_buffer);
+ l_err = SCOM::sendScomToHyp(i_opType, i_target, l_addr, io_buffer);
}
TRACDCOMP(g_trac_xscom,EXIT_MRK"xscomPerformOp");
OpenPOWER on IntegriCloud