diff options
| author | Elizabeth Liner <eliner@us.ibm.com> | 2014-09-11 15:59:59 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-10-31 17:19:49 -0500 |
| commit | c864e50f89bfeb102a2edca45825e6e02cf6ba56 (patch) | |
| tree | 171cebc68e36d757780e8d94ba5f74e5ddf7e40d /src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.C | |
| parent | 23bb36591f824acacfb4e924ab0efda26e8d1f6e (diff) | |
| download | blackbird-hostboot-c864e50f89bfeb102a2edca45825e6e02cf6ba56.tar.gz blackbird-hostboot-c864e50f89bfeb102a2edca45825e6e02cf6ba56.zip | |
Support VPD keyword changes for ISDIMMS
RTC:94871
Change-Id: I8c00494263284ed7a047dbc7c6d02a54aeff5f6c
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13580
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.C')
| -rw-r--r-- | src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.C | 170 |
1 files changed, 166 insertions, 4 deletions
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.C index 20ef8435c..6fa6a4d54 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.C +++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.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. */ @@ -20,14 +22,13 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: getMBvpdTermData.C,v 1.11 2014/04/08 20:52:26 whs Exp $ +// $Id: getMBvpdTermData.C,v 1.16 2014/10/27 16:12:56 eliner Exp $ /** * @file getMBvpdTermData.C * * @brief get Termination Data from MBvpd MT keyword * */ - #include <stdint.h> // fapi support @@ -313,11 +314,172 @@ fapi::ReturnCode getMBvpdTermData( // Read the MT keyword field l_pMtBuffer = new mt_keyword; - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, + uint8_t l_customDimm = 0; + + l_fapirc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM,&i_mbaTarget, + l_customDimm); + if(l_fapirc) + { + FAPI_ERR("getMBvpdTermData: Read of Custom Dimm failed"); + break; + } + + //if custom_dimm = 0, use isdimm + if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm) + { + //MT keyword is located in the SPDX record, + //and found by using ATTR_SPD_NUM_RANKS + //T1: one dimm, rank 1 T2: one dimm, rank 2 T3: one dimm, rank 4 + //T5: two dimm, rank 1 T6: two dimm, rank 2 T8: two dimm, rank 4 + uint8_t l_spd_dimm_ranks[2][2] = {{0,0},{0,0}}; + uint8_t l_mba_port; + uint8_t l_mba_dimm; + + std::vector<fapi::Target> l_target_dimm_array; + l_fapirc = fapiGetAssociatedDimms(i_mbaTarget, l_target_dimm_array, + fapi::TARGET_STATE_PRESENT); + if(l_fapirc) + { + FAPI_ERR("getMBvpdTermData: read of Associated Dimms failed"); + break; + } + + for(uint8_t l_dimm_index=0; l_dimm_index<l_target_dimm_array.size(); + l_dimm_index+=1) + { + l_fapirc = FAPI_ATTR_GET(ATTR_MBA_PORT, + &l_target_dimm_array[l_dimm_index], + l_mba_port); + if(l_fapirc) + { + FAPI_ERR("getMBvpdTermData: read of ATTR_MBA_PORT failed"); + break; + } + l_fapirc = FAPI_ATTR_GET(ATTR_MBA_DIMM, + &l_target_dimm_array[l_dimm_index], + l_mba_dimm); + if(l_fapirc) + { + FAPI_ERR("getMBvpdTermData: read of ATTR_MBA_DIMM failed"); + break; + } + + l_fapirc = FAPI_ATTR_GET(ATTR_SPD_NUM_RANKS, + &l_target_dimm_array[l_dimm_index], + l_spd_dimm_ranks[l_mba_port][l_mba_dimm]); + } + if(l_fapirc) + { + FAPI_ERR("getMBvpdTermData: read of ATTR_SPD_NUM_RANKS failed"); + break; + } + + uint8_t l_rankCopy = 0; + uint8_t l_dimmInvalid = 0; + /* Mismatched rank numbers between the paired ports is an error that + * should deconfigure the parent MBA so the data for that MBA should + * never be fetched. The same is for mismatched slot 1 and slot 0 + * on the same port + */ + + //single or double drop + if(l_spd_dimm_ranks[0][1] == 0 && l_spd_dimm_ranks[1][1] == 0) + { + //if the two match, it's a valid case. + if(l_spd_dimm_ranks[0][0] == l_spd_dimm_ranks[1][0]) + { + //0000, set to 1 + if(l_spd_dimm_ranks[0][0] == 0) + { + l_rankCopy = 1; + //throwing error for all empty + FAPI_ERR("No dimm's found"); + const uint8_t DIMM_P0S0 = l_spd_dimm_ranks[0][0]; + const uint8_t DIMM_P0S1 = l_spd_dimm_ranks[0][1]; + const uint8_t DIMM_P1S0 = l_spd_dimm_ranks[1][0]; + const uint8_t DIMM_P1S1 = l_spd_dimm_ranks[1][1]; + FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_DIMMS_NOT_FOUND); + + //either 0101,0202,0404. + }else + l_rankCopy = l_spd_dimm_ranks[0][0]; + }else + { + //throwing error for invalid dimm combination + l_dimmInvalid = 1; + } + //if all 4 are the same, its double ranked + }else if(l_spd_dimm_ranks[0][1] == l_spd_dimm_ranks[0][0] && + l_spd_dimm_ranks[1][1] == l_spd_dimm_ranks[1][0] && + l_spd_dimm_ranks[0][1] == l_spd_dimm_ranks[1][1]) + { + //either 1111,2222,4444 + l_rankCopy = l_spd_dimm_ranks[0][0] + 4; + }else + { + //throwing error for invalid dimm combination + l_dimmInvalid = 1; + } + + if(l_dimmInvalid) + { + FAPI_ERR("There is an invalid combination of dimm's found"); + const uint8_t INVALID_DIMM_P0S0 = l_spd_dimm_ranks[0][0]; + const uint8_t INVALID_DIMM_P0S1 = l_spd_dimm_ranks[0][1]; + const uint8_t INVALID_DIMM_P1S0 = l_spd_dimm_ranks[1][0]; + const uint8_t INVALID_DIMM_P1S1 = l_spd_dimm_ranks[1][1]; + const fapi::Target & MBA = i_mbaTarget; + FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_DIMM_FOUND); + break; + } + + fapi::MBvpdKeyword l_MT_Keyword = fapi::MBVPD_KEYWORD_T1; + switch (l_rankCopy) + { + case 1: + l_MT_Keyword = fapi::MBVPD_KEYWORD_T1; + break; + case 2: + l_MT_Keyword = fapi::MBVPD_KEYWORD_T2; + break; + case 4: + l_MT_Keyword = fapi::MBVPD_KEYWORD_T4; + break; + case 5: + l_MT_Keyword = fapi::MBVPD_KEYWORD_T5; + break; + case 6: + l_MT_Keyword = fapi::MBVPD_KEYWORD_T6; + break; + case 8: + l_MT_Keyword = fapi::MBVPD_KEYWORD_T8; + break; + default: + FAPI_ERR("Incorrect data from dimm ranks : 0x%02x",l_rankCopy); + const uint8_t & RANK_NUM = l_rankCopy; + FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_MT_DATA); + break; + } + if(l_fapirc) + { + FAPI_ERR("getMBvpdTermData: Invalid rank 0x%02x",l_rankCopy); + break; + } + + l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, + l_MT_Keyword, + l_mbTarget, + reinterpret_cast<uint8_t *>(l_pMtBuffer), + l_MtBufsize); + //else custom_dimm is 1 and we need to use the CDIMM + }else{ + l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, fapi::MBVPD_KEYWORD_MT, l_mbTarget, reinterpret_cast<uint8_t *>(l_pMtBuffer), l_MtBufsize); + } + if (l_fapirc) { FAPI_ERR("getMBvpdTermData: Read of MT keyword failed"); |

