From 0122e5443d294f93010344288d51c9131d57fc47 Mon Sep 17 00:00:00 2001 From: Bilicon Patil Date: Thu, 25 Jul 2013 08:16:58 -0500 Subject: Refactor eRepair Accessor HWP Combine the two eRepair Accesor HWP that operated on Field VPD and Manufacturing VPD into a single HWP. Change-Id: I2528d3035bff008a0c409e540149c86dc78d4b4c RTC: 69592 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5566 Tested-by: Jenkins Server Reviewed-by: Zane Shelley Reviewed-by: A. Patrick Williams III --- .../hwp/bus_training/erepairAccessorHwpFuncs.C | 16 +- .../hwp/bus_training/erepairGetFailedLanesHwp.C | 66 +- .../bus_training/erepairGetMnfgFailedLanesHwp.C | 509 ------------- .../hwp/bus_training/erepairSetFailedLanesHwp.C | 55 +- .../bus_training/erepairSetMnfgFailedLanesHwp.C | 816 --------------------- src/usr/hwpf/hwp/bus_training/makefile | 2 - src/usr/hwpf/hwp/dmi_training/dmi_training.C | 35 +- .../edi_ei_initialization/edi_ei_initialization.C | 40 + 8 files changed, 144 insertions(+), 1395 deletions(-) delete mode 100644 src/usr/hwpf/hwp/bus_training/erepairGetMnfgFailedLanesHwp.C delete mode 100755 src/usr/hwpf/hwp/bus_training/erepairSetMnfgFailedLanesHwp.C (limited to 'src/usr/hwpf/hwp') diff --git a/src/usr/hwpf/hwp/bus_training/erepairAccessorHwpFuncs.C b/src/usr/hwpf/hwp/bus_training/erepairAccessorHwpFuncs.C index b31f9bada..84f8d4f90 100644 --- a/src/usr/hwpf/hwp/bus_training/erepairAccessorHwpFuncs.C +++ b/src/usr/hwpf/hwp/bus_training/erepairAccessorHwpFuncs.C @@ -1115,8 +1115,8 @@ fapi::ReturnCode getVerifiedRepairLanes( std::vector l_txFaillanes; std::vector l_rxFaillanes; - FAPI_INF(">> getVerifiedRepairLanes: charm: %d, vpdType: %d", - i_charmModeIPL, i_vpdType); + FAPI_INF(">> getVerifiedRepairLanes: charm: %d, vpdType: %s", + i_charmModeIPL, i_vpdType == EREPAIR_VPD_FIELD ? "Field":"Mnfg"); do { @@ -1391,7 +1391,7 @@ fapi::ReturnCode erepairGetFieldFailedLanes(const fapi::Target &i_endp_target, { fapi::ReturnCode l_rc; - FAPI_INF(">> erepairGetFieldFailedLanes for %s", i_endp_target.toEcmdString()); + FAPI_DBG(">> erepairGetFieldFailedLanes for %s", i_endp_target.toEcmdString()); do { @@ -1399,6 +1399,7 @@ fapi::ReturnCode erepairGetFieldFailedLanes(const fapi::Target &i_endp_target, FAPI_EXEC_HWP(l_rc, erepairGetFailedLanesHwp, i_endp_target, + EREPAIR_VPD_FIELD, o_txFailLanes, o_rxFailLanes); @@ -1434,14 +1435,15 @@ fapi::ReturnCode erepairGetMnfgFailedLanes(const fapi::Target &i_endp_target, { fapi::ReturnCode l_rc; - FAPI_INF(">> erepairGetMnfgFailedLanes for %s", + FAPI_DBG(">> erepairGetMnfgFailedLanes for %s", i_endp_target.toEcmdString()); do { // Execute the Accessor HWP to retrieve the failed lanes from the VPD FAPI_EXEC_HWP(l_rc, - erepairGetMnfgFailedLanesHwp, + erepairGetFailedLanesHwp, i_endp_target, + EREPAIR_VPD_MNFG, o_txFailLanes, o_rxFailLanes); @@ -1632,6 +1634,7 @@ fapi::ReturnCode erepairSetFieldFailedLanes( FAPI_EXEC_HWP(l_rc, erepairSetFailedLanesHwp, i_endp_target, + EREPAIR_VPD_FIELD, i_txFailLanes, i_rxFailLanes); @@ -1657,8 +1660,9 @@ fapi::ReturnCode erepairSetMnfgFailedLanes( { // Execute the Accessor HWP to write the fail lanes to Mnfg VPD FAPI_EXEC_HWP(l_rc, - erepairSetMnfgFailedLanesHwp, + erepairSetFailedLanesHwp, i_endp_target, + EREPAIR_VPD_MNFG, i_txFailLanes, i_rxFailLanes); diff --git a/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C b/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C index 3d1f03e17..63683c1d0 100644 --- a/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C +++ b/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C @@ -51,6 +51,7 @@ extern "C" * parsing. * * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target + * @param[in] i_vpdType Specifies which VPD (MNFG or Field) to access. * @param[o] o_txFailLanes Reference to a vector that will hold eRepair fail * lane numbers of the Tx sub-interface. * @param[o] o_rxFailLanes Reference to a vector that will hold eRepair fail @@ -58,9 +59,10 @@ extern "C" * * @return ReturnCode */ -fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes); +fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, + EREPAIR::erepairVpdType i_vpdType, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); /** * @brief Function called by the FW Team HWP that parses the data read from @@ -91,9 +93,11 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, * Accessor HWP *****************************************************************************/ -fapi::ReturnCode erepairGetFailedLanesHwp(const fapi::Target &i_tgtHandle, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes) +fapi::ReturnCode erepairGetFailedLanesHwp( + const fapi::Target &i_tgtHandle, + EREPAIR::erepairVpdType i_vpdType, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes) { fapi::ReturnCode l_rc; fapi::Target l_processorTgt; @@ -125,6 +129,7 @@ fapi::ReturnCode erepairGetFailedLanesHwp(const fapi::Target &i_tgtHandle, // Retrieve the Field eRepair lane numbers from the VPD l_rc = retrieveRepairData(i_tgtHandle, + i_vpdType, o_txFailLanes, o_rxFailLanes); @@ -136,28 +141,34 @@ fapi::ReturnCode erepairGetFailedLanesHwp(const fapi::Target &i_tgtHandle, } }while(0); - FAPI_INF("<< erepairGetFailedLanesHwp"); - return l_rc; } -fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes) +fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, + EREPAIR::erepairVpdType i_vpdType, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes) { fapi::ReturnCode l_rc; uint8_t *l_retBuf = NULL; uint32_t l_bufSize = 0; fapi::Target l_procTarget; - FAPI_INF(">> retrieveRepairData"); + FAPI_DBG(">> retrieveRepairData"); do { if(i_tgtHandle.getType() == fapi::TARGET_TYPE_MEMBUF_CHIP) { + fapi::MBvpdRecord l_vpdRecord = fapi::MBVPD_RECORD_VEIR; + + if(i_vpdType == EREPAIR::EREPAIR_VPD_MNFG) + { + l_vpdRecord = fapi::MBVPD_RECORD_MER0; + } + // Determine the size of the eRepair data in the VPD - l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VEIR, + l_rc = fapiGetMBvpdField(l_vpdRecord, fapi::MBVPD_KEYWORD_PDI, i_tgtHandle, NULL, @@ -171,7 +182,10 @@ fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, } if((l_bufSize == 0) || - (l_bufSize > EREPAIR::EREPAIR_MEM_FIELD_VPD_SIZE_PER_CENTAUR)) + ((i_vpdType == EREPAIR::EREPAIR_VPD_FIELD) && + (l_bufSize > EREPAIR::EREPAIR_MEM_FIELD_VPD_SIZE_PER_CENTAUR))|| + ((i_vpdType == EREPAIR::EREPAIR_VPD_MNFG) && + (l_bufSize > EREPAIR::EREPAIR_MEM_MNFG_VPD_SIZE_PER_CENTAUR))) { FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_MEM_VPD_SIZE); break; @@ -187,7 +201,7 @@ fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, } // Retrieve the Field eRepair data from the PNOR - l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VEIR, + l_rc = fapiGetMBvpdField(l_vpdRecord, fapi::MBVPD_KEYWORD_PDI, i_tgtHandle, l_retBuf, @@ -211,8 +225,15 @@ fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, break; } + fapi::MvpdRecord l_vpdRecord = fapi::MVPD_RECORD_VWML; + + if(i_vpdType == EREPAIR::EREPAIR_VPD_MNFG) + { + l_vpdRecord = fapi::MVPD_RECORD_MER0; + } + // Determine the size of the eRepair data in the VPD - l_rc = fapiGetMvpdField(fapi::MVPD_RECORD_VWML, + l_rc = fapiGetMvpdField(l_vpdRecord, fapi::MVPD_KEYWORD_PDI, l_procTarget, NULL, @@ -226,7 +247,10 @@ fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, } if((l_bufSize == 0) || - (l_bufSize > EREPAIR::EREPAIR_P8_MODULE_VPD_FIELD_SIZE)) + ((i_vpdType == EREPAIR::EREPAIR_VPD_FIELD) && + (l_bufSize > EREPAIR::EREPAIR_P8_MODULE_VPD_FIELD_SIZE)) || + ((i_vpdType == EREPAIR::EREPAIR_VPD_MNFG) && + (l_bufSize > EREPAIR::EREPAIR_P8_MODULE_VPD_MNFG_SIZE))) { FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_FABRIC_VPD_SIZE); @@ -243,7 +267,7 @@ fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, } // Retrieve the Field eRepair data from the PNOR - l_rc = fapiGetMvpdField(fapi::MVPD_RECORD_VWML, + l_rc = fapiGetMvpdField(l_vpdRecord, fapi::MVPD_KEYWORD_PDI, l_procTarget, l_retBuf, @@ -274,7 +298,7 @@ fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle, // Delete the buffer which has Field eRepair data delete[] l_retBuf; - FAPI_INF("<< retrieveRepairData"); + FAPI_DBG("<< retrieveRepairData"); return (l_rc); } @@ -298,7 +322,7 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, fapi::ReturnCode l_rc; fapi::ATTR_CHIP_UNIT_POS_Type l_busNum; - FAPI_INF(">> determineRepairLanes"); + FAPI_DBG(">> determineRepairLanes"); do { @@ -497,7 +521,7 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, }while(0); - FAPI_INF("<< determineRepairLanes: tx: %d, rx: %d", + FAPI_INF("<< No.of Fail Lanes: tx: %d, rx: %d", o_txFailLanes.size(), o_rxFailLanes.size()); return(l_rc); diff --git a/src/usr/hwpf/hwp/bus_training/erepairGetMnfgFailedLanesHwp.C b/src/usr/hwpf/hwp/bus_training/erepairGetMnfgFailedLanesHwp.C deleted file mode 100644 index aeaa23a7f..000000000 --- a/src/usr/hwpf/hwp/bus_training/erepairGetMnfgFailedLanesHwp.C +++ /dev/null @@ -1,509 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/erepairGetMnfgFailedLanesHwp.C $ */ -/* */ -/* IBM CONFIDENTIAL */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2012,2013 */ -/* */ -/* 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 */ -/** - * @file erepairGetMnfgFailedLanesHwp.C - * - * @brief FW Team HWP that accesses the fail lanes of Fabric and Memory buses - * from the Manufacturing VPD. - */ - -/* - * Change Log ****************************************************************** - * Flag Defect/Feature User Date Description - * ------ -------------- ---------- ----------- ---------------------------- - * bilicon 12/02/2012 Created. - */ - -#include - -extern "C" -{ - -// TODO: RTC Task: 69592. Refactor eRepair code to remove this file and change -// the erepairGetFailedLanesHwp.C file to read Manufacturing VPD - -/*****************************************************************************e - * Forward Declarations - *****************************************************************************/ - -/** - * @brief Function called by the FW Team HWP that reads the data from Mnfg VPD. - * This function makes the actual calls to read the VPD. - * It determines the size of the buffer to be read, allocates memory - * of the determined size, calls fapiGetMvpdField to read the eRepair - * records. This buffer is further passed to another routine for - * parsing. - * - * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target - * @param[o] o_txFailLanes Reference to a vector that will hold eRepair fail - * lane numbers of the Tx sub-interface. - * @param[o] o_rxFailLanes Reference to a vector that will hold eRepair fail - * lane numbers of the Rx sub-interface. - * - * @return ReturnCode - */ -fapi::ReturnCode retrieveMnfgRepairData(const fapi::Target &i_tgtHandle, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes); - -/** - * @brief Function called by the FW Team HWP that parses the data read from - * Mnfg VPD. This function matches each eRepair record read from the VPD - * and matches it against the attributes of the passed target. - * If a match is found, the corresponding eRepair record is copied into - * the respective failLane vectors to be returned to the caller. - * - * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target - * @param[in] i_buf This is the buffer that has the eRepair records - * read from the VPD - * @param[in] i_bufSz This is the size of passed buffer in terms of bytes - * @param[o] o_txFailLanes Reference to a vector that will hold eRepair fail - * lane numbers of the Tx sub-interface. - * @param[o] o_rxFailLanes Reference to a vector that will hold eRepair fail - * lane numbers of the Rx sub-interface. - * - * @return ReturnCode - */ -fapi::ReturnCode determineMnfgRepairLanes(const fapi::Target &i_tgtHandle, - uint8_t *i_buf, - uint32_t i_bufSz, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes); - - -/****************************************************************************** - * Accessor HWP - *****************************************************************************/ - -fapi::ReturnCode erepairGetMnfgFailedLanesHwp(const fapi::Target &i_tgtHandle, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes) -{ - fapi::ReturnCode l_rc; - fapi::TargetType l_tgtType = fapi::TARGET_TYPE_NONE; - std::vector l_mcsChiplets; - - FAPI_INF(">> erepairGetMnfgFailedLanesHwp: i_tgtHandle: %s", - i_tgtHandle.toEcmdString()); - - do - { - o_txFailLanes.clear(); - o_rxFailLanes.clear(); - - // Determine the type of target - l_tgtType = i_tgtHandle.getType(); - - // Verify if the correct target type is passed - if((l_tgtType != fapi::TARGET_TYPE_MCS_CHIPLET) && - (l_tgtType != fapi::TARGET_TYPE_MEMBUF_CHIP) && - (l_tgtType != fapi::TARGET_TYPE_XBUS_ENDPOINT) && - (l_tgtType != fapi::TARGET_TYPE_ABUS_ENDPOINT)) - { - FAPI_ERR("erepairGetMnfgFailedLanesHwp: Invalid Target type %d", - l_tgtType); - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_TARGET_TYPE); - break; - } - - // Retrieve the Manufacturing eRepair lane numbers from the VPD - l_rc = retrieveMnfgRepairData(i_tgtHandle, - o_txFailLanes, - o_rxFailLanes); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) during retrieval of Mfg records", - static_cast(l_rc)); - break; - } - }while(0); - - FAPI_INF("<< erepairGetMnfgFailedLanesHwp"); - - return l_rc; -} - - -fapi::ReturnCode retrieveMnfgRepairData(const fapi::Target &i_tgtHandle, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes) -{ - fapi::ReturnCode l_rc; - uint8_t *l_retBuf = NULL; - uint32_t l_bufSize = 0; - fapi::Target l_procTarget; - - FAPI_INF(">> retrieveMnfgRepairData"); - - do - { - if(i_tgtHandle.getType() == fapi::TARGET_TYPE_MEMBUF_CHIP) - { - // Determine the size of the eRepair data in the VPD - l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_MER0, - fapi::MBVPD_KEYWORD_PDI, - i_tgtHandle, - NULL, - l_bufSize); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMBvpdField", - static_cast (l_rc)); - break; - } - - if((l_bufSize == 0) || - (l_bufSize > EREPAIR::EREPAIR_MEM_MNFG_VPD_SIZE_PER_CENTAUR)) - { - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_MEM_VPD_SIZE); - break; - } - - // Allocate memory for buffer - l_retBuf = new uint8_t[l_bufSize]; - if(l_retBuf == NULL) - { - FAPI_ERR("Failed to allocate memory size of %d", l_bufSize); - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_MEMORY_ALLOC_FAIL); - break; - } - - // Retrieve the Field eRepair data from the PNOR - l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_MER0, - fapi::MBVPD_KEYWORD_PDI, - i_tgtHandle, - l_retBuf, - l_bufSize); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMBvpdField", - static_cast (l_rc)); - break; - } - } - else - { - // Determine the Processor target - l_rc = fapiGetParentChip(i_tgtHandle, l_procTarget); - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetParentChip", - static_cast(l_rc)); - break; - } - - // Determine the size of the eRepair data in the VPD - l_rc = fapiGetMvpdField(fapi::MVPD_RECORD_MER0, - fapi::MVPD_KEYWORD_PDI, - l_procTarget, - NULL, - l_bufSize); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMvpdField", - static_cast (l_rc)); - break; - } - - if((l_bufSize == 0) || - (l_bufSize > EREPAIR::EREPAIR_P8_MODULE_VPD_MNFG_SIZE)) - { - FAPI_SET_HWP_ERROR(l_rc, - RC_ACCESSOR_HWP_INVALID_FABRIC_VPD_SIZE); - break; - } - - // Allocate memory for buffer - l_retBuf = new uint8_t[l_bufSize]; - if(l_retBuf == NULL) - { - FAPI_ERR("Failed to allocate memory size of %d", l_bufSize); - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_MEMORY_ALLOC_FAIL); - break; - } - - // Retrieve the Field eRepair data from the PNOR - l_rc = fapiGetMvpdField(fapi::MVPD_RECORD_MER0, - fapi::MVPD_KEYWORD_PDI, - l_procTarget, - l_retBuf, - l_bufSize); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMvpdField", - static_cast (l_rc)); - break; - } - } - - // Parse the buffer to determine eRepair lanes and copy the - // fail lane numbers to the return vector - l_rc = determineMnfgRepairLanes(i_tgtHandle, - l_retBuf, - l_bufSize, - o_txFailLanes, - o_rxFailLanes); - if(l_rc) - { - FAPI_ERR("determineRepairLanes failed"); - break; - } - }while(0); - - // Delete the buffer which has Field eRepair data - delete[] l_retBuf; - - FAPI_INF("<< retrieveMnfgRepairData"); - - return (l_rc); -} - -fapi::ReturnCode determineMnfgRepairLanes(const fapi::Target &i_tgtHandle, - uint8_t *i_buf, - uint32_t i_bufSz, - std::vector &o_txFailLanes, - std::vector &o_rxFailLanes) -{ - uint32_t l_numRepairs = 0; - uint8_t *l_vpdPtr = NULL; - eRepairHeader *l_vpdHeadPtr = NULL; - uint32_t l_loop = 0; - uint32_t l_bytesParsed = 0; - const uint32_t l_memRepairDataSz = sizeof(eRepairMemBus); - const uint32_t l_fabricRepairDataSz = sizeof(eRepairPowerBus); - fapi::TargetType l_tgtType = fapi::TARGET_TYPE_NONE; - fapi::Target l_mcsTarget; - fapi::Target l_tgtHandle; - fapi::ReturnCode l_rc; - fapi::ATTR_CHIP_UNIT_POS_Type l_busNum; - - FAPI_INF(">> determineMnfgRepairLanes"); - - do - { - // Read the header and count information - - l_vpdPtr = i_buf; // point to the start of header data - l_vpdHeadPtr = reinterpret_cast (l_vpdPtr); - - l_numRepairs = l_vpdHeadPtr->numRecords; - - l_bytesParsed = sizeof(eRepairHeader); // we've read the header data - l_vpdPtr += sizeof(eRepairHeader); // point to the start of repair data - - l_tgtType = i_tgtHandle.getType(); - - // Parse for Power bus data - if((l_tgtType == fapi::TARGET_TYPE_XBUS_ENDPOINT) || - (l_tgtType == fapi::TARGET_TYPE_ABUS_ENDPOINT)) - { - eRepairPowerBus *l_fabricBus; - - // Read Power bus eRepair data and get the failed lane numbers - for(l_loop = 0; - l_loop < l_numRepairs; - l_loop++, (l_vpdPtr += l_fabricRepairDataSz)) - { - // Make sure we are not parsing more data than the passed size - l_bytesParsed += l_fabricRepairDataSz; - if(l_bytesParsed > i_bufSz) - { - break; - } - - l_fabricBus = reinterpret_cast(l_vpdPtr); - -#ifndef _BIG_ENDIAN - // We are on a Little Endian system. - // Need to swap the nibbles of the structure - eRepairPowerBus - - uint8_t l_temp = l_vpdPtr[2]; - l_fabricBus->type = (l_temp >> 4); - l_fabricBus->interface = (l_temp & 0x0F); -#endif - // Check if we have the correct Processor ID - // Get the MRU ID of the passed processor target and - // match with l_fabricBus.device.processor_id. - // Note: This is currently not required. - - // Check if we have the matching the Fabric Bus types - if((l_tgtType == fapi::TARGET_TYPE_ABUS_ENDPOINT) && - (l_fabricBus->type != EREPAIR::PROCESSOR_EDI)) - { - continue; - } - - if((l_tgtType == fapi::TARGET_TYPE_XBUS_ENDPOINT) && - (l_fabricBus->type != EREPAIR::PROCESSOR_EI4)) - { - continue; - } - - // Check if we have the matching fabric bus interface - l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS,&i_tgtHandle,l_busNum); - if(l_rc) - { - FAPI_ERR("Error (0x%x), from FAPI_ATTR_GET", - static_cast(l_rc)); - break; - } - - if(l_fabricBus->device.fabricBus != l_busNum) - { - continue; - } - - // Check if we have valid fail lane numbers - if(l_fabricBus->failBit == EREPAIR::INVALID_FAIL_LANE_NUMBER) - { - continue; - } - - // Copy the fail lane numbers in the vectors - if(l_fabricBus->interface == EREPAIR::PBUS_DRIVER) - { - o_txFailLanes.push_back(l_fabricBus->failBit); - } - else if(l_fabricBus->interface == EREPAIR::PBUS_RECEIVER) - { - o_rxFailLanes.push_back(l_fabricBus->failBit); - } - } // end of for loop - } // end of if(l_tgtType is XBus or ABus) - else if((l_tgtType == fapi::TARGET_TYPE_MCS_CHIPLET) || - (l_tgtType == fapi::TARGET_TYPE_MEMBUF_CHIP)) - { - // Parse for Memory bus data - eRepairMemBus *l_memBus; - l_tgtHandle = i_tgtHandle; - - if(l_tgtType == fapi::TARGET_TYPE_MEMBUF_CHIP) - { - l_rc = fapiGetOtherSideOfMemChannel( - i_tgtHandle, - l_mcsTarget, - fapi::TARGET_STATE_FUNCTIONAL); - - if(l_rc) - { - FAPI_ERR("determineMnfgRepairLanes: Unable to get the" - " connected MCS target"); - break; - } - - l_tgtHandle = l_mcsTarget; - } - - // Read Power bus eRepair data and get the failed lane numbers - for(l_loop = 0; - l_loop < l_numRepairs; - l_loop++, (l_vpdPtr += l_memRepairDataSz)) - { - // Make sure we are not parsing more data than the passed size - l_bytesParsed += l_memRepairDataSz; - if(l_bytesParsed > i_bufSz) - { - break; - } - - l_memBus = reinterpret_cast(l_vpdPtr); - -#ifndef _BIG_ENDIAN - // We are on a Little Endian system. - // Need to swap the nibbles of the structure - eRepairMemBus - - uint8_t l_temp = l_vpdPtr[2]; - l_memBus->type = (l_temp >> 4); - l_memBus->interface = (l_temp & 0x0F); -#endif - - // Check if we have the correct Processor ID - // Get the MRU ID of the passed processor target and - // match with l_memBus.device.processor_id - // Note: This is currently not required. - - // Check if we have the matching the Memory Bus types - if(l_memBus->type != EREPAIR::MEMORY_EDI) - { - continue; - } - - // Check if we have the matching memory bus interface - l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS,&l_tgtHandle,l_busNum); - if(l_rc) - { - FAPI_ERR("Error (0x%x), from ATTR_CHIP_UNIT_POS", - static_cast(l_rc)); - break; - } - - if(l_memBus->device.memChannel != l_busNum) - { - continue; - } - - // Check if we have valid fail lane numbers - if(l_memBus->failBit == EREPAIR::INVALID_FAIL_LANE_NUMBER) - { - continue; - } - - // Copy the fail lane numbers in the vectors - if(l_tgtType == fapi::TARGET_TYPE_MCS_CHIPLET) - { - if(l_memBus->interface == EREPAIR::DMI_MCS_DRIVE) - { - o_txFailLanes.push_back(l_memBus->failBit); - } - else if(l_memBus->interface == EREPAIR::DMI_MCS_RECEIVE) - { - o_rxFailLanes.push_back(l_memBus->failBit); - } - } - if(l_tgtType == fapi::TARGET_TYPE_MEMBUF_CHIP) - { - if(l_memBus->interface == EREPAIR::DMI_MEMBUF_DRIVE) - { - o_txFailLanes.push_back(l_memBus->failBit); - } - else if(l_memBus->interface == EREPAIR::DMI_MEMBUF_RECEIVE) - { - o_rxFailLanes.push_back(l_memBus->failBit); - } - } - } // end of for loop - } // end of if(l_tgtType is MCS) - - }while(0); - - FAPI_INF("<< determineMnfgRepairLanes"); - - return(l_rc); -} - -}// endof extern "C" diff --git a/src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C b/src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C index bf87865e6..c1b14059a 100755 --- a/src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C +++ b/src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C @@ -50,6 +50,7 @@ extern "C" * This function calls fapiSetMvpdField to write the VPD. * * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target + * @param[in] i_vpdType Specifies which VPD (MNFG or Field) to access. * @param[in] i_txFailLanes Reference to a vector that has eRepair fail * lane numbers of the Tx sub-interface. * @param[in] i_rxFailLanes Reference to a vector that has eRepair fail @@ -58,6 +59,7 @@ extern "C" * @return ReturnCode */ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, + erepairVpdType i_vpdType, const std::vector &i_txFailLanes, const std::vector &i_rxFailLanes); @@ -108,6 +110,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, *****************************************************************************/ ReturnCode erepairSetFailedLanesHwp(const Target &i_tgtHandle, + erepairVpdType i_vpdType, const std::vector &i_txFailLanes, const std::vector &i_rxFailLanes) { @@ -142,6 +145,7 @@ ReturnCode erepairSetFailedLanesHwp(const Target &i_tgtHandle, } l_rc = writeRepairDataToVPD(i_tgtHandle, + i_vpdType, i_txFailLanes, i_rxFailLanes); @@ -153,13 +157,12 @@ ReturnCode erepairSetFailedLanesHwp(const Target &i_tgtHandle, } }while(0); - FAPI_INF("<< erepairSetFailedLanesHwp"); - return l_rc; } ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, + erepairVpdType i_vpdType, const std::vector &i_txFailLanes, const std::vector &i_rxFailLanes) { @@ -168,16 +171,23 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, uint32_t l_bufSize = 0; Target l_procTarget; - FAPI_INF(">> writeRepairDataToVPD"); + FAPI_DBG(">> writeRepairDataToVPD"); do { if(i_tgtHandle.getType() == TARGET_TYPE_MEMBUF_CHIP) { + fapi::MBvpdRecord l_vpdRecord = MBVPD_RECORD_VEIR; + + if(i_vpdType == EREPAIR_VPD_MNFG) + { + l_vpdRecord = MBVPD_RECORD_MER0; + } + /*** Read the data from the FRU VPD ***/ // Determine the size of the eRepair data in the Centaur VPD - l_rc = fapiGetMBvpdField(MBVPD_RECORD_VEIR, + l_rc = fapiGetMBvpdField(l_vpdRecord, MBVPD_KEYWORD_PDI, i_tgtHandle, NULL, @@ -190,7 +200,10 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, } if((l_bufSize == 0) || - (l_bufSize > EREPAIR_MEM_FIELD_VPD_SIZE_PER_CENTAUR)) + ((i_vpdType == EREPAIR_VPD_FIELD) && + (l_bufSize > EREPAIR_MEM_FIELD_VPD_SIZE_PER_CENTAUR)) || + ((i_vpdType == EREPAIR_VPD_MNFG) && + (l_bufSize > EREPAIR_MEM_MNFG_VPD_SIZE_PER_CENTAUR))) { FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_MEM_VPD_SIZE); break; @@ -206,7 +219,7 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, } // Retrieve the Field eRepair data from the Centaur FRU VPD - l_rc = fapiGetMBvpdField(MBVPD_RECORD_VEIR, + l_rc = fapiGetMBvpdField(l_vpdRecord, MBVPD_KEYWORD_PDI, i_tgtHandle, l_retBuf, @@ -234,7 +247,7 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, } /*** Write the updated eRepair buffer back to Centaru FRU VPD ***/ - l_rc = fapiSetMBvpdField(MBVPD_RECORD_VEIR, + l_rc = fapiSetMBvpdField(l_vpdRecord, MBVPD_KEYWORD_PDI, i_tgtHandle, l_retBuf, @@ -257,10 +270,17 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, break; } + fapi::MvpdRecord l_vpdRecord = MVPD_RECORD_VWML; + + if(i_vpdType == EREPAIR_VPD_MNFG) + { + l_vpdRecord = MVPD_RECORD_MER0; + } + /*** Read the data from the Module VPD ***/ // Determine the size of the eRepair data in the VPD - l_rc = fapiGetMvpdField(MVPD_RECORD_VWML, + l_rc = fapiGetMvpdField(l_vpdRecord, MVPD_KEYWORD_PDI, l_procTarget, NULL, @@ -273,7 +293,10 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, } if((l_bufSize == 0) || - (l_bufSize > EREPAIR_P8_MODULE_VPD_FIELD_SIZE)) + ((i_vpdType == EREPAIR_VPD_FIELD) && + (l_bufSize > EREPAIR_P8_MODULE_VPD_FIELD_SIZE)) || + ((i_vpdType == EREPAIR_VPD_MNFG) && + (l_bufSize > EREPAIR_P8_MODULE_VPD_MNFG_SIZE))) { FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_FABRIC_VPD_SIZE); @@ -290,7 +313,7 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, } // Retrieve the Field eRepair data from the MVPD - l_rc = fapiGetMvpdField(MVPD_RECORD_VWML, + l_rc = fapiGetMvpdField(l_vpdRecord, MVPD_KEYWORD_PDI, l_procTarget, l_retBuf, @@ -318,7 +341,7 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, } /*** Write the updated eRepair buffer back to MVPD ***/ - l_rc = fapiSetMvpdField(MVPD_RECORD_VWML, + l_rc = fapiSetMvpdField(l_vpdRecord, MVPD_KEYWORD_PDI, l_procTarget, l_retBuf, @@ -335,8 +358,6 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, // Delete the buffer which has Field eRepair data delete[] l_retBuf; - FAPI_INF("<< writeRepairDataToVPD"); - return (l_rc); } @@ -348,7 +369,7 @@ ReturnCode writeRepairLanesToBuf(const Target &i_tgtHandle, { ReturnCode l_rc; - FAPI_INF(">> writeRepairLanesToBuf"); + FAPI_DBG(">> writeRepairLanesToBuf"); do { @@ -385,7 +406,6 @@ ReturnCode writeRepairLanesToBuf(const Target &i_tgtHandle, } }while(0); - FAPI_INF("<< writeRepairLanesToBuf"); return (l_rc); } @@ -413,7 +433,8 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, std::vector::iterator l_it; ATTR_CHIP_UNIT_POS_Type l_busNum; - FAPI_INF(">> updateRepairLanesToBuf, interface: %d", i_interface); + FAPI_DBG(">> updateRepairLanesToBuf, interface: %s", + i_interface == DRIVE ? "Drive" : "Recevie"); do { @@ -801,8 +822,6 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, }while(0); - FAPI_INF("<< updateRepairLanesToBuf"); - return(l_rc); } diff --git a/src/usr/hwpf/hwp/bus_training/erepairSetMnfgFailedLanesHwp.C b/src/usr/hwpf/hwp/bus_training/erepairSetMnfgFailedLanesHwp.C deleted file mode 100755 index 872264f2f..000000000 --- a/src/usr/hwpf/hwp/bus_training/erepairSetMnfgFailedLanesHwp.C +++ /dev/null @@ -1,816 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/bus_training/erepairSetMnfgFailedLanesHwp.C $ */ -/* */ -/* IBM CONFIDENTIAL */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013 */ -/* */ -/* 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 */ -/** - * @file erepairSetMnfgFailedLanesHwp.C - * - * @brief FW Team HWP that accesses the fail lanes of Fabric and Memory buses. - */ - -/* - * Change Log ****************************************************************** - * Flag Defect/Feature User Date Description - * ------ -------------- ---------- ----------- ---------------------------- - * bilicon 13-JAN-2013 Created. - */ - -#include - -using namespace EREPAIR; -using namespace fapi; - -extern "C" -{ - -// TODO: RTC Task: 69592. Refactor eRepair code to remove this file and change -// the erepairSetFailedLanesHwp.C file to write Manufacturing VPD - -/****************************************************************************** - * Forward Declarations - *****************************************************************************/ - -/** - * @brief Function called by the FW Team HWP that writes the data to Mnfg VPD. - * This function calls fapiSetMvpdField to write the VPD. - * - * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target - * @param[in] i_txFailLanes Reference to a vector that has eRepair fail - * lane numbers of the Tx sub-interface. - * @param[in] i_rxFailLanes Reference to a vector that has eRepair fail - * lane numbers of the Rx sub-interface. - * - * @return ReturnCode - */ -ReturnCode writeMnfgRepairDataToVPD(const Target &i_tgtHandle, - const std::vector &i_txFailLanes, - const std::vector &i_rxFailLanes); - -/** - * @brief Function called by the FW Team HWP that updates the passed buffer - * with the eRepair faillane numbers. - * - * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target - * @param[in] i_txFailLanes Reference to a vector that has the Tx side faillane - * numbers that need to be updated to the o_buf buffer - * @param[in] i_rxFailLanes Reference to a vector that has the Rx side faillane - * numbers that need to be updated to the o_buf buffer - * @param[in] i_bufSz This is the size of passed buffer in terms of bytes - * @param[o] o_buf This is the buffer that has the eRepair records - * that needs to be written to the VPD - * - * @return ReturnCode - */ -ReturnCode writeMnfgRepairLanesToBuf(const Target &i_tgtHandle, - const std::vector &i_txFailLanes, - const std::vector &i_rxFailLanes, - const uint32_t i_bufSz, - uint8_t *o_buf); - -/** - * @brief Function called by the FW Team HWP that updates the passed buffer - * with the eRepair faillane numbers of a specified interface. - * - * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target - * @param[in] i_interface This indicates the sub-interface type the passed - * faillane vector represents - * @param[in] i_bufSz This is the size of passed buffer in terms of bytes - * @param[in] i_failLanes Reference to a vector that has the faillane numbers - * that need to be updated to the o_buf buffer - * @param[o] o_buf This is the buffer that has the eRepair records - * that needs to be written to the VPD - * - * @return ReturnCode - */ -ReturnCode updateMnfgRepairLanesToBuf(const Target &i_tgtHandle, - const interfaceType i_interface, - const uint32_t i_bufSz, - const std::vector &i_failLanes, - uint8_t *o_buf); - -/****************************************************************************** - * Accessor HWP - *****************************************************************************/ - -ReturnCode erepairSetMnfgFailedLanesHwp( - const Target &i_tgtHandle, - const std::vector &i_txFailLanes, - const std::vector &i_rxFailLanes) -{ - ReturnCode l_rc; - TargetType l_tgtType = TARGET_TYPE_NONE; - - FAPI_INF(">> erepairSetMnfgFailedLanesHwp: i_tgtHandle: %s", - i_tgtHandle.toEcmdString()); - - do - { - if((i_txFailLanes.size() == 0) && (i_rxFailLanes.size() == 0)) - { - FAPI_INF("erepairSetMnfgFailedLanesHwp: No fail lanes were provided."); - break; - } - - // Determine the type of target - l_tgtType = i_tgtHandle.getType(); - - // Verify if the correct target type is passed - if((l_tgtType != TARGET_TYPE_MCS_CHIPLET) && - (l_tgtType != TARGET_TYPE_MEMBUF_CHIP) && - (l_tgtType != TARGET_TYPE_XBUS_ENDPOINT) && - (l_tgtType != TARGET_TYPE_ABUS_ENDPOINT)) - { - FAPI_ERR("erepairSetMnfgFailedLanesHwp: Invalid Target type %d", - l_tgtType); - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_TARGET_TYPE); - break; - } - - l_rc = writeMnfgRepairDataToVPD(i_tgtHandle, - i_txFailLanes, - i_rxFailLanes); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) during write of Field records", - static_cast(l_rc)); - break; - } - }while(0); - - FAPI_INF("<< erepairSetMnfgFailedLanesHwp"); - - return l_rc; -} - - -ReturnCode writeMnfgRepairDataToVPD(const Target &i_tgtHandle, - const std::vector &i_txFailLanes, - const std::vector &i_rxFailLanes) -{ - ReturnCode l_rc; - uint8_t *l_retBuf = NULL; - uint32_t l_bufSize = 0; - Target l_procTarget; - - FAPI_INF(">> writeMnfgRepairDataToVPD"); - - do - { - if(i_tgtHandle.getType() == TARGET_TYPE_MEMBUF_CHIP) - { - /*** Read the data from the FRU VPD ***/ - - // Determine the size of the eRepair data in the Centaur VPD - l_rc = fapiGetMBvpdField(MBVPD_RECORD_MER0, - MBVPD_KEYWORD_PDI, - i_tgtHandle, - NULL, - l_bufSize); - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMBvpdField", - static_cast (l_rc)); - break; - } - - if((l_bufSize == 0) || - (l_bufSize > EREPAIR_MEM_MNFG_VPD_SIZE_PER_CENTAUR)) - { - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_MEM_VPD_SIZE); - break; - } - - // Allocate memory for buffer - l_retBuf = new uint8_t[l_bufSize]; - if(l_retBuf == NULL) - { - FAPI_ERR("Failed to allocate memory size of %d", l_bufSize); - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_MEMORY_ALLOC_FAIL); - break; - } - - // Retrieve the Field eRepair data from the Centaur FRU VPD - l_rc = fapiGetMBvpdField(MBVPD_RECORD_MER0, - MBVPD_KEYWORD_PDI, - i_tgtHandle, - l_retBuf, - l_bufSize); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMBvpdField", - static_cast (l_rc)); - break; - } - - /*** Update the new eRepair data to the buffer ***/ - l_rc = writeMnfgRepairLanesToBuf(i_tgtHandle, - i_txFailLanes, - i_rxFailLanes, - l_bufSize, - l_retBuf); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from writeMnfgRepairLanesToBuf", - static_cast (l_rc)); - break; - } - - /*** Write the updated eRepair buffer back to MVPD ***/ - l_rc = fapiSetMBvpdField(MBVPD_RECORD_MER0, - MBVPD_KEYWORD_PDI, - i_tgtHandle, - l_retBuf, - l_bufSize); - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiSetMBvpdField", - static_cast (l_rc)); - break; - } - } // end of(targetType == MEMBUF) - else - { - // Determine the Processor target - l_rc = fapiGetParentChip(i_tgtHandle, l_procTarget); - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetParentChip", - static_cast(l_rc)); - break; - } - - /*** Read the data from the Module VPD ***/ - - // Determine the size of the eRepair data in the VPD - l_rc = fapiGetMvpdField(MVPD_RECORD_MER0, - MVPD_KEYWORD_PDI, - l_procTarget, - NULL, - l_bufSize); - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMvpdField", - static_cast (l_rc)); - break; - } - - if((l_bufSize == 0) || - (l_bufSize > EREPAIR_P8_MODULE_VPD_MNFG_SIZE)) - { - FAPI_SET_HWP_ERROR(l_rc, - RC_ACCESSOR_HWP_INVALID_FABRIC_VPD_SIZE); - break; - } - - // Allocate memory for buffer - l_retBuf = new uint8_t[l_bufSize]; - if(l_retBuf == NULL) - { - FAPI_ERR("Failed to allocate memory size of %d", l_bufSize); - FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_MEMORY_ALLOC_FAIL); - break; - } - - // Retrieve the Field eRepair data from the MVPD - l_rc = fapiGetMvpdField(MVPD_RECORD_MER0, - MVPD_KEYWORD_PDI, - l_procTarget, - l_retBuf, - l_bufSize); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiGetMvpdField", - static_cast (l_rc)); - break; - } - - /*** Update the new eRepair data to the buffer ***/ - l_rc = writeMnfgRepairLanesToBuf(i_tgtHandle, - i_txFailLanes, - i_rxFailLanes, - l_bufSize, - l_retBuf); - - if(l_rc) - { - FAPI_ERR("Error (0x%x) from writeMnfgRepairLanesToBuf", - static_cast (l_rc)); - break; - } - - /*** Write the updated eRepair buffer back to MVPD ***/ - l_rc = fapiSetMvpdField(MVPD_RECORD_MER0, - MVPD_KEYWORD_PDI, - l_procTarget, - l_retBuf, - l_bufSize); - if(l_rc) - { - FAPI_ERR("Error (0x%x) from fapiSetMvpdField", - static_cast (l_rc)); - break; - } - } - }while(0); - - // Delete the buffer which has Field eRepair data - delete[] l_retBuf; - - FAPI_INF("<< writeMnfgRepairDataToVPD"); - - return (l_rc); -} - -ReturnCode writeMnfgRepairLanesToBuf(const Target &i_tgtHandle, - const std::vector &i_txFailLanes, - const std::vector &i_rxFailLanes, - const uint32_t i_bufSz, - uint8_t *o_buf) -{ - ReturnCode l_rc; - - FAPI_INF(">> writeMnfgRepairLanesToBuf"); - - do - { - if(i_txFailLanes.size()) - { - /*** Lets update the tx side fail lane vector to the VPD ***/ - l_rc = updateMnfgRepairLanesToBuf(i_tgtHandle, - DRIVE, - i_bufSz, - i_txFailLanes, - o_buf); - - if(l_rc) - { - FAPI_ERR("Error (0x%x), from" - " updateMnfgRepairLanesToBuf(DRIVE)"); - break; - } - } - - if(i_rxFailLanes.size()) - { - /*** Lets update the rx side fail lane vector to the VPD ***/ - l_rc = updateMnfgRepairLanesToBuf(i_tgtHandle, - RECEIVE, - i_bufSz, - i_rxFailLanes, - o_buf); - - if(l_rc) - { - FAPI_ERR("Error (0x%x), from" - " updateMnfgRepairLanesToBuf(RECEIVE)"); - break; - } - } - - }while(0); - - FAPI_INF("<< writeMnfgRepairLanesToBuf"); - return (l_rc); -} - -ReturnCode updateMnfgRepairLanesToBuf(const Target &i_tgtHandle, - const interfaceType i_interface, - const uint32_t i_bufSz, - const std::vector &i_failLanes, - uint8_t *o_buf) -{ - ReturnCode l_rc; - uint32_t l_numRepairs = 0; - uint32_t l_newNumRepairs = 0; - uint32_t l_repairCnt = 0; - uint32_t l_bytesParsed = 0; - uint8_t l_repairLane = 0; - uint32_t l_repairDataSz = 0; - uint8_t *l_vpdPtr = NULL; - uint8_t *l_vpdDataPtr = NULL; - eRepairHeader *l_vpdHeadPtr = NULL; - eRepairPowerBus *l_overWritePtr = NULL; - bool l_overWrite = false; - TargetType l_tgtType = TARGET_TYPE_NONE; - Target l_mcsTarget; - Target l_tgtHandle; - std::vector::iterator l_it; - ATTR_CHIP_UNIT_POS_Type l_busNum; - - FAPI_INF(">> updateMnfgRepairLanesToBuf, interface: %d", i_interface); - - do - { - l_repairDataSz = sizeof(eRepairPowerBus); // Size of memory Bus and - // fabric Bus eRepair data - // is same. - - // Read the header and count information - l_vpdPtr = o_buf; // point to the start of header data - l_vpdHeadPtr = reinterpret_cast (l_vpdPtr); - - l_numRepairs = l_newNumRepairs = l_vpdHeadPtr->numRecords; - - // We've read the header data, increment bytes parsed - l_bytesParsed = sizeof(eRepairHeader); - - // Get a pointer to the start of repair data - l_vpdPtr += sizeof(eRepairHeader); - - l_tgtType = i_tgtHandle.getType(); - - l_tgtHandle = i_tgtHandle; - if(l_tgtType == TARGET_TYPE_MEMBUF_CHIP) - { - l_rc = fapiGetOtherSideOfMemChannel(i_tgtHandle, - l_mcsTarget, - TARGET_STATE_FUNCTIONAL); - - if(l_rc) - { - FAPI_ERR("updateMnfgRepairLanesToBuf: unable to get the" - " connected MCS target"); - break; - } - - l_tgtHandle = l_mcsTarget; - } - - // Get the bus number - l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &l_tgtHandle, l_busNum); - if(l_rc) - { - FAPI_ERR("Error (0x%x), from FAPI_ATTR_GET", - static_cast(l_rc)); - break; - } - - /*** Lets update the fail lane vector to the Buffer ***/ - - // Create a structure of eRepair data that we will be matching - // in the buffer. - struct erepairDataMatch - { - interfaceType intType; - TargetType tgtType; - union repairData - { - eRepairPowerBus fabBus; - eRepairMemBus memBus; - }bus; - }; - - // Create an array of the above match structure to have all the - // combinations of Fabric and Memory repair data - erepairDataMatch l_repairMatch[8] = - { - { // index 0 - DRIVE, - TARGET_TYPE_XBUS_ENDPOINT, - { // repairData - { // fabBus - { // device - 0, // processor_id - l_busNum, // fabricBus - }, - PROCESSOR_EI4, // type - PBUS_DRIVER, // interface - }, - }, - }, - { // index 1 - DRIVE, - TARGET_TYPE_ABUS_ENDPOINT, - { // repairData - { // fabBus - { // device - 0, // processor_id - l_busNum, // fabricBus - }, - PROCESSOR_EDI, // type - PBUS_DRIVER, // interface - }, - }, - }, - { // index 2 - RECEIVE, - TARGET_TYPE_XBUS_ENDPOINT, - { // repairData - { // fabBus - { // device - 0, // processor_id - l_busNum, // fabricBus - }, - PROCESSOR_EI4, // type - PBUS_RECEIVER, // interface - }, - }, - }, - { // index 3 - RECEIVE, - TARGET_TYPE_ABUS_ENDPOINT, - { // repairData - { // fabBus - { // device - 0, // processor_id - l_busNum, // fabricBus - }, - PROCESSOR_EDI, // type - PBUS_RECEIVER, // interface - }, - }, - }, - { // index 4 - DRIVE, - TARGET_TYPE_MCS_CHIPLET, - { // repairData - { // fabBus - { // device - 0, // proc_centaur_id - l_busNum, // memChannel - }, - MEMORY_EDI, // type - DMI_MCS_DRIVE,// interface - }, - }, - }, - { // index 5 - DRIVE, - TARGET_TYPE_MEMBUF_CHIP, - { // repairData - { // memBus - { // device - 0, // proc_centaur_id - l_busNum, // memChannel - }, - MEMORY_EDI, // type - DMI_MEMBUF_DRIVE,// interface - }, - }, - }, - { // index 6 - RECEIVE, - TARGET_TYPE_MCS_CHIPLET, - { // repairData - { // memBus - { // device - 0, // proc_centaur_id - l_busNum, // memChannel - }, - MEMORY_EDI, // type - DMI_MCS_RECEIVE, // interface - }, - }, - }, - { // index 7 - RECEIVE, - TARGET_TYPE_MEMBUF_CHIP, - { // repairData - { // memBus - { // device - 0, // proc_centaur_id - l_busNum, // memChannel - }, - MEMORY_EDI, // type - DMI_MEMBUF_RECEIVE, // interface - }, - }, - } - }; - - l_vpdDataPtr = l_vpdPtr; - l_repairCnt = 0; - - // Pick each faillane for copying into buffer - for(l_it = i_failLanes.begin(); - l_it != i_failLanes.end(); - l_it++, (l_vpdDataPtr += l_repairDataSz)) - { - l_repairLane = *l_it; - l_overWrite = false; - - // Parse the VPD for fabric and memory eRepair records - for(; - (l_repairCnt < l_numRepairs) && (l_bytesParsed <= i_bufSz); - l_repairCnt++, (l_vpdDataPtr += l_repairDataSz)) - { - l_overWritePtr = - reinterpret_cast (l_vpdDataPtr); - - // Lets find the matching fabric - for(uint8_t l_loop = 0; l_loop < 8; l_loop++) - { - if((l_tgtType == TARGET_TYPE_XBUS_ENDPOINT) || - (l_tgtType == TARGET_TYPE_ABUS_ENDPOINT)) - { - if((i_interface == l_repairMatch[l_loop].intType) && - (l_tgtType == l_repairMatch[l_loop].tgtType) && - (l_overWritePtr->type == - l_repairMatch[l_loop].bus.fabBus.type) && - (l_overWritePtr->interface == - l_repairMatch[l_loop].bus.fabBus.interface) && - (l_overWritePtr->device.fabricBus == - l_repairMatch[l_loop].bus.fabBus.device.fabricBus)) - { - // update the failBit number - l_overWritePtr->failBit = l_repairLane; - - // Increment the count of parsed bytes - l_bytesParsed += l_repairDataSz; - - l_repairCnt++; - l_overWrite = true; - - break; - } - } - else if((l_tgtType == TARGET_TYPE_MCS_CHIPLET) || - (l_tgtType == TARGET_TYPE_MEMBUF_CHIP) ) - { - if((i_interface == l_repairMatch[l_loop].intType) && - (l_tgtType == l_repairMatch[l_loop].tgtType) && - (l_overWritePtr->type == - l_repairMatch[l_loop].bus.memBus.type) && - (l_overWritePtr->interface == - l_repairMatch[l_loop].bus.memBus.interface) && - (l_overWritePtr->device.fabricBus == - l_repairMatch[l_loop].bus.memBus.device.memChannel)) - { - // update the failBit number - l_overWritePtr->failBit = l_repairLane; - - // Increment the count of parsed bytes - l_bytesParsed += l_repairDataSz; - - l_repairCnt++; - l_overWrite = true; - - break; - } - } - } - - if(l_overWrite == true) - { - // Go for the next repairLane - break; - } - } // end of for(vpd Parsing) - - // Check if we have parsed more bytes than the passed size - if((l_bytesParsed > i_bufSz) && (l_repairCnt < l_numRepairs)) - { - if((l_tgtType == TARGET_TYPE_XBUS_ENDPOINT) || - (l_tgtType == TARGET_TYPE_ABUS_ENDPOINT)) - { - FAPI_SET_HWP_ERROR(l_rc, RC_EREPAIR_MVPD_FULL); - } - else if((l_tgtType == TARGET_TYPE_MCS_CHIPLET) || - (l_tgtType == TARGET_TYPE_MEMBUF_CHIP) ) - { - FAPI_SET_HWP_ERROR(l_rc, RC_EREPAIR_MBVPD_FULL); - } - break; - } - - // Add at the end - if(l_overWrite == false) - { - if((l_tgtType == TARGET_TYPE_XBUS_ENDPOINT) || - (l_tgtType == TARGET_TYPE_ABUS_ENDPOINT)) - { - // Make sure we are not writing more records than the size - // allocated in the VPD - if(l_bytesParsed == i_bufSz) - { - FAPI_SET_HWP_ERROR(l_rc, RC_EREPAIR_MVPD_FULL); - break; - } - - eRepairPowerBus *l_fabricBus = - reinterpret_cast(l_vpdDataPtr); - - l_fabricBus->device.processor_id = 0; - l_fabricBus->device.fabricBus = l_busNum; - l_fabricBus->failBit = l_repairLane; - - if(i_interface == DRIVE) - { - l_fabricBus->interface = PBUS_DRIVER; - } - else if(i_interface == RECEIVE) - { - l_fabricBus->interface = PBUS_RECEIVER; - } - - if(l_tgtType == TARGET_TYPE_XBUS_ENDPOINT) - { - l_fabricBus->type = PROCESSOR_EI4; - } - else if(l_tgtType == TARGET_TYPE_ABUS_ENDPOINT) - { - l_fabricBus->type = PROCESSOR_EDI; - } - - l_newNumRepairs++; - - // Increment the count of parsed bytes - l_bytesParsed += l_repairDataSz; -#ifndef _BIG_ENDIAN - // We are on a Little Endian system. - // Need to swap the nibbles of structure - eRepairPowerBus - - l_vpdDataPtr[2] = ((l_vpdDataPtr[2] >> 4) | - (l_vpdDataPtr[2] << 4)); -#endif - } - else if((l_tgtType == TARGET_TYPE_MCS_CHIPLET) || - (l_tgtType == TARGET_TYPE_MEMBUF_CHIP) ) - { - // Make sure we are not writing more records than the size - // allocated in the VPD - if(l_bytesParsed == i_bufSz) - { - FAPI_SET_HWP_ERROR(l_rc, RC_EREPAIR_MBVPD_FULL); - break; - } - - eRepairMemBus *l_memBus = - reinterpret_cast(l_vpdDataPtr); - - l_memBus->device.proc_centaur_id = 0; - l_memBus->device.memChannel = l_busNum; - l_memBus->type = MEMORY_EDI; - l_memBus->failBit = l_repairLane; - - if(i_interface == DRIVE) - { - if(l_tgtType == TARGET_TYPE_MCS_CHIPLET) - { - l_memBus->interface = DMI_MCS_DRIVE; - } - else if(l_tgtType == TARGET_TYPE_MEMBUF_CHIP) - { - l_memBus->interface = DMI_MEMBUF_DRIVE; - } - } - else if(i_interface == RECEIVE) - { - if(l_tgtType == TARGET_TYPE_MCS_CHIPLET) - { - l_memBus->interface = DMI_MCS_RECEIVE; - } - else if(l_tgtType == TARGET_TYPE_MEMBUF_CHIP) - { - l_memBus->interface = DMI_MEMBUF_RECEIVE; - } - } - - l_newNumRepairs++; - - // Increment the count of parsed bytes - l_bytesParsed += l_repairDataSz; -#ifndef _BIG_ENDIAN - // We are on a Little Endian system. - // Need to swap the nibbles of structure - eRepairPowerBus - - l_vpdDataPtr[2] = ((l_vpdDataPtr[2] >> 4) | - (l_vpdDataPtr[2] << 4)); -#endif - } - } // end of if(l_overWrite == false) - } // end of for(failLanes) - - // Update the eRepair count - l_vpdHeadPtr->numRecords = l_newNumRepairs; - - }while(0); - - FAPI_INF("<< updateMnfgRepairLanesToBuf"); - - return(l_rc); -} - -}// endof extern "C" diff --git a/src/usr/hwpf/hwp/bus_training/makefile b/src/usr/hwpf/hwp/bus_training/makefile index c32d387ba..da43662fc 100644 --- a/src/usr/hwpf/hwp/bus_training/makefile +++ b/src/usr/hwpf/hwp/bus_training/makefile @@ -43,9 +43,7 @@ OBJS = gcr_funcs.o io_funcs.o io_run_training.o pbusLinkSvc.o proc_fab_smp.o \ io_restore_erepair.o \ erepairAccessorHwpFuncs.o \ erepairGetFailedLanesHwp.o \ - erepairGetMnfgFailedLanesHwp.o \ erepairSetFailedLanesHwp.o \ - erepairSetMnfgFailedLanesHwp.o ## NOTE: add a new directory onto the vpaths when you add a new HWP diff --git a/src/usr/hwpf/hwp/dmi_training/dmi_training.C b/src/usr/hwpf/hwp/dmi_training/dmi_training.C index 16d7e6298..44544384d 100644 --- a/src/usr/hwpf/hwp/dmi_training/dmi_training.C +++ b/src/usr/hwpf/hwp/dmi_training/dmi_training.C @@ -549,7 +549,6 @@ void* call_dmi_erepair( void *io_pArgs ) std::vector l_endp2_txFaillanes; std::vector l_endp2_rxFaillanes; uint32_t l_count = 0; - fapi::TargetType l_tgtType = fapi::TARGET_TYPE_NONE; TargetHandleList l_mcsTargetList; TargetHandleList l_memTargetList; @@ -681,25 +680,20 @@ void* call_dmi_erepair( void *io_pArgs ) break; } - l_tgtType = l_fapi_endp1_target.getType(); for(l_count = 0; l_count < l_endp1_txFaillanes.size(); l_count++) { - TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" - " restored Tx lane %d, of %s, of endpoint %s", + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Tx lane %d, of DMI-Bus, of endpoint %s", l_endp1_txFaillanes[l_count], - l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : - l_tgtType == TARGET_TYPE_ABUS_ENDPOINT ? "A-Bus" : - "DMI-Bus", l_fapi_endp1_target.toEcmdString()); + l_fapi_endp1_target.toEcmdString()); } for(l_count = 0; l_count < l_endp1_rxFaillanes.size(); l_count++) { - TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" - " restored Rx lane %d, of %s, of endpoint %s", + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Rx lane %d, of DMI-Bus, of endpoint %s", l_endp1_txFaillanes[l_count], - l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : - l_tgtType == TARGET_TYPE_ABUS_ENDPOINT ? "A-Bus" : - "DMI-Bus", l_fapi_endp1_target.toEcmdString()); + l_fapi_endp1_target.toEcmdString()); } } // end of if(l_endp1_txFaillanes.size() || l_endp1_rxFaillanes.size()) @@ -750,25 +744,20 @@ void* call_dmi_erepair( void *io_pArgs ) break; } - l_tgtType = l_fapi_endp2_target.getType(); for(l_count = 0; l_count < l_endp2_txFaillanes.size(); l_count++) { - TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" - " restored Tx lane %d, of %s, of endpoint %s", + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Tx lane %d, of DMI-Bus, of endpoint %s", l_endp2_txFaillanes[l_count], - l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : - l_tgtType == TARGET_TYPE_ABUS_ENDPOINT ? "A-Bus" : - "DMI-Bus", l_fapi_endp2_target.toEcmdString()); + l_fapi_endp2_target.toEcmdString()); } for(l_count = 0; l_count < l_endp2_rxFaillanes.size(); l_count++) { - TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" - " restored Rx lane %d, of %s, of endpoint %s", + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Rx lane %d, of DMI-Bus, of endpoint %s", l_endp2_txFaillanes[l_count], - l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : - l_tgtType == TARGET_TYPE_ABUS_ENDPOINT ? "A-Bus" : - "DMI-Bus", l_fapi_endp2_target.toEcmdString()); + l_fapi_endp2_target.toEcmdString()); } } // end of if(l_endp2_txFaillanes.size() || l_endp2_rxFaillanes.size()) } // end for l_mcs_target diff --git a/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C b/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C index f1bf9bb9e..271a7bcf3 100644 --- a/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C +++ b/src/usr/hwpf/hwp/edi_ei_initialization/edi_ei_initialization.C @@ -106,6 +106,8 @@ void* call_fabric_erepair( void *io_pArgs ) TargetPairs_t l_PbusConnections; const uint32_t MaxBusSet = 2; TYPE busSet[MaxBusSet] = { TYPE_ABUS, TYPE_XBUS }; + uint32_t l_count = 0; + fapi::TargetType l_tgtType = fapi::TARGET_TYPE_NONE; for (uint32_t i = 0; l_StepError.isNull() && (i < MaxBusSet); i++) { @@ -230,6 +232,25 @@ void* call_fabric_erepair( void *io_pArgs ) break; } + l_tgtType = l_fapi_endp1_target.getType(); + for(l_count = 0; l_count < l_endp1_txFaillanes.size(); l_count++) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Tx lane %d, of %s, of endpoint %s", + l_endp1_txFaillanes[l_count], + l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : + "A-Bus", l_fapi_endp1_target.toEcmdString()); + } + + for(l_count = 0; l_count < l_endp1_rxFaillanes.size(); l_count++) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Rx lane %d, of %s, of endpoint %s", + l_endp1_txFaillanes[l_count], + l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : + "A-Bus", l_fapi_endp1_target.toEcmdString()); + } + if(l_endp2_txFaillanes.size() || l_endp2_rxFaillanes.size()) { // call the io_restore_erepair HWP to restore eRepair @@ -270,6 +291,25 @@ void* call_fabric_erepair( void *io_pArgs ) errlCommit(l_errl, HWPF_COMP_ID); break; } + + l_tgtType = l_fapi_endp2_target.getType(); + for(l_count = 0; l_count < l_endp2_txFaillanes.size(); l_count++) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Tx lane %d, of %s, of endpoint %s", + l_endp1_txFaillanes[l_count], + l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : + "A-Bus", l_fapi_endp2_target.toEcmdString()); + } + + for(l_count = 0; l_count < l_endp2_rxFaillanes.size(); l_count++) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"Successfully" + " restored Rx lane %d, of %s, of endpoint %s", + l_endp2_txFaillanes[l_count], + l_tgtType == TARGET_TYPE_XBUS_ENDPOINT ? "X-Bus" : + "A-Bus", l_fapi_endp2_target.toEcmdString()); + } } // end for l_PbusConnections } // end for MaxBusSet -- cgit v1.2.1