diff options
author | Van Lee <vanlee@us.ibm.com> | 2012-10-04 19:03:07 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-10-10 10:56:21 -0500 |
commit | c093ffb2f52adae60468cfa466e9939ad9026a62 (patch) | |
tree | 9ebd4d8a489240fc221350cec2575e6cd75b0293 /src/usr/hwpf/hwp/bus_training | |
parent | 167b115362297b549ac9459b5301698ee2a86b4f (diff) | |
download | talos-hostboot-c093ffb2f52adae60468cfa466e9939ad9026a62.tar.gz talos-hostboot-c093ffb2f52adae60468cfa466e9939ad9026a62.zip |
HWP: integrate proc_build_smp into Hostboot
RTC: 42153
Change-Id: I2d68a5d3614480e7fc9113c276c5a6b5440f9990
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1836
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/bus_training')
-rw-r--r-- | src/usr/hwpf/hwp/bus_training/makefile | 2 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/bus_training/pbusLinkSvc.C | 251 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/bus_training/pbusLinkSvc.H | 133 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/bus_training/proc_fab_smp.C | 288 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/bus_training/proc_fab_smp.H | 160 |
5 files changed, 833 insertions, 1 deletions
diff --git a/src/usr/hwpf/hwp/bus_training/makefile b/src/usr/hwpf/hwp/bus_training/makefile index dd17dd43f..3fa717649 100644 --- a/src/usr/hwpf/hwp/bus_training/makefile +++ b/src/usr/hwpf/hwp/bus_training/makefile @@ -34,7 +34,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp ## pointer to common HWP files EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include -OBJS = gcr_funcs.o io_funcs.o io_run_training.o +OBJS = gcr_funcs.o io_funcs.o io_run_training.o pbusLinkSvc.o proc_fab_smp.o ## NOTE: add a new directory onto the vpaths when you add a new HWP ## vpath %.C proc_cen_framelock:io_run_training diff --git a/src/usr/hwpf/hwp/bus_training/pbusLinkSvc.C b/src/usr/hwpf/hwp/bus_training/pbusLinkSvc.C new file mode 100644 index 000000000..22cf3bfa6 --- /dev/null +++ b/src/usr/hwpf/hwp/bus_training/pbusLinkSvc.C @@ -0,0 +1,251 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/hwpf/hwp/edi_ei_initialization/pbusLinkSvc.C $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ +#include "pbusLinkSvc.H" + +namespace EDI_EI_INITIALIZATION +{ + +using namespace TARGETING; +using namespace fapi; + +PbusLinkSvc & PbusLinkSvc::getTheInstance() +{ + return Singleton<PbusLinkSvc>::instance(); +} + +PbusLinkSvc::PbusLinkSvc() +{ + mutex_init(&iv_mutex); +} + +PbusLinkSvc::~PbusLinkSvc() +{ + mutex_destroy(&iv_mutex); +} + +errlHndl_t PbusLinkSvc::getPbusConnections( TargetPairs_t & o_PbusConnections, + TYPE i_busType, bool i_noDuplicate ) +{ + errlHndl_t l_errl = NULL; + TargetPairs_t * l_PbusConnections = NULL; + o_PbusConnections.clear(); + + mutex_lock(&iv_mutex); + + if (i_busType == TYPE_ABUS) + { + if (iv_abusConnections.size() == 0) + { + l_errl = collectPbusConections( TYPE_ABUS ); + } + if (l_errl == NULL) + { + l_PbusConnections = i_noDuplicate ? &iv_abusUniqueConnections : + &iv_abusConnections; + } + } + else + { + if (iv_xbusConnections.size() == 0) + { + l_errl = collectPbusConections( TYPE_XBUS ); + } + if (l_errl == NULL) + { + l_PbusConnections = i_noDuplicate ? &iv_xbusUniqueConnections : + &iv_xbusConnections; + } + } + + o_PbusConnections.insert( (*l_PbusConnections).begin(), + (*l_PbusConnections).end() ); + + mutex_unlock(&iv_mutex); + + return l_errl; +} + + +errlHndl_t PbusLinkSvc::collectPbusConections( TYPE i_busType ) +{ + errlHndl_t l_errl = NULL; + + // Get all functional i_busType chiplets + TARGETING::TargetHandleList l_busTargetList; + getAllChiplets(l_busTargetList, i_busType); + + // select the appropriate maps to work with + TargetPairs_t & l_PbusConnections = (i_busType == TYPE_ABUS) ? + iv_abusConnections : iv_xbusConnections; + TargetPairs_t & l_PbusUniqueConnections = (i_busType == TYPE_ABUS) ? + iv_abusUniqueConnections : iv_xbusUniqueConnections; + + // Collect all functional i_busType pbus connections + for (size_t i = 0; (l_errl == NULL) && (i < l_busTargetList.size()); i++) + { + // get two endpoint targets + const TARGETING::Target * l_pTarget = l_busTargetList[i]; + const TARGETING::Target * l_dstTgt = NULL; + l_dstTgt = l_pTarget->getAttr<ATTR_PEER_TARGET>(); + + // connection is existing, not to itself and is a real target + if ((l_dstTgt != NULL) && (l_dstTgt != l_pTarget)) + { + TYPE l_dstType = l_dstTgt->getAttr<ATTR_TYPE>(); + if (l_dstType != i_busType) + { + TARG_ERR("Both endpoints' bus type mismatch"); + EntityPath l_path; + l_path = l_pTarget->getAttr<ATTR_PHYS_PATH>(); + l_path.dump(); + l_path = l_dstTgt->getAttr<ATTR_PHYS_PATH>(); + l_path.dump(); + + // Mixed bus type connection + /** + * @errortype ERRL_SEV_UNRECOVERABLE + * @moduleid MOD_EDI_EI_IO_RUN_TRAINING + * @reasoncode RC_MIXED_PBUS_CONNECTION + * @userdata1 Endpoint1 bus type + * @userdata2 Endpoint2 bus type + * @devdesc Platform generated error. See User Data. + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + MOD_EDI_EI_IO_RUN_TRAINING, + RC_MIXED_PBUS_CONNECTION, + i_busType, + l_dstType ); + continue; + } + + // Get the chip parents of endpoints + const TARGETING::Target * l_endp1Parent = getParentChip(l_pTarget); + const TARGETING::Target * l_endp2Parent = getParentChip(l_dstTgt); + + if (l_endp1Parent == l_endp2Parent) + { + TARG_ERR("Both endpoints from same chip"); + EntityPath l_path; + l_path = l_pTarget->getAttr<ATTR_PHYS_PATH>(); + l_path.dump(); + l_path = l_dstTgt->getAttr<ATTR_PHYS_PATH>(); + l_path.dump(); + + // connection of same chip + /** + * @errortype ERRL_SEV_UNRECOVERABLE + * @moduleid MOD_EDI_EI_IO_RUN_TRAINING + * @reasoncode RC_SAME_CHIP_PBUS_CONNECTION + * @devdesc Platform generated error. + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + MOD_EDI_EI_IO_RUN_TRAINING, + RC_SAME_CHIP_PBUS_CONNECTION ); + continue; + } + + for (size_t j = 0; j < l_busTargetList.size(); j++) + { + // l_dstTgt is functional + if (l_dstTgt == l_busTargetList[j]) + { + // save the pair if not yet done so + l_PbusConnections[l_pTarget] = l_dstTgt; + l_PbusUniqueConnections[l_pTarget] = l_dstTgt; + break; + } + } + } + } + + // Validate pbus connections are valid and strike out + // duplicates for the Unique connection map + TargetPairs_t::iterator l_itr, l_jtr; + for (l_itr = l_PbusUniqueConnections.begin(); + (l_errl == NULL) && (l_itr != l_PbusUniqueConnections.end()); ++l_itr) + { + const TARGETING::Target *l_ptr1 = l_itr->first; + const TARGETING::Target *l_ptr2 = l_itr->second; + l_jtr = l_PbusUniqueConnections.find(l_ptr2); + if ((l_jtr == l_PbusUniqueConnections.end()) + || (l_jtr->second != l_ptr1)) + { + // Connection is conflicting, e.g. + // endp1 -> endp2 but endp2 -> endp3. + // endp1 -> endp2 but endp2 -> endp2 (itself) or not existing + EntityPath l_path; + l_path = l_itr->second->getAttr<ATTR_PHYS_PATH>(); + char *l_pathString = l_path.toString(); + TARG_ERR( "First endpoint's PEER_TARGET is %s", l_pathString ); + free (l_pathString); + if (l_jtr != l_PbusUniqueConnections.end()) + { + l_path = l_jtr->second->getAttr<ATTR_PHYS_PATH>(); + l_pathString = l_path.toString(); + TARG_ERR("Second endpoint's PEER_TARGET is %s", l_pathString); + free (l_pathString); + } + else + { + if (l_ptr2) + { + l_path = l_ptr2->getAttr<ATTR_PHYS_PATH>(); + l_pathString = l_path.toString(); + TARG_ERR("Second endpoint's PEER_TARGET is itself, %s", + l_pathString); + free (l_pathString); + } + else + { + TARG_ERR("Second endpoint's PEER_TARGET is not existing"); + } + } + + /** + * @errortype ERRL_SEV_UNRECOVERABLE + * @moduleid MOD_EDI_EI_IO_RUN_TRAINING + * @reasoncode RC_CONFLICT_PBUS_CONNECTION + * @userdata1 Bus endpoint target pointer1 + * @userdata2 Bus endpoint target pointer2 + * @devdesc Platform generated error. See User Data. + */ + l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + MOD_EDI_EI_IO_RUN_TRAINING, + RC_CONFLICT_PBUS_CONNECTION, + reinterpret_cast<uint64_t>(l_ptr1), + reinterpret_cast<uint64_t>(l_ptr2)); + break; + } + else + { + l_PbusUniqueConnections.erase(l_jtr); + } + } + + return l_errl; +} + +} diff --git a/src/usr/hwpf/hwp/bus_training/pbusLinkSvc.H b/src/usr/hwpf/hwp/bus_training/pbusLinkSvc.H new file mode 100644 index 000000000..ee2caffd5 --- /dev/null +++ b/src/usr/hwpf/hwp/bus_training/pbusLinkSvc.H @@ -0,0 +1,133 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/hwpf/hwp/edi_ei_initialization/pbusLinkSvc.H $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ +/** + * @file pbusLinkSvc.H + * + * Singleton service to provide validation of pbus connections and + * return validated valid connections + * + */ + +#ifndef __PBUSLINKSVC_H +#define __PBUSLINKSVC_H + +#include <stdint.h> +#include <util/singleton.H> +#include <map> +#include <hwpf/plat/fapiPlatReasonCodes.H> + +#include <errl/errlentry.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/utilFilter.H> +#include <targeting/common/trace.H> + +// fapi support +#include <fapi.H> + +namespace EDI_EI_INITIALIZATION +{ + +using namespace TARGETING; +using namespace fapi; + +typedef std::map<const TARGETING::Target*, + const TARGETING::Target*> TargetPairs_t; + +class PbusLinkSvc +{ + +public: + + /** + * @brief Get singleton instance of this class. + * + * @return the (one and only) instance of PbusLinkSvc + */ + static PbusLinkSvc& getTheInstance(); + + /** + * @brief getPbusConnections() will collect all pbus connections of + * the specified bus type. If this is the first time collection, + * it will perform the collection and save them into the vectors + * within the singleton. Then, it will make a copy into the + * caller's map whose reference is passed to this function. + * + * @parm[out] o_PbusConnections, reference of a map for getting a copy + * of the map of specified bus connections + * @parm[in] i_busType, type of bus connection, TYPE_XBUS or TYPE_ABUS + * @parm[in] i_noDuplicate, set to true to eliminate duplicates, i.e. + * only (endpoint1,endpoint2) or (endpoint2,endpoint1) will + * be in the present in the map + * @return errlHndl_t if encountering an error, or NULL (no error) + * + */ + + errlHndl_t getPbusConnections( TargetPairs_t & o_PbusConnections, + TYPE i_busType, bool i_noDuplicate = true ); + +protected: + /** + * @brief Constructor for the PbusLinkSvc object. + */ + PbusLinkSvc(); + + /** + * @brief Destructor for the PbusLinkSvc object. + */ + ~PbusLinkSvc(); + +private: + /** + * @note Disable copy constructor and assignment operator + */ + PbusLinkSvc(const PbusLinkSvc& i_right); + PbusLinkSvc& operator=(const PbusLinkSvc& i_right); + + TargetPairs_t iv_abusUniqueConnections; + TargetPairs_t iv_abusConnections; + TargetPairs_t iv_xbusUniqueConnections; + TargetPairs_t iv_xbusConnections; + + // Mutex serializing changes to the above four maps + mutex_t iv_mutex; + + /** + * @brief collectPbusConections() will collect all pbus connections of + * the specified bus type. It checks for mixed-type connection, + * conflicting connection, and invalid-same-chip connection. + * The connections are saved within the singleton. + * + * @parm[in] i_busType, type of bus connection, TYPE_XBUS or TYPE_ABUS + * @return errlHndl_t if encountering an error, or NULL (no error) + * + */ + errlHndl_t collectPbusConections( TYPE i_busType ); + +}; + +} + +#endif diff --git a/src/usr/hwpf/hwp/bus_training/proc_fab_smp.C b/src/usr/hwpf/hwp/bus_training/proc_fab_smp.C new file mode 100644 index 000000000..8f97676d8 --- /dev/null +++ b/src/usr/hwpf/hwp/bus_training/proc_fab_smp.C @@ -0,0 +1,288 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/bus_training/proc_fab_smp.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +// $Id: proc_fab_smp.C,v 1.7 2012/09/24 05:00:12 jmcgill Exp $ +// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/p8/working/procedures/ipl/fapi/proc_fab_smp.C,v $ +//------------------------------------------------------------------------------ +// *| +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +// *| +// *! TITLE : proc_fab_smp.C +// *! DESCRIPTION : Common fabric structure defintions/utility functions (FAPI) +// *! +// *! OWNER NAME : Joe McGill Email: jmcgill@us.ibm.com +// *! +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include "proc_fab_smp.H" + +extern "C" { + + +//------------------------------------------------------------------------------ +// Function definitions +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +// function: utility function to read & return fabric node ID attribute +// parameters: i_target => pointer to chip target +// o_node_id => structure encapsulating node ID value +// returns: FAPI_RC_SUCCESS if attribute read is successful & value is valid, +// RC_PROC_FAB_SMP_FABRIC_NODE_ID_ATTR_ERR if attribute value is +// invalid, +// else FAPI_ATTR_GET return code +//------------------------------------------------------------------------------ +fapi::ReturnCode proc_fab_smp_get_node_id_attr( + const fapi::Target* i_target, + proc_fab_smp_node_id& o_node_id) +{ + // return code + fapi::ReturnCode rc; + // temporary attribute storage used to build procedure data structures + uint8_t node_id_attr; + + // mark function entry + FAPI_DBG("proc_fab_smp_get_node_id_attr: Start"); + + do + { + // retrieve node ID attribute + rc = FAPI_ATTR_GET(ATTR_FABRIC_NODE_ID, + i_target, + node_id_attr); + if (!rc.ok()) + { + FAPI_ERR("proc_fab_smp_get_node_id_attr: Error querying ATTR_FABRIC_NODE_ID"); + break; + } + + // print attribute value + FAPI_DBG("proc_fab_smp_get_node_id_attr: ATTR_FABRIC_NODE_ID = 0x%X", + node_id_attr); + + // translate to output value + switch (node_id_attr) + { + case 0: + o_node_id = FBC_NODE_ID_0; + break; + case 1: + o_node_id = FBC_NODE_ID_1; + break; + case 2: + o_node_id = FBC_NODE_ID_2; + break; + case 3: + o_node_id = FBC_NODE_ID_3; + break; + case 4: + o_node_id = FBC_NODE_ID_4; + break; + case 5: + o_node_id = FBC_NODE_ID_5; + break; + case 6: + o_node_id = FBC_NODE_ID_6; + break; + case 7: + o_node_id = FBC_NODE_ID_7; + break; + default: + FAPI_ERR("proc_fab_smp_get_node_id_attr: Invalid fabric node ID attribute value 0x%02X", + node_id_attr); + const uint8_t& ATTR_DATA = node_id_attr; + FAPI_SET_HWP_ERROR(rc, + RC_PROC_FAB_SMP_FABRIC_NODE_ID_ATTR_ERR); + break; + } + } while(0); + + // mark function exit + FAPI_DBG("proc_fab_smp_get_node_id_attr: End"); + return rc; +} + + +//------------------------------------------------------------------------------ +// function: utility function to read & return fabric chip ID attribute +// parameters: i_target => pointer to chip target +// o_chip_id => structure encapsulating chip ID value +// returns: FAPI_RC_SUCCESS if attribute read is successful & value is valid, +// RC_PROC_FAB_SMP_FABRIC_CHIP_ID_ATTR_ERR if attribute value is +// invalid, +// else FAPI_ATTR_GET return code +//------------------------------------------------------------------------------ +fapi::ReturnCode proc_fab_smp_get_chip_id_attr( + const fapi::Target* i_target, + proc_fab_smp_chip_id& o_chip_id) +{ + // return code + fapi::ReturnCode rc; + // temporary attribute storage used to build procedure data structures + uint8_t chip_id_attr; + + // mark function entry + FAPI_DBG("proc_fab_smp_get_chip_id_attr: Start"); + + do + { + // retrieve chip ID attribute + rc = FAPI_ATTR_GET(ATTR_FABRIC_CHIP_ID, + i_target, + chip_id_attr); + if (!rc.ok()) + { + FAPI_ERR("proc_fab_smp_get_chip_id_attr: Error querying ATTR_FABRIC_CHIP_ID"); + break; + } + + // print attribute value + FAPI_DBG("proc_fab_smp_get_chip_id_attr: ATTR_FABRIC_CHIP_ID = 0x%X", + chip_id_attr); + + // translate to output value + switch (chip_id_attr) + { + case 0: + o_chip_id = FBC_CHIP_ID_0; + break; + case 1: + o_chip_id = FBC_CHIP_ID_1; + break; + case 2: + o_chip_id = FBC_CHIP_ID_2; + break; + case 3: + o_chip_id = FBC_CHIP_ID_3; + break; + case 4: + o_chip_id = FBC_CHIP_ID_4; + break; + case 5: + o_chip_id = FBC_CHIP_ID_5; + break; + case 6: + o_chip_id = FBC_CHIP_ID_6; + break; + case 7: + o_chip_id = FBC_CHIP_ID_7; + break; + default: + FAPI_ERR("proc_fab_smp_get_chip_id_attr: Invalid fabric chip ID attribute value 0x%02X", + chip_id_attr); + const uint8_t& ATTR_DATA = chip_id_attr; + FAPI_SET_HWP_ERROR(rc, + RC_PROC_FAB_SMP_FABRIC_CHIP_ID_ATTR_ERR); + break; + } + } while(0); + + // mark function exit + FAPI_DBG("proc_fab_smp_get_chip_id_attr: End"); + return rc; +} + + +//------------------------------------------------------------------------------ +// function: utility function to read & return PCIe/DSMP mux attribute values +// parameters: i_target => pointer to chip target +// o_pcie_not_f_link => vector of boolean values representing state +// of PCIe/DSMP mux settings (one value per +// foreign link, true=PCIe function, false= +// DSMP function) +// returns: FAPI_RC_SUCCESS if attribute read is successful & value is valid, +// RC_PROC_FAB_SMP_PCIE_NOT_F_LINK_ATTR_ERR if attribute value is +// invalid, +// else FAPI_ATTR_GET return code +//------------------------------------------------------------------------------ +fapi::ReturnCode proc_fab_smp_get_pcie_dsmp_mux_attrs( + const fapi::Target* i_target, + bool o_pcie_not_f_link[PROC_FAB_SMP_NUM_F_LINKS]) +{ + // return code + fapi::ReturnCode rc; + // temporary attribute storage used to build procedure data structures + uint8_t pcie_not_f_link_attr[PROC_FAB_SMP_NUM_F_LINKS]; + + // mark function entry + FAPI_DBG("proc_fab_smp_get_pcie_dsmp_mux_attrs: Start"); + + do + { + // retrieve PCIe/DSMP mux attributes + rc = FAPI_ATTR_GET(ATTR_PROC_PCIE_NOT_F_LINK, + i_target, + pcie_not_f_link_attr); + if (!rc.ok()) + { + FAPI_ERR("proc_fab_smp_get_pcie_dsmp_mux_attrs: Error querying ATTR_PROC_PCIE_NOT_F_LINK"); + break; + } + + // loop over all links + for (uint8_t l = 0; + l < PROC_FAB_SMP_NUM_F_LINKS; + l++) + { + // print attribute value + FAPI_DBG("proc_fab_smp_get_pcie_dsmp_mux_attrs: ATTR_PROC_PCIE_NOT_F_LINK[%d] = 0x%X", + l, pcie_not_f_link_attr[l]); + + // validate attribute value + switch (pcie_not_f_link_attr[l]) + { + case 0: + o_pcie_not_f_link[l] = false; + break; + case 1: + o_pcie_not_f_link[l] = true; + break; + default: + FAPI_ERR("proc_fab_smp_get_pcie_dsmp_mux_attrs: Invalid PCIe/DSMP mux attribute value 0x%02X", + pcie_not_f_link_attr[l]); + const uint8_t& ATTR_DATA = pcie_not_f_link_attr[l]; + FAPI_SET_HWP_ERROR(rc, + RC_PROC_FAB_SMP_PCIE_NOT_F_LINK_ATTR_ERR); + break; + } + if (!rc.ok()) + { + break; + } + } + } while(0); + + // mark function exit + FAPI_DBG("proc_fab_smp_get_pcie_dsmp_mux_attrs: End"); + return rc; +} + + + +} // extern "C" diff --git a/src/usr/hwpf/hwp/bus_training/proc_fab_smp.H b/src/usr/hwpf/hwp/bus_training/proc_fab_smp.H new file mode 100644 index 000000000..3b235161f --- /dev/null +++ b/src/usr/hwpf/hwp/bus_training/proc_fab_smp.H @@ -0,0 +1,160 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/bus_training/proc_fab_smp.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +// $Id: proc_fab_smp.H,v 1.6 2012/09/24 05:00:15 jmcgill Exp $ +// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/p8/working/procedures/ipl/fapi/proc_fab_smp.H,v $ +//------------------------------------------------------------------------------ +// *| +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +// *| +// *! TITLE : proc_fab_smp.H +// *! DESCRIPTION : Common fabric structure defintions/utility functions (FAPI) +// *! +// *! OWNER NAME : Joe McGill Email: jmcgill@us.ibm.com +// *! +//------------------------------------------------------------------------------ + +#ifndef _PROC_FAB_SMP_H_ +#define _PROC_FAB_SMP_H_ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include <fapi.H> + + +//------------------------------------------------------------------------------ +// Structure definitions +//------------------------------------------------------------------------------ + +// define set of supported fabric node ID values +enum proc_fab_smp_node_id +{ + FBC_NODE_ID_0 = 0, + FBC_NODE_ID_1 = 1, + FBC_NODE_ID_2 = 2, + FBC_NODE_ID_3 = 3, + FBC_NODE_ID_4 = 4, + FBC_NODE_ID_5 = 5, + FBC_NODE_ID_6 = 6, + FBC_NODE_ID_7 = 7 +}; + +// define set of supported fabric chip ID values +enum proc_fab_smp_chip_id +{ + FBC_CHIP_ID_0 = 0, + FBC_CHIP_ID_1 = 1, + FBC_CHIP_ID_2 = 2, + FBC_CHIP_ID_3 = 3, + FBC_CHIP_ID_4 = 4, + FBC_CHIP_ID_5 = 5, + FBC_CHIP_ID_6 = 6, + FBC_CHIP_ID_7 = 7 +}; + +// define set of supported epsilon table types +enum proc_fab_smp_eps_table_type +{ + PROC_FAB_SMP_EPSILON_TABLE_TYPE_LE = 0, + PROC_FAB_SMP_EPSILON_TABLE_TYPE_HE = 1 +}; + +// define set of supported broadcast/pump modes +enum proc_fab_smp_pump_mode +{ + PROC_FAB_SMP_PUMP_MODE1 = 1, + PROC_FAB_SMP_PUMP_MODE2 = 2 +}; + + +//------------------------------------------------------------------------------ +// Constant definitions +//------------------------------------------------------------------------------ + +// largest representable fabric real address given HW implementation +const uint64_t PROC_FAB_SMP_MAX_ADDRESS = ((1ULL << 50)-1ULL); + +// number of links supported per chip +const uint8_t PROC_FAB_SMP_NUM_A_LINKS = 3; +const uint8_t PROC_FAB_SMP_NUM_X_LINKS = 4; +const uint8_t PROC_FAB_SMP_NUM_F_LINKS = 2; + +// range of fabric node/chip ID fields +const uint8_t PROC_FAB_SMP_NUM_CHIP_IDS = 8; +const uint8_t PROC_FAB_SMP_NUM_NODE_IDS = 8; + +extern "C" +{ + +//------------------------------------------------------------------------------ +// Function prototypes +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// function: utility function to read & return fabric node ID attribute +// parameters: i_target => pointer to P8 chip target +// o_node_id => structure encapsulating node ID value +// returns: FAPI_RC_SUCCESS if attribute read is successful & value is valid, +// RC_PROC_FAB_SMP_FABRIC_NODE_ID_ATTR_ERR if attribute value is +// invalid, +// else FAPI_ATTR_GET return code +//------------------------------------------------------------------------------ +fapi::ReturnCode proc_fab_smp_get_node_id_attr( + const fapi::Target* i_target, + proc_fab_smp_node_id& o_node_id); + +//------------------------------------------------------------------------------ +// function: utility function to read & return fabric chip ID attribute +// parameters: i_target => pointer to P8 chip target +// o_chip_id => structure encapsulating chip ID value +// returns: FAPI_RC_SUCCESS if attribute read is successful & value is valid, +// RC_PROC_FAB_SMP_FABRIC_CHIP_ID_ATTR_ERR if attribute value is +// invalid, +// else FAPI_ATTR_GET return code +//------------------------------------------------------------------------------ +fapi::ReturnCode proc_fab_smp_get_chip_id_attr( + const fapi::Target* i_target, + proc_fab_smp_chip_id& o_chip_id); + +//------------------------------------------------------------------------------ +// function: utility function to read & return PCIe/DSMP mux attribute values +// parameters: i_target => pointer to P8 chip target +// o_pcie_not_f_link => vector of boolean values representing state +// of PCIe/DSMP mux settings (one value per +// foreign link, true=PCIe function, false= +// DSMP function) +// returns: FAPI_RC_SUCCESS if attribute read is successful & value is valid, +// RC_PROC_FAB_SMP_PCIE_NOT_F_LINK_ATTR_ERR if attribute value is +// invalid, +// else FAPI_ATTR_GET return code +//------------------------------------------------------------------------------ +fapi::ReturnCode proc_fab_smp_get_pcie_dsmp_mux_attrs( + const fapi::Target* i_target, + bool o_pcie_not_f_link[PROC_FAB_SMP_NUM_F_LINKS]); + + +} // extern "C" + +#endif // _PROC_FAB_SMP_H_ |