From 8c8662a2daf4a57ad704a6642f2f33d560fb8d01 Mon Sep 17 00:00:00 2001 From: Elliott Dahle Date: Wed, 11 Sep 2013 10:09:33 -0500 Subject: Temporary fix for C-DIMM VPD which does not contain AM Keyword Change-Id: I61ea36418c1d745b95f63a419759975e7c610a41 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6112 Reviewed-by: MIKE J. JONES Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- .../hwp/mvpd_accessors/getMBvpdSpareDramData.C | 83 +++++++++------------- 1 file changed, 35 insertions(+), 48 deletions(-) diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C index 14f3f3187..3bfae7b32 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C +++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C @@ -20,7 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: getMBvpdSpareDramData.C,v 1.1 2013/08/13 20:35:13 mjjones Exp $ +// $Id: getMBvpdSpareDramData.C,v 1.3 2013/09/12 14:12:39 mjjones Exp $ #include // fapi support @@ -69,9 +69,6 @@ fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba, MbaSpareData iv_mbaSpareData[NUM_MBAS]; }; - // Old VPD without the Spare Data - const uint8_t VPD_WITHOUT_SPARE_DATA_SIZE = sizeof(MirrorData); - // Current VPD AM keyword size const uint32_t AM_KEYWORD_SIZE = sizeof(AmKeyword); fapi::ReturnCode l_rc; @@ -81,6 +78,11 @@ fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba, AmKeyword * l_pAmBuffer = NULL; uint32_t l_AmBufSize = sizeof(AmKeyword); + // For old VPD without spare DRAM data + // Store data for all 4 ranks of this DIMM + const uint8_t VPD_WITHOUT_SPARE_LOW_NIBBLE = 0x55; + const uint8_t VPD_WITHOUT_SPARE_FULL_BYTE = 0xFF; + do { // Check to see if IS-DIMM @@ -115,55 +117,40 @@ fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba, reinterpret_cast(l_pAmBuffer), l_AmBufSize); - if (l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: Read of AM keyword failed"); - break; - } - - // Check correct amount of data returned - if (l_AmBufSize < AM_KEYWORD_SIZE) + // Check for error or incorrect amount of data returned + if (l_rc || (l_AmBufSize < AM_KEYWORD_SIZE)) { - - // If Old VPD - if (VPD_WITHOUT_SPARE_DATA_SIZE == l_AmBufSize) + // This handles two scenarios: + // 1. fapiGetMBvpdField has returned an error because + // the AM keyword is not present in this DIMM's + // VPD. + // 2. This DIMM does have the AM Keyword, however it + // is in an old version of VPD and does not contain + // any spare DRAM information. + // In both cases, the ATTR_SPD_DRAM_WIDTH + // attribute is used to determine spare DRAM availability. + // If x4 configuration, assume LOW_NIBBLE. + // Otherwise, FULL_BYTE. + // TODO RTC 84278: Undo the workaround for scenario 1 once the + // C-DIMM VPD is updated on all DIMMs to the current version. + uint8_t l_dramWidth = 0; + l_rc = FAPI_ATTR_GET(ATTR_SPD_DRAM_WIDTH, &i_dimm, l_dramWidth); + if (l_rc) { - // Because prior VPD AM keyword does not contain - // spare DRAM data, the ATTR_SPD_DRAM_WIDTH - // attribute is used to determine spare DRAM availability. - // If x4 configuration, assume LOW_NIBBLE. - // Otherwise, FULL_BYTE. - uint8_t l_dramWidth = 0; - l_rc = FAPI_ATTR_GET(ATTR_SPD_DRAM_WIDTH, &i_dimm, l_dramWidth); - if (l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: " - "Error getting DRAM spare data"); - break; - } - // If x4 configuration, low nibble. - if (fapi::ENUM_ATTR_SPD_DRAM_WIDTH_W4 == l_dramWidth) - { - o_data = fapi::ENUM_ATTR_VPD_DIMM_SPARE_LOW_NIBBLE; - break; - } - // Else, full spare. - else - { - o_data = fapi::ENUM_ATTR_VPD_DIMM_SPARE_FULL_BYTE; - break; - } + FAPI_ERR("getMBvpdSpareDramData: " + "Error getting DRAM spare data"); + break; } - + // If x4 configuration, low nibble. + if (fapi::ENUM_ATTR_SPD_DRAM_WIDTH_W4 == l_dramWidth) + { + o_data = VPD_WITHOUT_SPARE_LOW_NIBBLE; + break; + } + // Else, full spare. else { - FAPI_ERR("getMBvpdSpareDramData: " - "Insufficient amount of data returned:" - " %u < %u", l_AmBufSize, AM_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_AM; - const uint32_t & RETURNED_SIZE = l_AmBufSize; - FAPI_SET_HWP_ERROR(l_rc, - RC_MBVPD_INSUFFICIENT_VPD_RETURNED); + o_data = VPD_WITHOUT_SPARE_FULL_BYTE; break; } } -- cgit v1.2.1