Skip to content

Commit

Permalink
Update dimmBadDqCheckParamGetBitmap to be generic
Browse files Browse the repository at this point in the history
Change-Id: Ia1b7ab8fa257a3bdad8ea5fbd46add150a165e73
RTC: 201603
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69581
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
  • Loading branch information
cnpalmer authored and zane131 committed Dec 12, 2018
1 parent 4a8f0e5 commit a10dc16
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 57 deletions.
14 changes: 8 additions & 6 deletions src/include/usr/fapi2/dimmBadDqBitmapFuncs.H
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,17 @@ extern "C"
* dimmBadDqBitmapAccessHwp to get the DQ bitmap and returns the data
* for the specified rank.
*
* @param[in] i_fapiTrgt Reference to MCA/MBA Target
* @param[in] i_fapiTrgt Reference to MCA/MBA/MEM_PORT Target
* @param[in] i_dimm MCA/MBA port DIMM number
* @param[in] i_rank DIMM rank number
* @param[out] o_data Reference to data where Bad DQ bitmap is copied to
* @param[in] i_port Optional port for MBA targets. Default is port 0.
* @param[in] i_port Optional port for MBA targets only. Default is port 0.
*
* @return ReturnCode
*/
fapi2::ReturnCode p9DimmGetBadDqBitmap( const fapi2::Target
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA|fapi2::TARGET_TYPE_MEM_PORT>
& i_fapiTrgt,
const uint8_t i_dimm,
const uint8_t i_rank,
uint8_t (&o_data)[mss::BAD_DQ_BYTE_COUNT],
Expand All @@ -66,16 +67,17 @@ fapi2::ReturnCode p9DimmGetBadDqBitmap( const fapi2::Target
* dimmBadDqBitmapAccessHwp to get the DQ bitmap, fills in the data for the
* specified rank and calls dimmBadDqBitmapAccessHwp to set the DQ bitmap
*
* @param[in] i_fapiTrgt Reference to MCA/MBA Chiplet
* @param[in] i_fapiTrgt Reference to MCA/MBA/MEM_PORT Target
* @param[in] i_dimm MCA/MBA port DIMM number
* @param[in] i_rank DIMM rank number
* @param[in] i_data Reference to data where Bad DQ bitmap is copied from
* @param[in] i_port Optional port for MBA targets. Default is port 0.
* @param[in] i_port Optional port for MBA targets only. Default is port 0.
*
* @return ReturnCode
*/
fapi2::ReturnCode p9DimmSetBadDqBitmap( const fapi2::Target
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA|fapi2::TARGET_TYPE_MEM_PORT>
& i_fapiTrgt,
const uint8_t i_dimm,
const uint8_t i_rank,
const uint8_t (&i_data)[mss::BAD_DQ_BYTE_COUNT],
Expand Down
72 changes: 21 additions & 51 deletions src/usr/fapi2/dimmBadDqBitmapFuncs.C
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ extern "C"
// Utility function to check parameters and get the Bad DQ bitmap
//------------------------------------------------------------------------------
fapi2::ReturnCode dimmBadDqCheckParamGetBitmap( const fapi2::Target
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA|fapi2::TARGET_TYPE_MEM_PORT>
& i_fapiTrgt,
const uint8_t i_port,
const uint8_t i_dimm,
const uint8_t i_rank,
Expand Down Expand Up @@ -72,67 +73,34 @@ fapi2::ReturnCode dimmBadDqCheckParamGetBitmap( const fapi2::Target
break;
}

// Get the proc model
TARGETING::Target* l_masterProc = nullptr;
TARGETING::targetService().masterProcChipTargetHandle( l_masterProc );
TARGETING::ATTR_MODEL_type l_procModel =
l_masterProc->getAttr<TARGETING::ATTR_MODEL>();

// Get all functional DIMMs
TargetHandleList l_dimmList;
getChildAffinityTargets( l_dimmList, l_trgt, CLASS_NA, TYPE_DIMM );

if ( TARGETING::MODEL_CUMULUS == l_procModel )
// Find the DIMM with the correct port/dimm slct
uint8_t l_port = 0;
uint8_t l_dimm = 0;

for ( auto &dimmTrgt : l_dimmList )
{
// Find the DIMM with the correct MBA port/dimm
uint8_t l_port = 0;
uint8_t l_dimm = 0;
// Get and compare the port
l_port = dimmTrgt->getAttr<ATTR_MEM_PORT>();

for ( auto &dimmTrgt : l_dimmList )
if ( l_port == i_port )
{
// Get and compare the port
l_port = dimmTrgt->getAttr<ATTR_CEN_MBA_PORT>();
// Get and compare the dimm
l_dimm = dimmTrgt->getAttr<ATTR_POS_ON_MEM_PORT>();

if ( l_port == i_port )
{
// Get and compare the dimm
l_dimm = dimmTrgt->getAttr<ATTR_CEN_MBA_DIMM>();

if ( l_dimm == i_dimm )
{
o_dimmTrgt = dimmTrgt;
// Port and dimm are correct, get the Bad DQ bitmap
l_rc = FAPI_ATTR_GET( fapi2::ATTR_BAD_DQ_BITMAP,
dimmTrgt, o_dqBitmap );
if ( l_rc ) break;
}
}
}
}
else if ( TARGETING::MODEL_NIMBUS == l_procModel )
{
for ( auto &dimmTrgt : l_dimmList )
{
uint32_t l_pos = dimmTrgt->getAttr<ATTR_FAPI_POS>() %
mss::MAX_DIMM_PER_PORT;
if ( l_pos == i_dimm )
if ( l_dimm == i_dimm )
{
o_dimmTrgt = dimmTrgt;
// Get the Bad DQ bitmap by querying ATTR_BAD_DQ_BITMAP.
l_rc = FAPI_ATTR_GET( fapi2::ATTR_BAD_DQ_BITMAP,
o_dimmTrgt, o_dqBitmap );
break;
// Port and dimm are correct, get the Bad DQ bitmap
l_rc = FAPI_ATTR_GET( fapi2::ATTR_BAD_DQ_BITMAP, dimmTrgt,
o_dqBitmap );
if ( l_rc ) break;
}
}
}
else
{
// TODO RTC 201603 - axone/generic updates
// Invalid target.
FAPI_ERR( "dimmBadDqCheckParamGetBitmap: Invalid proc model" );
l_rc = fapi2::FAPI2_RC_INVALID_ATTR_GET;
break;
}

if ( l_rc )
{
Expand All @@ -147,7 +115,8 @@ fapi2::ReturnCode dimmBadDqCheckParamGetBitmap( const fapi2::Target

//------------------------------------------------------------------------------
fapi2::ReturnCode p9DimmGetBadDqBitmap( const fapi2::Target
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA|fapi2::TARGET_TYPE_MEM_PORT>
& i_fapiTrgt,
const uint8_t i_dimm,
const uint8_t i_rank,
uint8_t (&o_data)[mss::BAD_DQ_BYTE_COUNT],
Expand Down Expand Up @@ -182,7 +151,8 @@ fapi2::ReturnCode p9DimmGetBadDqBitmap( const fapi2::Target

//------------------------------------------------------------------------------
fapi2::ReturnCode p9DimmSetBadDqBitmap( const fapi2::Target
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
<fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA|fapi2::TARGET_TYPE_MEM_PORT>
& i_fapiTrgt,
const uint8_t i_dimm,
const uint8_t i_rank,
const uint8_t (&i_data)[mss::BAD_DQ_BYTE_COUNT],
Expand Down

0 comments on commit a10dc16

Please sign in to comment.