diff options
-rw-r--r-- | src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C | 51 | ||||
-rwxr-xr-x | src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C | 70 |
2 files changed, 92 insertions, 29 deletions
diff --git a/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C b/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C index 135b302c3..a4db16036 100644 --- a/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C +++ b/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C @@ -47,7 +47,7 @@ extern "C" /** * @brief Function called by the FW Team HWP that reads the data from Field VPD. - * This function makes the actual calls to read the 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 @@ -329,8 +329,34 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, do { - // Read the header and count information + l_tgtType = i_tgtHandle.getType(); + + // Get the parent chip target + fapi::Target l_chipTarget = i_tgtHandle; + if((l_tgtType == fapi::TARGET_TYPE_XBUS_ENDPOINT) || + (l_tgtType == fapi::TARGET_TYPE_ABUS_ENDPOINT) || + (l_tgtType == fapi::TARGET_TYPE_MCS_CHIPLET)) + { + l_rc = fapiGetParentChip(i_tgtHandle, l_chipTarget); + if(l_rc) + { + FAPI_ERR("Error (0x%x) from fapiGetParentChip", + static_cast<uint32_t>(l_rc)); + break; + } + } + + // Get the chip position + uint32_t l_chipPosition; + l_rc = FAPI_ATTR_GET(ATTR_POS, &l_chipTarget, l_chipPosition); + if(l_rc) + { + FAPI_ERR("Error (0x%x), from FAPI_ATTR_GET", + static_cast<uint32_t>(l_rc)); + break; + } + // Read the header and count information l_vpdPtr = i_buf; // point to the start of header data l_vpdHeadPtr = reinterpret_cast<eRepairHeader *> (l_vpdPtr); @@ -339,8 +365,6 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, 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)) @@ -369,10 +393,12 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, 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. + if(l_chipPosition != l_fabricBus->device.processor_id) + { + continue; + } // Check if we have the matching the Fabric Bus types if((l_tgtType == fapi::TARGET_TYPE_ABUS_ENDPOINT) && @@ -465,10 +491,11 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, 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 correct Processor/Centaur ID + if(l_chipPosition != l_memBus->device.proc_centaur_id) + { + continue; + } // Check if we have the matching the Memory Bus types if(l_memBus->type != EREPAIR::MEMORY_EDI) @@ -524,7 +551,7 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle, }while(0); - FAPI_INF("<< No.of Fail Lanes: tx: %zd, rx: %zd", + 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/erepairSetFailedLanesHwp.C b/src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C index 575b09282..a59d9e5a4 100755 --- a/src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C +++ b/src/usr/hwpf/hwp/bus_training/erepairSetFailedLanesHwp.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -219,7 +221,7 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, break; } - // Retrieve the Field eRepair data from the Centaur FRU VPD + // Retrieve the eRepair data from the Centaur FRU VPD l_rc = fapiGetMBvpdField(l_vpdRecord, MBVPD_KEYWORD_PDI, i_tgtHandle, @@ -247,7 +249,7 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, break; } - /*** Write the updated eRepair buffer back to Centaru FRU VPD ***/ + /*** Write the updated eRepair buffer back to Centaur FRU VPD ***/ l_rc = fapiSetMBvpdField(l_vpdRecord, MBVPD_KEYWORD_PDI, i_tgtHandle, @@ -313,7 +315,7 @@ ReturnCode writeRepairDataToVPD(const Target &i_tgtHandle, break; } - // Retrieve the Field eRepair data from the MVPD + // Retrieve the eRepair data from the MVPD l_rc = fapiGetMvpdField(l_vpdRecord, MVPD_KEYWORD_PDI, l_procTarget, @@ -480,11 +482,41 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, 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", + FAPI_ERR("Error (0x%x), from FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS)", + static_cast<uint32_t>(l_rc)); + break; + } + + // Get the chip target + Target l_chipTarget = i_tgtHandle; + if((l_tgtType == TARGET_TYPE_XBUS_ENDPOINT) || + (l_tgtType == TARGET_TYPE_ABUS_ENDPOINT) || + (l_tgtType == TARGET_TYPE_MCS_CHIPLET)) + { + l_rc = fapiGetParentChip(i_tgtHandle, l_chipTarget); + if(l_rc) + { + FAPI_ERR("Error (0x%x) from fapiGetParentChip", + static_cast<uint32_t>(l_rc)); + break; + } + } + + // Get the chip number + uint32_t l_chipPosition; + l_rc = FAPI_ATTR_GET(ATTR_POS, &l_chipTarget, l_chipPosition); + if(l_rc) + { + FAPI_ERR("Error (0x%x), from FAPI_ATTR_GET(ATTR_POS)", static_cast<uint32_t>(l_rc)); break; } + // This is needed because we can only store and compare a uint8_t + // value. For our purpose the value in l_chipPosition (Proc Position and + // Centaur Position) will always be within the range of uint8_t + uint8_t l_chipNum = l_chipPosition; + /*** Lets update the fail lane vector to the Buffer ***/ // Create a structure of eRepair data that we will be matching @@ -510,7 +542,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // fabBus { // device - 0, // processor_id + l_chipNum,// processor_id l_busNum, // fabricBus }, PROCESSOR_EI4, // type @@ -524,7 +556,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // fabBus { // device - 0, // processor_id + l_chipNum,// processor_id l_busNum, // fabricBus }, PROCESSOR_EDI, // type @@ -538,7 +570,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // fabBus { // device - 0, // processor_id + l_chipNum,// processor_id l_busNum, // fabricBus }, PROCESSOR_EI4, // type @@ -552,7 +584,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // fabBus { // device - 0, // processor_id + l_chipNum,// processor_id l_busNum, // fabricBus }, PROCESSOR_EDI, // type @@ -566,7 +598,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // fabBus { // device - 0, // proc_centaur_id + l_chipNum,// proc_centaur_id l_busNum, // memChannel }, MEMORY_EDI, // type @@ -580,7 +612,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // memBus { // device - 0, // proc_centaur_id + l_chipNum,// proc_centaur_id l_busNum, // memChannel }, MEMORY_EDI, // type @@ -594,7 +626,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // memBus { // device - 0, // proc_centaur_id + l_chipNum,// proc_centaur_id l_busNum, // memChannel }, MEMORY_EDI, // type @@ -608,7 +640,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { // repairData { // memBus { // device - 0, // proc_centaur_id + l_chipNum,// proc_centaur_id l_busNum, // memChannel }, MEMORY_EDI, // type @@ -646,6 +678,8 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { if((i_interface == l_repairMatch[l_loop].intType) && (l_tgtType == l_repairMatch[l_loop].tgtType) && + ((l_overWritePtr->device).processor_id == + l_repairMatch[l_loop].bus.fabBus.device.processor_id)&& (l_overWritePtr->type == l_repairMatch[l_loop].bus.fabBus.type) && (l_overWritePtr->interface == @@ -670,6 +704,8 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, { if((i_interface == l_repairMatch[l_loop].intType) && (l_tgtType == l_repairMatch[l_loop].tgtType) && + ((l_overWritePtr->device).processor_id == + l_repairMatch[l_loop].bus.memBus.device.proc_centaur_id)&& (l_overWritePtr->type == l_repairMatch[l_loop].bus.memBus.type) && (l_overWritePtr->interface == @@ -744,10 +780,10 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, break; } - eRepairPowerBus *l_fabricBus = + eRepairPowerBus *l_fabricBus = reinterpret_cast<eRepairPowerBus *>(l_vpdWritePtr); - l_fabricBus->device.processor_id = 0; + l_fabricBus->device.processor_id = l_chipNum; l_fabricBus->device.fabricBus = l_busNum; l_fabricBus->failBit = l_repairLane; @@ -795,7 +831,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, eRepairMemBus *l_memBus = reinterpret_cast<eRepairMemBus *>(l_vpdWritePtr); - l_memBus->device.proc_centaur_id = 0; + l_memBus->device.proc_centaur_id = l_chipNum; l_memBus->device.memChannel = l_busNum; l_memBus->type = MEMORY_EDI; l_memBus->failBit = l_repairLane; @@ -833,7 +869,7 @@ ReturnCode updateRepairLanesToBuf(const Target &i_tgtHandle, l_vpdWritePtr[2] = ((l_vpdWritePtr[2] >> 4) | (l_vpdWritePtr[2] << 4)); -#endif +#endif } } // end of if(l_overWrite == false) } // end of for(failLanes) |