From c864e50f89bfeb102a2edca45825e6e02cf6ba56 Mon Sep 17 00:00:00 2001 From: Elizabeth Liner Date: Thu, 11 Sep 2014 15:59:59 -0500 Subject: 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 --- .../hwp/mvpd_accessors/getMBvpdPhaseRotatorData.C | 105 ++++++++++++- .../hwp/mvpd_accessors/getMBvpdSpareDramData.C | 147 +++++++++++------- src/usr/hwpf/hwp/mvpd_accessors/getMBvpdTermData.C | 170 ++++++++++++++++++++- src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml | 67 +++++++- src/usr/hwpf/plat/fapiPlatMBvpdAccess.C | 54 ++++++- src/usr/vpd/cvpd.H | 2 +- 6 files changed, 471 insertions(+), 74 deletions(-) (limited to 'src/usr') diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdPhaseRotatorData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdPhaseRotatorData.C index f2054ee71..60a725c28 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdPhaseRotatorData.C +++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdPhaseRotatorData.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,7 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: getMBvpdPhaseRotatorData.C,v 1.8 2014/02/12 22:11:46 mjjones Exp $ +// $Id: getMBvpdPhaseRotatorData.C,v 1.10 2014/10/23 20:59:36 eliner Exp $ /** * @file getMBvpdPhaseRotatorData.C * @@ -144,11 +146,100 @@ fapi::ReturnCode getMBvpdPhaseRotatorData( // Read the MR keyword field l_pMrBuffer = new mr_keyword; - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_MR, - l_mbTarget, - reinterpret_cast(l_pMrBuffer), - l_MrBufsize); + uint8_t l_customDimm = 0; + + l_fapirc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM,&i_mbaTarget, + l_customDimm); + if(l_fapirc) + { + FAPI_ERR("getMBvpdPhaseRotatorData: Read of Custom Dimm failed"); + break; + } + + //if custom_dimm = 0, use isdimm + if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm) + { + const uint8_t l_M0_KEYWORD_SIZE = 32; + + uint8_t l_m0_keyword[l_M0_KEYWORD_SIZE]; + uint32_t l_M0Bufsize = l_M0_KEYWORD_SIZE; + + l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, + fapi::MBVPD_KEYWORD_M0, + l_mbTarget, + (uint8_t *)(&l_m0_keyword), + l_M0Bufsize); + if (l_fapirc) + { + FAPI_ERR("getMBvpdPhaseRotatorData: Read of M0 keyword failed"); + break; // break out with fapirc + } + + uint32_t l_dimmPos = 0; + //@todo-RTC:116304 + l_fapirc = FAPI_ATTR_GET(ATTR_POS,&l_mbTarget,l_dimmPos); + if(l_fapirc) + { + FAPI_ERR("getMBvpdPhaseRotatorData: read of ATTR_POS failed"); + break; + } + + fapi::MBvpdKeyword l_MR_Keyword = fapi::MBVPD_KEYWORD_M1; + + uint8_t l_actualM0Data = l_m0_keyword[l_dimmPos]; + + switch (l_actualM0Data) + { + case 1: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M1; + break; + case 2: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M2; + break; + case 3: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M3; + break; + case 4: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M4; + break; + case 5: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M5; + break; + case 6: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M6; + break; + case 7: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M7; + break; + case 8: + l_MR_Keyword = fapi::MBVPD_KEYWORD_M8; + break; + default: + FAPI_ERR("Incorrect M0 data : 0x%02x",l_actualM0Data); + const uint8_t & M0_DATA = l_actualM0Data; + FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_M0_DATA); + break; + } + if(l_fapirc) + { + FAPI_ERR("getMBvpdPhaseRotatorData: Invalid M0 data"); + break; + } + + l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, + l_MR_Keyword, + l_mbTarget, + reinterpret_cast(l_pMrBuffer), + l_MrBufsize); + //else custom_dimm is 1 and we need to use the CDIMM + }else{ + l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, + fapi::MBVPD_KEYWORD_MR, + l_mbTarget, + reinterpret_cast(l_pMrBuffer), + l_MrBufsize); + } + if (l_fapirc) { FAPI_ERR("getMBvpdPhaseRotatorData: Read of MR keyword failed"); diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C index 33b63b9f6..3e05baffc 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C +++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.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,7 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: getMBvpdSpareDramData.C,v 1.5 2014/02/12 22:14:28 mjjones Exp $ +// $Id: getMBvpdSpareDramData.C,v 1.7 2014/10/23 21:00:12 eliner Exp $ #include // fapi support @@ -78,80 +80,107 @@ fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba, do { - // find the Centaur memory buffer from the passed MBA - l_rc = fapiGetParentChip (i_mba, l_mbTarget); - if (l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: Finding the parent mb failed "); - break; - } + uint8_t l_customDimm = 0; - // Read AM keyword field - l_pAmBuffer = new AmKeyword(); - l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_AM, - l_mbTarget, - reinterpret_cast(l_pAmBuffer), - l_AmBufSize); - if (l_rc) + l_rc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM,&i_mba,l_customDimm); + if(l_rc) { - FAPI_ERR("getMBvpdSpareDramData: " - "Read of AM Keyword failed"); + FAPI_ERR("getMBvpdSpareDramData: Read of Custom Dimm failed"); break; } - // Check for error or incorrect amount of data returned - if (l_AmBufSize < AM_KEYWORD_SIZE) + //if custom_dimm = 0, use isdimm + if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm) { - FAPI_ERR("getMBvpdSpareDramData:" - " less AM keyword returned than expected %d < %d", - l_AmBufSize, AM_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_AM; - const uint32_t & RETURNED_SIZE = l_AmBufSize; - const fapi::Target & CHIP_TARGET = l_mbTarget; - FAPI_SET_HWP_ERROR(l_rc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; - } + //ISDIMMs do not have any spare drams, + //return 0 for all ports and ranks. + for (uint8_t i = 0; i < DIMM_DQ_MAX_MBA_PORTS; i++) + { + for (uint8_t j = 0; j < DIMM_DQ_MAX_MBAPORT_DIMMS; j++) + { + for (uint8_t k = 0; k < DIMM_DQ_MAX_DIMM_RANKS; k++) + { + o_data[i][j][k] = 0; + } + } + } + //if custom_dimm = 1, use cdimm + }else + { + // find the Centaur memory buffer from the passed MBA + l_rc = fapiGetParentChip (i_mba, l_mbTarget); + if (l_rc) + { + FAPI_ERR("getMBvpdSpareDramData: Finding the parent mb failed "); + break; + } - // Find the position of the passed mba on the centuar - uint8_t l_mba = 0; - l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &i_mba, l_mba); + // Read AM keyword field + l_pAmBuffer = new AmKeyword(); + l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, + fapi::MBVPD_KEYWORD_AM, + l_mbTarget, + reinterpret_cast(l_pAmBuffer), + l_AmBufSize); + if (l_rc) + { + FAPI_ERR("getMBvpdSpareDramData: " + "Read of AM Keyword failed"); + break; + } - if (l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: Get MBA position failed "); - break; - } - // Data in the AM Keyword contains information for both MBAs and - // is stored in [mba][port][dimm] ([2][2][2]) format, where the - // third (dimm) dimension contains a byte where each two bits of that - // byte are the spare status for a particular rank. - // The caller expects data returned for a particular MBA, - // and where the ranks for each dimm are separately indexed, - // so conversion to a [port][dimm][rank] ([2][2][4]) format - // is necessary. - for (uint8_t i = 0; i < DIMM_DQ_MAX_MBA_PORTS; i++) - { - for (uint8_t j = 0; j < DIMM_DQ_MAX_MBAPORT_DIMMS; j++) + // Check for error or incorrect amount of data returned + if (l_AmBufSize < AM_KEYWORD_SIZE) { - // Mask to pull of two bits at a time from iv_dimmSpareData - uint8_t l_dimmMask = 0xC0; - // Shift amount decrements each time as l_dimmMask is shifted - // to the right - uint8_t l_rankBitShift = 6; - for (uint8_t k = 0; k < DIMM_DQ_MAX_DIMM_RANKS; k++) + FAPI_ERR("getMBvpdSpareDramData:" + " less AM keyword returned than expected %d < %d", + l_AmBufSize, AM_KEYWORD_SIZE); + const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_AM; + const uint32_t & RETURNED_SIZE = l_AmBufSize; + const fapi::Target & CHIP_TARGET = l_mbTarget; + FAPI_SET_HWP_ERROR(l_rc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); + break; + } + + // Find the position of the passed mba on the centuar + uint8_t l_mba = 0; + l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &i_mba, l_mba); + + if (l_rc) + { + FAPI_ERR("getMBvpdSpareDramData: Get MBA position failed "); + break; + } + // Data in the AM Keyword contains information for both MBAs and + // is stored in [mba][port][dimm] ([2][2][2]) format, where the + // third (dimm) dimension contains a byte where each two bits of + // that byte are the spare status for a particular rank. + // The caller expects data returned for a particular MBA, + // and where the ranks for each dimm are separately indexed, + // so conversion to a [port][dimm][rank] ([2][2][4]) format + // is necessary. + for (uint8_t i = 0; i < DIMM_DQ_MAX_MBA_PORTS; i++) + { + for (uint8_t j = 0; j < DIMM_DQ_MAX_MBAPORT_DIMMS; j++) { - o_data[i][j][k] = ((l_pAmBuffer->iv_mbaSpareData[l_mba]. + // Mask to pull of two bits at a time from iv_dimmSpareData + uint8_t l_dimmMask = 0xC0; + // Shift amount decrements each time as l_dimmMask + // is shifted to the right + uint8_t l_rankBitShift = 6; + for (uint8_t k = 0; k < DIMM_DQ_MAX_DIMM_RANKS; k++) + { + o_data[i][j][k] =((l_pAmBuffer->iv_mbaSpareData[l_mba]. iv_portSpareData[i].iv_dimmSpareData[j]. iv_dimmSpareData & l_dimmMask) >> l_rankBitShift); - l_dimmMask >>= 2; - l_rankBitShift -= 2; + l_dimmMask >>= 2; + l_rankBitShift -= 2; + } } } } }while(0); - delete l_pAmBuffer; l_pAmBuffer = NULL; return l_rc; 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 // 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 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_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(l_pMtBuffer), l_MtBufsize); + } + if (l_fapirc) { FAPI_ERR("getMBvpdTermData: Read of MT keyword failed"); diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml b/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml index 41db40b28..e912380b3 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml +++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml @@ -5,7 +5,9 @@ - + + + @@ -20,7 +22,7 @@ - + @@ -243,4 +245,65 @@ MEMBUF_TARGET + + RC_MBVPD_INVALID_MT_DATA + + To get the proper MT data, we need a valid + dimm rank combination. + + RANK_NUM + + CODE + HIGH + + + + RC_MBVPD_DIMMS_NOT_FOUND + + To get the proper MT data, we need to find the + dimm's to get a valid dimm rank combination + + DIMM_P0S0 + DIMM_P0S1 + DIMM_P1S0 + DIMM_P1S1 + + CODE + HIGH + + + + RC_MBVPD_INVALID_DIMM_FOUND + + Something went very wrong in the dimm's and + the combination received is not valid + + INVALID_DIMM_P0S0 + INVALID_DIMM_P0S1 + INVALID_DIMM_P1S0 + INVALID_DIMM_P1S1 + + MEMORY_PLUGGING_ERROR + HIGH + + + MBA + MEDIUM + + + MBA + + + + RC_MBVPD_INVALID_M0_DATA + + To get the proper MR data, we need to have the + correct M0 data. + + M0_DATA + + CODE + HIGH + + diff --git a/src/usr/hwpf/plat/fapiPlatMBvpdAccess.C b/src/usr/hwpf/plat/fapiPlatMBvpdAccess.C index 9f7a7695d..73e9a4a19 100644 --- a/src/usr/hwpf/plat/fapiPlatMBvpdAccess.C +++ b/src/usr/hwpf/plat/fapiPlatMBvpdAccess.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,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. */ @@ -60,6 +62,9 @@ fapi::ReturnCode MBvpdRecordXlate(const fapi::MBvpdRecord i_fapiRecord, CVPD::MER0, CVPD::VSPD, CVPD::VINI, + CVPD::OPFR, + CVPD::VNDR, + CVPD::SPDX, }; const uint8_t NUM_MBVPD_RECORDS = sizeof(mbvpdFapiRecordToHbRecord)/sizeof(mbvpdFapiRecordToHbRecord[0]); @@ -123,6 +128,53 @@ fapi::ReturnCode MBvpdKeywordXlate(const fapi::MBvpdKeyword i_fapiKeyword, CVPD::VZ, CVPD::pdD, CVPD::MX, + CVPD::DW, + CVPD::PN, + CVPD::SN, + CVPD::DR, + CVPD::CE, + CVPD::FN, + CVPD::CC, + CVPD::HE, + CVPD::CT, + CVPD::HW, + CVPD::VD, + CVPD::VN, + CVPD::VP, + CVPD::SV, + CVPD::M0, + CVPD::M1, + CVPD::M2, + CVPD::M3, + CVPD::M4, + CVPD::M5, + CVPD::M6, + CVPD::M7, + CVPD::M8, + CVPD::T1, + CVPD::T2, + CVPD::T4, + CVPD::T5, + CVPD::T6, + CVPD::T8, + CVPD::Q0, + CVPD::Q1, + CVPD::Q2, + CVPD::Q3, + CVPD::Q4, + CVPD::Q5, + CVPD::Q6, + CVPD::Q7, + CVPD::Q8, + CVPD::K0, + CVPD::K1, + CVPD::K2, + CVPD::K3, + CVPD::K4, + CVPD::K5, + CVPD::K6, + CVPD::K7, + CVPD::K8, }; const uint8_t NUM_MBVPD_KEYWORDS = sizeof(mbvpdFapiKeywordToHbKeyword)/sizeof(mbvpdFapiKeywordToHbKeyword[0]); diff --git a/src/usr/vpd/cvpd.H b/src/usr/vpd/cvpd.H index 30424603e..f7b2b120a 100644 --- a/src/usr/vpd/cvpd.H +++ b/src/usr/vpd/cvpd.H @@ -70,7 +70,7 @@ namespace CVPD { VINI, "VINI" }, { OPFR, "OPFR" }, { VNDR, "VNDR" }, - { VSPX, "VSPX" }, + { SPDX, "SPDX" }, // ------------------------------------------------------------------- // DO NOT USE!! This is for test purposes ONLY! { CVPD_TEST_RECORD, "TEST" }, -- cgit v1.2.3