summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C
diff options
context:
space:
mode:
authorBilicon Patil <bilpatil@in.ibm.com>2013-04-04 06:06:34 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-05-08 09:25:18 -0500
commit8e8dbe99d13d923536353afd96b9b003382b7f2c (patch)
tree06ddd905db79c197fc0e9fe94cb28674a7b2ee94 /src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C
parent0b8a07b09265dd48c2881caca24e150a948272a0 (diff)
downloadtalos-hostboot-8e8dbe99d13d923536353afd96b9b003382b7f2c.tar.gz
talos-hostboot-8e8dbe99d13d923536353afd96b9b003382b7f2c.zip
Set Accessor HWP to write repair data to VPD and Support for Centaur targets.
Change-Id: I57eee26a677c213317beaa6b84c79a73cccf34a5 RTC: 22646 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3864 Tested-by: Jenkins Server Reviewed-by: Zane Shelley <zshelle@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C')
-rw-r--r--src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C203
1 files changed, 142 insertions, 61 deletions
diff --git a/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C b/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C
index 153eb17fe..ddc54e0f4 100644
--- a/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C
+++ b/src/usr/hwpf/hwp/bus_training/erepairGetFailedLanesHwp.C
@@ -51,10 +51,6 @@ extern "C"
* parsing.
*
* @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS target
- * @param[in] i_procTgt Reference to the Processor target associated with
- * passed i_tgtHandle
- * @param[in] i_recordType This is the VPD record type that is used to query
- * the VPD data
* @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
@@ -63,8 +59,6 @@ extern "C"
* @return ReturnCode
*/
fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle,
- const fapi::Target &i_procTgt,
- fapi::MvpdRecord i_recordType,
std::vector<uint8_t> &o_txFailLanes,
std::vector<uint8_t> &o_rxFailLanes);
@@ -103,7 +97,6 @@ fapi::ReturnCode erepairGetFailedLanesHwp(const fapi::Target &i_tgtHandle,
{
fapi::ReturnCode l_rc;
fapi::Target l_processorTgt;
- fapi::MvpdRecord l_fieldRecord;
fapi::TargetType l_tgtType = fapi::TARGET_TYPE_NONE;
std::vector<fapi::Target> l_mcsChiplets;
@@ -119,10 +112,8 @@ fapi::ReturnCode erepairGetFailedLanesHwp(const fapi::Target &i_tgtHandle,
l_tgtType = i_tgtHandle.getType();
// Verify if the correct target type is passed
- // TODO: l_tgtType of fapi::TARGET_TYPE_MEMBUF_CHIP will be supported
- // when HWSV will provide the device driver to read the
- // Centaur FRU VPD. RTC Task 51234, Depends on Story 44009
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))
{
@@ -132,27 +123,15 @@ fapi::ReturnCode erepairGetFailedLanesHwp(const fapi::Target &i_tgtHandle,
break;
}
- // Determine the Processor target
- l_rc = fapiGetParentChip(i_tgtHandle, l_processorTgt);
- if(l_rc)
- {
- FAPI_ERR("Error (0x%x) from fapiGetParentChip",
- static_cast<uint32_t>(l_rc));
- break;
- }
-
// Retrieve the Field eRepair lane numbers from the VPD
- l_fieldRecord = fapi::MVPD_RECORD_VWML;
l_rc = retrieveRepairData(i_tgtHandle,
- l_processorTgt,
- l_fieldRecord,
o_txFailLanes,
o_rxFailLanes);
if(l_rc)
{
FAPI_ERR("Error (0x%x) during retrieval of Field records",
- static_cast<uint32_t>(l_rc));
+ static_cast<uint32_t>(l_rc));
break;
}
}while(0);
@@ -162,37 +141,42 @@ fapi::ReturnCode erepairGetFailedLanesHwp(const fapi::Target &i_tgtHandle,
return l_rc;
}
-
fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle,
- const fapi::Target &i_procTgt,
- fapi::MvpdRecord i_recordType,
std::vector<uint8_t> &o_txFailLanes,
std::vector<uint8_t> &o_rxFailLanes)
{
- uint8_t *l_retBuf = NULL;
- uint32_t l_bufSize = 0;
fapi::ReturnCode l_rc;
+ uint8_t *l_retBuf = NULL;
+ uint32_t l_bufSize = 0;
+ fapi::Target l_procTarget;
- FAPI_INF(">> retrieveRepairData: i_procTgt: %s", i_procTgt.toEcmdString());
+ FAPI_INF(">> retrieveRepairData");
do
{
- // Determine the size of the eRepair data in the VPD
- l_rc = fapiGetMvpdField(i_recordType,
- fapi::MVPD_KEYWORD_PDI,
- i_procTgt,
- NULL,
- l_bufSize);
-
- if(l_rc)
+ if(i_tgtHandle.getType() == fapi::TARGET_TYPE_MEMBUF_CHIP)
{
- FAPI_ERR("Error (0x%x) from fapiGetMvpdField",
- static_cast<uint32_t> (l_rc));
- break;
- }
+ // Determine the size of the eRepair data in the VPD
+ l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VEIR,
+ fapi::MBVPD_KEYWORD_PDI,
+ i_tgtHandle,
+ NULL,
+ l_bufSize);
+
+ if(l_rc)
+ {
+ FAPI_ERR("Error (0x%x) during VPD size read",
+ static_cast<uint32_t> (l_rc));
+ break;
+ }
+
+ if((l_bufSize == 0) ||
+ (l_bufSize > EREPAIR::EREPAIR_MEM_FIELD_VPD_SIZE_PER_CENTAUR))
+ {
+ FAPI_SET_HWP_ERROR(l_rc, RC_ACCESSOR_HWP_INVALID_MEM_VPD_SIZE);
+ break;
+ }
- if(l_bufSize != 0)
- {
// Allocate memory for buffer
l_retBuf = new uint8_t[l_bufSize];
if(l_retBuf == NULL)
@@ -203,32 +187,88 @@ fapi::ReturnCode retrieveRepairData(const fapi::Target &i_tgtHandle,
}
// Retrieve the Field eRepair data from the PNOR
- l_rc = fapiGetMvpdField(i_recordType,
+ l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VEIR,
+ fapi::MBVPD_KEYWORD_PDI,
+ i_tgtHandle,
+ l_retBuf,
+ l_bufSize);
+
+ if(l_rc)
+ {
+ FAPI_ERR("Error (0x%x) during VPD read",
+ static_cast<uint32_t> (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<uint32_t>(l_rc));
+ break;
+ }
+
+ // Determine the size of the eRepair data in the VPD
+ l_rc = fapiGetMvpdField(fapi::MVPD_RECORD_VWML,
fapi::MVPD_KEYWORD_PDI,
- i_procTgt,
- l_retBuf,
+ l_procTarget,
+ NULL,
l_bufSize);
if(l_rc)
{
- FAPI_ERR("Error (0x%x) from fapiGetMvpdField",
+ FAPI_ERR("Error (0x%x) during VPD size read",
static_cast<uint32_t> (l_rc));
break;
}
- // Parse the buffer to determine eRepair lanes and copy the
- // fail lane numbers to the return vector
- l_rc = determineRepairLanes(i_tgtHandle,
- l_retBuf,
- l_bufSize,
- o_txFailLanes,
- o_rxFailLanes);
+ if((l_bufSize == 0) ||
+ (l_bufSize > EREPAIR::EREPAIR_P8_MODULE_VPD_FIELD_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_VWML,
+ fapi::MVPD_KEYWORD_PDI,
+ l_procTarget,
+ l_retBuf,
+ l_bufSize);
+
if(l_rc)
{
- FAPI_ERR("determineRepairLanes failed");
+ FAPI_ERR("Error (0x%x) during VPD read",
+ static_cast<uint32_t> (l_rc));
break;
}
}
+
+ // Parse the buffer to determine eRepair lanes and copy the
+ // fail lane numbers to the return vector
+ l_rc = determineRepairLanes(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
@@ -253,6 +293,8 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle,
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;
@@ -290,6 +332,9 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle,
break;
}
+ // TODO: RTC task 71260
+ // Investigate if there is an Endianess issue with
+ // the memcpy and fix it.
memcpy(&l_fabricBus, l_vpdPtr, l_fabricRepairDataSz);
// Check if we have the correct Processor ID
@@ -335,10 +380,29 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle,
}
} // end of for loop
} // end of if(l_tgtType is XBus or ABus)
- else if(l_tgtType == fapi::TARGET_TYPE_MCS_CHIPLET)
+ 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("determineRepairLanes: 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;
@@ -352,6 +416,9 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle,
break;
}
+ // TODO: RTC task 71260
+ // Investigate if there is an Endianess issue with
+ // the memcpy and fix it.
memcpy(&l_memBus, l_vpdPtr, l_memRepairDataSz);
// Check if we have the correct Processor ID
@@ -366,7 +433,7 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle,
}
// Check if we have the matching memory bus interface
- l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS,&i_tgtHandle,l_busNum);
+ 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",
@@ -386,13 +453,27 @@ fapi::ReturnCode determineRepairLanes(const fapi::Target &i_tgtHandle,
}
// Copy the fail lane numbers in the vectors
- if(l_memBus.interface == EREPAIR::DMI_MCS_DRIVE)
+ if(l_tgtType == fapi::TARGET_TYPE_MCS_CHIPLET)
{
- o_txFailLanes.push_back(l_memBus.failBit);
+ 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);
+ }
}
- else if(l_memBus.interface == EREPAIR::DMI_MCS_RECEIVE)
+ else if(l_tgtType == fapi::TARGET_TYPE_MEMBUF_CHIP)
{
- o_rxFailLanes.push_back(l_memBus.failBit);
+ 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)
OpenPOWER on IntegriCloud