diff options
author | Caleb Palmer <cnpalmer@us.ibm.com> | 2018-03-02 15:06:13 -0600 |
---|---|---|
committer | Zane C. Shelley <zshelle@us.ibm.com> | 2018-03-06 15:40:29 -0500 |
commit | d2fd055febb7951474bffd527cc88e189a866ee3 (patch) | |
tree | 2c59d50e3653c248777f6b048514dff4e6d9c357 /src/usr/fapi2 | |
parent | 18a73baccdc224201d38f73d5000e1f88f1bd52d (diff) | |
download | talos-hostboot-d2fd055febb7951474bffd527cc88e189a866ee3.tar.gz talos-hostboot-d2fd055febb7951474bffd527cc88e189a866ee3.zip |
Free mem and fix dimm trgt in bad dq accessors
Change-Id: I8db862122b9bab7eae2e75a4188c863704e9fdcd
CQ: SW419983
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54996
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
-rw-r--r-- | src/usr/fapi2/attribute_service.C | 33 | ||||
-rw-r--r-- | src/usr/fapi2/dimmBadDqBitmapFuncs.C | 27 |
2 files changed, 39 insertions, 21 deletions
diff --git a/src/usr/fapi2/attribute_service.C b/src/usr/fapi2/attribute_service.C index 1089f97e4..dfcaff74a 100644 --- a/src/usr/fapi2/attribute_service.C +++ b/src/usr/fapi2/attribute_service.C @@ -695,11 +695,10 @@ errlHndl_t __dimmUpdateDqBitmapEccByte( const uint8_t ECC_DQ_BYTE_NUMBER_INDEX = 8; const uint8_t ENUM_ATTR_SPD_MODULE_MEMORY_BUS_WIDTH_WE8 = 0x08; size_t MEM_BUS_WIDTH_SIZE = 0x01; + uint8_t *l_eccBits = static_cast<uint8_t*>(malloc(MEM_BUS_WIDTH_SIZE)); do { - uint8_t *l_eccBits = static_cast<uint8_t*>(malloc(MEM_BUS_WIDTH_SIZE)); - l_errl = deviceRead( i_dimm, l_eccBits, MEM_BUS_WIDTH_SIZE, @@ -729,6 +728,12 @@ errlHndl_t __dimmUpdateDqBitmapEccByte( } }while(0); + if ( l_eccBits != nullptr ) + { + free( l_eccBits ); + l_eccBits = nullptr; + } + return l_errl; } @@ -1222,6 +1227,9 @@ ReturnCode fapiAttrGetBadDqBitmap( errlHndl_t l_errl = nullptr; TARGETING::TargetHandle_t l_dimmTarget = nullptr; + uint8_t * l_badDqData = + static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); + do { l_errl = getTargetingTarget( i_dimmFapiTarget, l_dimmTarget ); @@ -1245,9 +1253,6 @@ ReturnCode fapiAttrGetBadDqBitmap( break; } - uint8_t * l_badDqData = - static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); - l_errl = deviceRead(l_dimmTarget, l_badDqData, DIMM_BAD_DQ_SIZE_BYTES, DEVICE_SPD_ADDRESS(SPD::DIMM_BAD_DQ_DATA)); @@ -1363,6 +1368,12 @@ ReturnCode fapiAttrGetBadDqBitmap( }while(0); + if ( l_badDqData != nullptr ) + { + free( l_badDqData ); + l_badDqData = nullptr; + } + return l_rc; } @@ -1376,7 +1387,8 @@ ReturnCode fapiAttrSetBadDqBitmap( fapi2::ReturnCode l_rc; errlHndl_t l_errl = nullptr; TARGETING::TargetHandle_t l_dimmTarget = nullptr; - + uint8_t * l_badDqData = + static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); do { l_errl = getTargetingTarget(i_dimmFapiTarget, l_dimmTarget); @@ -1507,9 +1519,6 @@ ReturnCode fapiAttrSetBadDqBitmap( // We need to make sure the rest of the data in VPD beyond the bad dq // bitmap is unchanged. - uint8_t * l_badDqData = - static_cast<uint8_t*>( malloc(DIMM_BAD_DQ_SIZE_BYTES) ); - l_errl = deviceRead(l_dimmTarget, l_badDqData, DIMM_BAD_DQ_SIZE_BYTES, DEVICE_SPD_ADDRESS(SPD::DIMM_BAD_DQ_DATA)); @@ -1560,6 +1569,12 @@ ReturnCode fapiAttrSetBadDqBitmap( }while(0); + if ( l_badDqData != nullptr ) + { + free( l_badDqData ); + l_badDqData = nullptr; + } + return l_rc; } diff --git a/src/usr/fapi2/dimmBadDqBitmapFuncs.C b/src/usr/fapi2/dimmBadDqBitmapFuncs.C index e55431187..8281edb94 100644 --- a/src/usr/fapi2/dimmBadDqBitmapFuncs.C +++ b/src/usr/fapi2/dimmBadDqBitmapFuncs.C @@ -78,14 +78,12 @@ fapi2::ReturnCode dimmBadDqCheckParamGetBitmap( const fapi2::Target TARGETING::ATTR_MODEL_type l_procModel = l_masterProc->getAttr<TARGETING::ATTR_MODEL>(); - // Get the DIMM + // Get all functional DIMMs TargetHandleList l_dimmList; + getChildAffinityTargets( l_dimmList, l_trgt, CLASS_NA, TYPE_DIMM ); if ( TARGETING::MODEL_CUMULUS == l_procModel ) { - // Get all functional DIMMs - getChildAffinityTargets( l_dimmList, l_trgt, CLASS_NA, TYPE_DIMM ); - // Find the DIMM with the correct MBA port/dimm uint8_t l_port = 0; uint8_t l_dimm = 0; @@ -113,14 +111,19 @@ fapi2::ReturnCode dimmBadDqCheckParamGetBitmap( const fapi2::Target } else if ( TARGETING::MODEL_NIMBUS == l_procModel ) { - // Get all connected DIMMs, even nonfunctioning ones. - getChildAffinityTargets( l_dimmList, l_trgt, CLASS_NA, TYPE_DIMM, - false ); - o_dimmTrgt = l_dimmList[i_dimm]; - - // 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 ); + for ( auto &dimmTrgt : l_dimmList ) + { + uint32_t l_pos = dimmTrgt->getAttr<ATTR_FAPI_POS>() % + mss::MAX_DIMM_PER_PORT; + if ( l_pos == 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; + } + } } else { |